bids-standard / bids-examples

A set of BIDS compatible datasets with empty raw data files that can be used for writing lightweight software tests.
http://bids-standard.github.io/bids-examples/
179 stars 137 forks source link

Convert Range into Levels for #447

Open yarikoptic opened 5 months ago

yarikoptic commented 5 months ago

deno based validator in

fails with

Validating dataset fnirs_automaticity/: Running  bids-validator fnirs_automaticity --json --ignoreNiftiHeaders
  [
    {
      "key": "TSV_VALUE_INCORRECT_TYPE",
      "severity": "error",
      "reason": "A value in a column did match the acceptable type for that column headers specified format.",
      "files_1": [
        {
          "name": "participants.tsv",
          "path": "/participants.tsv",
          "evidence": "'10' {
    name: \"handedness\",
    display_name: \"Subject handedness\",
    description: 'String value indicating one of \"left\", \"right\", \"ambidextrous\".\n' +
      \"\n\" +
      'For \"left\", use one of these values'... 216 more characters,
    type: \"string\",
    enum: [
      \"left\",         \"l\",
      \"L\",            \"LEFT\",
      \"Left\",         \"right\",
      \"r\",            \"R\",
      \"RIGHT\",        \"Right\",
      \"ambidextrous\", \"a\",
      \"A\",            \"AMBIDEXTROUS\",
      \"Ambidextrous\", \"n/a\"
    ]
  }"
        }
      ]
    }
  ]

since values there are numeric 9 and 10:

❯ mlr --itsv  cut -f handedness fnirs_automaticity/participants.tsv | sort | uniq -c
     19 handedness=10
      5 handedness=9

and .json contains some ad-hoc Range thus trying to change default "Levels" assigned to that column.

❯ jq .handedness < fnirs_automaticity/participants.json
{
  "Description": "handedness of the participant as a score on the Dutch Handedness Questionnaire",
  "TermURL": "doi:1765/956",
  "Range": "-10 (left) to + 10 (right)"
}

I think it is easy to resolve by providing Levels. Alternative is to extend BIDS with support for range, but that is in the future and thus not feasible as a quick fix here.

attn @sappelhoff @rob-luke @robertoostenveld who mastered the original PR as depicted in e84c122a11a4850d9b68ab4a13622e7f9754c26c

effigies commented 5 months ago

The issue remains that we are not yet validating JSON-defined columns.