bids-validator
bids-validator copied to clipboard
Warn on ignored-but-non-BIDSy filenames
The spec has recently (https://github.com/bids-standard/bids-specification/pull/264) been updated with some clarifying language:
Unspecified data
Additional files and folders containing raw data MAY be added as needed for special cases. All non-standard file entities SHOULD conform to BIDS-style naming conventions, including alphabetic entities and suffixes and alphanumeric labels/indices. Non-standard suffixes SHOULD reflect the nature of the data, and existing entities SHOULD be used when appropriate. For example, an ASSET calibration scan might be named
sub-01_acq-ASSET_calibration.nii.gz.Non-standard files and directories should be named with care. Future BIDS efforts may standardize new entities and suffixes, changing the meaning of file names and setting requirements on their contents or metadata. Validation and parsing tools MAY treat the presence of non-standard files and directories as an error, so consult the details of these tools for mechanisms to suppress warnings or provide interpretations of your file names.
Although the validator should not error on ignored files (even in its strictest mode), a file that does not follow the schema key1-value1_..._keyN-valueN_suffix.ext should raise a warning that the file does not follow BIDS conventions. A proposed regex:
([a-z]+-[a-zA-Z0-9]+_)[a-zA-Z0-9]\.[a-zA-Z0-9\.]+
This will match zero or more pairs of lowercase keys and alphanumeric values connected by a hyphen and followed by an alphanumeric suffix, and an extension with alphanumeric and period (.) characters in it.