Skip to content

Comments

Refactor common and goodbye readers....#55

Merged
viktorbeck98 merged 13 commits intodevelopmentfrom
refactor-common
Feb 13, 2026
Merged

Refactor common and goodbye readers....#55
viktorbeck98 merged 13 commits intodevelopmentfrom
refactor-common

Conversation

@ipmach
Copy link
Contributor

@ipmach ipmach commented Feb 11, 2026

  • Minor refactor main structure
  • Removal of readers
  • Removal of outputs
  • Added From, To and FromTo library to support file reads from multiple formats for the different components.

@ipmach
Copy link
Contributor Author

ipmach commented Feb 12, 2026

Use Case

Two examples of how to load and save data.

Methods use

 detector = DummyDetector()
 parser = DummyParser()

Standard use

Load data from a log file.

for parsed_log in From.log(parser, in_path=log_path):
    alerts.append(detector.process(parsed_log))

or run them independently:

for parsed_log in From.log(parser, in_path=log_path):
    parsed_logs.append(parsed_log)

for parsed_log in parsed_logs:
    To.json(detector.process(parsed_log), out_path=temp1)

Debug use

We want to save the data in every step

for parsed_log in FromTo.log2json(parser, in_path=log_path, out_path=temp1):
    pass

for alerts in FromTo.json2json(detector, in_path=temp1, out_path=temp2):
    pass

@ipmach ipmach requested a review from viktorbeck98 February 12, 2026 13:48
@ipmach ipmach added the enhancement New feature or request label Feb 12, 2026
@ipmach
Copy link
Contributor Author

ipmach commented Feb 12, 2026

@viktorbeck98 can you review this PR?

@ipmach ipmach marked this pull request as ready for review February 12, 2026 13:49
Copy link
Collaborator

@viktorbeck98 viktorbeck98 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left a comment for src/detectmatelibrary/utils/from_to.py. Looks good!

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the functionality and the names but I am unsure whether the file location fits. This is more supposed to be a helper class for the developer / library user use case., no? @ipmach what do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mm... yes. Should we create a helper folder? @viktorbeck98

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but following that logic, shouldn't be the persistency the same?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just posting here again: Persistency will be used a lot in the detectors, whereas from_to.py will not, so that's where I would differ

@viktorbeck98 viktorbeck98 merged commit 225e7c3 into development Feb 13, 2026
1 check failed
@viktorbeck98 viktorbeck98 deleted the refactor-common branch February 13, 2026 16:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants