|
| 1 | +# Frequently Asked Questions |
| 2 | + |
| 3 | +This page is for questions about the Javascript validator that may not be |
| 4 | +well addressed elsewhere in the documentation. |
| 5 | + |
| 6 | +If you have a question, please [open an issue][new-issue]. |
| 7 | +The answer may end up on this page! |
| 8 | + |
| 9 | +## Q: What does the validator actually check? |
| 10 | + |
| 11 | +The BIDS Validator aspires to check that a dataset meets the requirements of the BIDS Standard. |
| 12 | +The primary way it does this is by interpreting the [BIDS Schema][schema-description]. |
| 13 | + |
| 14 | +The general categories of rules include: |
| 15 | + |
| 16 | +- Filename rules: These rules indicate valid combinations of [entities][], [suffixes][definitions] |
| 17 | + [datatypes][definitions] and [extensions][definitions]. |
| 18 | + Every file in a dataset must match a filename rule. |
| 19 | +- Sidecar and JSON rules: These rules indicate whether fields are REQUIRED, RECOMMENDED |
| 20 | + or OPTIONAL in a JSON file. |
| 21 | + REQUIRED fields produce errors on absence, while RECOMMENDED fields produce warnings on absence. |
| 22 | + If the field is defined, then it also has a type (for example, numeric or textual); |
| 23 | + type mismatches produce errors. |
| 24 | +- Tabular data rules: These rules indicate what columns are REQUIRED, RECOMMENDED or OPTIONAL |
| 25 | + in a TSV file, and behave similarly to sidecar rules. |
| 26 | + Additionally, tabular file rules may indicate that columns must appear in a certain order or |
| 27 | + have unique values, and that additional columns are permitted or forbidden. |
| 28 | + If JSON sidecar files provide definitions for columns, |
| 29 | + the values in those columns are validated against those definitions. |
| 30 | +- Checks: These rules are conditional assertions, with the form of selectors and checks. |
| 31 | + Selectors are expressions that determine whether the rule applies to the file or dataset, |
| 32 | + and checks are expressions about the file or dataset that must evaluate to `true`. |
| 33 | + |
| 34 | +## Q: Why doesn't the validator warn/error about inconsistencies in some TSV columns? |
| 35 | + |
| 36 | +A specific question we've received is why the validator does not ensure that a |
| 37 | +column like `sex` in `participants.tsv` will permit both `f` and `F`, |
| 38 | +rather than enforce consistency. |
| 39 | + |
| 40 | +The reason for this is that `sex` (like `age`) is not rigorously defined by the BIDS Standard, |
| 41 | +but is provided as an example with a default definition. |
| 42 | +Default definitions are loose and often accept a wide range of values that would be |
| 43 | +understandable by humans while still allowing some amount of machine validation. |
| 44 | +As of BIDS 1.10.0, the definition of `sex` in the schema is: |
| 45 | + |
| 46 | +```json |
| 47 | +{ |
| 48 | + "sex": { |
| 49 | + "LongName": "sex", |
| 50 | + "Description": "String value indicating phenotypical sex.", |
| 51 | + "Levels": { |
| 52 | + "F": "Female", |
| 53 | + "FEMALE": "Female", |
| 54 | + "Female": "Female", |
| 55 | + "f": "Female", |
| 56 | + "female": "Female", |
| 57 | + "M": "Male", |
| 58 | + "MALE": "Male", |
| 59 | + "Male": "Male", |
| 60 | + "m": "Male", |
| 61 | + "male": "Male", |
| 62 | + "O": "Other", |
| 63 | + "OTHER": "Other", |
| 64 | + "Other": "Other", |
| 65 | + "o": "Other", |
| 66 | + "other": "Other" |
| 67 | + } |
| 68 | + } |
| 69 | +} |
| 70 | +``` |
| 71 | + |
| 72 | +Data curators are encouraged to refine this definition in their `participants.json` sidecar file, |
| 73 | +for example, if you use the SNOMEDCT ontology: |
| 74 | + |
| 75 | +```json |
| 76 | +{ |
| 77 | + "sex": { |
| 78 | + "LongName": "sex", |
| 79 | + "Description": "Finding related to biological sex", |
| 80 | + "TermURL": "http://purl.bioontology.org/ontology/SNOMEDCT/429019009", |
| 81 | + "Levels": { |
| 82 | + "F": { |
| 83 | + "Description": "Female", |
| 84 | + "TermURL": "http://purl.bioontology.org/ontology/SNOMEDCT/248152002", |
| 85 | + }, |
| 86 | + "M": { |
| 87 | + "Description": "Male", |
| 88 | + "TermURL": "http://purl.bioontology.org/ontology/SNOMEDCT/248153007", |
| 89 | + }, |
| 90 | + "I": { |
| 91 | + "Description": "Intersex", |
| 92 | + "TermURL": "http://purl.bioontology.org/ontology/SNOMEDCT/32570691000036108", |
| 93 | + }, |
| 94 | + "X": { |
| 95 | + "Description": "Indeterminate sex", |
| 96 | + "TermURL": "http://purl.bioontology.org/ontology/SNOMEDCT/32570681000036106", |
| 97 | + } |
| 98 | + } |
| 99 | + } |
| 100 | +} |
| 101 | +``` |
| 102 | + |
| 103 | +If provided, the validator will check that all values in the column are `F`, `M`, `I`, `X`, |
| 104 | +or `n/a` (which is permitted in all columns, according to the BIDS Standard). |
| 105 | + |
| 106 | + |
| 107 | +[new-issue]: https://github.com/bids-standard/bids-validator/issues/new |
| 108 | +[schema-description]: https://bidsschematools.readthedocs.io/en/latest/description.html |
| 109 | +[entities]: https://bids-specification.readthedocs.io/en/stable/common-principles.html#entities |
| 110 | +[definitions]: https://bids-specification.readthedocs.io/en/stable/common-principles.html#definitions |
0 commit comments