Improvements to study list selection, study/timepoint association UI (LT-116 and LT-60)
This commit is contained in:
1 parent
41b75de814
commit
cb8672576e
8 files changed
+179
-24
No files matched your search
+19
-7
@@ -4,6 +4,8 @@
|
||||
<div class="col-md-12">
|
||||
<h4>Instructions</h4>
|
||||
<p>Associate the selected studies with timepoints in the clinical trial.</p>
|
||||
<p>We have automatically retrieved all studies within 14 days (<strong>{{formatDA earliestDate}}</strong> to <strong>{{formatDA latestDate}}</strong>) of your selected studies, in case you forgot to
|
||||
select a study.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -12,6 +14,7 @@
|
||||
<tr>
|
||||
<th class="center">Include Study?</th>
|
||||
<th class="center">Study Date</th>
|
||||
<th class="center">Patient Name</th>
|
||||
<th class="center">Study Description</th>
|
||||
<th class="center">Timepoint Type</th>
|
||||
</tr>
|
||||
@@ -21,25 +24,34 @@
|
||||
{{ #each relevantStudies }}
|
||||
<tr>
|
||||
<td class="center">
|
||||
<input type="checkbox" class="includeStudy" checked/>
|
||||
<input type="checkbox" class="includeStudy" {{inlineIf autoselected false 'checked'}}/>
|
||||
</td>
|
||||
<td class="center">
|
||||
<td class="center studyDataCell {{ #if autoselected }}disabled{{ /if }}">
|
||||
{{ #if autoselected}}
|
||||
<p class="studyDate autoselected"
|
||||
title="This study was automatically added to your list due to its
|
||||
similarity with your other selected studies">
|
||||
data-toggle="tooltip"
|
||||
title="This study was autoselected.">
|
||||
{{formatDA studyDate}}
|
||||
</p>
|
||||
{{ else }}
|
||||
<p class="studyDate">{{formatDA studyDate}}</p>
|
||||
{{ /if }}
|
||||
</td>
|
||||
<td>
|
||||
<td class="center studyDataCell {{ #if autoselected }}disabled{{ /if }}">
|
||||
<p>{{formatPN patientName}}</p>
|
||||
</td>
|
||||
<td class="studyDataCell {{ #if autoselected }}disabled{{ /if }}">
|
||||
<p>{{studyDescription}}</p>
|
||||
</td>
|
||||
<td class="timepointOptions center">
|
||||
<td class="timepointOptions center studyDataCell {{ #if autoselected }}disabled{{ /if }}">
|
||||
{{ #each timepointOptions }}
|
||||
<label><input type="radio" name="{{_id}}" value={{type}}> {{name}}</label>
|
||||
<label>
|
||||
<input type="radio"
|
||||
name="{{../_id}}"
|
||||
value={{type}}
|
||||
{{ inlineIf autoselected true 'disabled'}}>
|
||||
{{name}}
|
||||
</label>
|
||||
{{ /each }}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
+124
-6
@@ -1,5 +1,72 @@
|
||||
function autoSelectStudies() {
|
||||
return [];
|
||||
/**
|
||||
* Finds related studies within defined time window of =/- 14 days of selected studies
|
||||
* @param selectedStudies
|
||||
* @param range Object
|
||||
*/
|
||||
function getDateRange(selectedStudies, range) {
|
||||
if (range === undefined) {
|
||||
range = {
|
||||
days: 14
|
||||
};
|
||||
}
|
||||
|
||||
if (!selectedStudies.length) {
|
||||
return;
|
||||
}
|
||||
|
||||
var earliestStudy = selectedStudies[0];
|
||||
var latestStudy = selectedStudies[selectedStudies.length - 1];
|
||||
|
||||
var earliestDate = moment(earliestStudy.studyDate, 'YYYYMMDD');
|
||||
earliestDate.subtract(range);
|
||||
|
||||
var latestDate = moment(latestStudy.studyDate, 'YYYYMMDD');
|
||||
latestDate.add(range);
|
||||
|
||||
return {
|
||||
earliestDate: earliestDate,
|
||||
latestDate: latestDate
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @returns {Array}
|
||||
*/
|
||||
function autoSelectStudies(selectedStudies) {
|
||||
if (!selectedStudies.length) {
|
||||
return;
|
||||
}
|
||||
|
||||
var range = getDateRange(selectedStudies);
|
||||
|
||||
var autoselected = WorklistStudies.find({
|
||||
studyDate: {
|
||||
$gte: range.earliestDate.format('YYYYMMDD'),
|
||||
$lte: range.latestDate.format('YYYYMMDD')
|
||||
}
|
||||
}, {
|
||||
sort: {
|
||||
studyDate: 1
|
||||
}
|
||||
}).fetch();
|
||||
|
||||
// Make an array of studyInstanceUids in selectedStudies
|
||||
var studyInstanceUids = selectedStudies.map(function(selectedStudy) {
|
||||
return selectedStudy.studyInstanceUid;
|
||||
});
|
||||
|
||||
autoselected.forEach(function(study) {
|
||||
var exists = studyInstanceUids.indexOf(study.studyInstanceUid);
|
||||
if (exists > -1) {
|
||||
study.autoselected = false;
|
||||
return;
|
||||
}
|
||||
|
||||
study.autoselected = true;
|
||||
});
|
||||
|
||||
return autoselected;
|
||||
}
|
||||
|
||||
Template.studyAssociationTable.helpers({
|
||||
@@ -10,9 +77,13 @@ Template.studyAssociationTable.helpers({
|
||||
* @returns {Array.<T>}
|
||||
*/
|
||||
relevantStudies: function() {
|
||||
var userSelectedStudies = WorklistSelectedStudies.find().fetch() || [];
|
||||
var autoselected = autoSelectStudies(userSelectedStudies);
|
||||
return userSelectedStudies.concat(autoselected);
|
||||
var selectedStudies = WorklistSelectedStudies.find({}, {
|
||||
sort: {
|
||||
studyDate: 1
|
||||
}
|
||||
}).fetch() || [];
|
||||
var autoselected = autoSelectStudies(selectedStudies);
|
||||
return autoselected;
|
||||
},
|
||||
/**
|
||||
* This helper returns the list of Timepoint types the user can set for this study
|
||||
@@ -30,7 +101,54 @@ Template.studyAssociationTable.helpers({
|
||||
name: 'Follow-up'
|
||||
}
|
||||
];
|
||||
},
|
||||
earliestDate: function() {
|
||||
var selectedStudies = WorklistSelectedStudies.find({}, {
|
||||
sort: {
|
||||
studyDate: 1
|
||||
}
|
||||
}).fetch();
|
||||
var range = getDateRange(selectedStudies);
|
||||
if (!range) {
|
||||
return;
|
||||
}
|
||||
|
||||
return range.earliestDate;
|
||||
},
|
||||
latestDate: function() {
|
||||
var selectedStudies = WorklistSelectedStudies.find({}, {
|
||||
sort: {
|
||||
studyDate: 1
|
||||
}
|
||||
}).fetch();
|
||||
var range = getDateRange(selectedStudies);
|
||||
if (!range) {
|
||||
return;
|
||||
}
|
||||
|
||||
return range.latestDate;
|
||||
}
|
||||
});
|
||||
|
||||
//trial criteria!
|
||||
Template.studyAssociationTable.events({
|
||||
'change input.includeStudy': function(e) {
|
||||
var checkbox = e.currentTarget;
|
||||
var studyDataCells = $(checkbox).parents('tr').find('td.studyDataCell');
|
||||
if (checkbox.checked === true) {
|
||||
studyDataCells.removeClass('disabled');
|
||||
studyDataCells.find('input').attr('disabled', false);
|
||||
} else {
|
||||
studyDataCells.addClass('disabled');
|
||||
studyDataCells.find('input').attr('disabled', true);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//trial criteria!
|
||||
/*There shall be Associate option in right-click dialog
|
||||
If associated, double-click shall go to image view.
|
||||
If not associated, user shall be directed to Associate Time Points Dialog
|
||||
Use shall also be allowed to select multiple studies from study list to associate
|
||||
Associate Time Point dialog shall present selected studies and studies within defined time window of =/- 14 days of selected studies
|
||||
User should only be able to associate one time point at a time (user should not be able to select both BL and F/U for different studies in associate dialog)
|
||||
*/
|
||||
+4
-1
@@ -13,4 +13,7 @@
|
||||
margin: 0 3px
|
||||
|
||||
label
|
||||
padding: 0 5px
|
||||
padding: 0 5px
|
||||
|
||||
td.disabled
|
||||
opacity: 0.2
|
||||
Reference in new issue
Block a user