LT-247: Creating modalities summary
This commit is contained in:
parent
848251eba9
commit
fcdefda586
@ -1,7 +1,7 @@
|
|||||||
<template name="studyTimepoint">
|
<template name="studyTimepoint">
|
||||||
<div class="studyTimepointWrapper">
|
<div class="studyTimepointWrapper">
|
||||||
<div class="studyTimepoint">
|
<div class="studyTimepoint">
|
||||||
{{#each study in (studies this.timepoint)}}
|
{{#each study in this.studies}}
|
||||||
{{>studyTimepointStudy study=study}}
|
{{>studyTimepointStudy study=study}}
|
||||||
{{/each}}
|
{{/each}}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -47,12 +47,3 @@ Template.studyTimepoint.events({
|
|||||||
$wrapper.css('max-height', $timepoint.height());
|
$wrapper.css('max-height', $timepoint.height());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Template.studyTimepoint.helpers({
|
|
||||||
studies: function(timepoint) {
|
|
||||||
const query = {
|
|
||||||
selected: true
|
|
||||||
};
|
|
||||||
return ViewerStudies.find(query);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|||||||
@ -15,10 +15,9 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="timepointDate pull-right m-r-1">{{formatDA timepoint.earliestDate 'D-MMM-YYYY'}}</div>
|
<div class="timepointDate pull-right m-r-1">{{formatDA timepoint.earliestDate 'D-MMM-YYYY'}}</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- TODO: [design] find out where to get this information -->
|
<div class="timepointModalities">{{modalitiesSummary timepoint}}</div>
|
||||||
<div class="timepointModalities">2 MR, 2 CT</div>
|
|
||||||
</div>
|
</div>
|
||||||
{{>studyTimepoint timepoint=timepoint index=@index}}
|
{{>studyTimepoint studies=(studies timepoint) index=@index}}
|
||||||
</div>
|
</div>
|
||||||
<hr class="m-y-1">
|
<hr class="m-y-1">
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|||||||
@ -1,3 +1,15 @@
|
|||||||
|
Template.studyTimepointBrowser.onCreated(() => {
|
||||||
|
const instance = Template.instance();
|
||||||
|
|
||||||
|
// Get the studies for a specific timepoint
|
||||||
|
instance.getStudies = timepoint => {
|
||||||
|
const query = {
|
||||||
|
selected: true
|
||||||
|
};
|
||||||
|
return ViewerStudies.find(query);
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
Template.studyTimepointBrowser.onRendered(() => {
|
Template.studyTimepointBrowser.onRendered(() => {
|
||||||
const instance = Template.instance();
|
const instance = Template.instance();
|
||||||
instance.autorun(() => {
|
instance.autorun(() => {
|
||||||
@ -37,6 +49,10 @@ Template.studyTimepointBrowser.helpers({
|
|||||||
// Returns all timepoints with sorting
|
// Returns all timepoints with sorting
|
||||||
return Timepoints.find({}, sort);
|
return Timepoints.find({}, sort);
|
||||||
},
|
},
|
||||||
|
// Get the studies for a specific timepoint
|
||||||
|
studies(timepoint) {
|
||||||
|
return Template.instance().getStudies(timepoint);
|
||||||
|
},
|
||||||
// Decides if a timepoint should be shown or omitted
|
// Decides if a timepoint should be shown or omitted
|
||||||
shouldShowTimepoint(timepoint, index) {
|
shouldShowTimepoint(timepoint, index) {
|
||||||
const instance = Template.instance();
|
const instance = Template.instance();
|
||||||
@ -64,5 +80,24 @@ Template.studyTimepointBrowser.helpers({
|
|||||||
const followUp = total - index - 1;
|
const followUp = total - index - 1;
|
||||||
const parenthesis = states[index] || '';
|
const parenthesis = states[index] || '';
|
||||||
return `Follow-up ${followUp} ${parenthesis}`;
|
return `Follow-up ${followUp} ${parenthesis}`;
|
||||||
|
},
|
||||||
|
// Build the modalities summary for all timepoint's studies
|
||||||
|
modalitiesSummary(timepoint) {
|
||||||
|
const instance = Template.instance();
|
||||||
|
|
||||||
|
const studies = instance.getStudies(timepoint);
|
||||||
|
|
||||||
|
const modalities = {};
|
||||||
|
studies.forEach(study => {
|
||||||
|
const modality = study.modalities || 'UN';
|
||||||
|
modalities[modality] = modalities[modality] + 1 || 1;
|
||||||
|
});
|
||||||
|
|
||||||
|
const result = [];
|
||||||
|
_.each(modalities, (count, modality) => {
|
||||||
|
result.push(`${count} ${modality}`);
|
||||||
|
});
|
||||||
|
|
||||||
|
return result.join(', ');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@ -2,7 +2,11 @@
|
|||||||
<div class="studyTimepointStudy">
|
<div class="studyTimepointStudy">
|
||||||
<div class="studyModality">
|
<div class="studyModality">
|
||||||
<div class="studyModalityBox">
|
<div class="studyModalityBox">
|
||||||
{{this.study.modalities}}
|
{{#if this.study.modalities}}
|
||||||
|
{{this.study.modalities}}
|
||||||
|
{{else}}
|
||||||
|
UN
|
||||||
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
<div class="studyModalityText">
|
<div class="studyModalityText">
|
||||||
<div class="studyModalityDate">{{formatDA this.study.studyDate 'D-MMM-YYYY'}}</div>
|
<div class="studyModalityDate">{{formatDA this.study.studyDate 'D-MMM-YYYY'}}</div>
|
||||||
@ -11,7 +15,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="studyTimepointThumbnails">
|
<div class="studyTimepointThumbnails">
|
||||||
{{#each thumbnail in (thumbnails this.study)}}
|
{{#each thumbnail in (thumbnails this.study)}}
|
||||||
{{>thumbnailEntry thumbnail}}
|
{{>thumbnailEntry thumbnail}}
|
||||||
{{/each}}
|
{{/each}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user