LT-248: Hook up Current Case measurement status to progress box

This commit is contained in:
Erik Ziegler 2016-06-28 14:33:39 +02:00
parent 048bb3f050
commit a58e237418
9 changed files with 91 additions and 22 deletions

View File

@ -24,12 +24,12 @@
// true : ensure whatever is used is consistent
// "single" : require single quotes
// "double" : require double quotes
"undef" : true, // true: Require all non-global variables to be declared (prevents global leaks)
"undef" : false, // true: Require all non-global variables to be declared (prevents global leaks)
"unused" : true, // Unused variables:
// true : all variables, last function parameter
// "vars" : all variables only
// "strict" : all variables, all function parameters
"strict" : true, // true: Requires all functions run in ES5 Strict Mode
"strict" : false, // true: Requires all functions run in ES5 Strict Mode
"maxparams" : false, // {int} Max number of formal params allowed per function
"maxdepth" : false, // {int} Max depth of nested blocks (within functions)
"maxstatements" : false, // {int} Max number statements per function

View File

@ -140,12 +140,12 @@ chest.constraint = {
};
left.studyMatchingRules.push(baseline);
left.seriesMatchingRules.push(body);
left.seriesMatchingRules.push(chest);
//left.seriesMatchingRules.push(body);
//left.seriesMatchingRules.push(chest);
right.studyMatchingRules.push(followup);
right.seriesMatchingRules.push(body);
right.seriesMatchingRules.push(chest);
//right.seriesMatchingRules.push(body);
//right.seriesMatchingRules.push(chest);
var first = new HP.Stage(oneByTwo, 'oneByTwo');
first.viewports.push(left);

View File

@ -5,7 +5,7 @@
<h5>Locked</h5>
{{ /if }}
{{ #if progressComplete }}
<button class="btn">Enter response</button>
<button class="btn js-finish-case">Enter response</button>
{{ /if }}
</div>
</template>

View File

@ -1,13 +1,55 @@
Template.caseProgress.onCreated(function caseProgressOnCreated() {
const instance = Template.instance();
if (!instance.data.currentTimepointId) {
throw 'Case Progress has no timepointId';
}
const currentTimepointId = instance.data.currentTimepointId;
const timepoint = Timepoints.findOne({
timepointId: currentTimepointId
});
const timepointType = timepoint.timepointType;
instance.progressPercent = new ReactiveVar();
instance.progressPercent.set(50);
instance.progressText = new ReactiveVar();
instance.progressText.set(5);
instance.isLocked = new ReactiveVar(false);
instance.isLocked = new ReactiveVar();
instance.isLocked.set(timepoint.isLocked);
if (timepointType === 'baseline') {
instance.progressPercent.set(100);
} else {
// Retrieve the initial number of targets left to measure at this
// follow-up. Note that this is done outside of the reactive function
// below so that new lesions don't change the initial target count.
const totalTargets = Measurements.find({
isTarget: true
}).count();
// Setup a reactive function to update the progress whenever
// a measurement is made
instance.autorun(() => {
// Obtain the number of Measurements for which the current Timepoint has
// no Measurement data
let numRemainingMeasurements = 0;
Measurements.find().forEach(measurement => {
if (!measurement.timepoints[currentTimepointId]) {
numRemainingMeasurements++;
}
});
// Update the Case Progress text with the remaining measurement count
instance.progressText.set(numRemainingMeasurements);
// Calculate the Case Progress as a percentage in order to update the
// radial progress bar
const numMeasurementsMade = Math.max(totalTargets - numRemainingMeasurements, 0);
const progressPercent = Math.round(100 * numMeasurementsMade / totalTargets);
instance.progressPercent.set(progressPercent);
});
}
});
Template.caseProgress.helpers({
@ -24,7 +66,14 @@ Template.caseProgress.helpers({
},
progressComplete() {
var progressPercent = Template.instance().progressPercent.get();
let progressPercent = Template.instance().progressPercent.get();
return progressPercent === 100;
}
});
Template.caseProgress.events({
'click .js-finish-case'() {
console.log('Case Finished!');
switchToTab('worklistTab');
}
});

View File

@ -1,3 +1,18 @@
@import "{design}/app"
//.caseProgress
.caseProgress
transition(all 0.3 ease)
.radialProgress
float:left
display: inline-block
h5
float:left
display: inline-block
button.btn
float: left
display: inline-block
margin: 6px
cursor: pointer

View File

@ -22,8 +22,7 @@ Template.flexboxLayout.onRendered(() => {
Template.flexboxLayout.helpers({
leftSidebarOpen() {
const instance = Template.instance();
return instance.state.get('leftSidebar');
return Template.instance().state.get('leftSidebar');
},
lesionSidebarOpen() {

View File

@ -13,6 +13,8 @@ Template.viewer.onCreated(function() {
instance.data.state.set('leftSidebar', Session.get('leftSidebar'));
instance.data.state.set('rightSidebar', Session.get('rightSidebar'));
Session.set('currentTimepointId', instance.data.currentTimepointId);
var contentId = this.data.contentId;
OHIF = OHIF || window.OHIF || {

View File

@ -6,7 +6,7 @@
* @param title The title to be used for the tab heading
*/
openNewTabWithTimepoint = function(timepointId, title) {
var contentid = 'viewerTab';
var contentId = 'viewerTab';
var timepoint = Timepoints.findOne({
timepointId: timepointId
@ -25,15 +25,16 @@ openNewTabWithTimepoint = function(timepointId, title) {
ViewerData = window.ViewerData || ViewerData;
// Update the ViewerData global object
ViewerData[contentid] = {
ViewerData[contentId] = {
title: title,
contentid: contentid,
contentId: contentId,
studyInstanceUids: data.studyInstanceUids,
timepointIds: data.timepointIds
timepointIds: data.timepointIds,
currentTimepointId: timepointId
};
// Switch to the new tab
switchToTab(contentid);
switchToTab(contentId);
};
/**

View File

@ -20,10 +20,15 @@ getStudyMetadata = function(studyInstanceUid, doneCallback, failCallback) {
doneCallback(study);
return;
}
console.time('getStudyMetadata');
// If no study metadata is in the cache variable, we need to retrieve it from
// the server with a call.
Meteor.call('GetStudyMetadata', studyInstanceUid, function(error, study) {
log.info('worklistStudy getStudyMetadata: ' + studyInstanceUid);
console.timeEnd('getStudyMetadata');
if (Meteor.user && Meteor.user()) {
var hipaaEvent = {
eventType: 'viewed',
@ -37,8 +42,6 @@ getStudyMetadata = function(studyInstanceUid, doneCallback, failCallback) {
HipaaLogger.logEvent(hipaaEvent);
}
log.info('worklistStudy getStudyMetadata: ' + studyInstanceUid);
if (error) {
log.warn(error);
failCallback(error);