diff --git a/.jshintrc b/.jshintrc index 607e68961..de718b5a2 100644 --- a/.jshintrc +++ b/.jshintrc @@ -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 diff --git a/LesionTracker/client/lesionTrackerHangingProtocol.js b/LesionTracker/client/lesionTrackerHangingProtocol.js index d0b7a836a..9e77a9782 100644 --- a/LesionTracker/client/lesionTrackerHangingProtocol.js +++ b/LesionTracker/client/lesionTrackerHangingProtocol.js @@ -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); diff --git a/Packages/lesiontracker/client/components/caseProgress/caseProgress.html b/Packages/lesiontracker/client/components/caseProgress/caseProgress.html index e9d8f97e6..9bf1a8a7f 100644 --- a/Packages/lesiontracker/client/components/caseProgress/caseProgress.html +++ b/Packages/lesiontracker/client/components/caseProgress/caseProgress.html @@ -5,7 +5,7 @@
Locked
{{ /if }} {{ #if progressComplete }} - + {{ /if }} \ No newline at end of file diff --git a/Packages/lesiontracker/client/components/caseProgress/caseProgress.js b/Packages/lesiontracker/client/components/caseProgress/caseProgress.js index bea1195d8..74ba85a5c 100644 --- a/Packages/lesiontracker/client/components/caseProgress/caseProgress.js +++ b/Packages/lesiontracker/client/components/caseProgress/caseProgress.js @@ -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'); + } +}); diff --git a/Packages/lesiontracker/client/components/caseProgress/caseProgress.styl b/Packages/lesiontracker/client/components/caseProgress/caseProgress.styl index 668aaa8b4..20c1393c4 100644 --- a/Packages/lesiontracker/client/components/caseProgress/caseProgress.styl +++ b/Packages/lesiontracker/client/components/caseProgress/caseProgress.styl @@ -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 diff --git a/Packages/lesiontracker/client/components/flexboxLayout/flexboxLayout.js b/Packages/lesiontracker/client/components/flexboxLayout/flexboxLayout.js index 1cca22d80..f26742bd2 100644 --- a/Packages/lesiontracker/client/components/flexboxLayout/flexboxLayout.js +++ b/Packages/lesiontracker/client/components/flexboxLayout/flexboxLayout.js @@ -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() { diff --git a/Packages/lesiontracker/client/components/viewer/viewer.js b/Packages/lesiontracker/client/components/viewer/viewer.js index 2f8e2e7a4..0d512d376 100644 --- a/Packages/lesiontracker/client/components/viewer/viewer.js +++ b/Packages/lesiontracker/client/components/viewer/viewer.js @@ -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 || { diff --git a/Packages/lesiontracker/lib/worklist/openNewTabWithTimepoint.js b/Packages/lesiontracker/lib/worklist/openNewTabWithTimepoint.js index e135d565b..3ef777c61 100644 --- a/Packages/lesiontracker/lib/worklist/openNewTabWithTimepoint.js +++ b/Packages/lesiontracker/lib/worklist/openNewTabWithTimepoint.js @@ -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); }; /** diff --git a/Packages/worklist/client/lib/getStudyMetadata.js b/Packages/worklist/client/lib/getStudyMetadata.js index 10f8e1154..90e1d7e28 100644 --- a/Packages/worklist/client/lib/getStudyMetadata.js +++ b/Packages/worklist/client/lib/getStudyMetadata.js @@ -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);