Skip to content
Merged
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
23f2054
use profile.sens instead of autosens-adjusted sens
scottleibrand Aug 18, 2017
bfe0436
model remainingCarbs as a /\ shaped bilinear curve
scottleibrand Aug 19, 2017
5aaae23
typofix
scottleibrand Aug 19, 2017
fc664b3
wait 90m before setting minCOBPredBG
scottleibrand Aug 19, 2017
8a308a6
if IOB covers less than half of COB, microBolus 1/2 the insulinReq
scottleibrand Aug 19, 2017
8078d3b
syntax
scottleibrand Aug 19, 2017
e8d0e6e
logging cleanup
scottleibrand Aug 19, 2017
eb6c7b3
consider BG predictions out to 4h now
scottleibrand Aug 19, 2017
4b0659e
make SMB maxBolus configurable via maxSMBBasalMinutes
scottleibrand Aug 23, 2017
7446820
fix variable reference
scottleibrand Aug 23, 2017
b1777cc
fix variable reference
scottleibrand Aug 23, 2017
6c2b312
debugging
scottleibrand Aug 23, 2017
e9479f2
debugging
scottleibrand Aug 23, 2017
db8812d
remove extra variable
scottleibrand Aug 23, 2017
8e3b06e
debugging
scottleibrand Aug 23, 2017
4bb7ac1
fix math
scottleibrand Aug 23, 2017
91e142a
still SMB 1/3 of insulinReq if that's more than halfMealInsulinReq
scottleibrand Aug 23, 2017
863ca43
Merge branch 'maxSMBBasalMinutes' into halfMealInsulinReq
scottleibrand Aug 23, 2017
df2591b
only allow more than 30m of basal as SMB when COB is uncovered
scottleibrand Aug 23, 2017
9273fc6
Merge branch 'halfMealInsulinReq' into scott-dev
scottleibrand Aug 23, 2017
45ffb45
Merge branch 'bilinear-remainingCI' into scott-dev
scottleibrand Aug 23, 2017
412b7f7
if IOB covers more than 3/4 of COB, limit maxBolus to 30m of basal
scottleibrand Aug 23, 2017
dab1c2c
if IOB covers more than 3/4 of COB, limit maxBolus to 30m of basal
scottleibrand Aug 23, 2017
7441732
Merge remote-tracking branch 'origin/0.6.0-dev' into scott-dev
scottleibrand Aug 23, 2017
b7236c8
Merge remote-tracking branch 'origin/0.6.0-dev' into scott-dev
scottleibrand Aug 23, 2017
8035800
Merge remote-tracking branch 'origin/0.6.0-dev' into scott-dev
scottleibrand Aug 23, 2017
dcc2520
default to 30m if typeof profile_data.maxSMBBasalMinutes == 'undefined'
scottleibrand Aug 23, 2017
69184c4
default to 30m if typeof profile_data.maxSMBBasalMinutes == 'undefined'
scottleibrand Aug 23, 2017
b603f22
Merge branch 'halfMealInsulinReq' into scott-dev
scottleibrand Aug 23, 2017
f5bc64d
round mealInsulinReq
scottleibrand Aug 23, 2017
3b52d03
Merge branch 'halfMealInsulinReq' into scott-dev
scottleibrand Aug 23, 2017
28c5258
fix debug output
scottleibrand Aug 24, 2017
3d380d4
Merge branch 'halfMealInsulinReq' into scott-dev
scottleibrand Aug 24, 2017
f50d634
ignore bolusing status if pump is suspended
scottleibrand Aug 24, 2017
2e2224b
use insulinReq/2 up to 2/3 of COB, and maxSMBBasalMinutes up to 100%
scottleibrand Aug 24, 2017
7146568
Merge branch 'halfMealInsulinReq' into scott-dev
scottleibrand Aug 24, 2017
52fca93
allow SMBs every 2 minutes
scottleibrand Aug 25, 2017
5854b55
Merge branch 'halfMealInsulinReq' into scott-dev
scottleibrand Aug 25, 2017
5ebb955
microBolus 1/2 the insulinReq if IOB covers less than 3/4 of COB
scottleibrand Aug 25, 2017
badaf89
Merge branch 'halfMealInsulinReq' into scott-dev
scottleibrand Aug 25, 2017
43a936c
if IOB doesn't cover COB, microBolus 1/2 the insulinReq
scottleibrand Aug 25, 2017
67f3458
Merge branch 'halfMealInsulinReq' into scott-dev
scottleibrand Aug 25, 2017
11ef6e0
debugging
scottleibrand Aug 25, 2017
968643d
debugging
scottleibrand Aug 25, 2017
38abb95
debugging
scottleibrand Aug 25, 2017
78d15f4
predict IOB out to 4h, regardless of DIA
scottleibrand Aug 26, 2017
ea0d947
Merge branch 'bilinear-remainingCI' into scott-dev
scottleibrand Aug 26, 2017
4ff1dee
debugging
scottleibrand Aug 26, 2017
bbb13a4
cid debugging
scottleibrand Aug 26, 2017
4b746e8
limit cid to 4 hours: the reset goes to remainingCI
scottleibrand Aug 26, 2017
fe13ff4
Merge branch 'bilinear-remainingCI' into scott-dev
scottleibrand Aug 26, 2017
03b0f4e
remove extra debugging
scottleibrand Aug 26, 2017
4304398
remove extra debugging
scottleibrand Aug 26, 2017
de178de
cid debugging
scottleibrand Aug 26, 2017
f2a919a
fix cid formula to end after 4h not 8h
scottleibrand Aug 26, 2017
cdc7078
Merge branch 'bilinear-remainingCI' into scott-dev
scottleibrand Aug 26, 2017
947697a
debugging
scottleibrand Aug 26, 2017
4dbeec6
for purposes of categorizing boluses as SMBs to add to basalIOB, use …
scottleibrand Aug 28, 2017
d129a5b
Merge branch '0.6.0-dev' into remainingCI-debug
scottleibrand Sep 7, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions lib/determine-basal/determine-basal.js
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,9 @@ var determine_basal = function determine_basal(glucose_status, currenttemp, iob_
var lastCOBpredBG;
var lastUAMpredBG;
var UAMduration = 0;
var remainingCItotal = 0;
var remainingCIs = [];
var predCIs = [];
try {
iobArray.forEach(function(iobTick) {
//console.error(iobTick);
Expand All @@ -368,6 +371,10 @@ var determine_basal = function determine_basal(glucose_status, currenttemp, iob_
// bilinear curve peaking at remainingCIpeak at 2h (24*5m) and ending at 4h (48*5m intervals)
var intervals = Math.min( COBpredBGs.length, 48-COBpredBGs.length );
var remainingCI = Math.max(0, intervals / 24 * remainingCIpeak );
remainingCItotal += predCI+remainingCI;
remainingCIs.push(round(remainingCI,1));
predCIs.push(round(predCI,1));
//process.stderr.write(round(predCI,1)+"+"+round(remainingCI,1)+" ");
COBpredBG = COBpredBGs[COBpredBGs.length-1] + predBGI + Math.min(0,predDev) + predCI + remainingCI;
aCOBpredBG = aCOBpredBGs[aCOBpredBGs.length-1] + predBGI + Math.min(0,predDev) + predACI;
// for UAMpredBGs, predicted carb impact drops at minDeviationSlope
Expand Down Expand Up @@ -404,6 +411,10 @@ var determine_basal = function determine_basal(glucose_status, currenttemp, iob_
} catch (e) {
console.error("Problem with iobArray. Optional feature Advanced Meal Assist disabled:",e);
}
console.error("predCIs:",predCIs.join(" "));
console.error("remainingCIs:",remainingCIs.join(" "));
console.error("COB:",meal_data.mealCOB,"remainingCItotal/csf:",round(remainingCItotal/csf,2),"remainingCarbs:",round(remainingCarbs,2));
//,"totalCA:",round(totalCA,2),"remainingCItotal/csf+totalCA:",round(remainingCItotal/csf+totalCA,2));
rT.predBGs = {};
IOBpredBGs.forEach(function(p, i, theArray) {
theArray[i] = round(Math.min(401,Math.max(39,p)));
Expand Down