diff --git a/src/schema/rules/checks/references.yaml b/src/schema/rules/checks/references.yaml index cbbc8f5454..b0f1dd6e9d 100644 --- a/src/schema/rules/checks/references.yaml +++ b/src/schema/rules/checks/references.yaml @@ -1,43 +1,64 @@ --- -SubjectRelativeIntendedFor: +SubjectRelativeIntendedForString: selectors: - datatype != "ieeg" - - type(sidecar.IntendedFor) != "null" + - type(sidecar.IntendedFor) == "string" checks: - - exists(sidecar.IntendedFor, "bids-uri") || exists(sidecar.IntendedFor, "subject") + - exists(sidecar.IntendedFor, "bids-uri") + exists(sidecar.IntendedFor, "subject") == 1 -DatasetRelativeIntendedFor: +SubjectRelativeIntendedForArray: + selectors: + - datatype != "ieeg" + - type(sidecar.IntendedFor) == "array" + checks: + - exists(sidecar.IntendedFor, "bids-uri") + exists(sidecar.IntendedFor, "subject") == length(sidecar.IntendedFor) + +DatasetRelativeIntendedForString: selectors: - datatype == "ieeg" - - type(sidecar.IntendedFor) != "null" + - type(sidecar.IntendedFor) == "string" checks: - - exists(sidecar.IntendedFor, "bids-uri") || exists(sidecar.IntendedFor, "dataset") + - exists(sidecar.IntendedFor, "bids-uri") + exists(sidecar.IntendedFor, "dataset") == 1 -AssociatedEmptyRoom: +DatasetRelativeIntendedForArray: selectors: - - suffix == "meg" - - type(sidecar.AssociatedEmptyRoom) != "null" + - datatype == "ieeg" + - type(sidecar.IntendedFor) == "array" checks: - - exists(sidecar.AssociatedEmptyRoom, "bids-uri") || exists(sidecar.AssociatedEmptyRoom, "dataset") + - exists(sidecar.IntendedFor, "bids-uri") + exists(sidecar.IntendedFor, "dataset") == length(sidecar.IntendedFor) -Stimuli: +AssociatedEmptyRoomString: selectors: - - suffix == "events" - - extension == ".tsv" - - type(columns.stim_file) != "null" + - datatype == "meg" + - type(sidecar.AssociatedEmptyRoom) == "string" checks: - - exists(columns.stim_file, "stimuli") + - exists(sidecar.AssociatedEmptyRoom, "bids-uri") + exists(sidecar.AssociatedEmptyRoom, "dataset") == 1 -Sources: +AssociatedEmptyRoomArray: selectors: - - dataset.dataset_description.DatasetType == "derivatives" - - type(sidecar.Sources) != "null" + - datatype == "meg" + - type(sidecar.AssociatedEmptyRoom) == "array" checks: - - exists(sidecar.Sources, "bids-uri") || exists(sidecar.Sources, "dataset") + - | + exists(sidecar.AssociatedEmptyRoom, "bids-uri") + exists(sidecar.AssociatedEmptyRoom, "dataset") + == length(sidecar.AssociatedEmptyRoom) -SpatialReferences: +Sources: selectors: - dataset.dataset_description.DatasetType == "derivatives" - - type(sidecar.SpatialReference.URI) != "null" + - type(sidecar.Sources) != "null" checks: - - exists(sidecar.SpatialReference.URI, "bids-uri") || exists(sidecar.SpatialReference.URI, "dataset") + - exists(sidecar.Sources, "bids-uri") + exists(sidecar.Sources, "dataset") == length(sidecar.Sources) + +## Verifying the existence of SpatialReferences is out-of-scope for schema validation +## The ability to use any URI leaves this field too open-ended for effective validation, and the +## object of key/URI pairs is worse. +## +## 2024.04.18 CJM & RWB +# +# SpatialReferencesString: +# selectors: +# - dataset.dataset_description.DatasetType == "derivatives" +# - type(sidecar.SpatialReference) == "string" +# checks: +# - exists(sidecar.SpatialReference, "bids-uri") + exists(sidecar.SpatialReference, "dataset") == 1