Skip to content

Commit

Permalink
RF: Split rules by array or string
Browse files Browse the repository at this point in the history
  • Loading branch information
effigies committed Apr 18, 2024
1 parent 735bf23 commit 61c11c7
Showing 1 changed file with 44 additions and 18 deletions.
62 changes: 44 additions & 18 deletions src/schema/rules/checks/references.yaml
Original file line number Diff line number Diff line change
@@ -1,39 +1,65 @@
---
SubjectRelativeIntendedFor:
SubjectRelativeIntendedForString:
selectors:
- datatype != "ieeg"
- type(sidecar.IntendedFor) != "null"
- length(sidecar.IntendedFor) > 0
- 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) == "string"
checks:
- exists(sidecar.IntendedFor, "bids-uri") + exists(sidecar.IntendedFor, "dataset") == 1

DatasetRelativeIntendedForArray:
selectors:
- datatype == "ieeg"
- type(sidecar.IntendedFor) != "null"
- length(sidecar.IntendedFor) > 0
- type(sidecar.IntendedFor) == "array"
checks:
- exists(sidecar.IntendedFor, "bids-uri") || exists(sidecar.IntendedFor, "dataset")
- exists(sidecar.IntendedFor, "bids-uri") + exists(sidecar.IntendedFor, "dataset") == length(sidecar.IntendedFor)

AssociatedEmptyRoom:
AssociatedEmptyRoomString:
selectors:
- suffix == "meg"
- type(sidecar.AssociatedEmptyRoom) != "null"
- length(sidecar.AssociatedEmptyRoom) > 0
- datatype == "meg"
- type(sidecar.AssociatedEmptyRoom) == "string"
checks:
- exists(sidecar.AssociatedEmptyRoom, "bids-uri") || exists(sidecar.AssociatedEmptyRoom, "dataset")
- exists(sidecar.AssociatedEmptyRoom, "bids-uri") + exists(sidecar.AssociatedEmptyRoom, "dataset") == 1

AssociatedEmptyRoomArray:
selectors:
- datatype == "meg"
- type(sidecar.AssociatedEmptyRoom) == "array"
checks:
- |
exists(sidecar.AssociatedEmptyRoom, "bids-uri") + exists(sidecar.AssociatedEmptyRoom, "dataset")
== length(sidecar.AssociatedEmptyRoom)
Sources:
selectors:
- dataset.dataset_description.DatasetType == "derivatives"
- type(sidecar.Sources) != "null"
- length(sidecar.Sources) > 0
checks:
- exists(sidecar.Sources, "bids-uri") || exists(sidecar.Sources, "dataset")
- exists(sidecar.Sources, "bids-uri") + exists(sidecar.Sources, "dataset") == length(sidecar.Sources)

SpatialReferencesString:
selectors:
- dataset.dataset_description.DatasetType == "derivatives"
- type(sidecar.SpatialReference.URI) == "string"
checks:
- exists(sidecar.SpatialReference.URI, "bids-uri") + exists(sidecar.SpatialReference.URI, "dataset") == 1

SpatialReferences:
SpatialReferencesArray:
selectors:
- dataset.dataset_description.DatasetType == "derivatives"
- type(sidecar.SpatialReference.URI) != "null"
- type(sidecar.SpatialReference.URI) == "array"
checks:
- exists(sidecar.SpatialReference.URI, "bids-uri") || exists(sidecar.SpatialReference.URI, "dataset")
- exists(sidecar.SpatialReference.URI, "bids-uri") + exists(sidecar.SpatialReference.URI, "dataset") == length(sidecar.SpatialReference.URI)

0 comments on commit 61c11c7

Please sign in to comment.