From 0509fdc2ed911756015c36c6216c5d4334796d41 Mon Sep 17 00:00:00 2001 From: Cody Baker Date: Tue, 16 Aug 2022 10:31:51 -0400 Subject: [PATCH 1/4] first commit --- nwbinspector/checks/nwbfile_metadata.py | 12 ++++++++++++ .../internal_configs/dandi.inspector_config.yaml | 1 + requirements.txt | 2 +- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/nwbinspector/checks/nwbfile_metadata.py b/nwbinspector/checks/nwbfile_metadata.py index bf8e80872..0eb99ff67 100644 --- a/nwbinspector/checks/nwbfile_metadata.py +++ b/nwbinspector/checks/nwbfile_metadata.py @@ -127,6 +127,18 @@ def check_subject_age(subject: Subject): ) +@register_check(importance=Importance.BEST_PRACTICE_SUGGESTION, neurodata_type=Subject) +def check_subject_age_reference(subject: Subject): + """Check if the Subject age reference is one of supported options.""" + valid_options = ["birth", "?"] + if subject.age.reference not in valid_options: + return InspectorMessage( + message=( + f"Subject age reference, '{subject.age.reference}', is not one of the valid options ({valid_options})." + ) + ) + + @register_check(importance=Importance.BEST_PRACTICE_SUGGESTION, neurodata_type=Subject) def check_subject_id_exists(subject: Subject): """Check if subject_id is defined.""" diff --git a/nwbinspector/internal_configs/dandi.inspector_config.yaml b/nwbinspector/internal_configs/dandi.inspector_config.yaml index 8169b962e..f0e6dbe3f 100644 --- a/nwbinspector/internal_configs/dandi.inspector_config.yaml +++ b/nwbinspector/internal_configs/dandi.inspector_config.yaml @@ -1,6 +1,7 @@ CRITICAL: # All the fields under CRITICAL will be required for dandi validate to pass - check_subject_exists - check_subject_id_exists + - check_subject_age_reference BEST_PRACTICE_VIOLATION: - check_subject_sex # these are planned to be elevated to CRITICAL when required for DANDI validate - check_subject_species # these are planned to be elevated to CRITICAL when required for DANDI validate diff --git a/requirements.txt b/requirements.txt index 576c7bd57..80c5c853c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -pynwb +pynwb @ git+https://github.com/NeurodataWithoutBorders/pynwb.git@age_reference # relax to pynwb when upstream is merged PyYAML jsonschema packaging From 9d61c97fd2210a97e23cf8fcc81da1164f8e1273 Mon Sep 17 00:00:00 2001 From: Cody Baker <51133164+CodyCBakerPhD@users.noreply.github.com> Date: Wed, 17 Aug 2022 12:14:07 -0400 Subject: [PATCH 2/4] Update nwbinspector/checks/nwbfile_metadata.py Co-authored-by: Ben Dichter --- nwbinspector/checks/nwbfile_metadata.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nwbinspector/checks/nwbfile_metadata.py b/nwbinspector/checks/nwbfile_metadata.py index 0eb99ff67..c1ec8ed86 100644 --- a/nwbinspector/checks/nwbfile_metadata.py +++ b/nwbinspector/checks/nwbfile_metadata.py @@ -130,7 +130,7 @@ def check_subject_age(subject: Subject): @register_check(importance=Importance.BEST_PRACTICE_SUGGESTION, neurodata_type=Subject) def check_subject_age_reference(subject: Subject): """Check if the Subject age reference is one of supported options.""" - valid_options = ["birth", "?"] + valid_options = ["birth", "gestational", None] if subject.age.reference not in valid_options: return InspectorMessage( message=( From e63f48fdc2ee86bddf245761cf82c23f05fd7a77 Mon Sep 17 00:00:00 2001 From: Cody Baker <51133164+CodyCBakerPhD@users.noreply.github.com> Date: Wed, 17 Aug 2022 12:14:57 -0400 Subject: [PATCH 3/4] Update nwbinspector/checks/nwbfile_metadata.py Co-authored-by: Ben Dichter --- nwbinspector/checks/nwbfile_metadata.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nwbinspector/checks/nwbfile_metadata.py b/nwbinspector/checks/nwbfile_metadata.py index c1ec8ed86..245963b47 100644 --- a/nwbinspector/checks/nwbfile_metadata.py +++ b/nwbinspector/checks/nwbfile_metadata.py @@ -131,10 +131,10 @@ def check_subject_age(subject: Subject): def check_subject_age_reference(subject: Subject): """Check if the Subject age reference is one of supported options.""" valid_options = ["birth", "gestational", None] - if subject.age.reference not in valid_options: + if subject.age__reference not in valid_options: return InspectorMessage( message=( - f"Subject age reference, '{subject.age.reference}', is not one of the valid options ({valid_options})." + f"Subject age reference, '{subject.age__reference}', is not one of the valid options ({valid_options})." ) ) From b634cd13e7276acae7d86f6d472ce36977ec6407 Mon Sep 17 00:00:00 2001 From: Ben Dichter Date: Wed, 6 Sep 2023 09:04:41 -0400 Subject: [PATCH 4/4] Update requirements.txt --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 80c5c853c..576c7bd57 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -pynwb @ git+https://github.com/NeurodataWithoutBorders/pynwb.git@age_reference # relax to pynwb when upstream is merged +pynwb PyYAML jsonschema packaging