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

ENH: Add column definitions for channels.json #1839

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions bids-validator/validators/json/json.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,8 @@ const selectSchema = (file) => {
schema = require('./schemas/beh.json')
} else if (file.name.endsWith('_motion.json')) {
schema = require('./schemas/motion.json')
} else if (file.name.endsWith('_channels.json')) {
schema = require('./schemas/channels.json')
}
}
return schema
Expand Down
47 changes: 47 additions & 0 deletions bids-validator/validators/json/schemas/channels.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
"$schema": "http://json-schema.org/draft-06/schema#",
"allOf": [
{
"type": "object",
"properties": {
"reference_frame": {
"title": "Reference Frame",
"type": "object",
"properties": {
"Levels": {
"type": "object",
"patternProperties": {
"^.+$": {
"type": "object",
"properties": {
"RotationOrder": {
"description": "The sequence in which the extrinsic rotations are applied around the three axes.",
"type": "string",
"enum": ["XYZ", "XZY", "YXZ", "YZX", "ZXY", "ZYX"]
},
"RotationRule": {
"description": "The direction of rotation around each axis.",
"type": "string",
"enum": ["left-hand", "right-hand"]
},
"SpatialAxes": {
"description": "The coordinate system in which the motion data are to be interpreted. A sequence of characters from the set `{'A', 'P', 'L', 'R', 'S', 'I', '_'}` indicating the direction of each axis. For example `\"ARS\"` indicates positive values in the X, Y, Z axes are respectively anterior, right, and superior of the origin, while `\"PLI\"` indicates positive values are posterior, left, and inferior of the origin. The `\"_\"` character may be used for unused axes.",
"type": "string",
"pattern": "^[APLRSI_]{3}$"
}
}
}
}
}
}
}
}
},
{
"type": "object",
"patternProperties": {
"^.+$": { "$ref": "common_definitions.json#/definitions/ColumnDescription" }
}
}
]
}
69 changes: 68 additions & 1 deletion bids-validator/validators/json/schemas/common_definitions.json
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,73 @@
"SoftwareVersions": { "type": "string" },
"TaskDescription": { "type": "string" },
"TaskName": { "type": "string", "minLength": 1 },
"TriggerChannelCount": { "type": "integer", "minimum": 0 }
"TermURL": {
"title": "TermURL",
"description": "URL pointing to a formal definition in an ontology available on the web.",
"type": "string",
"format": "uri"
},
"TriggerChannelCount": { "type": "integer", "minimum": 0 },
"ColumnDescription": {
"type": "object",
"title": "Column",
"description": "Column of a corresponding tabular file.",
"properties": {
"LongName": {
"title": "LongName",
"description": " Long (unabbreviated) name of column.",
"type": "string"
},
"Description": {
"title": "Description",
"description": "Description of the column.",
"type": "string"
},
"Units": {
"title": "Units",
"description": "Measurement units.",
"type": "string"
},
"Levels": {
"type": "object",
"title": "Levels",
"description": "For categorical variables: a dictionary of possible values (keys) and their descriptions (values).",
"patternProperties": {
"^.+$": {
"anyOf": [
{ "type": "string" },
{
"type": "object",
"properties": {
"Description": { "type": "string" },
"TermURL": { "$ref": "#/definitions/TermURL" }
}
}
]
}
}
},
"TermURL": { "$ref": "#/definitions/TermURL" },
"HED": {
"anyOf": [
{
"type": "object",
"title": "HED",
"description": "For categorical variables: a dictionary of possible values (keys) and their HED strings (values).",
"patternProperties": {
"^.+$": {
"type": "string"
}
}
},
{
"type": "string",
"title": "HED",
"description": "For value variables: a string with a single '#' character where the cell value is to be interpolated."
}
]
}
}
}
}
}
72 changes: 1 addition & 71 deletions bids-validator/validators/json/schemas/data_dictionary.json
Original file line number Diff line number Diff line change
@@ -1,76 +1,6 @@
{
"type": "object",
"patternProperties": {
"^.+$": {
"type": "object",
"title": "Column",
"description": "Column of a corresponding tabular file.",
"properties": {
"LongName": {
"title": "LongName",
"description": " Long (unabbreviated) name of column.",
"type": "string"
},
"Description": {
"title": "Description",
"description": "Description of the column.",
"type": "string"
},
"Units": {
"title": "Units",
"description": "Measurement units.",
"type": "string"
},
"Levels": {
"type": "object",
"title": "Levels",
"description": "For categorical variables: a dictionary of possible values (keys) and their descriptions (values).",
"patternProperties": {
"^.+$": {
"anyOf": [
{ "type": "string" },
{
"type": "object",
"properties": {
"Description": { "type": "string" },
"TermURL": {
"title": "TermURL",
"description": "URL pointing to a formal definition in an ontology available on the web.",
"type": "string",
"format": "uri"
}
}
}
]
}
}
},
"TermURL": {
"title": "TermURL",
"description": "URL pointing to a formal definition in an ontology available on the web.",
"type": "string",
"format": "uri"
},
"HED": {
"anyOf": [
{
"type": "object",
"title": "HED",
"description": "For categorical variables: a dictionary of possible values (keys) and their HED strings (values).",
"patternProperties": {
"^.+$": {
"type": "string"
}
}
},
{
"type": "string",
"title": "HED",
"description": "For value variables: a string with a single '#' character where the cell value is to be interpolated."
}
]
}
}
}
"^.+$": { "$ref": "common_definitions.json#/definitions/ColumnDescription" }
}
}
66 changes: 1 addition & 65 deletions bids-validator/validators/json/schemas/events.json
Original file line number Diff line number Diff line change
@@ -1,71 +1,7 @@
{
"type": "object",
"patternProperties": {
"^.+$": {
"type": "object",
"title": "Column",
"description": "Column of a corresponding tabular file.",
"properties": {
"LongName": {
"title": "LongName",
"description": " Long (unabbreviated) name of column.",
"type": "string"
},
"Description": {
"title": "Description",
"description": "Description of the column.",
"type": "string"
},
"Units": {
"title": "Units",
"description": "Measurement units.",
"type": "string"
},
"Levels": {
"type": "object",
"title": "Levels",
"description": "For categorical variables: a dictionary of possible values (keys) and their descriptions (values).",
"patternProperties": {
"^.+$": {
"anyOf": [
{ "type": "string" },
{
"type": "object",
"properties": {
"Description": { "type": "string" },
"TermURL": {
"title": "TermURL",
"description": "URL pointing to a formal definition in an ontology available on the web.",
"type": "string",
"format": "uri"
}
}
}
]
}
}
},
"HED": {
"anyOf": [
{
"type": "object",
"title": "HED",
"description": "For categorical variables: a dictionary of possible values (keys) and their HED strings (values).",
"patternProperties": {
"^.+$": {
"type": "string"
}
}
},
{
"type": "string",
"title": "HED",
"description": "For value variables: a string with a single '#' character where the cell value is to be interpolated."
}
]
}
}
}
"^.+$": { "$ref": "common_definitions.json#/definitions/ColumnDescription" }
},
"properties": {
"StimulusPresentation": {
Expand Down
Loading