Validating Files¶
Validating NWB Files¶
To be accepted by DANDI, NWB files must conform to criteria that are enforced via three levels of validation:
NWB File Validation¶
PyNWB validation is used to validate the NWB files, ensuring that they meet the specifications of core NWB and of any NWB extensions that were used. Generally speaking, all files produced by PyNWB and MatNWB should pass validation, however there are occasional bugs. More often, NWB files that fail to meet these criteria have been created outside PyNWB and MatNWB.
Missing DANDI Metadata¶
DANDI has requirements for metadata beyond what is strictly required for NWB validation. The following metadata must be present in the NWB file for a successful upload to DANDI:
- You must define a
Subjectobject. - The
Subjectobject must have asubject_idattribute. - The
Subjectobject must have aspeciesattribute. This can either be the Latin binomial, e.g. "Mus musculus", or an NCBI taxonomic identifier. - The
Subjectobject must have asexattribute. It must be "M", "F", "O" (other), or "U" (unknown). - The
Subjectobject must have eitherdate_of_birthorageattribute. It must be in ISO 8601 format, e.g. "P70D" for 70 days, or, if it is a range, must be "[lower]/[upper]", e.g. "P10W/P12W", which means "between 10 and 12 weeks"
These requirements are specified in the DANDI configuration file of NWB Inspector.
Critical NWB Checks¶
The NWB Inspector scans NWB files using heuristics to find mistakes or areas for improvements in NWB files. There are three levels of importance for checks: CRITICAL, BEST PRACTICE VIOLATIONS, and BEST PRACTICE SUGGESTIONS. CRITICAL warnings indicate some internal inconsistency in the data of the NWB files. The NWB Inspector will print out all warnings, but only CRITICAL warnings will prevent a file from being uploaded to DANDI. The NWB Inspector supports a special configuration for DANDI that includes additional checks relevant to DANDI. To use this configuration, you can specify the --config dandi option when running NWB Inspector.
You can run NWB Inspector locally by installing it via pip:
pip install nwbinspector
Then you can run it on your NWB file:
nwbinspector --config dandi path/to/yourfile.nwb
You can also use a directory as input, in which case it will recursively scan for NWB files.
Passing all of these levels of validation can sometimes be tricky. If you have any questions, please ask them via the DANDI Help Desk and we would be happy to assist you.
Validating BIDS Files¶
Once your files are converted to the BIDS standard, perform validation of the files using the BIDS validator.