Skip to content

Commit c68d0bb

Browse files
Merge 24.3 to 24.7
2 parents 6bea191 + 83b2a8b commit c68d0bb

2 files changed

Lines changed: 34 additions & 3 deletions

File tree

ehr/resources/web/ehr/panel/BloodSummaryPanel.js

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,16 @@ Ext4.define('EHR.panel.BloodSummaryPanel', {
309309
return text;
310310
});
311311
},
312+
getMaxBloodAvailValue: function(allowableBloodVals){
313+
var maxVal = Math.max(...allowableBloodVals);
314+
var tenPercent = maxVal * .10;
315+
return maxVal + tenPercent;
316+
},
317+
getMinBloodAvailValue: function(allowableBloodVals){
318+
var minVal = Math.min(...allowableBloodVals);
319+
var tenPercent = minVal * .10;
320+
return minVal < 0 ? minVal + tenPercent : 0;
321+
},
312322

313323
getTickValues: function(rows){
314324
var ticks = [], msPerDay = 86400000, totalTicks = 10;
@@ -385,12 +395,18 @@ Ext4.define('EHR.panel.BloodSummaryPanel', {
385395
html: '<p>Total volume of blood collected in the past ' + currentRow.blood_draw_interval.value + ' days: <b>'
386396
+ Ext4.util.Format.round(currentRow.bloodPrevious.value, 1) + ' mL</b>. '
387397
+ 'The amount of blood available if drawn today is: <b>' + Ext4.util.Format.round(currentRow.allowableDisplay.value, 1) + ' mL</b>.</p>'
388-
+ '<p>The graph below shows how the amount of blood available will change over time, including when previous draws will drop off.</p>',
398+
+ '<p>The graph below shows how the amount of blood available will change over time, including when previous draws will drop off. Hover over the timepoints for more information.</p>',
389399
border: false,
390400
style: 'margin-bottom: 20px'
391401
});
392402
}
393403

404+
//for use later when getting max/min vals for y-axis scale
405+
var allowableBloodVals = [];
406+
for (var i = 0; i < results.rows.length; i++){
407+
allowableBloodVals.push(results.rows[i].allowableDisplay.value);
408+
}
409+
394410
var layerName = "Volume";
395411
toAdd.push({
396412
xtype: 'container',
@@ -426,6 +442,9 @@ Ext4.define('EHR.panel.BloodSummaryPanel', {
426442
},
427443
x: {
428444
tickValues: this.getTickValues(results.rows)
445+
},
446+
y: {
447+
domain: [this.getMinBloodAvailValue(allowableBloodVals), this.getMaxBloodAvailValue(allowableBloodVals)],
429448
}
430449
},
431450
layers: [{
@@ -455,7 +474,18 @@ Ext4.define('EHR.panel.BloodSummaryPanel', {
455474
},
456475
getPlotConfig: function(){
457476
var cfg = LDK.panel.GraphPanel.prototype.getPlotConfig.call(this);
458-
cfg.legendPos = 'none';
477+
cfg.legendData = [
478+
{
479+
color:'#FC8D62',
480+
text:'Blood Draw',
481+
shape: LABKEY.vis.Scale.Shape()[1]
482+
},
483+
{
484+
color:'#66C2A5',
485+
text:'Reconstitution Status',
486+
shape: LABKEY.vis.Scale.Shape()[0]
487+
}
488+
]
459489
cfg.aes.color = null;
460490
cfg.aes.shape = null;
461491

ehr/src/org/labkey/ehr/EHRController.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
import org.labkey.api.data.JsonWriter;
4141
import org.labkey.api.data.RuntimeSQLException;
4242
import org.labkey.api.data.SimpleFilter;
43+
import org.labkey.api.data.Sort;
4344
import org.labkey.api.data.TableInfo;
4445
import org.labkey.api.data.TableSelector;
4546
import org.labkey.api.dataiterator.DataIteratorContext;
@@ -2191,7 +2192,7 @@ public ApiResponse execute(IdForm idForm, BindException errors)
21912192
SimpleFilter filter = new SimpleFilter();
21922193
filter.addCondition(FieldKey.fromParts("id"), idForm.getIdList(), CompareType.IN);
21932194

2194-
TableSelector selector = new TableSelector(bloodDrawsTable, filter, null);
2195+
TableSelector selector = new TableSelector(bloodDrawsTable, filter, new Sort("date"));
21952196

21962197
Map<String, Object> params = new HashMap<>();
21972198
params.put("DATE_INTERVAL", idForm.getInterval());

0 commit comments

Comments
 (0)