Improving response criteria mechanism
This commit is contained in:
parent
6edd34ea5e
commit
6e2dfacd3a
@ -156,9 +156,6 @@ class ConformanceCriteria {
|
|||||||
|
|
||||||
const promise = OHIF.studylist.retrieveStudyMetadata(studyInstanceUid);
|
const promise = OHIF.studylist.retrieveStudyMetadata(studyInstanceUid);
|
||||||
promise.then(study => {
|
promise.then(study => {
|
||||||
cornerstone.loadImage(imageId).then(image => {
|
|
||||||
console.warn('>>>>LOADED', image);
|
|
||||||
});
|
|
||||||
const metadata = OHIF.viewer.metadataProvider.getMetadata(imageId);
|
const metadata = OHIF.viewer.metadataProvider.getMetadata(imageId);
|
||||||
data[measurementType].push({
|
data[measurementType].push({
|
||||||
measurement,
|
measurement,
|
||||||
@ -179,6 +176,10 @@ class ConformanceCriteria {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static setEvaluationDefinitions(evaluationKey, evaluationDefinitions) {
|
||||||
|
evaluations[evaluationKey] = evaluationDefinitions;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
OHIF.measurements.ConformanceCriteria = ConformanceCriteria;
|
OHIF.measurements.ConformanceCriteria = ConformanceCriteria;
|
||||||
|
|||||||
@ -79,4 +79,8 @@ export class CriteriaEvaluator {
|
|||||||
return nonconformities;
|
return nonconformities;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static setCriterion(criterionKey, criterionDefinitions) {
|
||||||
|
Criteria[criterionKey] = criterionDefinitions;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,13 +10,34 @@ export const MaxTargetsSchema = {
|
|||||||
minimum: 1
|
minimum: 1
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
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
|
||||||
|
},
|
||||||
required: ['limit']
|
required: ['limit']
|
||||||
};
|
};
|
||||||
|
|
||||||
/* MaxTargetsCriterion
|
/* MaxTargetsCriterion
|
||||||
* Check if the number of target measurements exceeded the limit allowed
|
* Check if the number of target measurements exceeded the limit allowed
|
||||||
* Options
|
* Options:
|
||||||
* limit: Max targets allowed in study
|
* limit: Max targets allowed in study
|
||||||
|
* locationIn: Filter to evaluate only measurements with the specified locations
|
||||||
|
* locationNotIn: Filter to evaluate only measurements without the specified locations
|
||||||
|
* message: Message to be displayed in case of nonconformity
|
||||||
*/
|
*/
|
||||||
export class MaxTargetsCriterion extends BaseCriterion {
|
export class MaxTargetsCriterion extends BaseCriterion {
|
||||||
|
|
||||||
@ -25,12 +46,17 @@ export class MaxTargetsCriterion extends BaseCriterion {
|
|||||||
}
|
}
|
||||||
|
|
||||||
evaluate(data) {
|
evaluate(data) {
|
||||||
const measurementNumbers = _.uniq(_.map(data.targets, target => {
|
const { options } = this;
|
||||||
return target.measurement.measurementNumber;
|
const measurementNumbers = [];
|
||||||
}));
|
_.each(data.targets, target => {
|
||||||
|
const { location } = target.measurement;
|
||||||
|
if (options.locationIn && options.locationIn.indexOf(location) === -1) return;
|
||||||
|
if (options.locationNotIn && options.locationNotIn.indexOf(location) > -1) return;
|
||||||
|
measurementNumbers.push(target.measurement.measurementNumber);
|
||||||
|
});
|
||||||
|
|
||||||
let message;
|
let message = options.message;
|
||||||
if (measurementNumbers.length > this.options.limit) {
|
if (!message && measurementNumbers.length > this.options.limit) {
|
||||||
message = `The study should not have more than ${this.options.limit} targets.`;
|
message = `The study should not have more than ${this.options.limit} targets.`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -15,7 +15,7 @@ export const MaxTargetsPerOrganSchema = {
|
|||||||
/*
|
/*
|
||||||
* MaxTargetsPerOrganCriterion
|
* MaxTargetsPerOrganCriterion
|
||||||
* Check if the number of target measurements per organ exceeded the limit allowed
|
* Check if the number of target measurements per organ exceeded the limit allowed
|
||||||
* Options
|
* Options:
|
||||||
* limit: Max targets allowed in study
|
* limit: Max targets allowed in study
|
||||||
*/
|
*/
|
||||||
export class MaxTargetsPerOrganCriterion extends BaseCriterion {
|
export class MaxTargetsPerOrganCriterion extends BaseCriterion {
|
||||||
|
|||||||
@ -80,4 +80,4 @@ export class ModalityCriterion extends BaseCriterion {
|
|||||||
return this.generateResponse(message, measurements);
|
return this.generateResponse(message, measurements);
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user