bids-validator icon indicating copy to clipboard operation
bids-validator copied to clipboard

BIDS URI support

Open effigies opened this issue 3 years ago • 2 comments

xref https://github.com/bids-standard/bids-specification/pull/918

Minimally we need:

  • [x] Permit dataset_description.DatasetLinks object
    • Empty string as a key is an error
    • Values are URIs (relative paths accepted)
  • [ ] Handle BIDS-URIs as part of NIfTI validation routine for IntendedFor
    • see https://github.com/bids-standard/bids-validator/issues/1393#issuecomment-1019520428
    • however, see also: https://github.com/bids-standard/bids-validator/pull/1409#issuecomment-1191749813

Long-term:

  • Deprecation warning if BIDS-URI field is not URI
  • Validate all IntendedFor (not just for NIfTI), BIDS URI validation only if "local"

effigies avatar Dec 07 '21 18:12 effigies

Empty string as a key is an error

That can probably be done in JSON schema terms via:

{
 "not": {
  "anyOf": [
    { "required": [ "" ] }
  ]
}

https://stackoverflow.com/a/70266255/5201771

sappelhoff avatar Dec 09 '21 17:12 sappelhoff

The bids-validator currently contains a check for the IntendedFor field as part of the NIfTI validation:

https://github.com/bids-standard/bids-validator/blob/4feb91b8aa9506c123d38327485dd5d4cd69e80b/bids-validator/validators/nifti/nii.js#L1247-L1265

This leads to issues during validation with BIDS URIs, see this bids-examples PR: https://github.com/bids-standard/bids-examples/pull/304, and the problem log:

bids-validator 7t_trt -c /home/runner/work/bids-examples/bids-examples/bidsconfig.json --ignoreNiftiHeaders
[email protected]
bids-specification@disable
(node:1867) Warning: Closing directory handle on garbage collection
(Use `node --trace-warnings ...` to show where the warning was created)
	1: [ERR] 'IntendedFor' field needs to point to an existing file. (code: 37 - INTENDED_FOR)
		./sub-01/ses-1/fmap/sub-01_ses-1_run-1_phasediff.nii.gz
			Evidence: bids::sub-01/ses-1/func/sub-01_ses-1_task-rest_acq-fullbrain_run-1_bold.nii.gz
...

For non-NIfTI files, this is not a problem, because such a check was never implemented as far as I know.

This is something that needs to be fixed before we can merge BIDS URI support into the spec.

sappelhoff avatar Jan 23 '22 16:01 sappelhoff

Done in schema validator. Not planned for legacy validator.

effigies avatar Apr 26 '24 13:04 effigies