LT-247: Creating modalities summary
This commit is contained in:
parent
848251eba9
commit
fcdefda586
@ -1,7 +1,7 @@
|
||||
<template name="studyTimepoint">
|
||||
<div class="studyTimepointWrapper">
|
||||
<div class="studyTimepoint">
|
||||
{{#each study in (studies this.timepoint)}}
|
||||
{{#each study in this.studies}}
|
||||
{{>studyTimepointStudy study=study}}
|
||||
{{/each}}
|
||||
</div>
|
||||
|
||||
@ -47,12 +47,3 @@ Template.studyTimepoint.events({
|
||||
$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 class="timepointDate pull-right m-r-1">{{formatDA timepoint.earliestDate 'D-MMM-YYYY'}}</div>
|
||||
</div>
|
||||
<!-- TODO: [design] find out where to get this information -->
|
||||
<div class="timepointModalities">2 MR, 2 CT</div>
|
||||
<div class="timepointModalities">{{modalitiesSummary timepoint}}</div>
|
||||
</div>
|
||||
{{>studyTimepoint timepoint=timepoint index=@index}}
|
||||
{{>studyTimepoint studies=(studies timepoint) index=@index}}
|
||||
</div>
|
||||
<hr class="m-y-1">
|
||||
{{/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(() => {
|
||||
const instance = Template.instance();
|
||||
instance.autorun(() => {
|
||||
@ -37,6 +49,10 @@ Template.studyTimepointBrowser.helpers({
|
||||
// Returns all timepoints with sorting
|
||||
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
|
||||
shouldShowTimepoint(timepoint, index) {
|
||||
const instance = Template.instance();
|
||||
@ -64,5 +80,24 @@ Template.studyTimepointBrowser.helpers({
|
||||
const followUp = total - index - 1;
|
||||
const parenthesis = states[index] || '';
|
||||
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="studyModality">
|
||||
<div class="studyModalityBox">
|
||||
{{this.study.modalities}}
|
||||
{{#if this.study.modalities}}
|
||||
{{this.study.modalities}}
|
||||
{{else}}
|
||||
UN
|
||||
{{/if}}
|
||||
</div>
|
||||
<div class="studyModalityText">
|
||||
<div class="studyModalityDate">{{formatDA this.study.studyDate 'D-MMM-YYYY'}}</div>
|
||||
@ -11,7 +15,7 @@
|
||||
</div>
|
||||
<div class="studyTimepointThumbnails">
|
||||
{{#each thumbnail in (thumbnails this.study)}}
|
||||
{{>thumbnailEntry thumbnail}}
|
||||
{{>thumbnailEntry thumbnail}}
|
||||
{{/each}}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user