diff --git a/nwbinspector/checks/nwbfile_metadata.py b/nwbinspector/checks/nwbfile_metadata.py index 3137ed5e1..81e4ed903 100644 --- a/nwbinspector/checks/nwbfile_metadata.py +++ b/nwbinspector/checks/nwbfile_metadata.py @@ -161,6 +161,18 @@ def check_subject_proper_age_range(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", "gestational", None] + 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 4463ea1b2..22df25e5e 100644 --- a/nwbinspector/internal_configs/dandi.inspector_config.yaml +++ b/nwbinspector/internal_configs/dandi.inspector_config.yaml @@ -5,5 +5,6 @@ CRITICAL: # All the fields under CRITICAL will be required for dandi validate t - check_subject_species - check_subject_age - check_subject_proper_age_range + - check_subject_age_reference BEST_PRACTICE_VIOLATION: - check_data_orientation # not 100% accurate, so need to deelevate from CRITICAL to skip it in dandi validate