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

21st
Sep 2015
Ed Raskin
@msrcgm
Sep 21 2015 00:29
Thanks @amazaheri and @bewest for all of your amazing help, support (technical and emotional :) ) just got home and will send the json files and working on some other thoughts and work to hopefully help the project along. @bewest I definitely agree with many of your thoughts and see I am quite far along in understanding and results progress too.
Oskar Pearson
@oskarpearson
Sep 21 2015 00:46
NB for people in the UK: openaps/openaps#47
Dana Lewis
@danamlewis
Sep 21 2015 00:56
thx @oskarpearson
Chris Oattes
@cjo20
Sep 21 2015 00:58
@oskarpearson sounds like a good idea
Scott Leibrand
@scottleibrand
Sep 21 2015 00:59
seems sensible to me, but I don't use mmol/L...
Ed Raskin
@msrcgm
Sep 21 2015 00:59
Also thanks to @scottleibrand for helping me understand/deduce some fundamentals last night.
Scott Leibrand
@scottleibrand
Sep 21 2015 01:54
You're most welcome. :)
eszcloud
@eszcloud
Sep 21 2015 03:18

Questions on openaps-predict: I can run reports (such as those shown in the readme), but the output of predict_glucose_without_future_basal.json and predict_glucose.json look identical. It seems like they should differ someplace. Any ideas?

I've tried removing them and then re-adding in case something went awry at that step to no avail.

Nathan Racklyeft
@loudnate
Sep 21 2015 03:45
@eszcloud when you ran the report, did you have a temp basal in progress?
eszcloud
@eszcloud
Sep 21 2015 03:48
No temp basal
Nathan Racklyeft
@loudnate
Sep 21 2015 03:51
right, so those two reports should be identical
when you configured the report predict_glucose_without_future_basal.json, you passed an argument of the current pump clock, which runs the prediction as if the temp basal in progress was cancelled at that time.
eszcloud
@eszcloud
Sep 21 2015 04:26
Ah. Ok.
Should the two reports also be flat with a singular value for blood sugar?
Jason Calabrese
@jasoncalabrese
Sep 21 2015 04:33
Think I'm going to give in and start with a pi, instead of waiting to do it on Android, what's the current shopping list
Ali Mazaheri
@amazaheri
Sep 21 2015 04:34
yay!
Jason Calabrese
@jasoncalabrese
Sep 21 2015 04:38
Also thinking about the pump swaping setup, iob from the mdt pump won't really mean much, would need to include day time tartlets from the other pump
Dana Lewis
@danamlewis
Sep 21 2015 04:38
@amazaheri is swapping pumps, but not sure what he's been doing in that regard
Jason Calabrese
@jasoncalabrese
Sep 21 2015 04:42
Need to make sure things match up between nighttime and daytime, so using the same calculators seems key
Not sure why I want thinking about dealing pumps, hopefully can find a site like the inset 30, that would work for both
Jason Calabrese
@jasoncalabrese
Sep 21 2015 04:48
*wasn't thinking about swaping pumps
Dana Lewis
@danamlewis
Sep 21 2015 04:49
Ah
Jason Calabrese
@jasoncalabrese
Sep 21 2015 05:18
ok, ordered pi and stuff
Scott Leibrand
@scottleibrand
Sep 21 2015 06:13
Yay! :-)
Chris Oattes
@cjo20
Sep 21 2015 09:30
@scottleibrand: I'm not sure that liverSensRatio should be as high as 8. Thinking about it, avgActivity / sensitivity gives how many units were active, on average(ish) for the duration that the carbs should have been absorbed over, then multiplying by the carb ratio gives the number of carbs that insulin should have covered. It then adds the length of time it would have taken to abs
orb those carbs to the total absorbtion time. If the average insulin activity is enough to cover all of the carbs eaten, it would double the time the carbs are absorbed over. Setting liverSensRatio to 8 means that instead of doubling the time it would take, it delays it by the time it would take to absorb 8x as many carbs. So if I ate 30g carbs, absorbed 30g carbs an hour, used 1u for 10g carbs and had
3u active on average (for a correction, say). With a liverSensRatio of 8, it would add an extra 8 hours to the absorbtion time
if I had 1u active on average, it would change the absorbtion time from 1 hour to almost 4 hours
Chris Oattes
@cjo20
Sep 21 2015 09:35
and, if I'm understanding the code correctly, it would delay the absorbtion of any other carbs eaten later until after those 30g carbs had been absorbed. So if I had 100g sugar 1 hour after the 30g carbs, it wouldn't be absorbed until about 3 hours later
Chris Oattes
@cjo20
Sep 21 2015 09:48
That's probably about as clear as mud. Let me know if I need to explain it better :)
Scott Leibrand
@scottleibrand
Sep 21 2015 12:06
You're probably right. I wonder if liverSensRatio > 8 would actually result in displayed COB being higher than number of carbs eaten? Seems like a fairly straightforward thing to test now that Jason merged my change. Want to go ahead and put some fake data into Care Portal along the lines of your example and make note of what the COB pill actually does?
You should then be able to change liverSensRatio and go back in the retrospective view to see if it causes the numbers to make more sense. If so, feel free to PR a change to liverSensRatio with the details.
Chris Oattes
@cjo20
Sep 21 2015 12:26
scottleibrand: I would, if I actually had nightscout set up
I might see if I can do that this evening after work
I was wondering if this actually needs to be accounted for in the way it is. If you're modelling the liver storing glucose as glycogen and releasing it later, that release is what basal insulin is meant to be handling.
Chris Oattes
@cjo20
Sep 21 2015 12:33
high insulin levels drive more glycogen being stored, but I think the liver has a limit as to how much it will store, and i don't know whether it is low insulin levels or low glucose levels that promote glycogen release, but i suspect it is the latter
there may be some logic in reducing the number of carbs 'on board' based on the insulin level because the liver has stored it, but that would probably be capped to a relatively small amount, and I don't think you need to necessarily account for it being released again
Scott Leibrand
@scottleibrand
Sep 21 2015 13:01
For Nightscout's current purposes, we don't really need hepatic carb absorption at all. It was added because our wip/iob-cob purple prediction line was going way too high after meals, and we needed a way to account for the role insulin plays in blunting that rise.
And I didn't want to simply "disappear" those carbs from the prediction.
This is probably more useful for when we bring back the nightscout purple IOB/COB prediction line, or in something like openaps-predict (if it has the same issue). Until then we can probably set liverSensRatio to 1 and its effect will mostly disappear.
Chris Oattes
@cjo20
Sep 21 2015 13:19
the role insulin plays in blunting the rise is part of the "1u drops X mg/dl" though
Scott Leibrand
@scottleibrand
Sep 21 2015 13:23
That's not sufficient, though. Empirically, the effect of insulin activity is multiplied when carbs are absorbing: insulin activity blunts the effect of of carbs on BG, more so than modeled by via standard insulin activity curves alone.
and biologically, it is well known that the liver uses a dual signal of incoming BG (higher in portal vein than peripheral vasculature) and insulin activity to prompt glycogen storage.
So the hepatic carb absorption model makes sense both conceptually and empirically: the question is one of magnitude, and tuning the model to accurately represent the effect we actually see. We had it quite well tuned for Dana with wip/iob-cob, but that didn't work as well for kids. Hopefully with your fix we can tune it to work better than naive carb absorption for everyone.
Chris Oattes
@cjo20
Sep 21 2015 13:26
I wish insulin acted faster. Then I could actually attempt reasonable experiments, rather than being limited to basically 1 a day provided my BG is behaving
Scott Leibrand
@scottleibrand
Sep 21 2015 13:27
Have you tried Afrezza? Didn't work that well for us, but it's magic for some people.
Chris Oattes
@cjo20
Sep 21 2015 13:29
I haven't. i'm tempted to try Apidra. I'm not that unhappy with novorapid, it's just that if insulin lasted for 20 minutes instead of 4+ hours, you could actually set up a decent number of tests in a day and it'd be easier to work things out empirically :P
Scott Leibrand
@scottleibrand
Sep 21 2015 13:37
Yeah, insulin action curve of Afrezza is crazy fast. I was really excited about it. It does seem to work really well for people who haven't already perfected the dosing of injected insulin. I have heard of one person so far (Gustavo) who has had better results with Afrezza than with a closed loop, though.
Chris Oattes
@cjo20
Sep 21 2015 13:48
I wonder if a better way of modelling it is to just change the absorbtion rate if there is insulin active. Even something as simplistic as if (insulinLevel > X) { absorbtionRate *= 0.9 }
Scott Leibrand
@scottleibrand
Sep 21 2015 13:53
That is effectively what we did, except we made the absorption rate reduce smoothly as activity increased. The reason for calculating it the way we did is that it becomes computationally difficult to retrospectively calculate the BG predictions forward from every point in the past.
If you're interested, check out the retrospective prediction code in wip/iob-cob.
The degree of recursion required, and the D3 stuff we have in cgm-remote-monitor, meant that the retrospective predictions would take over 10 seconds to load even on modern mobile devices.
Chris Oattes
@cjo20
Sep 21 2015 13:57
D3 stuff? Which files does the retrospective stuff live in?
Scott Leibrand
@scottleibrand
Sep 21 2015 14:21
D3js GUI stuff. I don't recall exactly: search for "retrospective".
(On a plane to PHX: pushing back now).
You should be able to search the nightscout wip/iob-cob branch. I think that should be mostly up to date with mine, at least as far as the core predictive algorithm. All the differences are in temp basal visualization for closed loop IIRC.
Chris Oattes
@cjo20
Sep 21 2015 14:23
I'll hve a look when I get home. Have a good flight
Scott Leibrand
@scottleibrand
Sep 21 2015 14:23
thanks.
Ed Raskin
@msrcgm
Sep 21 2015 15:16
@jasoncalabrese this is the infusion set to use with your animas so that you can swap to Medtronic at night http://www.tandemdiabetes.com/Products/Infusion-Sets/t-90/. Then get the mio set on the Medtronic side.
Chris Oattes
@cjo20
Sep 21 2015 15:28
@danamlewis when you calculated your carb absorbtion rate, what food(s) did you use?
Oh, foods. Sorry, I read "tools" :)
Juice or mtn dew, for the first one
Then continued to observe across all types of food I ate. For me, gi made no difference.
Ed Raskin
@msrcgm
Sep 21 2015 15:39
So interesting @danamlewis we found gi made zero difference as well.
Chris Oattes
@cjo20
Sep 21 2015 15:40
made no difference to the rate, the delay, or both?
Dana Lewis
@danamlewis
Sep 21 2015 15:42
Both
@msrcgm Interesting to hear, as several folks w kids told me it's different for kids. I think it's a giant "your diabetes may vary" and bodies vary overall perhaps?
Chris Oattes
@cjo20
Sep 21 2015 15:45
I wonder how that works physiologically. Given that starch needs to broken down in to simpler sugars to be absorbed, which happens a little in the mouth (amylase), but mostly in the small intestine, compared to glucose being absorbed directly in the stomach
Dana Lewis
@danamlewis
Sep 21 2015 15:46
My observation tends to be the fast stuff gets broken down first; then everything else, but regardless averages to about 30.
Occasionally if I eat tons of straight sugar I might see slightly expedited effect, but a) really rare and b) still generally holds true if there's other things being absorbed
Chris Oattes
@cjo20
Sep 21 2015 15:47
I was thikning more about the delay being the same
Chris Oattes
@cjo20
Sep 21 2015 15:59
i suspect that in most day-to-day cases, any meal will contain some sugars, which would always give you the start of the rise at the same time as juice (because the sugar is absorbed straight away), as well as the same rise time for the first part at least
Dana Lewis
@danamlewis
Sep 21 2015 16:00
Yea
On the flip side, I see a lot of people say pizza has long lasting effects because of fat/protein. But I really think it's because pizza is high carb and it takes 3-4 hours if you have several pieces to finish absorbing it. (120g = 4 hours after the 15 min delay)
Jason Calabrese
@jasoncalabrese
Sep 21 2015 16:06
@cjo20 @scottleibrand, I'm not sure if the liverSensRatio is fully used in NS, I kind of remember seeing it not work and commenting something out
thought it was more bgi
I tested the PR last night and didn't notice a change in the cob values, but the fix still looked correct and tests still passed
Chris Oattes
@cjo20
Sep 21 2015 16:07
jasoncalabrese: it looks like it is used in working out CoB, scott seemed to think it was only used in displaying carbs yet-to-be absorbed
I need to set up NS at home to be able to test a scenario I came up with earlier https://gist.github.com/cjo20/9f66a020fb4cc0c13d19
@danamlewis I find that pizza lasts longer than would be expected, which is what the liverSensRatio stuff is trying to adjust for (I think)
Dana Lewis
@danamlewis
Sep 21 2015 16:09
@cjo20 Even with knowing carb absorption rate?
Jason Calabrese
@jasoncalabrese
Sep 21 2015 16:09
Chris Oattes
@cjo20
Sep 21 2015 16:11
danamlewis: yeah. When I initially tested my carb absorbtion rate it was something like 40g/hr (using coke). When I've had pizza in the past, I've still been seeing a rise at 5 hours
and thats been ~100g carbs
I'm tempted to put ~13g flour in a glass of water and do the absorbtion rate test
Dana Lewis
@danamlewis
Sep 21 2015 16:15
Oh wow
Chris Oattes
@cjo20
Sep 21 2015 16:16
because I can't think of anything else that has only starch and no sugar :P
Chris Oattes
@cjo20
Sep 21 2015 16:24
unless anyone can think of something more appealing which is just starch
Pete Schwamb
@ps2
Sep 21 2015 17:21
a potato?
Chris Oattes
@cjo20
Sep 21 2015 17:23
that'd involve cooking it, and I'm not entirely sure how much starch gets converted to sugar doing that
Scott Leibrand
@scottleibrand
Sep 21 2015 17:25
Probably not enough to matter, if you care about real world impact of real world starches.
Ben West
@bewest
Sep 21 2015 20:35
why not both :-)
would be great to have webapp/apps to help people determine this, report results to community
have lots of tests
"the oreo test"
"the milk test"
on and on
would be great to compare/contrast, report on delta as proper research
Dana Lewis
@danamlewis
Sep 21 2015 20:38
wondering about a simple spreadsheet or something to track this kind of stuff in the interim
or if there's a similar as easy (as a spreadsheet) solution
Scott Leibrand
@scottleibrand
Sep 21 2015 20:49
could make it a google form that populates a spreadsheet
that gives you quite a bit of flexibility to provide instructions and collect structured data
Chris Oattes
@cjo20
Sep 21 2015 21:06
@scottleibrand well I tried setting up NS to be able to test CoB, and it doesn't want seem to want to acknowledge any of the entries I'm putting in :/
Scott Leibrand
@scottleibrand
Sep 21 2015 21:07
might want to move that over to nightscout/public: I'm not really the best for nightscout troubleshooting: seems I have issues every time I upgrade
Ben West
@bewest
Sep 21 2015 21:11
google form is great idea
bet they even have a way to graph some results too
Rachel Sandlain
@audiefile
Sep 21 2015 21:14
@bewest "the oreo test" sounds like a real hardship but for science I could probably eat one. or 3. ;)
Dana Lewis
@danamlewis
Sep 21 2015 21:16
@audiefile I eat pizza "for science" all the time. it's great ;)
Ben West
@bewest
Sep 21 2015 21:16
the drs/researchers I shared this idea with freaked out: "we can't tell people to eat oreos!"
I was like... you know they're doing this anyway?
Scott Leibrand
@scottleibrand
Sep 21 2015 21:16
haha
Ben West
@bewest
Sep 21 2015 21:16
why not know what happens?
Dana Lewis
@danamlewis
Sep 21 2015 21:17
I'm going to see my endo tomorrow
I have a feeling someone finally told him about my AP
Ben West
@bewest
Sep 21 2015 21:17
pfff
Chris Oattes
@cjo20
Sep 21 2015 21:17
he did well not finding out about it already :P
Rachel Sandlain
@audiefile
Sep 21 2015 21:18
@bewest I've heard of and really like the drs that realize you need to figure out how to bolus for pizza because you know you are going to eat it. Especially for kids
@danamlewis Did you not want the endo to know about your AP?
Ben West
@bewest
Sep 21 2015 21:19
good question
Dana Lewis
@danamlewis
Sep 21 2015 21:20
I told him about DIYPS right after we first built it. No interest at all.
No interest at my next appt either.
Ben West
@bewest
Sep 21 2015 21:21
really, no interest at all?
Dana Lewis
@danamlewis
Sep 21 2015 21:21
Nope. "Do you have less lows?" was his one question, even with me attempting to bust out all my data on time in range etc
Ben West
@bewest
Sep 21 2015 21:22
yeah, not sure I'd see that as no interest
Dana Lewis
@danamlewis
Sep 21 2015 21:22
I haven't seen him IRL since we closed loop (because at this point I'm doing 1/year in person visits and labs every 3 months), so will be interesting in general to see what he asks and if it comes up
Ben West
@bewest
Sep 21 2015 21:22
interesting experience
I would be showing it off still
hehe
Dana Lewis
@danamlewis
Sep 21 2015 21:22
but, I've self-managed my insulin dosing including basals for 12 years. haven't had a doc do anything regarding insulin since I first went on a pump.
Ben West
@bewest
Sep 21 2015 21:23
yeah, most of my dr's kind of want to get out of my way
Dana Lewis
@danamlewis
Sep 21 2015 21:23
so philosophically wondering why a doc would need to know?
Ben West
@bewest
Sep 21 2015 21:23
so, "do you have less lows" seems like the only relevant question
at some level
Dana Lewis
@danamlewis
Sep 21 2015 21:23
in AL, everyone went to endo every 3 months. up here in WA it seems like PWDs go to PCPs isntead of endos unless you're "poorly controlled" (not my case, clearly)
so there's a disconnect there too
Ben West
@bewest
Sep 21 2015 21:23
right
right, he may have certain requirements on him
Dana Lewis
@danamlewis
Sep 21 2015 21:25
dunno. the PNW is just a weird place ;)
Ben West
@bewest
Sep 21 2015 21:25
I guess to @audiefile's question though, his interest seems separate from your desire to show it to your dr
Dana Lewis
@danamlewis
Sep 21 2015 21:25
I think it would be great if we had a discussion about what and how it works etc.
Ben West
@bewest
Sep 21 2015 21:26
ah, I see
Dana Lewis
@danamlewis
Sep 21 2015 21:26
so that's why i'm interested to see how the appt goes tomorrow
Ben West
@bewest
Sep 21 2015 21:26
I doubt any drs directly involved with your personal therapy will do that with you
ironically
Dana Lewis
@danamlewis
Sep 21 2015 21:26
assigned? No, i picked this doc (surprisingly)
Ben West
@bewest
Sep 21 2015 21:26
wrong word
Dana Lewis
@danamlewis
Sep 21 2015 21:27
I wanted an endo rather than a PCP in case I ran into problems, PCPs tend to freak out at even prescribing antibiotics for real people sick stuff because I have diabetes and "it might mess up my blood sugars" (and being sick wouldn't?)
Ben West
@bewest
Sep 21 2015 21:27
lol
you might try an internist
I've had best luck with them
but I doubt any dr would go through the system like that, I think it would ironically expose them to a lot of risk
from their POV
or if they did, they'd probably write a note like chris'
"patient understand this is not approved use of device. doing well."
Dana Lewis
@danamlewis
Sep 21 2015 21:29
Maybe. My doc didn't write a note after I told him about DIYPS.
Ben West
@bewest
Sep 21 2015 21:29
like "crap, now I have to do paperwork"
yeah, that's staying out of your way, I think
Dana Lewis
@danamlewis
Sep 21 2015 21:29
It wasn't referenced at all in my record. (He Audio records them in real time in front of me)
Ben West
@bewest
Sep 21 2015 21:30
he didn't have to record it because he didn't ask any questions
see no evil, hear no evil, no paperwork :-0
Dana Lewis
@danamlewis
Sep 21 2015 21:30
Anyway, philosophically, I'm not sure they should have a say unless someone had questions about their devices
Cynical Ben :)
Jason Calabrese
@jasoncalabrese
Sep 21 2015 21:31
for school, I'd want it all listed as a required medical device, got the Dr to do that for NS, would do the same for any other devices
then school has to go along with it
Dana Lewis
@danamlewis
Sep 21 2015 21:31
Yea. Only speaking of my own adult perspective here
Ben West
@bewest
Sep 21 2015 21:32
dr is liable for "do no harm"
so their main concern is hypos and getting sued
Jason Calabrese
@jasoncalabrese
Sep 21 2015 21:32
what about in travel situations, maybe at some point a Dr's note would matter?
Ben West
@bewest
Sep 21 2015 21:32
apparently many endos require people running at higher levels just to avoid this issue, despite the safety problems
er, obvious health issue
just saw this in the FB group, someone near san diego had her cgm taken away
and her endo demanding she increase her a1c
21 years old
interesting, for me that's exactly the reaction I would hope for
Dana Lewis
@danamlewis
Sep 21 2015 21:35
@jasoncalabrese hm, maybe then, but I don't have a general doc's note, either. (Surprisingly have never had concerns even when carrying 4 raspberry pis and associated batteries in cords - true for US, England, Portugal, Switzerland, and Italy and all their security too).
it might matter if I went to the white house or similar type high security situations
but I haven't run into any situations yet where it has been an issue or even a question
Jason Calabrese
@jasoncalabrese
Sep 21 2015 21:36
@bewest was just telling me about his travel issues
Ben West
@bewest
Sep 21 2015 21:37
I've never had problems with phones/gadgets per se
Jason Calabrese
@jasoncalabrese
Sep 21 2015 21:37
but don't know if a note would help
Ben West
@bewest
Sep 21 2015 21:37
but devices from the vendors are very problematic for me
the actual devices on me get grabbed or whatever
I've caught them pushing buttons, etc
Dana Lewis
@danamlewis
Sep 21 2015 21:38
I get pat downs all the time but luckily have never run into that, but I'm pretty up front about telling them where everything's attached, and telling them when they forgot a step (like asking me if i have sensitive areas)
Ben West
@bewest
Sep 21 2015 21:39
ah, so any time they want to touch me I kind of freak out now
Dana Lewis
@danamlewis
Sep 21 2015 21:39
i am guessing the answer is no, but getting pre-check cut down on the # of pat downs.
I used to get them 9/10 in regular security lines because they'd see my juice. But in pre-check, I maybe get 1/7 or 8 for random selection and not because of diabetes.
(9/10 also because I would refuse the body scanner, but in pre-check they only require metal detector which I am fine with)
Ben West
@bewest
Sep 21 2015 21:41
in orlando, the agent had me touch my own device
and then scanned/wanded my hand or whatever
that was the only time I've felt comfortable
Dana Lewis
@danamlewis
Sep 21 2015 21:42
yea, that's always what happens. I've never had them touch it or ask me to take it off.
Rachel Sandlain
@audiefile
Sep 21 2015 21:42
my endo is super chill. she has jokingly talked about me teaching her (the last 3-4 appointments (every 6mo) I say have you heard about... and then show it off)
Dana Lewis
@danamlewis
Sep 21 2015 21:42
@audiefile nice!
Ben West
@bewest
Sep 21 2015 21:42
hehehe
that's awesome
Jason Calabrese
@jasoncalabrese
Sep 21 2015 21:43
yeah, should get consulting fees when we go to the Dr
Ben West
@bewest
Sep 21 2015 21:43
but it's same kind of thing? less of her asking, and more of you volunteering?
Dana Lewis
@danamlewis
Sep 21 2015 21:43
@jasoncalabrese I wish, to balance out the copay ;)
Rachel Sandlain
@audiefile
Sep 21 2015 21:45
I tend to volunteer but she actually listens. At one appt I mentioned the mysugr app and brought printouts of the reports (which she liked as they were in color) but at the next appointment she said that she had recommended it to other patients
Dana Lewis
@danamlewis
Sep 21 2015 21:45
@audiefile is she peds, or does she have a lot of t1 patients?
Rachel Sandlain
@audiefile
Sep 21 2015 21:46
Nightscout I think was less interesting to her as I don't think she sees many children. I'm not sure about t1 versus t2. Just guessing but more t2
Dana Lewis
@danamlewis
Sep 21 2015 21:46
(I think one of the big differences is in Alabama, all the adult endos saw overwhelming amounts of T2 compared to T1s, and same up here in PNW, most endos see T2 vs T1 and that also might influence experiences)
Ben West
@bewest
Sep 21 2015 21:47
I recommend the internist
I use internist as my pcp when I can
until he retired
they kind of deal with failing organs "in general" rather than one or two diseases
Dana Lewis
@danamlewis
Sep 21 2015 21:48
yea
Ben West
@bewest
Sep 21 2015 21:49
so they generally like to do whatever to increase options/flexibility