Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sidecar fields should specify their data type (e.g. float or int) if not a string #350

Closed
yarikoptic opened this issue Oct 18, 2019 · 2 comments · Fixed by #605
Closed
Labels
enhancement New feature or request opinions wanted Please read and offer your opinion on this matter

Comments

@yarikoptic
Copy link
Collaborator

yarikoptic commented Oct 18, 2019

My use case was to look at the MagneticFieldStrength field. That one is a RECOMMENDED one in https://bids-specification.readthedocs.io/en/stable/04-modality-specific-files/01-magnetic-resonance-imaging-data.html#scanner-hardware and "Corresponds to DICOM Tag 0018,0087 Magnetic Field Strength". So it seems (not spelled out) that it should be a numeric value.

Absence of clarity results in cases where either people specify non numeric value (e.g. 3T for MagneticFieldStrength) where numeric value is expected:

$> datalad -f '{parentds}' -c datalad.search.index-egrep-documenttype=all search bids.MagneticFieldStrength:3T | uniq 
/home/yoh/datalad/openfmri/ds000217
/home/yoh/datalad/openneuro/ds001525

or have it as a string "3" in the json (don't have an immediate example in the wild but the result of listing known values via datalad suggests that:

$> datalad search --show-keys full | grep -A2 'Field.*Strength' 
bids.FieldStrength
 in  2 datasets
 has 1 unique values: 3.0
--
bids.MagneticFieldStrength
 in  104 datasets
 has 8 unique values: 1.5, 2.8936200141907, 3, 1.494, 6.98, 7, '3T', '3'
--
dicom.MagneticFieldStrength
 in  19 datasets
 has 1 unique values: 3.0
--
dicom.Series.MagneticFieldStrength
 in  15 datasets
 has 1 unique values: 3.0
[WARNING] In this search mode, the reported list of metadata keys may be incomplete 

NB ignore those non-compliant hits using FieldStrength ;-)

So I think that it would be valuable to enhance all lists of Fields with information about the expected data types, and make bids-validator verify correct specification (the issue for the MagneticFieldStrenth is https://github.com/bids-standard/bids-validator/issues/851).

@sappelhoff
Copy link
Member

I agree that being explicit about the expected data type for a given JSON field is important.

The validator does currently already take care of this for some fields using JSON schemas ... see this example: https://github.com/bids-standard/bids-validator/blob/0f55b8f4b2f6e608a8a3cb0aee93fa732e898307/bids-validator/validators/json/schemas/eeg.json#L18

it'd be good to consistently advertise the expected data type in the spec and validate it.

@tsalo
Copy link
Member

tsalo commented Aug 21, 2020

This is related to #533 (adding type information to the documentation and schema) and #221 (adding type information to the sidecars directly).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request opinions wanted Please read and offer your opinion on this matter
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants