LT-92: Adding validation to RecistApi

This commit is contained in:
Bruno Alves de Faria committed 2017-01-18 11:01:52 -02:00
1 parent d1e0695a4b
commit 5605133517
7 files changed
+84 -25

No files matched your search

@@ -1,3 +1,2 @@
import './measurements.js';
import './recist.js';
import './timepoints.js';
@@ -326,6 +326,21 @@ class MeasurementApi {
});
}
getMeasurementById(measurementId) {
let foundGroup;
_.find(this.toolGroups, toolGroup => {
foundGroup = toolGroup.findOne({ toolItemId: measurementId });
return !!foundGroup;
});
// Stop here if no group was found or if the record is a placeholder
if (!foundGroup || !foundGroup.toolId) {
return;
}
return this.tools[foundGroup.toolId].findOne(measurementId);
}
fetch(toolGroupId, selector, options) {
if (!this.toolGroups[toolGroupId]) {
throw 'MeasurementApi: No Collection with the id: ' + toolGroupId;
@@ -336,7 +351,7 @@ class MeasurementApi {
const result = [];
const items = this.toolGroups[toolGroupId].find(selector, options).fetch();
items.forEach(item => {
if(item.toolId) {
if (item.toolId) {
result.push(this.tools[item.toolId].findOne(item.toolItemId));
} else {
result.push({ measurementNumber: item.measurementNumber });
@@ -1,22 +0,0 @@
import { OHIF } from 'meteor/ohif:core';
class RecistApi {
constructor(measurementApi) {
if (measurementApi) {
this.measurementApi = measurementApi;
}
this.warnings = {};
}
validate() {
}
getModalities() {
}
}
OHIF.measurements.RecistApi = RecistApi;