Skip to content

Commit

Permalink
Added sensor code transmitter ID fields (#6780)
Browse files Browse the repository at this point in the history
* Copied #5442 - Duplicated @c-robertson's work

* Added tx id and sensor code to tooltip

* Added swagger docs for the new fields

* Added missing language keys

* Added new fields to sage plugin display

Co-authored-by: Sulka Haro <sulka@sulka.net>
  • Loading branch information
inventor96 and sulkaharo committed Jan 26, 2021
1 parent 5aa98ee commit 85aea0f
Show file tree
Hide file tree
Showing 8 changed files with 68 additions and 22 deletions.
12 changes: 11 additions & 1 deletion lib/client/careportal.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ function init (client, $) {
submitHooks = {};

_.forEach(careportal.allEventTypes, function each (event) {
inputMatrix[event.val] = _.pick(event, ['otp','remoteCarbs', 'remoteAbsorption', 'remoteBolus', 'bg', 'insulin', 'carbs', 'protein', 'fat', 'prebolus', 'duration', 'percent', 'absolute', 'profile', 'split', 'reasons', 'targets']);
inputMatrix[event.val] = _.pick(event, ['otp','remoteCarbs', 'remoteAbsorption', 'remoteBolus', 'bg', 'insulin', 'carbs', 'protein', 'fat', 'prebolus', 'duration', 'percent', 'absolute', 'profile', 'split', 'sensor', 'reasons', 'targets']);
submitHooks[event.val] = event.submitHook;
});
}
Expand Down Expand Up @@ -92,6 +92,8 @@ function init (client, $) {
$('#proteinGivenLabel').css('display', displayType(inputMatrix[eventType]['protein']));
$('#fatGivenLabel').css('display', displayType(inputMatrix[eventType]['fat']));

$('#sensorInfo').css('display', displayType(inputMatrix[eventType]['sensor']));

$('#durationLabel').css('display', displayType(inputMatrix[eventType]['duration']));
$('#percentLabel').css('display', displayType(inputMatrix[eventType]['percent'] && $('#absolute').val() === ''));
$('#absoluteLabel').css('display', displayType(inputMatrix[eventType]['absolute'] && $('#percent').val() === ''));
Expand All @@ -115,6 +117,8 @@ function init (client, $) {
resetIfHidden(inputMatrix[eventType]['carbs'], '#carbsGiven');
resetIfHidden(inputMatrix[eventType]['protein'], '#proteinGiven');
resetIfHidden(inputMatrix[eventType]['fat'], '#fatGiven');
resetIfHidden(inputMatrix[eventType]['sensor'], '#sensorCode');
resetIfHidden(inputMatrix[eventType]['sensor'], '#transmitterId');
resetIfHidden(inputMatrix[eventType]['duration'], '#duration');
resetIfHidden(inputMatrix[eventType]['absolute'], '#absolute');
resetIfHidden(inputMatrix[eventType]['percent'], '#percent');
Expand Down Expand Up @@ -213,6 +217,8 @@ function init (client, $) {
$('#carbsGiven').val('');
$('#proteinGiven').val('');
$('#fatGiven').val('');
$('#sensorCode').val('');
$('#transmitterId').val('');
$('#insulinGiven').val('');
$('#duration').val('');
$('#percent').val('');
Expand Down Expand Up @@ -244,6 +250,8 @@ function init (client, $) {
, carbs: $('#carbsGiven').val()
, protein: $('#proteinGiven').val()
, fat: $('#fatGiven').val()
, sensorCode: $('#sensorCode').val()
, transmitterId: $('#transmitterId').val()
, insulin: $('#insulinGiven').val()
, duration: times.msecs(parse_duration($('#duration').val())).mins < 1 ? $('#duration').val() : times.msecs(parse_duration($('#duration').val())).mins
, percent: $('#percent').val()
Expand Down Expand Up @@ -415,6 +423,8 @@ function init (client, $) {
pushIf(data.carbs, translate('Carbs Given') + ': ' + data.carbs);
pushIf(data.protein, translate('Protein Given') + ': ' + data.protein);
pushIf(data.fat, translate('Fat Given') + ': ' + data.fat);
pushIf(data.sensorCode, translate('Sensor Code') + ': ' + data.sensorCode);
pushIf(data.transmitterId, translate('Transmitter ID') + ': ' + data.transmitterId);
pushIf(data.insulin, translate('Insulin Given') + ': ' + data.insulin);
pushIf(data.eventType === 'Combo Bolus', translate('Combo Bolus') + ': ' + data.splitNow + '% : ' + data.splitExt + '%');
pushIf(data.duration, translate('Duration') + ': ' + data.duration + ' ' + translate('mins'));
Expand Down
2 changes: 2 additions & 0 deletions lib/client/renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,8 @@ function init (client, d3) {
(durationText ? '<strong>' + translate('Duration') + ':</strong> ' + durationText + '<br/>' : '') +
(d.insulinNeedsScaleFactor ? '<strong>' + translate('Insulin Scale Factor') + ':</strong> ' + d.insulinNeedsScaleFactor * 100 + '%<br/>' : '') +
(correctionRangeText ? '<strong>' + translate('Correction Range') + ':</strong> ' + correctionRangeText + '<br/>' : '') +
(d.transmitterId ? '<strong>' + translate('Transmitter ID') + ':</strong> ' + d.transmitterId + '<br/>' : '') +
(d.sensorCode ? '<strong>' + translate('Sensor Code') + ':</strong> ' + d.sensorCode + '<br/>' : '') +
(d.notes ? '<strong>' + translate('Notes') + ':</strong> ' + d.notes : '');
}

Expand Down
42 changes: 21 additions & 21 deletions lib/plugins/careportal.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,87 +15,87 @@ function init() {
return [
{ val: '<none>'
, name: '<none>'
, bg: true, insulin: true, carbs: true, protein: false, fat: false, prebolus: false, duration: false, percent: false, absolute: false, profile: false, split: false
, bg: true, insulin: true, carbs: true, protein: false, fat: false, prebolus: false, duration: false, percent: false, absolute: false, profile: false, split: false, sensor: false
}
, { val: 'BG Check'
, name: 'BG Check'
, bg: true, insulin: false, carbs: false, protein: false, fat: false, prebolus: false, duration: false, percent: false, absolute: false, profile: false, split: false
, bg: true, insulin: false, carbs: false, protein: false, fat: false, prebolus: false, duration: false, percent: false, absolute: false, profile: false, split: false, sensor: false
}
, { val: 'Snack Bolus'
, name: 'Snack Bolus'
, bg: true, insulin: true, carbs: true, protein: true, fat: true, prebolus: true, duration: false, percent: false, absolute: false, profile: false, split: false
, bg: true, insulin: true, carbs: true, protein: true, fat: true, prebolus: true, duration: false, percent: false, absolute: false, profile: false, split: false, sensor: false
}
, { val: 'Meal Bolus'
, name: 'Meal Bolus'
, bg: true, insulin: true, carbs: true, protein: true, fat: true, prebolus: true, duration: false, percent: false, absolute: false, profile: false, split: false
, bg: true, insulin: true, carbs: true, protein: true, fat: true, prebolus: true, duration: false, percent: false, absolute: false, profile: false, split: false, sensor: false
}
, { val: 'Correction Bolus'
, name: 'Correction Bolus'
, bg: true, insulin: true, carbs: false, protein: false, fat: false, prebolus: false, duration: false, percent: false, absolute: false, profile: false, split: false
, bg: true, insulin: true, carbs: false, protein: false, fat: false, prebolus: false, duration: false, percent: false, absolute: false, profile: false, split: false, sensor: false
}
, { val: 'Carb Correction'
, name: 'Carb Correction'
, bg: true, insulin: false, carbs: true, protein: true, fat: true, prebolus: false, duration: false, percent: false, absolute: false, profile: false, split: false
, bg: true, insulin: false, carbs: true, protein: true, fat: true, prebolus: false, duration: false, percent: false, absolute: false, profile: false, split: false, sensor: false
}
, { val: 'Combo Bolus'
, name: 'Combo Bolus'
, bg: true, insulin: true, carbs: true, protein: true, fat: true, prebolus: true, duration: true, percent: false, absolute: false, profile: false, split: true
, bg: true, insulin: true, carbs: true, protein: true, fat: true, prebolus: true, duration: true, percent: false, absolute: false, profile: false, split: true, sensor: false
}
, { val: 'Announcement'
, name: 'Announcement'
, bg: true, insulin: false, carbs: false, protein: false, fat: false, prebolus: false, duration: false, percent: false, absolute: false, profile: false, split: false
, bg: true, insulin: false, carbs: false, protein: false, fat: false, prebolus: false, duration: false, percent: false, absolute: false, profile: false, split: false, sensor: false
}
, { val: 'Note'
, name: 'Note'
, bg: true, insulin: false, carbs: false, protein: false, fat: false, prebolus: false, duration: true, percent: false, absolute: false, profile: false, split: false
, bg: true, insulin: false, carbs: false, protein: false, fat: false, prebolus: false, duration: true, percent: false, absolute: false, profile: false, split: false, sensor: false
}
, { val: 'Question'
, name: 'Question'
, bg: true, insulin: false, carbs: false, protein: false, fat: false, prebolus: false, duration: false, percent: false, absolute: false, profile: false, split: false
, bg: true, insulin: false, carbs: false, protein: false, fat: false, prebolus: false, duration: false, percent: false, absolute: false, profile: false, split: false, sensor: false
}
, { val: 'Exercise'
, name: 'Exercise'
, bg: false, insulin: false, carbs: false, protein: false, fat: false, prebolus: false, duration: true, percent: false, absolute: false, profile: false, split: false
, bg: false, insulin: false, carbs: false, protein: false, fat: false, prebolus: false, duration: true, percent: false, absolute: false, profile: false, split: false, sensor: false
}
, { val: 'Site Change'
, name: 'Pump Site Change'
, bg: true, insulin: true, carbs: false, protein: false, fat: false, prebolus: false, duration: false, percent: false, absolute: false, profile: false, split: false
, bg: true, insulin: true, carbs: false, protein: false, fat: false, prebolus: false, duration: false, percent: false, absolute: false, profile: false, split: false, sensor: false
}
, { val: 'Sensor Start'
, name: 'CGM Sensor Start'
, bg: true, insulin: false, carbs: false, protein: false, fat: false, prebolus: false, duration: false, percent: false, absolute: false, profile: false, split: false
, bg: true, insulin: false, carbs: false, protein: false, fat: false, prebolus: false, duration: false, percent: false, absolute: false, profile: false, split: false, sensor: true
}
, { val: 'Sensor Change'
, name: 'CGM Sensor Insert'
, bg: true, insulin: false, carbs: false, protein: false, fat: false, prebolus: false, duration: false, percent: false, absolute: false, profile: false, split: false
, bg: true, insulin: false, carbs: false, protein: false, fat: false, prebolus: false, duration: false, percent: false, absolute: false, profile: false, split: false, sensor: true
}
, { val: 'Sensor Stop'
, name: 'CGM Sensor Stop'
, bg: true, insulin: false, carbs: false, prebolus: false, duration: false, percent: false, absolute: false, profile: false, split: false
, bg: true, insulin: false, carbs: false, prebolus: false, duration: false, percent: false, absolute: false, profile: false, split: false, sensor: false
}
, { val: 'Pump Battery Change'
, name: 'Pump Battery Change'
, bg: true, insulin: false, carbs: false, protein: false, fat: false, prebolus: false, duration: false, percent: false, absolute: false, profile: false, split: false
, bg: true, insulin: false, carbs: false, protein: false, fat: false, prebolus: false, duration: false, percent: false, absolute: false, profile: false, split: false, sensor: false
}
, { val: 'Insulin Change'
, name: 'Insulin Cartridge Change'
, bg: true, insulin: false, carbs: false, protein: false, fat: false, prebolus: false, duration: false, percent: false, absolute: false, profile: false, split: false
, bg: true, insulin: false, carbs: false, protein: false, fat: false, prebolus: false, duration: false, percent: false, absolute: false, profile: false, split: false, sensor: false
}
, { val: 'Temp Basal Start'
, name: 'Temp Basal Start'
, bg: true, insulin: false, carbs: false, protein: false, fat: false, prebolus: false, duration: true, percent: true, absolute: true, profile: false, split: false
, bg: true, insulin: false, carbs: false, protein: false, fat: false, prebolus: false, duration: true, percent: true, absolute: true, profile: false, split: false, sensor: false
}
, { val: 'Temp Basal End'
, name: 'Temp Basal End'
, bg: true, insulin: false, carbs: false, protein: false, fat: false, prebolus: false, duration: true, percent: false, absolute: false, profile: false, split: false
, bg: true, insulin: false, carbs: false, protein: false, fat: false, prebolus: false, duration: true, percent: false, absolute: false, profile: false, split: false, sensor: false
}
, { val: 'Profile Switch'
, name: 'Profile Switch'
, bg: true, insulin: false, carbs: false, protein: false, fat: false, prebolus: false, duration: true, percent: false, absolute: false, profile: true, split: false
, bg: true, insulin: false, carbs: false, protein: false, fat: false, prebolus: false, duration: true, percent: false, absolute: false, profile: true, split: false, sensor: false
}
, { val: 'D.A.D. Alert'
, name: 'D.A.D. Alert'
, bg: true, insulin: false, carbs: false, protein: false, fat: false, prebolus: false, duration: false, percent: false, absolute: false, profile: false, split: false
, bg: true, insulin: false, carbs: false, protein: false, fat: false, prebolus: false, duration: false, percent: false, absolute: false, profile: false, split: false, sensor: false
}
];

Expand Down
6 changes: 6 additions & 0 deletions lib/plugins/sensorage.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,12 @@ function init(ctx) {
if (!_.isEmpty(latest[event].notes)) {
info.push({label: translate('Notes'), value: latest[event].notes});
}
if (!_.isEmpty(latest[event].transmitterId)) {
info.push({label: translate('Transmitter ID'), value: latest[event].transmitterId});
}
if (!_.isEmpty(latest[event].sensorCode)) {
info.push({label: translate('Sensor Code'), value: latest[event].sensorCode});
}
}
});

Expand Down
8 changes: 8 additions & 0 deletions swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -1192,6 +1192,14 @@
"type": "string",
"description": "The units for the glucose value, mg/dl or mmol."
},
"transmitterId": {
"type": "string",
"description": "The transmitter ID of the transmitter being started."
},
"sensorCode": {
"type": "string",
"description": "The code used to start a Dexcom G6 sensor."
},
"notes": {
"type": "string",
"description": "Description/notes of treatment."
Expand Down
6 changes: 6 additions & 0 deletions swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -891,6 +891,12 @@ components:
units:
type: string
description: 'The units for the glucose value, mg/dl or mmol.'
transmitterId:
type: string
description: 'The transmitter ID of the transmitter being started.'
sensorCode:
type: string
description: 'The code used to start a Dexcom G6 sensor.'
notes:
type: string
description: Description/notes of treatment.
Expand Down
2 changes: 2 additions & 0 deletions translations/en/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,8 @@
,"CGM Sensor Start":"CGM Sensor Start"
,"CGM Sensor Stop":"CGM Sensor Stop"
,"CGM Sensor Insert":"CGM Sensor Insert"
,"Sensor Code":"Sensor Code"
,"Transmitter ID":"Transmitter ID"
,"Dexcom Sensor Start":"Dexcom Sensor Start"
,"Dexcom Sensor Change":"Dexcom Sensor Change"
,"Insulin Cartridge Change":"Insulin Cartridge Change"
Expand Down
12 changes: 12 additions & 0 deletions views/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,18 @@
</label>
</fieldset>

<fieldset id="sensorInfo">
<legend class="translate">Sensor</legend>
<label id="sensorCodeLabel" for="sensorCode" class="left-column short-label">
<span class="translate">Sensor Code</span>
<input type="text" id="sensorCode" />
</label>
<label id="txIdLabel" for="transmitterId" class="left-column short-label">
<span class="translate">Tx ID</span>
<input type="text" id="transmitterId" />
</label>
</fieldset>

<label id="insulinGivenLabel" for="insulinGiven" class="left-column short-label">
<span class="translate">Insulin Given</span>
<input type="number" step="any" min="0" id="insulinGiven" placeholder="Amount in units" class="titletranslate" pattern="[0-9.,]*">
Expand Down

0 comments on commit 85aea0f

Please sign in to comment.