From cefd36e485985e8862d6607f9195c5f4ce210ba4 Mon Sep 17 00:00:00 2001 From: omokshyna Date: Wed, 1 Nov 2023 17:11:11 +0100 Subject: [PATCH] Added changes in validation pipeline --- library_spectra_validation/validation_pipeline.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/library_spectra_validation/validation_pipeline.py b/library_spectra_validation/validation_pipeline.py index bfe6006..e08d321 100644 --- a/library_spectra_validation/validation_pipeline.py +++ b/library_spectra_validation/validation_pipeline.py @@ -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""" @@ -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 @@ -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