|
2 | 2 | import re |
3 | 3 |
|
4 | 4 | from pynwb import NWBFile |
5 | | -from pynwb.file import Subject |
| 5 | +from pynwb.file import Subject, ProcessingModule |
6 | 6 |
|
7 | 7 | from ..register_checks import register_check, InspectorMessage, Importance |
8 | 8 |
|
9 | 9 | duration_regex = r"^P(?!$)(\d+(?:\.\d+)?Y)?(\d+(?:\.\d+)?M)?(\d+(?:\.\d+)?W)?(\d+(?:\.\d+)?D)?(T(?=\d)(\d+(?:\.\d+)?H)?(\d+(?:\.\d+)?M)?(\d+(?:\.\d+)?S)?)?$" |
10 | 10 | species_regex = r"[A-Z][a-z]* [a-z]+" |
11 | 11 |
|
| 12 | +PROCESSING_MODULE_CONFIG = ["ophys", "ecephys", "icephys", "behavior", "misc", "ogen", "retinotopy"] |
| 13 | + |
12 | 14 |
|
13 | 15 | @register_check(importance=Importance.BEST_PRACTICE_SUGGESTION, neurodata_type=NWBFile) |
14 | 16 | def check_experimenter(nwbfile: NWBFile): |
@@ -42,23 +44,6 @@ def check_subject_age(subject: Subject): |
42 | 44 | ) |
43 | 45 |
|
44 | 46 |
|
45 | | -# @nwbinspector_check(severity=1, neurodata_type=NWBFile) |
46 | | -# def check_keywords(nwbfile: NWBFile): |
47 | | -# """Check if keywords have been added for the session.""" |
48 | | -# if not nwbfile.keywords: |
49 | | -# return "Metadata /general/keywords is missing!" |
50 | | - |
51 | | - |
52 | | -# @nwbinspector_check(severity=1, neurodata_type=NWBFile) |
53 | | -# def check_doi_publications(nwbfile: NWBFile): |
54 | | -# """Check if related_publications have been added as doi links.""" |
55 | | -# valid_starts = ["doi:", "http://dx.doi.org/", "https://doi.org/"] |
56 | | -# if nwbfile.related_publications: |
57 | | -# for publication in nwbfile.related_publications: |
58 | | -# if any([publication.startswith(valid_start) for valid_start in valid_starts]): |
59 | | -# return f"Metadata /general/related_publications '{publication}' does not include 'doi'!" |
60 | | - |
61 | | - |
62 | 47 | @register_check(importance=Importance.BEST_PRACTICE_SUGGESTION, neurodata_type=NWBFile) |
63 | 48 | def check_subject_exists(nwbfile: NWBFile): |
64 | 49 | """Check if subject exists.""" |
@@ -95,8 +80,27 @@ def check_subject_species(subject: Subject): |
95 | 80 | ) |
96 | 81 |
|
97 | 82 |
|
98 | | -# @nwbinspector_check(severity=2, neurodata_type=NWBFile) |
99 | | -# def check_subject_species(nwbfile: NWBFile): |
100 | | -# """Check if the subject species has been specified, if one exists.""" |
101 | | -# if nwbfile.subject and not nwbfile.subject.species: |
102 | | -# return "Metadata /general/subject/species is missing!" |
| 83 | +@register_check(importance=Importance.BEST_PRACTICE_SUGGESTION, neurodata_type=ProcessingModule) |
| 84 | +def check_processing_module_name(processing_module: ProcessingModule): |
| 85 | + if processing_module.name not in PROCESSING_MODULE_CONFIG: |
| 86 | + return InspectorMessage( |
| 87 | + f"Processing module is named {processing_module.name}. It is recommended to use the " |
| 88 | + f"schema module names: {', '.join(PROCESSING_MODULE_CONFIG)}" |
| 89 | + ) |
| 90 | + |
| 91 | + |
| 92 | +# @nwbinspector_check(severity=1, neurodata_type=NWBFile) |
| 93 | +# def check_keywords(nwbfile: NWBFile): |
| 94 | +# """Check if keywords have been added for the session.""" |
| 95 | +# if not nwbfile.keywords: |
| 96 | +# return "Metadata /general/keywords is missing!" |
| 97 | + |
| 98 | + |
| 99 | +# @nwbinspector_check(severity=1, neurodata_type=NWBFile) |
| 100 | +# def check_doi_publications(nwbfile: NWBFile): |
| 101 | +# """Check if related_publications have been added as doi links.""" |
| 102 | +# valid_starts = ["doi:", "http://dx.doi.org/", "https://doi.org/"] |
| 103 | +# if nwbfile.related_publications: |
| 104 | +# for publication in nwbfile.related_publications: |
| 105 | +# if any([publication.startswith(valid_start) for valid_start in valid_starts]): |
| 106 | +# return f"Metadata /general/related_publications '{publication}' does not include 'doi'!" |
0 commit comments