LT-92: Creating JSON schema validation for conformance criteria

This commit is contained in:
Bruno Alves de Faria 2017-01-13 15:14:16 -02:00
parent ada2d1e284
commit 46bff61b08
6 changed files with 101 additions and 8 deletions

View File

@ -9,6 +9,7 @@
"version": "1.0.0",
"description": "",
"dependencies": {
"ajv": "^4.10.4",
"babel-runtime": "^6.18.0",
"bcrypt": "^0.8.7",
"meteor-node-stubs": "^0.2.3"

View File

@ -1,6 +1,17 @@
import { BaseCriterion } from './BaseCriterion';
import { _ } from 'meteor/underscore';
export const MaxTargetsSchema = {
properties: {
limit: {
label: 'Max targets allowed in study',
type: 'integer',
minimum: 1
}
},
required: ['limit']
};
export class MaxTargetsCriterion extends BaseCriterion {
constructor(options) {

View File

@ -1,6 +1,17 @@
import { BaseCriterion } from './BaseCriterion';
export class MaxTargetPerOrganCriterion extends BaseCriterion {
export const MaxTargetsPerOrganSchema = {
properties: {
limit: {
label: 'Max targets allowed per organ',
type: 'integer',
minimum: 1
}
},
required: ['limit']
};
export class MaxTargetsPerOrganCriterion extends BaseCriterion {
constructor(options) {
super(options);

View File

@ -1,5 +1,75 @@
import { BaseCriterion } from './BaseCriterion';
export const MeasurementsLengthSchema = {
properties: {
longAxis: {
label: 'Minimum length of long axis',
type: 'number',
minimum: 0
},
shortAxis: {
label: 'Minimum length of short axis',
type: 'number',
minimum: 0
},
longAxisSliceThicknessMultiplier: {
label: 'Length of long axis multiplier',
type: 'number',
minimum: 0
},
shortAxisSliceThicknessMultiplier: {
label: 'Length of short axis multiplier',
type: 'number',
minimum: 0
},
modalityIn: {
label: 'Filter to evaluate only measurements with the specified modalities',
type: 'array',
items: {
type: 'string'
},
minItems: 1,
uniqueItems: true
},
modalityNotIn: {
label: 'Filter to evaluate only measurements without the specified modalities',
type: 'array',
items: {
type: 'string'
},
minItems: 1,
uniqueItems: true
},
locationIn: {
label: 'Filter to evaluate only measurements with the specified locations',
type: 'array',
items: {
type: 'string'
},
minItems: 1,
uniqueItems: true
},
locationNotIn: {
label: 'Filter to evaluate only measurements without the specified locations',
type: 'array',
items: {
type: 'string'
},
minItems: 1,
uniqueItems: true
},
message: {
label: 'Message to be displayed in case of nonconformity'
}
},
oneOf: [
{ required: ['message', 'longAxis'] },
{ required: ['message', 'shortAxis'] },
{ required: ['message', 'longAxisSliceThicknessMultiplier'] },
{ required: ['message', 'shortAxisSliceThicknessMultiplier'] }
]
};
export class MeasurementsLengthCriterion extends BaseCriterion {
constructor(options) {

View File

@ -1,6 +1,6 @@
export { MaxTargetPerOrganCriterion } from './MaxTargetPerOrgan';
export { MaxTargetsCriterion } from './MaxTargets';
export { MeasurementsLengthCriterion } from './MeasurementsLength';
export { ModalityCriterion } from './Modality';
export { NonTargetResponseCriterion } from './NonTargetResponse';
export { TargetTypeCriterion } from './TargetType';
export * from './MaxTargetsPerOrgan';
export * from './MaxTargets';
export * from './MeasurementsLength';
export * from './Modality';
export * from './NonTargetResponse';
export * from './TargetType';

View File

@ -1,5 +1,5 @@
{
"MaxTargetPerOrgan": {
"MaxTargetsPerOrgan": {
"limit": 2
},
"MaxTargets": {