LT-254: Display maximum number of target measurements in Lesion Table based on Trial Criteria

This commit is contained in:
Erik Ziegler 2016-06-28 15:15:06 +02:00
parent a58e237418
commit 7cb8ed6c9f
7 changed files with 84 additions and 39 deletions

View File

@ -1,8 +1,13 @@
Template.caseProgress.onCreated(function caseProgressOnCreated() {
const instance = Template.instance();
instance.progressPercent = new ReactiveVar();
instance.progressText = new ReactiveVar();
instance.isLocked = new ReactiveVar();
if (!instance.data.currentTimepointId) {
throw 'Case Progress has no timepointId';
console.warn('Case has no timepointId');
return;
}
const currentTimepointId = instance.data.currentTimepointId;
@ -12,10 +17,6 @@ Template.caseProgress.onCreated(function caseProgressOnCreated() {
const timepointType = timepoint.timepointType;
instance.progressPercent = new ReactiveVar();
instance.progressText = new ReactiveVar();
instance.isLocked = new ReactiveVar();
instance.isLocked.set(timepoint.isLocked);
if (timepointType === 'baseline') {

View File

@ -1,6 +1,6 @@
<template name="lesionTableHeaderRow">
<div class="lesionTableHeaderRow">
<div class="add">
<div class="add js-setTool">
<svg>
<use xlink:href=/packages/lesiontracker/assets/icons.svg#icon-ui-add></use>
</svg>

View File

@ -1,38 +1,75 @@
const toolTypesById = {
target: 'bidirectional',
nonTarget: 'nonTarget',
newLesion: 'bidirectional'
};
const namesById = {
target: 'Targets',
nonTarget: 'Non-Targets',
newLesion: 'New Lesions'
};
Template.lesionTableHeaderRow.onCreated(() => {
const instance = Template.instance();
instance.maxNumLesions = new ReactiveVar();
if (!instance.data.currentTimepointId) {
console.warn('Case has no timepointId');
return;
}
// Give the header a proper name
instance.data.type = namesById[instance.data.id];
const currentTimepointId = instance.data.currentTimepointId;
const timepoint = Timepoints.findOne({
timepointId: currentTimepointId
});
const timepointType = timepoint.timepointType;
// TODO: Check if we have criteria where maximum limits are applied to
// Non-Targets and/or New Lesions
if (timepointType === 'baseline' && instance.data.id === 'target') {
instance.autorun(() => {
// Identify which Trial Conformance Criteria are currently being used
// Note that there may be more than one.
const criteriaTypes = TrialCriteriaTypes.find({
selected: true
}).map(function(criteria) {
return criteria.id;
});
const currentConstraints = getTrialCriteriaConstraints(criteriaTypes);
if (!currentConstraints) {
return;
}
// TODO: Fix Trial Conformance Criteria, it appears that totalNumberOfLesions
// is applied to both Targets and Non-Targets, when it should typically only be
// for Targets
const criteria = currentConstraints[timepointType];
const maxNumLesions = criteria.group.totalNumberOfLesions.numericality.lessThanOrEqualTo;
instance.maxNumLesions.set(maxNumLesions);
});
}
});
Template.lesionTableHeaderRow.helpers({
numberOfLesions: function() {
var instance = Template.instance();
const instance = Template.instance();
return instance.data.measurements.count();
},
maxNumLesions: function() {
var instance = Template.instance();
var lesionType = instance.id;
// TODO: Check what we are annotating
var timepointType = 'baseline';
// Identify which Trial Conformance Criteria are currently being used
// Note that there may be more than one.
var criteriaTypes = TrialCriteriaTypes.find({
selected: true
}).map(function(criteria) {
return criteria.id;
});
var currentConstraints = getTrialCriteriaConstraints(criteriaTypes);
if (!currentConstraints) {
// For testing
return 10;
}
var criteria = currentConstraints[timepointType][lesionType];
return criteria.group.totalNumberOfLesions;
return Template.instance().maxNumLesions.get();
}
});
Template.lesionTableHeaderRow.events({
'click .add': function() {
console.log('Add was clicked');
// TODO: Set active tool to new type
'click .js-setTool': function(event, instance) {
const id = instance.data.id;
const toolType = toolTypesById[id];
toolManager.setActiveTool(toolType);
}
});
});

View File

@ -34,6 +34,12 @@ $headerRowHeight = 63px
height: $headerRowHeight
max-width: 11px
&:hover
fill: $hoverColor
&:active
fill: $activeColor
.type
color: $textSecondaryColor
font-size: 22px

View File

@ -1,16 +1,16 @@
<template name="lesionTableView">
<div class="lesionTableView scrollArea">
{{>lesionTableHeaderRow id="target" type="Targets" measurements=targets}}
{{>lesionTableHeaderRow id="target" measurements=targets currentTimepointId=currentTimepointId}}
{{#each target in targets}}
{{>lesionTableRow (extend this rowItem=target)}}
{{/each}}
{{>lesionTableHeaderRow id="nonTarget" type="Non-targets" measurements=nonTargets}}
{{>lesionTableHeaderRow id="nonTarget" measurements=nonTargets currentTimepointId=currentTimepointId}}
{{#each nonTarget in nonTargets}}
{{>lesionTableRow (extend this rowItem=nonTarget)}}
{{/each}}
{{>lesionTableHeaderRow id="newLesions" type="New lesions" measurements=newLesions}}
{{>lesionTableHeaderRow id="newLesion" measurements=newLesions currentTimepointId=currentTimepointId}}
{{#each newLesion in newLesions}}
{{>lesionTableRow (extend this rowItem=newLesion)}}
{{/each}}

View File

@ -340,7 +340,8 @@ getTrialCriteriaConstraints = function(criteriaTypes, imageId) {
var criteria;
if (!imageId) {
criteria = TrialCriteriaConstraints[criteriaType]();
return criteria;
allCriteria.push(criteria);
return;
}
// Otherwise, retrieve the series metaData to identify the modality of the image

View File

@ -27,7 +27,7 @@ openNewTabWithTimepoint = function(timepointId, title) {
// Update the ViewerData global object
ViewerData[contentId] = {
title: title,
contentId: contentId,
contentid: contentId,
studyInstanceUids: data.studyInstanceUids,
timepointIds: data.timepointIds,
currentTimepointId: timepointId