These are chat archives for nightscout/intend-to-bolus

24th
Nov 2015
Jason Calabrese
@jasoncalabrese
Nov 24 2015 00:36
many of these meals that I'm having trouble with I would have used a combo, but it's a lot of guessing
with the loop going I'm not going to do combos
getting the 2nd, 3rd bolus in for those meals never works out right
dealing with big vacation lunch and site failure now
Jason Calabrese
@jasoncalabrese
Nov 24 2015 00:43
need some way to have it react to expected carbs, when/if there's an increase
Scott Leibrand
@scottleibrand
Nov 24 2015 00:45
sounds like you want an algorithm closer to our original diyps closed loop one, and/or more similar to what @loudnate is doing with dosing based on openaps-predict
Jason Calabrese
@jasoncalabrese
Nov 24 2015 00:47
yeah, I think something like that
Scott Leibrand
@scottleibrand
Nov 24 2015 00:48
biggest challenge & reason I didn't do that for openaps is the high variance of carb absorption profiles between different PWDs
Jason Calabrese
@jasoncalabrese
Nov 24 2015 00:48
even for the same person
don't think there is a constant
Scott Leibrand
@scottleibrand
Nov 24 2015 00:49
yeah, for some people it varies more meal to meal
Jason Calabrese
@jasoncalabrese
Nov 24 2015 00:49
what I was was thinking was a way to let openaps high temp more when expected carbs were hitting
but once you miss it, it's almost impossible to catch up
one new thing I'm seeing since looping is that we are often going into a meal low temping, where in the past predictive low alarms would have gone off and I would have covered with carbs
and after that it's hard to get the bolus timing right
Scott Leibrand
@scottleibrand
Nov 24 2015 00:53
yeah, we've discovered it's often best when riding low an hour before the meal to go ahead and do a few carbs and cover them, to get IOB back up to zero
Jason Calabrese
@jasoncalabrese
Nov 24 2015 00:54
need to see the oref0 iob in NS to do that
will help understand it too
Scott Leibrand
@scottleibrand
Nov 24 2015 00:56
yeah
that's our next step I think
Jason Calabrese
@jasoncalabrese
Nov 24 2015 01:17
found something that might have been slowing down my loop, was using iter_pump count 120 instead of iter_pump_hours hours 4
Ben West
@bewest
Nov 24 2015 01:18
that'll take longer for sure
Jason Calabrese
@jasoncalabrese
Nov 24 2015 01:18
thats 120 pages?
Ben West
@bewest
Nov 24 2015 01:18
no, 120 hours
oh
hmmm
Dana Lewis
@danamlewis
Nov 24 2015 01:18
Wow
Ben West
@bewest
Nov 24 2015 01:18
hmm
120 pages maybe
Scott Leibrand
@scottleibrand
Nov 24 2015 01:18
I think it's 120 "records", isn't it?
Ben West
@bewest
Nov 24 2015 01:18
records, yes
so probably not too bad, actually
Scott Leibrand
@scottleibrand
Nov 24 2015 01:19
so it varies based on how often it's executing and canceling temps
Jason Calabrese
@jasoncalabrese
Nov 24 2015 01:19
for 4 hours how many do you get
Scott Leibrand
@scottleibrand
Nov 24 2015 01:19
count the skyscrapers. :)
Ben West
@bewest
Nov 24 2015 01:19
would be nice to create recipe/setup that defaults that to your dia
or maybe 2x dia?
Scott Leibrand
@scottleibrand
Nov 24 2015 01:19
probably safer to just do 6h or something
typical DIA plus a couple hours
Ben West
@bewest
Nov 24 2015 01:20
ok, so 1.5 dia maybe
Scott Leibrand
@scottleibrand
Nov 24 2015 01:20
problem with that is you have to talk to the pump to complete setup
Ben West
@bewest
Nov 24 2015 01:20
that might be fine
part of training/explore-your-pump
Jason Calabrese
@jasoncalabrese
Nov 24 2015 01:21
Ben West
@bewest
Nov 24 2015 01:21
yeah, the 4 seems arbitray
Jason Calabrese
@jasoncalabrese
Nov 24 2015 01:21
what I have is mix of things
Ben West
@bewest
Nov 24 2015 01:21
some multiple of dia seems nice
this is personalized medicine ;-)
lot of the boilerplate we're still figuring out
Jason Calabrese
@jasoncalabrese
Nov 24 2015 01:22
how are iter_pump and iter_pump_hours working internally
Ben West
@bewest
Nov 24 2015 01:23
ah, internally those two are pretty similar
iter_pump is count of number of records
iter_pump_hours is records for last $x hours
instead of $x count
Jason Calabrese
@jasoncalabrese
Nov 24 2015 01:24
it's a steam or you need to figure out the requests up front
Ben West
@bewest
Nov 24 2015 01:24
they both use same generator framework internally, only the test is different
Jason Calabrese
@jasoncalabrese
Nov 24 2015 01:24
thinking about it for perf now
Ben West
@bewest
Nov 24 2015 01:24
they both use same python generator undeneath
only the condition to stop is different
pump memory only comes in pages
1024 bytes per page
so records are highly variable
pump memory is more or less history of buttons/internal changes
not history of therapy per se
my whole "loop" runs in under minute
1.4 minutes on pi
er
on pi
< 40 seconds, laptop, including preflight, which fails much faster now
without good preflight it takes longer
Scott Leibrand
@scottleibrand
Nov 24 2015 01:27
depends a lot on how good your carelink connectivity is
Ben West
@bewest
Nov 24 2015 01:27
on pi that can double the length
but still should take less than 2 minutes, probably
Scott Leibrand
@scottleibrand
Nov 24 2015 01:27
mine reliably finishes in <5m even so
Jason Calabrese
@jasoncalabrese
Nov 24 2015 01:28
needs to run faster, or impossible to use durring the day
Scott Leibrand
@scottleibrand
Nov 24 2015 01:28
yeah, 2 is probably typical, although requerying settings and doing upload takes some time too
why?
Jason Calabrese
@jasoncalabrese
Nov 24 2015 01:28
since I've been with him, I've been trying to keep it going
Ben West
@bewest
Nov 24 2015 01:28
faster than 2 minutes?
Jason Calabrese
@jasoncalabrese
Nov 24 2015 01:28
but even on a table it doesn't work sometime
getting him to stay in place for 2mins isn't easy
Ben West
@bewest
Nov 24 2015 01:29
range issues
Scott Leibrand
@scottleibrand
Nov 24 2015 01:29
yeah, don't bother trying to run it on a moving target
Ben West
@bewest
Nov 24 2015 01:29
I walk away from it all the time
Scott Leibrand
@scottleibrand
Nov 24 2015 01:29
either he wears it, he's sitting/sleeping, or we need better range
Ben West
@bewest
Nov 24 2015 01:29
mine takes 48 seconds
on laptop at least
on pi is much slower
2x
Jason Calabrese
@jasoncalabrese
Nov 24 2015 01:30
part of it was history
processing it was taking a while
Ben West
@bewest
Nov 24 2015 01:30
I think we're ready to start creating some more sophisticated uses
we need to spec out data models for things
then, we can have the native device uses output the right thing
Jason Calabrese
@jasoncalabrese
Nov 24 2015 01:31
it's faster now
Ben West
@bewest
Nov 24 2015 01:31
fewer interstitial reports
Jason Calabrese
@jasoncalabrese
Nov 24 2015 01:32
yeah, just running a command takes time, since it has to fire up node
Scott Leibrand
@scottleibrand
Nov 24 2015 01:32
python usually
Ben West
@bewest
Nov 24 2015 01:32
every call to oref0 is new node-vm instance
that's slightly less expensive than starting python, but still pretty expensive
any vm creation has inherent cost
java > python || ruby > node > c/c++ || golang
d is very good, I've heard
Jason Calabrese
@jasoncalabrese
Nov 24 2015 01:34
could combine a few things
some things like upload could be separate
and not get in the way of the loop
Ben West
@bewest
Nov 24 2015 01:35
we're close to being able to define what a daemon should do
so was thinking do local mqtt daemon
try to mesh with any .local advertisements
avahi/bonjour
Jason Calabrese
@jasoncalabrese
Nov 24 2015 01:36
that would be nice
was running my phone off Andrew's hotspot along with the pi
on a cave tour
but .local isn't working on android for me
Ben West
@bewest
Nov 24 2015 01:38
need avahi-daemon
oh, on android
need to be on same subnet/network
need to be on router/gateway that allows/does not block
"bridged" wifi
bonjour is owned by apple
Jason Calabrese
@jasoncalabrese
Nov 24 2015 01:40
can connect by ip from android, laptop on same hotspot can use .local
Ben West
@bewest
Nov 24 2015 01:40
so that might be part of it
Jason Calabrese
@jasoncalabrese
Nov 24 2015 01:46
wow, loop running way faster now
all that history was taking time
Ben West
@bewest
Nov 24 2015 01:46
yeah
Jason Calabrese
@jasoncalabrese
Nov 24 2015 01:47
and made a mess with dupes yesterday
Ben West
@bewest
Nov 24 2015 01:47
120 records is almost always enough to ask for 2 pages I think
usually 40 - 90 per page I think
temp basals are all two records each
eyim
@eyim
Nov 24 2015 02:27

@bewest Sorry late to the conversation. This is the same for my son which is why I was trying to change the threshold level so that it it starts low temping earlier as he is falling and has enough time to make a difference. Right now, it is too late to have any impact and I need to correct with carbs.

right, I'm saying with any downward pressure, for me, low temp is not enough at 90

Ali Mazaheri
@amazaheri
Nov 24 2015 05:15
just wrapped up configuring the network for our trip, Win10-> Microsoft Hosted Network Virtual Adapter-> hotspot on Surface and RasPi running off of it. Way more stable than Mobile hotspot
Capture.PNG
Ali Mazaheri
@amazaheri
Nov 24 2015 05:21
Capture.PNG
Scott Leibrand
@scottleibrand
Nov 24 2015 06:18
Does that auto-start and auto-associate whenever the Surface is on? Does the Surface require an Internet connection to run the hotspot, or does that work completely offline? Can you do that with Windows 10 mobile, or just desktop?
@jasoncalabrese your comments earlier about what you want OpenAPS to do with carbs gave me an idea that I think has legs. I just sent a write-up on it to Dana for review, and once she's done I'll send it your way. General idea is that as long as you have uncovered carbs, and BG is rising, it should be safe to ignore bolus IOB when calculating eventualBG, and high-temp according to BG and basal IOB as long as BG is rising. Then when BG crests, you go back to normal bolus snooze. Lots more details and scenario analysis to follow. :-)
Jason Calabrese
@jasoncalabrese
Nov 24 2015 06:33
guess the trick will be getting the carbs, tricking the bolus wizard is a pain, and pull from NS has it's own issues
think part of the problems we're running into is from not having a remote like we did with the ping
Matthias Granberry
@mgranberry
Nov 24 2015 06:36
@jasoncalabrese Would the Dexcom receiver work? It stores carbs and it's easy to pull that data off of it.
Jason Calabrese
@jasoncalabrese
Nov 24 2015 06:36
buttons on the receiver suck
Matthias Granberry
@mgranberry
Nov 24 2015 06:37
true enough
Jason Calabrese
@jasoncalabrese
Nov 24 2015 06:37
thinking about a little web app on the pi
Scott Leibrand
@scottleibrand
Nov 24 2015 06:37
Why would you have to trick the bolus wizard?
Jason Calabrese
@jasoncalabrese
Nov 24 2015 06:37
so it would be local network only
wouldn't bolus for all carbs for some meals at once
Scott Leibrand
@scottleibrand
Nov 24 2015 06:38
If you enter carbs into bolus wizard, you can just down-arrow to tell it to do whatever portion of the meal bolus you want to do up front.
Jason Calabrese
@jasoncalabrese
Nov 24 2015 06:38
so you'd have to enter all the carbs, then make up the bolus amount
Scott Leibrand
@scottleibrand
Nov 24 2015 06:38
sure, but how is that difficult?
or any more difficult than what you do now?
Jason Calabrese
@jasoncalabrese
Nov 24 2015 06:39
guess it's about the same
Scott Leibrand
@scottleibrand
Nov 24 2015 06:41
Email sent.
Maybe twice. :-)
Jason Calabrese
@jasoncalabrese
Nov 24 2015 06:41
think I want that local webapp too, he's getting annoyed with all the button pushing on the pump
but won't/can't do it all himself
Scott Leibrand
@scottleibrand
Nov 24 2015 06:43
Yeah
we'll probably end up using NS carb treatments.
Jason Calabrese
@jasoncalabrese
Nov 24 2015 06:44
on another topic I saw a case where a single bolus isn't getting sent to NS, looks like it's getting filtered by oref0-normalize-temps
trying to create a simple example to reproduce it
seems like the order of the pump history isn't expected
Scott Leibrand
@scottleibrand
Nov 24 2015 06:45
I'd be a lot more inclined to trust treatments from NS when the worst they can do is cause openaps to high-temp a little extra when BG is rising after a bolus.
Yeah, we had some issues with pumphistory ordering for IOB calculation too.
And using NS carb treatments means we can use what Dana's already entering for DIYPS.
Jason Calabrese
@jasoncalabrese
Nov 24 2015 06:47
yeah, I'd like to lock down ns treatments some more
we have an option to fully lock it down, with the api secret, but that won't work for school
think for school I'll need something else, been thinking of calling it a care code, like a little shared code we could give to all the nurses/staff
would be able to enter treatments, but maybe not all of them, maybe not at all times
Scott Leibrand
@scottleibrand
Nov 24 2015 06:58
Yeah, harder when you have to trust so many other people.
Jason Calabrese
@jasoncalabrese
Nov 24 2015 07:03
read over the email, really like the idea and think it will work
Dana Lewis
@danamlewis
Nov 24 2015 07:04
Cool, need more scenarios to add
Jason Calabrese
@jasoncalabrese
Nov 24 2015 07:05
besides creating some tests I'll need to be able to see all the calculations somehow, then I could test it for real and be able to watch it closely
not sure if that a pebble card like you have diyps or a ns plugin
an endpoint on the pi would be needed for offline
might need to look for carbs older than dia, since big meals will take even longer
Milos Kozak
@MilosKozak
Nov 24 2015 07:16
some time ago someone offered help to find all needed hw for openaps. still valid?
Ali Mazaheri
@amazaheri
Nov 24 2015 07:19
@scottleibrand yes and yes, mobile does the same but for some odd reason pi drops the connection
Dana Lewis
@danamlewis
Nov 24 2015 07:22
@MilosKozak You mean spare pump, or what?
Scott Leibrand
@scottleibrand
Nov 24 2015 07:23
@jasoncalabrese thought about that, but would probably rather not look that far back.
if you are still rising 4h after the meal, there's no more initial bolus to ignore, so we can mostly just chase the BGs.
Milos Kozak
@MilosKozak
Nov 24 2015 07:25
yeah pump + some stick is needed if i undestand it well. rpi is not problem to get localy
there is no local market with used pumps :(
used pump must be checked if it's working well. that's something i don't want to do overseas
Jason Calabrese
@jasoncalabrese
Nov 24 2015 07:28
only issue with chasing the BG is there seems to be plateau in lots of those cases with a little up and down, and we cancel the high temp with a tick down
has anyone tried Apidra while looping, we tried it before and didn't notice much different, but could be that it would help more when looping
@MilosKozak there's also the DanaR pump, think thats what @LorelaiL is using and is available in Europe
Milos Kozak
@MilosKozak
Nov 24 2015 07:33
yeah we discussing it too. @LorelaiL said the main issues are battery, connectivity drops and infusion sets incompatible with anything. but it's still an option ...
Jason Calabrese
@jasoncalabrese
Nov 24 2015 07:37
I thought compatible sites were going to be a problem for me, but all the detachable sets from unomedical seem to have compatible clips, maybe something like that with the DanaR
and connectivity is a problem with the carelink, but it looks like we'll get around that with custom hardware like the RileyLink
Ben West
@bewest
Nov 24 2015 07:39
in ubuntu fashion, there's an african proverb:
If you want to go quickly, go alone. If you want to go far, go together.
Milos Kozak
@MilosKozak
Nov 24 2015 07:40
big plus for DanaR is control from phone
Ben West
@bewest
Nov 24 2015 07:40
we've gone quickly... it's time to go far
Jason Calabrese
@jasoncalabrese
Nov 24 2015 07:40
nice @bewest
Scott Leibrand
@scottleibrand
Nov 24 2015 08:09
@jasoncalabrese we don't cancel on downtick, only when dropping at about the rate that would be expected from insulin activity (BGI/2).
Another thing we might want to do is phase out high-temping around BGI/2 rather than making it a binary cutoff.
eyim
@eyim
Nov 24 2015 09:48
blob
This message was deleted

Okay another example of where openaps not doing what I would think it would do. The situation is where he is low and stays low. It looks like openaps simply tries to cancel a high temp if there is one but doesn't try to implement a low temp basal. Basically when Dexcom shows a low, it just reads 39 the entire time. Therefore tick and avg delta = 0 if you stay low for a while and you get this:

{"delta":0,"glucose":39,"avgdelta":0}
{"duration":33,"rate":0,"temp":"absolute"}
{"iob":1.2243434921930496,"activity":0.06642615555555557,"bolusiob":0}
{"max_iob":6,"type":"current","dia":5,"current_basal":0.8,"max_daily_basal":1.1,"max_basal":3.5,"min_bg":120,"max_bg":120,"sens":80}
IOB: 1.22, Bolus IOB: 0.00
Avg. Delta: 0.0, BGI: -26.6
15m deviation: 80
BG: 39+0 -> 21-21 (Unadjusted: -59--59)
BG 39<110, avg delta 0>0; no high-temp to cancel

If he stays in this situation for more than the 30 minutes then any temp basal implemented as he is dropping runs out and no new low temp basal in enacted which I think it should. Several ways to address this. The first to deal with this exact scenario of it reading 39 and staying 39 but I think openaps should have some feature that says if below some cutoff it recommends a temp basal of 0 regardless of any projections or other calculations. This would be safest. The temp basal in the calculation above was one we put on manually.

Here is the chart. The scenario is that he goes to bed at around 125 but with a lot of insulin. My wife gives him 12 carbs of sugar and turns off his basal for 2 hours. The openaps system was sitting at this desk where he was studying so when he went to bed it was out of range but presumably it would low temp him like my wife as done. He begins to drop a little while later and we begin to feed him a ton of sugar at that point but regardless he goes low on the Dexcom and stays there for more than an hour. I move the openaps into range around 12:30 am once he has already hit low and it gives the recommendation above. I even temporarily turn off the low basal that we manually put on to see if that would make a difference but it gives the same recommendation - no high-temp to cancel rather than recommending a low temp basal.

Luckily by blood his bg had already shot up but I think this is the case if someone goes low and stays low, openaps should be recommending a 0 temp basal the entire time no matter what the other metrics are saying

Scott Leibrand
@scottleibrand
Nov 24 2015 09:53
Yeah, you're probably right. FWIW, the situation you're seeing is that the BGI says he "should" be dropping by 26 (!) mg/dL every 5 minutes (no wonder he hit 39!) but it sees him dropping far less than that, so it figures something is keeping his BG up and doesn't low-temp. That logic works pretty well at 70, but not so much at 50, and definitely not at 39, where the +0 is a complete artifact.
What would you say the "extend 0 temp no matter what" threshold should be?
eyim
@eyim
Nov 24 2015 09:58
For us, it would be 70. If he is below 70 we leave off his basal. It can cause him to shoot higher than we like on the rebound but it seems safer to me. Others without the issues we have to deal with may be more comfortable with something lower say 50 or 60
Scott Leibrand
@scottleibrand
Nov 24 2015 09:58
And thanks for reporting this. This is the kind of thing we really want to get fixed ASAP to be as safe as possible when it matters most.
I'm inclined to go with 55, since it's Dexcom's hypo alarm threshold.
eyim
@eyim
Nov 24 2015 09:58
That makes sense to me
Scott Leibrand
@scottleibrand
Nov 24 2015 10:00
Fortunately this 39+0 thing does not apply above 39: you have to actually have carbs working in order to keep from dropping, and those are likely to finish absorbing before any temp could ever take effect.
So if you're 60+0 and BGI is -20, we know the carbs are working.
And the minute we see they're not and he down-ticks, we will low-temp again.
another simple fix would be to change the < to <= to just handle the +0 case
but I think I like the 55 threshold better.
eyim
@eyim
Nov 24 2015 10:03
Yes definitely an outlier problem with the 39 artifact. I agree <= would handle this as well
Scott Leibrand
@scottleibrand
Nov 24 2015 10:03
Or more likely both.
eyim
@eyim
Nov 24 2015 10:03
Yep
Scott Leibrand
@scottleibrand
Nov 24 2015 10:04
can you do me a favor and open an issue under oref0 so I don't forget this?
eyim
@eyim
Nov 24 2015 10:04
Yes - sorry to keep you up
Scott Leibrand
@scottleibrand
Nov 24 2015 10:04
anything serious should automatically be flagged as an issue: can't be forgetting things. :-)
no worries, just finally getting sleepy about now.
We should also add explicit test cases for this scenario.
for the 39+0 as well as the before and after.
You could probably do that part.
eyim
@eyim
Nov 24 2015 10:10
Yes test cases are on my list of things to do
Jason Calabrese
@jasoncalabrese
Nov 24 2015 15:26
55 sounds good, other option is to introduce new thresholds
Ali Mazaheri
@amazaheri
Nov 24 2015 15:44
+1 on 55
in general I also rely on notifications to avoid going that low by manual carb correction, that with openaps low temps always work.
fjungman
@fjungman
Nov 24 2015 19:17
I usually just lurk, but the hypo topic is on my mind. I think temp to zero at 55 is a little late. Just fought a terrible hypo last night, after one on Saturday. If it was drifting down, slowly, then 55 is maybe ok, but still leaves the T1D with possible effects from low already. If dropping sharply, it is way too late. Remember, a non-T1 would be 80 to 100, so there is no reason to keep delivering insulin at 80 with a downward trend.
Dana Lewis
@danamlewis
Nov 24 2015 19:18
@fjungman sorry to hear :/ note though that in many cases, it's temping even around 120, depending on what your range is.
55 or related threshold being discussed here is regardless of IOB (in many cases it's already -1.0u), zero temp just as an extra safety margin
fjungman
@fjungman
Nov 24 2015 19:30
Here is the scenario from last night. Kid was 250 after installing a new sensor. He had zero IOB and zero carbs, basal rate just went to half for the night. He took 5.5 units (should bring him down about 135 pts). Here is the picture. ![alt]https://goo.gl/photos/9dheAFgcjEhkeHkD7 Did ten finger pricks with different meters and strips, all agreed he was low. Had to do a full glucagon. He leveled, ten minutes later (after a couple hours of this) he shoots up. I've never seen a low so hard to stop, and not related to anything we could think of. Triple-checked that the pump had only given 5.45 units, and nothing for several hours before. If I hadn't suspended when he started to crash, this could have been worse. So, the zero temp seems pretty important. Sorry, just really shaken from last night...
Dana Lewis
@danamlewis
Nov 24 2015 19:30
Ouch, indeed :( :(
Scott Leibrand
@scottleibrand
Nov 24 2015 19:31
yeah, that's not good. if you were running openaps, it probably would have low-temped as soon as bolus snooze started to decay from the 5.45U. what is his ISF and DIA?
Dana Lewis
@danamlewis
Nov 24 2015 19:31
As we're talking about scenarios for when LGS-type default mode might kick in, I see three categories to consider/test, curious if there's any others. One, if you're drifting down: temps can actually prevent you from going low. Two, going down more rapidly, possibly from a combo of factors: temps can help prevent the low from being as bad, but you might still dip low. you may or may not end up wanting to do a few carbs depending on if you're awake & how you feel. Three: WHOOSH, you're going low, for whatever reason, and you're likely going to need carbs regardless of loop: but, low temp can help a tiny bit, and also might play a role in recognizing when you have whopping amounts of negative IOB and prevent you from double-rebounding from negative IOB and overtreating carbs, as many of us tend to do if we're going down that fast.
Lori
@LoriLori
Nov 24 2015 19:32
not temping to 0 because DIA/2 not yet passed is not good I think
and DIA/2 either good idea, needs different way to handle different DIA curve for bulus
Scott Leibrand
@scottleibrand
Nov 24 2015 19:34
have you started using the loop yet? I think DIA/2 is one of those things that's hard to understand how it'll actually work until you see it in action.
short of actually looping, the best thing is probably to read/write test cases
the main challenge is, without 100% reliable carb entry, we don't know if that bolus was due to carbs or correction
once I know @fjungman's DIA I can roughly calculate when it would have low-temped
Lori
@LoriLori
Nov 24 2015 19:37
sorry, not looping because I need to rewrite it so I can understand it, pretty much adding rules one by one, currently at rule low suspend :(
Scott Leibrand
@scottleibrand
Nov 24 2015 19:37
but without bolus snooze, we would be low temping every time you meal bolus, which could be counterproductive
Lori
@LoriLori
Nov 24 2015 19:38
its nice project, its just too complicated to hold for me in my head so I need to rewrite it so I can look and see
Scott Leibrand
@scottleibrand
Nov 24 2015 19:38
after LGS, next is probably to calculate eventualBG based on net IOB and ISF
Dana Lewis
@danamlewis
Nov 24 2015 19:39
@LorelaiL have you look at HAPP to see the manual recommendations?
Scott Leibrand
@scottleibrand
Nov 24 2015 19:39
and set low/high temp as necessary to bring eventualBG back into range. but at that point you'll also want the safety check of "don't high-temp when falling"
Lori
@LoriLori
Nov 24 2015 19:39
2nd issue is my sensitivity and dia curve/activity are way off what I experience
fjungman
@fjungman
Nov 24 2015 19:39
ISF is 1 unit to drop 25 points
DIA is 1 unit for 5 carbs
Scott Leibrand
@scottleibrand
Nov 24 2015 19:39
no, that's IC ratio. DIA is insulin lifetime (duration of insulin action)
Lori
@LoriLori
Nov 24 2015 19:39
think if somebody's activty is not a perfect fit it will do not best things
fjungman
@fjungman
Nov 24 2015 19:40
Oh, 4 hours.
Scott Leibrand
@scottleibrand
Nov 24 2015 19:40
there are enough safety checks in oref0 that even if DIA is way off, it'll still do something a lot better than what the pump does
we've found that even when there's a bug that renders IOB as 0 no matter what, it still does a decent job keeping BG in range, just oscillates a bit more than normal
Lori
@LoriLori
Nov 24 2015 19:41
@danamlewis I have my app which runs determine basal and display result, I have log of last few days
I am looking at it but it just make little sense to me :(
Scott Leibrand
@scottleibrand
Nov 24 2015 19:42
another way to make sense of the algorithm is just to start writing test cases and see whether they pass, or why not
fjungman
@fjungman
Nov 24 2015 19:42
Bolus was a correction
Lori
@LoriLori
Nov 24 2015 19:42
sure it does better then pump itself, but if sensitivity if off like 10 instead of 20 then it starts to be fun
Scott Leibrand
@scottleibrand
Nov 24 2015 19:42
plus, you can commit the ones that pass, and discuss the ones that fail. very useful way to pay it forward. :)
yeah, you need ISF to be within a factor of 2 at worst. :)
Lori
@LoriLori
Nov 24 2015 19:43
it is very nice project, you do great job
think pump should really put temps into IoB number like you wrote in one of the articles
it is best thing I never saw anywhere else
Dana Lewis
@danamlewis
Nov 24 2015 19:45
you mean to show net iob? (Not sure what you just described there)
Lori
@LoriLori
Nov 24 2015 19:47
yes meant net IoB, it would be great if it is named netIoB in determine basal :)
Scott Leibrand
@scottleibrand
Nov 24 2015 19:47
@fjungman so at ISF of 25, 5.45U is -136mg/dL. bolus snooze is 1.25x that at t=0, so +170 from there, or net +34. if your low threshold is 110, then at t=0 it would low-temp if BG is <75. obviously that doesn't do any good initially, but over DIA/2 (2 hours), that snooze completely disappears, so at t=1h the snooze would be down to about 85 (with IOB still above 5), so at that point it would low-temp if you're below about 150.
there's also the 15m avgdelta deviation stuff, so I'm guessing it would start low-temping at about data-point 4 or 5, right before or after the big drop from ~160 to ~130
fjungman
@fjungman
Nov 24 2015 19:48
That is as good as a human can do (and better than I did).
Scott Leibrand
@scottleibrand
Nov 24 2015 19:49
in other words, 10-15 minutes before you did carbs
it certainly wouldn't have been enough to avoid having to do lots of carbs. not sure about the glucagon.
fjungman
@fjungman
Nov 24 2015 19:51
I just don't get why he didn't respond to the carbs. Nothing to do with OpenAPS or HAPP...
Dana Lewis
@danamlewis
Nov 24 2015 19:51
sometimes the body wants to store them first rather than use them.a nd it sucks when that's so :(
Scott Leibrand
@scottleibrand
Nov 24 2015 19:51
yeah. seems like muscles sometimes go into an absorb-all-the-glucose mode
@eyim was describing something similar
fjungman
@fjungman
Nov 24 2015 19:53
Hmm, after five years, this is the first time I've seen this behavior, but maybe I'm just paying better attention, thanks to this development process...
Thanks guys and gals!!!
Matthias Granberry
@mgranberry
Nov 24 2015 20:15
@fjungman you can prevent it (somewhat) by eating carbs after intense exercise. I find that it's most dangerous 6-12h out from exercise. You can google for delayed-onset hypoglycemia, but the information isn't terribly useful. It's another YDMV thing.
Jason Calabrese
@jasoncalabrese
Nov 24 2015 20:57
would be nice to setup a little test framework for these scenarios
feed in the treatments with relative times, and describe the expected results
maybe a json or yaml format, that we could use for docs?
Ben West
@bewest
Nov 24 2015 20:59
yeah
Jason Calabrese
@jasoncalabrese
Nov 24 2015 21:11
thinking of something like
treatments:
  - when:
      ago: 4hr
    insulin: 2
    carbs: 20
expect:
  - when:
      ago: 3hr
    iob:
      gte: 1
  - when: now
    iob: 0
maybe there's something we could base it on, then create a little dsl to keep them concise
eyim
@eyim
Nov 24 2015 22:21
@fjungman Yes we see the same thing sometimes due to exercise, sometimes due to hormones, and sometimes just due to the terrible diabetes gods. As for the appropriate level for the "no matter what" turn off basal level, I doubt we will ever come to an agreement on the appropriate level. I argue with myself at times on what is the appropriate level. It just depends on too many factors. I wonder therefore if the most appropriate way to handle it is to make it a configurable option like how we handle max iob. Openaps could look at a particular file that is easy to configure like max_iob.json in the current system and if there is nothing there then assume it is 55.
Scott Leibrand
@scottleibrand
Nov 24 2015 22:22
@eyim I just went looking through the code, and added a test for 39+0 with positive IOB, and am seeing that it should be, and is, setting a 0 temp in that situation
maybe I should run the same test against master as well as dev
yep, it's broken in master, but already fixed in dev
fjungman
@fjungman
Nov 24 2015 22:26
Efficient Elvs working on the dev...
Scott Leibrand
@scottleibrand
Nov 24 2015 22:26
pretty sure I had fixed it in my reason-fixes branch that I just merged. :)
eyim
@eyim
Nov 24 2015 22:38
@scottleibrand Thank you Scott. I know everyone appreciates it and knows you and all the other devs are working on this in your spare time. I'll pull down the latest dev version tonight
Ben West
@bewest
Nov 24 2015 22:38
elved
if it's small patch, we can do patch release
Scott Leibrand
@scottleibrand
Nov 24 2015 22:39
openaps/oref0#22
Ali Mazaheri
@amazaheri
Nov 24 2015 22:39
😊
fjungman
@fjungman
Nov 24 2015 22:41
Now, how long before that ends up in HAPP, @timomer? :smile:
Scott Leibrand
@scottleibrand
Nov 24 2015 22:46
@bewest looks like the changes are mostly bug fixes or new scripts/tests, so yeah I think we can merge openaps/oref0#22 as a patch release shortly. I'll update all my pi's to the latest dev and run them tonight, and we should be good to release tomorrow.
Jason Calabrese
@jasoncalabrese
Nov 24 2015 22:51
I'll update tonight
Scott Leibrand
@scottleibrand
Nov 24 2015 22:51
@eyim I will need to see a test case that fails (does the wrong thing) <55 before I add that new threshold. the two I added for 39+0 both pass.
so that will probably go into a future release, unless you get around to it today
Jason Calabrese
@jasoncalabrese
Nov 24 2015 23:03
Saw tests are for positive and negative iob, maybe 1 for 0 iob/bgi
Scott Leibrand
@scottleibrand
Nov 24 2015 23:10
PR welcome. :)
Jason Calabrese
@jasoncalabrese
Nov 24 2015 23:35
sent
Scott Leibrand
@scottleibrand
Nov 24 2015 23:38
merged. apparently js doesn't mind negative zero. :)
Jason Calabrese
@jasoncalabrese
Nov 24 2015 23:38
that wasn't intentional
fixing