Preventing all timepoint studies from being loaded at once

This commit is contained in:
Bruno Alves de Faria committed 2017-10-25 22:09:08 -02:00
1 parent 09dc9a4639
commit 956e6da0b3
4 files changed
+74 -37

No files matched your search

@@ -193,8 +193,7 @@ class TimepointApi {
// Return only the key timepoints (current, prior, nadir and baseline)
key() {
// Create a new Mini Mongo Collection to store the result
const result = new Mongo.Collection(null);
const result = [];
// Get all the timepoints
const all = this.all();
@@ -202,28 +201,27 @@ class TimepointApi {
// Iterate over each timepoint and insert the key ones in the result
_.each(all, (timepoint, index) => {
if (index < 2 || index === (all.length - 1)) {
result.insert(timepoint);
result.push(timepoint);
}
});
// Return the resulting timepoints
return result.find().fetch();
return result;
}
// Return only the timepoints for the given study
study(studyInstanceUid) {
// Create a new Mini Mongo Collection to store the result
const result = new Mongo.Collection(null);
const result = [];
// Iterate over each timepoint and insert the key ones in the result
_.each(this.all(), (timepoint, index) => {
if (_.contains(timepoint.studyInstanceUids, studyInstanceUid)) {
result.insert(timepoint);
result.push(timepoint);
}
});
// Return the resulting timepoints
return result.find().fetch();
return result;
}
// Return the timepoint's name
@@ -1,5 +1,31 @@
import { SimpleSchema } from 'meteor/aldeed:simple-schema';
const StudiesData = new SimpleSchema({
studyInstanceUid: {
type: String,
label: 'Study Instance Uid'
},
description: {
type: String,
label: 'Study Description',
optional: true
},
date: {
type: Date,
label: 'Study Date'
},
modality: {
type: String,
label: 'Study Modality'
},
loaded: {
type: Boolean,
label: 'Defines if the Study is already loaded',
optional: true,
defaultValue: false
}
});
export const schema = new SimpleSchema({
patientId: {
type: String,
@@ -36,5 +62,10 @@ export const schema = new SimpleSchema({
type: Number,
label: 'Number of patient\'s visit',
optional: true
},
studiesData: {
type: [StudiesData],
label: 'Studies minimal data to allow lazy loading',
optional: true
}
});