Skip to content

Commit

Permalink
Added changes in validation pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
omokshyna committed Nov 1, 2023
1 parent 4faa081 commit cefd36e
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions library_spectra_validation/validation_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ def __init__(self, metadata_field, before, after, logging_message, validated_by_
self.logging_message = logging_message
self.validated_by_user = validated_by_user

class RequirementFailure:
def __init__(self, metadata_field, logging_message):
self.metadata_field = metadata_field
self.logging_message = logging_message

def find_modifications(spectrum_old, spectrum_new, logging_message: str):
"""Checks which modifications have been made in a filter step"""
Expand All @@ -36,7 +40,9 @@ def find_modifications(spectrum_old, spectrum_new, logging_message: str):
before=spectrum_old.get(metadata_field),
after=spectrum_new(metadata_field),
logging_message=logging_message,
validated_by_user=False))
validated_by_user=False,
is_requirement=False))
#todo here determine if spectra is valid/invalid/repaired
return modifications


Expand Down Expand Up @@ -87,5 +93,8 @@ def process_spectrum_store_failed_filters(self, spectrum) -> List[Modification]:
logging_message = ""
spectrum_out = filter_func(spectrum)
if spectrum_out is None:
failed_requirements += logging_message
fields_changed = fields_checked_by_filter[filter_func.__name__]
for field_changed in fields_changed:
failed_requirements.append(RequirementFailure(field_changed,
logging_message))
return failed_requirements

0 comments on commit cefd36e

Please sign in to comment.