Skip to content

Commit

Permalink
Additional rules
Browse files Browse the repository at this point in the history
  • Loading branch information
EDRasmussen committed May 26, 2020
1 parent 19c478f commit eb23b96
Show file tree
Hide file tree
Showing 4 changed files with 155 additions and 34 deletions.
4 changes: 2 additions & 2 deletions bids-validator/bids_validator/rules/file_level_rules.json
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@
"pet_blood": {
"regexp": "^\\/(sub-[a-zA-Z0-9]+)\\/(?:(ses-[a-zA-Z0-9]+)\\/)pet\\/(sub-[a-zA-Z0-9]+)_(?:(ses-[a-zA-Z0-9]+))|((@@@_pet_ext_@@@))$",
"tokens": {
"@@@_pet_ext_@@@": ["_pet-blood\\.nii\\.json"]
"@@@_pet_ext_@@@": ["_blood\\.nii\\.json"]
}
},

Expand All @@ -250,7 +250,7 @@
"pet_blood_data": {
"regexp": "^\\/(sub-[a-zA-Z0-9]+)\\/(?:(ses-[a-zA-Z0-9]+)\\/)pet\\/(sub-[a-zA-Z0-9]+)_(?:(ses-[a-zA-Z0-9]+))|((@@@_pet_ext_@@@))$",
"tokens": {
"@@@_pet_ext_@@@": ["_pet-blood\\.tsv"]
"@@@_pet_ext_@@@": ["_blood\\.tsv"]
}
},

Expand Down
2 changes: 0 additions & 2 deletions bids-validator/validators/json/json.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,6 @@ const selectSchema = file => {
file.name.endsWith('coordsystem.json')
) {
schema = require('./schemas/coordsystem_eeg.json')
} else if (file.name.endsWith('pet_blood.json')) {
schema = require('./schemas/pet_blood.json')
} else if (file.name.endsWith('pet.json')) {
schema = require('./schemas/pet.json')
}
Expand Down
183 changes: 153 additions & 30 deletions bids-validator/validators/json/schemas/pet.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,9 @@
"PharmaceuticalDoseTimeUnits": { "type": "string", "minLength": 1 },

"InjectedRadioactivity": { "type": "number" },
"InjectedRadioActivityUnit": {
"type": "string",
"minLength": 1,
"enum": ["megabecquerel"]
},
"InjectedRadioactivityUnit": { "type": "string", "minLength": 1 },
"InjectedMass": { "type": "number" },
"InjectedMassUnit": {
"type": "string",
"minLength": 1
},
"InjectedMassUnit": { "type": "string", "minLength": 1 },
"InjectedMassPerWeight": { "type": "number" },
"InjectedMassPerWeightUnit": {
"type": "string",
Expand Down Expand Up @@ -171,26 +164,132 @@
"items": { "type": "number" }
},

"BloodAvail": { "type": "boolean" }
},
"allOf": [
{
"if": {
"properties": {
"BloodAvail": {
"enum": [true]
}
}
},
"then": {
"required": [
"PlasmaAvail",
"MetaboliteAvail",
"ContinousBloodAvail",
"DiscreteBloodAvail"
]
"MetaboliteAvail": {
"default": false,
"type": "boolean"
},
"PlasmaAvail": {
"default": false,
"type": "boolean"
},
"ContinousBloodAvail": {
"default": false,
"type": "boolean"
},
"DiscreteBloodAvail": {
"default": false,
"type": "boolean"
},

"Modality": { "type": "string", "minLength": 1 },
"PlasmaType": { "type": "string", "minLength": 1 },
"FreeFraction": {
"type": "number",
"min": 0,
"max": 1
},
"FreeFractionMethod": { "type": "string", "minLength": 1 },
"PlasmaTimeZero": {
"type": "string",
"pattern": "^(?:2[0-3]|[01][0-9]):[0-5][0-9]:[0-5][0-9]$"
},
"PlasmaDecayCorrected": { "type": "boolean" },
"PlasmaDecayCorrectionTime": {
"type": "string",
"pattern": "^(?:2[0-3]|[01][0-9]):[0-5][0-9]:[0-5][0-9]$"
},
"PlasmaSampleTime": {
"type": "array",
"items": { "type": "number" }
},
"PlasmaSampleTimeUnits": { "type": "string", "minLength": 1 },
"PlasmaActivity": {
"type": "array",
"items": { "type": "number" }
},
"PlasmaActivityUnits": { "type": "string", "minLength": 1 },

"MetaboliteType": { "type": "string", "minLength": 1 },
"MetaboliteMethod": { "type": "string", "minLength": 1 },
"MetaboliteTimeZero": {
"type": "string",
"pattern": "^(?:2[0-3]|[01][0-9]):[0-5][0-9]:[0-5][0-9]$"
},
"MetaboliteSampleTime": {
"type": "array",
"items": { "type": "number" }
},
"MetaboliteSampleTimeUnits": { "type": "string", "minLength": 1 },
"MetaboliteParentFraction": {
"type": "array",
"items": {
"type": "number",
"min": 0,
"max": 1
}
},
"MetaboliteParentFractionUnits": { "type": "string", "minLength": 1 },
"MetabolitePolar": { "type": "array", "items": { "type": "number" } },
"MetabolitePolarUnits": { "type": "string", "minLength": 1 },
"MetaboliteLipophilic": {
"type": "array",
"items": { "type": "number" }
},
"MetaboliteLipophilicUnits": { "type": "string", "minLength": 1 },

"Haematocrit": { "type": "string", "minLength": 1 },
"BloodDensity": { "type": "string", "minLength": 1 },
"BloodDensityUnits": { "type": "string", "minLength": 1 },
"BloodDiscreteTimeZero": {
"type": "string",
"pattern": "^(?:2[0-3]|[01][0-9]):[0-5][0-9]:[0-5][0-9]$"
},
"BloodDiscreteDecayCorrected": { "type": "boolean" },
"BloodDiscreteDecayCorrectionTime": {
"type": "string",
"pattern": "^(?:2[0-3]|[01][0-9]):[0-5][0-9]:[0-5][0-9]$"
},
"BloodDiscreteType": { "type": "string", "minLength": 1 },
"BloodDiscreteSampleTime": {
"type": "array",
"items": { "type": "number" }
},
"BloodDiscreteSampleTimeUnits": { "type": "string", "minLength": 1 },
"BloodDiscreteActivity": {
"type": "array",
"items": { "type": "number" }
},
"BloodDiscreteActivityUnits": { "type": "string", "minLength": 1 },

"WithdrawalRate": { "type": "string", "minLength": 1 },
"WithdrawalRateUnits": { "type": "string", "minLength": 1 },
"TubingLength": { "type": "string", "minLength": 1 },
"TubingLengthUnits": { "type": "string", "minLength": 1 },
"DispersionCorrected": { "type": "boolean" },
"DispersionConstant": { "type": "string", "minLength": 1 },
"DispersionConstantUnits": { "type": "string", "minLength": 1 },
"BloodContinuousTimeZero": {
"type": "string",
"pattern": "^(?:2[0-3]|[01][0-9]):[0-5][0-9]:[0-5][0-9]$"
},
"BloodContinuousDecayCorrected": { "type": "boolean" },
"BloodContinuousDecayCorrectionTime": {
"type": "string",
"pattern": "^(?:2[0-3]|[01][0-9]):[0-5][0-9]:[0-5][0-9]$"
},
"BloodContinuousType": { "type": "string", "minLength": 1 },
"BloodContinuousSampleTime": {
"type": "array",
"items": { "type": "number" }
},
"BloodContinuousSampleTimeUnits": { "type": "string", "minLength": 1 },
"BloodContinuousActivity": {
"type": "array",
"items": { "type": "number" }
},
"BloodContinuousActivityUnits": { "type": "string", "minLength": 1 }
},
"allOf": [
{
"if": {
"properties": {
Expand Down Expand Up @@ -252,13 +351,16 @@
"ReconFilterSize",
"AttenuationCorrection",

"BloodAvail"
"MetaboliteAvail",
"PlasmaAvail",
"ContinousBloodAvail",
"DiscreteBloodAvail"
],
"dependencies": {
"TracerMolecularWeight": ["TracerMolecularWeightUnit"],
"BodyWeight": ["BodyWeightUnit"],

"InjectedRadioactivity": ["InjectedRadioActivityUnit"],
"InjectedRadioactivity": ["InjectedRadioactivityUnit"],
"InjectedMass": ["InjectedMassUnit"],
"InjectedMassPerWeight": ["InjectedMassPerWeightUnit"],
"MolarActivity": ["MolarActivityUnit"],
Expand All @@ -274,6 +376,27 @@
"ReconMethodParameterLabels": [
"ReconMethodParameterUnit",
"ReconMethodParameterValues"
]
],

"PlasmaDecayCorrected": ["PlasmaDecayCorrectionTime"],
"PlasmaSampleTime": ["PlasmaSampleTimeUnits"],
"PlasmaActivity": ["PlasmaActivityUnits"],

"MetaboliteSampleTime": ["MetaboliteSampleTimeUnits"],
"MetaboliteParentFraction": ["MetaboliteParentFractionUnits"],
"MetabolitePolar": ["MetabolitePolarUnits"],
"MetaboliteLipophilic": ["MetaboliteLipophilicUnits"],

"BloodDensity": ["BloodDensityUnits"],
"BloodDiscreteDecayCorrected": ["BloodDiscreteDecayCorrectionTime"],
"BloodDiscreteSampleTime": ["BloodDiscreteSampleTimeUnits"],
"BloodDiscreteActivity": ["BloodDiscreteActivityUnits"],

"WithdrawalRate": ["WithdrawalRateUnits"],
"TubingLength": ["TubingLengthUnits"],
"DispersionCorrected": ["DispersionConstant", "DispersionConstantUnits"],
"BloodContinuousSampleTime": ["BloodContinuousSampleTimeUnits"],
"BloodContinuousActivity": ["BloodContinuousActivityUnits"],
"BloodContinuousDecayCorrected": ["BloodContinuousDecayCorrectionTime"]
}
}

0 comments on commit eb23b96

Please sign in to comment.