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

12th
Aug 2015
Ben West
@bewest
Aug 12 2015 01:24
awhile ago they removed support for 512 from their online carleink
they may well do the same for these
diabeticgonewild
@diabeticgonewild
Aug 12 2015 03:27
Low BG and nausea (from severe gastroparesis—not diabetes related) don't mix well. Downed 2 packs of gummy bears (fatty—I have to over treat cause of gastroparesis) plus Zofran ODT and Ativan/Benadryl/Haldol (nausea medicine compounded at the cancer hospital). It's miserable.
diabeticgonewild
@diabeticgonewild
Aug 12 2015 03:42
Plus gut hurts! FML!
kenstack
@kenstack
Aug 12 2015 04:32
I've been trying to better understand the behavior of the AR2 predictor that Lane / Ross originated for nightscout for use in my aps to trigger things like suspend or alarms. After being surprised by the lag I created a simple tool to visualize the results of the AR2 predictor on data direct from the nightscout api. For those interested you can grab it from the perceptus github repo - its just a short html/js file. You can run it right from the browser but look at the readme - you have to open chrome properly or your get an error related to security. I think its good to really visualize these predictors before you use them so you understand how they work and what to expect in terms of when things will trigger.
blob
It graphs your original data, the AR2 BG prediction and the loss function. Note that NS generates an alarm on a loss function value over 0.05 FOr my data so far, its not much better then the thresholds, but I want to compare it to some simple predictors like different thresholds by velocity for example.
Let me know if this is useful and if so we can start to compare other predictors and other specific situations - like certain bg levels versus rise and falls
Nathan Racklyeft
@loudnate
Aug 12 2015 04:43
Interesting!
kenstack
@kenstack
Aug 12 2015 04:47
I'd like to start putting together a series of test cases - contrived - that simulate rises falls etx - linear, accelerating, decelerating etc - to test various predictors
Chris Hannemann
@channemann
Aug 12 2015 04:50
@kenstack I'm very interested in this as well. Will give the repo a look soon. I figure the test cases here will line up with the test cases for openaps-js, perhaps minus things like testing connectivity issues
kenstack
@kenstack
Aug 12 2015 04:54
Yes exactly - what did a predictor say, then how did the system react based on someone's specific logic
Ben West
@bewest
Aug 12 2015 05:10
nice
timomer
@timomer
Aug 12 2015 08:18
without sounding too ignorant, what is the AR2 predictor? - this sounds very interesting and something I should be aware of
Ben West
@bewest
Aug 12 2015 08:25
no worries, @timomer, the AR2 prediction is what is in nightscout by default
Scott Leibrand
@scottleibrand
Aug 12 2015 08:26
AR = autoregressive.
it takes the slope of the current and 5m ago data points and assumes that will continue briefly, then gradually bend back toward 140.
As others have mentioned, it is based on empirical BG observations, which means it's (only) a decent prediction of what your BGs will do with normal treatment. There's nothing that will make your BG automatically return to 140 without some sort of correction.
I don't use it at all: all our predictions are based on IOB (and sometimes COB), with an adjustment for how far BG is currently deviating from IOB-based prediction.
timomer
@timomer
Aug 12 2015 08:30
Does it use only BG data, or treatment data as well for its calculation?
Scott Leibrand
@scottleibrand
Aug 12 2015 08:30
AR2 is BG only.
timomer
@timomer
Aug 12 2015 08:30
I will be looking at prediction algorithms soon
got it, thanks @scottleibrand
Ben West
@bewest
Aug 12 2015 08:30
it uses last 2 bg points and overlays it on broad sampling of glycemia across populations
timomer
@timomer
Aug 12 2015 08:31
@bewest thanks :)
Ben West
@bewest
Aug 12 2015 08:31
there's actually a fair bit of science behind it, it's the same algorithm shipping in 640
timomer
@timomer
Aug 12 2015 08:31
@scottleibrand i see you have a bgpredict class in openaps-js, will be looking at that today if i get the time
Scott Leibrand
@scottleibrand
Aug 12 2015 08:31
determine-basal.js uses simple bolus calculator math with a "deviation" adjustment that assumes the last-15m deviation of delta from BGI will continue for 15m longer.
No, ignore that file. I need to delete it.
it was an aborted attempt at something.
timomer
@timomer
Aug 12 2015 08:32
great, I could not work it out - make sense
Scott Leibrand
@scottleibrand
Aug 12 2015 08:32
All the real action is in determine-basal.js
timomer
@timomer
Aug 12 2015 08:32
great cool, ill dig more into that
Scott Leibrand
@scottleibrand
Aug 12 2015 08:33
Actually, you can do a PR to delete bgpredict if you want. :-)
timomer
@timomer
Aug 12 2015 08:33
got iob fully working the other day and starting to log onto a chart, aiming to get cob working today at least
Scott Leibrand
@scottleibrand
Aug 12 2015 08:33
cause I'll forget again ;-)
COB is not needed for OpenAPS, FWIW.
timomer
@timomer
Aug 12 2015 08:33
not sure if I have the guts to do any work on someone elses repo :)
agree, but I find it so helpful seeing the numbers
Scott Leibrand
@scottleibrand
Aug 12 2015 08:34
The deviation stuff handles the "current" carb impact pretty well.
Totally.
timomer
@timomer
Aug 12 2015 08:34
just seeing my IOB next to my Bg I find very helpful
Scott Leibrand
@scottleibrand
Aug 12 2015 08:34
You'll reallt only be working on your own fork of it. :-)
timomer
@timomer
Aug 12 2015 08:34
:)
Ben West
@bewest
Aug 12 2015 08:34
different predictors for different things
I woudlnt' dose off the AR2
but I love seeing it
when dosing, it's very useful to see the projected bg
timomer
@timomer
Aug 12 2015 08:35
yep agree, so info is just nice to see for consideration
some*
Ben West
@bewest
Aug 12 2015 08:35
according to bolus wizard, and then ask: "do I believe this story?"
right now users are asked to do this invisibly
and it's user's fault
timomer
@timomer
Aug 12 2015 08:36
yep
Scott Leibrand
@scottleibrand
Aug 12 2015 08:36
Yeah. Surprised the discussion of AR2 ended up here and in iOS, instead of in cgm-remote-monitor. :-)
Ben West
@bewest
Aug 12 2015 08:36
"here's five vectors, please confirm"
wtf?
where's the charts for what this action might do?
Scott Leibrand
@scottleibrand
Aug 12 2015 08:36
guess the cgm-remote-monitor room is officially dead? ;-)
timomer
@timomer
Aug 12 2015 08:37
my aim is to see the bg, IOB and COB trend logged on to one chart for my consideration and then have projected bg based on IOB and bg for now
I have never noticed that room!
Scott Leibrand
@scottleibrand
Aug 12 2015 08:38
Yeah, that's what nightscout dev has.
timomer
@timomer
Aug 12 2015 08:38
yeah, I need to dig more into NS dev
Scott Leibrand
@scottleibrand
Aug 12 2015 08:38
You have to get your pump data into treatments though.
Ben West
@bewest
Aug 12 2015 08:38
dev branch is huge rewrite
timomer
@timomer
Aug 12 2015 08:39
I cannot get any data from my pump yet (Roche) so logging treatments manually
Scott Leibrand
@scottleibrand
Aug 12 2015 08:39
Ah. Yeah, not much prospect of that then.
timomer
@timomer
Aug 12 2015 08:39
once I do link to the pump, may keep it like that, as will use the app for bolus wizard etc
Scott Leibrand
@scottleibrand
Aug 12 2015 08:39
We need a better way of uploading pumphistory.json to he Nightscout API though.
timomer
@timomer
Aug 12 2015 08:40
will be more powerful than the remote for the pump, the pump itself has no bolus wizard
Ben West
@bewest
Aug 12 2015 08:40
yeah, need mapping of ns manua treatments vs machine
Scott Leibrand
@scottleibrand
Aug 12 2015 08:40
Yeah, that is how we tend to use DIYPS now: as a bolus wizard that's mostly separate from OpenAPS.
Ben West
@bewest
Aug 12 2015 08:41
openaps in particular is just plumbing
timomer
@timomer
Aug 12 2015 08:41
right now I just submit the last 20 treatments for calculations, amusing anything >20 is not valid
Ben West
@bewest
Aug 12 2015 08:41
openaps is actually algorithm-agnostic
more of framework to run and test and prototype algorithms, with way to show the data
Scott Leibrand
@scottleibrand
Aug 12 2015 08:41
And then some sort of deduplication to remove manual treatments that correspond to automatic ones.
Ben West
@bewest
Aug 12 2015 08:42
scientific method will demand reproducing results, and showing hard data
timomer
@timomer
Aug 12 2015 08:42
out of interest, how may records do you submit via pumphistory.json?
Ben West
@bewest
Aug 12 2015 08:42
whatever you configure
timomer
@timomer
Aug 12 2015 08:42
is it the last 40 actions? for example
Scott Leibrand
@scottleibrand
Aug 12 2015 08:43
However many iter_pump_hours 3 brings back.
Ben West
@bewest
Aug 12 2015 08:43
openaps demands you express how many records
timomer
@timomer
Aug 12 2015 08:43
r
Ben West
@bewest
Aug 12 2015 08:43
saves it in openaps.ini, and runs with what you saved
timomer
@timomer
Aug 12 2015 08:43
@scottleibrand why would you "deduplication to remove manual treatments that correspond to automatic ones"
Ben West
@bewest
Aug 12 2015 08:44
there's ways to iterate over number of records, per hour, etc...
timomer
@timomer
Aug 12 2015 08:44
would manual and auto not all count towards your IOB, etc?
Ben West
@bewest
Aug 12 2015 08:45
assumption is manual intervention represents: "I know what I'm doing, leave me alone for awhile"
if you mess with the system via manual intervention, it will try to not double-guess you
timomer
@timomer
Aug 12 2015 08:46
right, got you
for the Medtronic pumps you guys are using, I am amusing there is a background 24h basal set by the user, that you ignore for any calculations?
Scott Leibrand
@scottleibrand
Aug 12 2015 08:51
I'm taking about "I did a 2 unit bolus" events
if you record that manually, and then read if from the pump, you don't want to assume IOB is 4U
Yes, we subtract your normal basal schedule from everything and use net IOB.
timomer
@timomer
Aug 12 2015 08:55
r
thats interesting, I would think its best to leave the 24h basal if it had been correctly researched and set by the user
did you every try seeing what happened if that was not utilised?
r, i see you get that from function basalLookup()
Scott Leibrand
@scottleibrand
Aug 12 2015 09:00
Yeah, we assume basal is set correctly.
We calculate the impact on net IOB by taking temp basal minus normal basal times duration.
timomer
@timomer
Aug 12 2015 09:03
yeah, more i think about it the more I can see how it should be included in calculations
Scott Leibrand
@scottleibrand
Aug 12 2015 09:27
I've considered switching to a gross IOB calculation before in order to model sensitivity changes properly against unchanged basal, but that math gets more complicated.
timomer
@timomer
Aug 12 2015 09:52
sensitivity changes is a very interesting subject, with all the data being logged there is no reason why the system could not make suggestions for isf for time periods - link that with Google Fit data to be sure the user is not active
Scott Leibrand
@scottleibrand
Aug 12 2015 10:03
Yeah, and/or suggest basal changes.
kenstack
@kenstack
Aug 12 2015 13:18
@bewest im not sure if the predictor in the 640 is this AR2 or not, and more importantly Im guessing the loss function /trigger is different. Do you know for sure? I know they trigger at a value well above the thrshold ie if your low threshold is 80, they trigger no basal when BG is projected to be say 100 30 minutes later - the idea being try not to get to 80. Ive been reading quite a bit about it but of course they dont disclose specifics. Any info would be helpful. I think I read the trigger for their predictor is like 20 points over your low threshold 30 minutes out.
Ali Mazaheri
@amazaheri
Aug 12 2015 15:17
wow missed alot here in past 12 hours! reading! @scottleibrand regarding pumphistory I had a chat with @jasoncalabrese regarding adding support for some openaps templates that we can hook into from sendtempbasal-azure.js and to make OpenAPS as an option for NS C-R-M, so that by enabling that we can use the entries to treatments or evena seperate colleciton for openaps
Scott Leibrand
@scottleibrand
Aug 12 2015 15:25
I like the separate collection idea. I currently upload to a pump collection separate from treatments so I can later deduplicate properly.
Ali Mazaheri
@amazaheri
Aug 12 2015 15:28
me too
Ideally you have a new feature (OpenAPS) set in Enable setting for c-r-m
right now its a hack just for me to see the corrections but if I enable IOB it will give wrong calculations, etc.
Jason Calabrese
@jasoncalabrese
Aug 12 2015 15:34
would be nice to read from the pumphistory collection, and create treatments on the fly (also deduping)
not sure where that would fit in yet
Ali Mazaheri
@amazaheri
Aug 12 2015 15:34
@jasoncalabrese lets make it happen :)
Nathan Racklyeft
@loudnate
Aug 12 2015 16:09
@kenstack so AR2 could be used to smooth out the sharp velocity changes I sometimes see at the point of real -> predicted glucose?
Screen Shot 2015-08-12 at 9.09.09 AM.png
kenstack
@kenstack
Aug 12 2015 16:46
@loudnate yes - the sim just calculates bg changes based on carbs and Iob - we'd have to add some sort of decaying function that represents initial velocity to match it - would force the slope to match but I'm worried we'd be adding non real info - could be done though
Ben West
@bewest
Aug 12 2015 18:10
ah
Ali Mazaheri
@amazaheri
Aug 12 2015 18:23
@bewest installing the openaps and decoding stuff on Win 10 and Intel Compute Stick I think I shoudl have everything running end to end by EOD today
Can you @loudnate and I connect to work on finalizing the changes to repos and create a seperate Windows Branch?
Scott Leibrand
@scottleibrand
Aug 12 2015 19:41
@jasoncalabrese @amazaheri that (creating treatments on the fly) is exactly what my old wip/iob-cob does.
Reads from a collection called "pump".
Ali Mazaheri
@amazaheri
Aug 12 2015 19:44
:+1:
Ben West
@bewest
Aug 12 2015 19:45
@amazaheri very fine work, sir :-)
Ali Mazaheri
@amazaheri
Aug 12 2015 19:47
not yet, when I see the branch public I am happy :)
So ideally if we can port that to c-r-m and have it so iob calculates considering OpenAPS correction it would be great!
Scott Leibrand
@scottleibrand
Aug 12 2015 19:50
Yep, that's what I did months ago for DIYPS closed loop. Only missing piece is replacing my direct mongo upload with an API call.
Ali Mazaheri
@amazaheri
Aug 12 2015 19:57
so can we reuse it? I can work on tha API side? thats something I love to have it integrated with what @bewest is workiong on nightscout stuff
Jason Calabrese
@jasoncalabrese
Aug 12 2015 20:15
posting treatments to the api should work now
same json as you sent to mongo
should all pass through
Ali Mazaheri
@amazaheri
Aug 12 2015 20:16
i give it a try tonight!
Jason Calabrese
@jasoncalabrese
Aug 12 2015 20:20
need to lock down POST
Ali Mazaheri
@amazaheri
Aug 12 2015 20:20
so should i provide secret or it doesnt require it in 7.0
Ali Mazaheri
@amazaheri
Aug 12 2015 20:21
awesome thx
Jason Calabrese
@jasoncalabrese
Aug 12 2015 20:21
it's bad, but no auth is available for care portal
hoping we can provide auth via NS.net for diy sites
Ali Mazaheri
@amazaheri
Aug 12 2015 20:22
I love to port everything to ns.net and focus on that vs diy
Ben West
@bewest
Aug 12 2015 20:22
:+1:
Jason Calabrese
@jasoncalabrese
Aug 12 2015 20:27
maybe special accounts where we can push from our own repos
still get mongo access, etc
isolation
Scott Leibrand
@scottleibrand
Aug 12 2015 21:13
If someone wants to try merging my wip/iob-cob with master, you should be able to use my pump history parsing code...
not sure how many merge conflicts there'll be
Jason Calabrese
@jasoncalabrese
Aug 12 2015 21:26
should be hard to port it, did you do that when loading from mongo?
Scott Leibrand
@scottleibrand
Aug 12 2015 22:20
Not sure I understand the question. Openaps does a mongoimport of pumphistory.json into the pump collection after each run. cgm-remote-monitor parses the pump collection along with treatments to generate the treatments list.
Jason Calabrese
@jasoncalabrese
Aug 12 2015 23:23
there was some code in you iob-cob branch that worked with the pump history? is that js code that was running NS?