reorganize packages, start converting overall app to react (very broken at the moment)
This commit is contained in:
1 parent
024fe1a448
commit
5f30f7bd35
479 files changed
+5364
-11611
No files matched your search
+39
@@ -0,0 +1,39 @@
|
||||
<template name="measurementTableView">
|
||||
{{#let config=measurementConfiguration groups=measurementGroups.get}}
|
||||
{{#each measurementGroup in groups}}
|
||||
{{! #if hasMeasurements measurementGroup.toolGroup.id}}
|
||||
{{>measurementTableHeaderRow (clone this
|
||||
toolGroup=measurementGroup.toolGroup
|
||||
measurementRows=measurementGroup.measurementRows)}}
|
||||
{{! /if}}
|
||||
{{#each rowItem in measurementGroup.measurementRows}}
|
||||
{{>measurementTableRow (clone this rowItem=rowItem)}}
|
||||
{{/each}}
|
||||
{{/each}}
|
||||
|
||||
{{#each newLesionGroup in config.newLesions}}
|
||||
{{#let toolGroup=(getNewLesionsToolGroup newLesionGroup)}}
|
||||
{{#let newMeasurements=(newLesionsMeasurements toolGroup)}}
|
||||
{{#if newMeasurements.length}}
|
||||
{{#let collection=newMeasurements}}
|
||||
{{>measurementTableHeaderRow (clone this
|
||||
toolGroup=toolGroup
|
||||
measurementRows=collection)}}
|
||||
|
||||
{{#each entry in collection}}
|
||||
{{>measurementTableRow (clone this rowItem=entry)}}
|
||||
{{/each}}
|
||||
{{/let}}
|
||||
{{/if}}
|
||||
{{/let}}
|
||||
{{/let}}
|
||||
{{/each}}
|
||||
{{/let}}
|
||||
{{#unless this.isHud}}
|
||||
{{#if or (hasMeasurements 'targets') (hasMeasurements 'nonTargets')}}
|
||||
<div class="report-area">
|
||||
<div class="btn btn-sm js-pdf">Generate Report</div>
|
||||
</div>
|
||||
{{/if}}
|
||||
{{/unless}}
|
||||
</template>
|
||||
+94
@@ -0,0 +1,94 @@
|
||||
import { Template } from 'meteor/templating';
|
||||
import { Tracker } from 'meteor/tracker';
|
||||
import { ReactiveVar } from 'meteor/reactive-var';
|
||||
import _ from 'underscore';
|
||||
import { OHIF } from 'meteor/ohif:core';
|
||||
|
||||
Template.measurementTableView.onCreated(() => {
|
||||
const instance = Template.instance();
|
||||
const { measurementApi, timepointApi } = instance.data;
|
||||
|
||||
instance.data.measurementGroups = new ReactiveVar();
|
||||
|
||||
Tracker.autorun(() => {
|
||||
measurementApi.changeObserver.depend();
|
||||
const data = OHIF.measurements.getMeasurementsGroupedByNumber(measurementApi, timepointApi);
|
||||
instance.data.measurementGroups.set(data);
|
||||
});
|
||||
});
|
||||
|
||||
Template.measurementTableView.events({
|
||||
'click .js-pdf'(event, instance) {
|
||||
const { measurementApi, timepointApi } = instance.data;
|
||||
OHIF.measurements.exportPdf(measurementApi, timepointApi);
|
||||
}
|
||||
});
|
||||
|
||||
Template.measurementTableView.helpers({
|
||||
hasMeasurements(toolGroupId) {
|
||||
const instance = Template.instance();
|
||||
const groups = instance.data.measurementGroups.get();
|
||||
|
||||
if (!groups) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const group = _.find(groups, item => item.toolGroup.id === toolGroupId);
|
||||
return group && !!group.measurementRows.length;
|
||||
},
|
||||
|
||||
getNewLesionsToolGroup(newLesionGroup) {
|
||||
const configuration = OHIF.measurements.MeasurementApi.getConfiguration();
|
||||
const toolGroup = _.findWhere(configuration.measurementTools, { id: newLesionGroup.toolGroupId });
|
||||
|
||||
return {
|
||||
id: newLesionGroup.id,
|
||||
name: newLesionGroup.name,
|
||||
childTools: toolGroup.childTools,
|
||||
measurementTypeId: toolGroup.id
|
||||
};
|
||||
},
|
||||
|
||||
newLesionsMeasurements(toolGroup) {
|
||||
const { measurementApi, timepointApi } = Template.instance().data;
|
||||
const current = timepointApi.current();
|
||||
const baseline = timepointApi.baseline();
|
||||
|
||||
if (!measurementApi || !timepointApi || !current || !baseline) return;
|
||||
|
||||
// If this is a baseline, stop here since there are no new measurements to display
|
||||
if (!current || current.timepointType === 'baseline') {
|
||||
OHIF.log.info('Skipping New Measurements section');
|
||||
return;
|
||||
}
|
||||
|
||||
// Retrieve all the data for this Measurement type (e.g. 'targets')
|
||||
// which was recorded at baseline.
|
||||
const measurementTypeId = toolGroup.measurementTypeId;
|
||||
const atBaseline = measurementApi.fetch(measurementTypeId, {
|
||||
timepointId: baseline.timepointId
|
||||
});
|
||||
|
||||
// Obtain a list of the Measurement Numbers from the
|
||||
// measurements which have baseline data
|
||||
const numbers = atBaseline.map(m => m.measurementNumber);
|
||||
|
||||
// Retrieve all the data for this Measurement type which
|
||||
// do NOT match the Measurement Numbers obtained above
|
||||
const data = measurementApi.fetch(measurementTypeId, {
|
||||
measurementNumber: { $nin: numbers }
|
||||
});
|
||||
|
||||
// Group the Measurements by Measurement Number
|
||||
const groupObject = _.groupBy(data, entry => entry.measurementNumber);
|
||||
|
||||
// Reformat the data for display in the table
|
||||
return Object.keys(groupObject).map(key => ({
|
||||
measurementTypeId: measurementTypeId,
|
||||
measurementNumber: key,
|
||||
location: OHIF.measurements.getLocation(groupObject[key]),
|
||||
responseStatus: false, // TODO: Get the latest timepoint and determine the response status
|
||||
entries: groupObject[key]
|
||||
}));
|
||||
}
|
||||
});
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
@import "{ohif:viewerbase}/app"
|
||||
|
||||
.measurementTableView
|
||||
|
||||
.report-area
|
||||
theme('background-color', '$uiGrayDarker')
|
||||
margin-top: 2px
|
||||
padding: 10px 0
|
||||
|
||||
.btn.js-pdf
|
||||
theme('background-color', '$activeColor')
|
||||
theme('border', '1px solid $uiBorderColorActive')
|
||||
color: #000
|
||||
display: table
|
||||
margin: 0 auto
|
||||
Reference in new issue
Block a user