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

17th
Nov 2015
Scott Leibrand
@scottleibrand
Nov 17 2015 00:11
Hehe forgot about that one. ;-)
insulin suction pump ftw! ;-)
Lori
@LoriLori
Nov 17 2015 00:14
adrenaline pump , more stable compared to glucagon, same action :)
Scott Leibrand
@scottleibrand
Nov 17 2015 00:19
Interesting side effects though. ;-)
Jason Calabrese
@jasoncalabrese
Nov 17 2015 00:29
it's nice how the pump takes care of the rounding and negatives
or maybe thats decocare?
Lori
@LoriLori
Nov 17 2015 00:38
if (rate < 0) { rate = 0; }
rate = Math.round((Math.round(rate / 0.05) * 0.05)*100)/100;
Scott Leibrand
@scottleibrand
Nov 17 2015 00:44
Yeah, only reason it is stil negative there is as a signal to my code to extend a zero temp.
Just need to change the way it's put into the reason.
eyim
@eyim
Nov 17 2015 02:34

Hmm - still haven't figured out how to use the timezones stuff. I've read through all the history I could find on this gitter channel and I believe I have everything set up correctly. I doubled checked the openaps.ini of Jason's and Ben's and it matches what I have set up. However when I send pump-history.json to it, it does nothing. It never adds the time zone -08:00 part to the various timestamps. pump-history.json and pump-history-zoned.json are exactly the same. And when I send clock.json to it, it returns this error: Anyone else seeing this?

tz://JSON/rezone/monitor/pump-history-zoned.json
reporting monitor/pump-history-zoned.json
tz://JSON/clock/monitor/clock-zoned.json
monitor/clock-zoned.json raised tzinfo argument must be None or of a tzinfo subclass, not type 'str'
Traceback (most recent call last):
File "/usr/local/bin/openaps-report", line 4, in <module>
import('pkg_resources').run_script('openaps==0.0.7', 'openaps-report')
File "/usr/local/lib/python2.7/dist-packages/setuptools-18.5-py2.7.egg/pkgresources/_init.py", line 742, in run_scri pt
File "/usr/local/lib/python2.7/dist-packages/setuptools-18.5-py2.7.egg/pkgresources/_init.py", line 1667, in run_scr ipt
File "/usr/local/lib/python2.7/dist-packages/openaps-0.0.7-py2.7.egg/EGG-INFO/scripts/openaps-report";, line 82, in <modu le>
app( )
File "/usr/local/lib/python2.7/dist-packages/openaps-0.0.7-py2.7.egg/openaps/cli/init.py", line 44, in call
self.run(self.args)
File "/usr/local/lib/python2.7/dist-packages/openaps-0.0.7-py2.7.egg/EGG-INFO/scripts/openaps-report";, line 75, in run
output = app(args, self)
File "/usr/local/lib/python2.7/dist-packages/openaps-0.0.7-py2.7.egg/openaps/cli/subcommand.py";, line 50, in call
return self.method.main(args, app)
File "/usr/local/lib/python2.7/dist-packages/openaps-0.0.7-py2.7.egg/openaps/reports/invoke.py";, line 40, in main
output = task.method(args, app)
File "/usr/local/lib/python2.7/dist-packages/openaps-0.0.7-py2.7.egg/openaps/uses/use.py";, line 39, in call
output = self.main(args, app)
File "/usr/local/lib/python2.7/dist-packages/openapscontrib-0.0.5-py2.7.egg/openapscontrib/timezones/_init.py", line 82, in main
results = self.convert(inputs)
File "/usr/local/lib/python2.7/dist-packages/openapscontrib-0.0.5-py2.7.egg/openapscontrib/timezones/_init.py", line 94, in convert
program = self.rezone(parse(program)).isoformat( )
File "/usr/local/lib/python2.7/dist-packages/openapscontrib-0.0.5-py2.7.egg/openapscontrib/timezones/_init.py", line 64, in rezone
dt = dt.replace(tzinfo=self.timezone) # .astimezone(self.timezone)
TypeError: tzinfo argument must be None or of a tzinfo subclass, not type 'str'

Scott Leibrand
@scottleibrand
Nov 17 2015 02:42
What does date report?
Ali Mazaheri
@amazaheri
Nov 17 2015 02:58
try getting openaps-0.0.8
that shouldvresolve your issue
eyim
@eyim
Nov 17 2015 03:00
Mon 16 Nov 19:00:29 PST 2015 is what the date reports
Scott Leibrand
@scottleibrand
Nov 17 2015 03:01
And openaps -v? (If 0.0.7, get dev: Ali is right there's a fix there)
guess we need to release 0.0.8 to master asap
eyim
@eyim
Nov 17 2015 03:03
Yes 0.0.7 i ran sudo easy_install -ZU openaps but it just gives me 0.0.7
If this solves it, I'll buy you guys a beer!! Spend 15 hours on it this weekend trying to figure it out :)
Scott Leibrand
@scottleibrand
Nov 17 2015 03:04
Ok, our bad for updating docs assuming people would have 0.0.8 without making it default.
No beer for me, but hope they fixes it. :-)
Matt Pressnall
@logichammer
Nov 17 2015 03:05

So I can read data off the pump and cgm mega easily now (incredible) and was like "OK, now what?" I wasn't sure where to start given that Dana and Scott have been developing their algo for over a year. I remembered that Dana said she was working on documentation for the phase that I am at ("Do I look at real time data, historical data, how should I handle double arrows up, etc?") and went "hacking" github and found the dev documentation: https://github.com/openaps/docs/tree/dev/docs/Build-manual-system and found the first online references to oref0.

oref0 has some amazing commands in it like ifttt-notify (something I would want but already included???? sweet!), pebble, uploading into nightscout, and what I am hoping is the magic bullet: determine-basal (that takes a lot of inputs and then makes a recommendation on what the temp basal should be?)

I can figure out what I need to do get data off devices, can feed those things into other software to get recommendations, vet that the recommendations make sense, look at the code to see why it made the recommendations it made, add scenarios that I would want covered but starting from scratch definitely seems daunting. Super grateful for the work that has gone into this and for all the sharing that is happening!

I'm going to go look at the source for oref0 but am I on the right track for starting to build my software loop? Looking at the dev documentation? Is the determine-basal method the amazing piece of code that I am hoping it is? I am going to comb through all of this but wanted to make sure I was on the right path? Anything else I should be looking at / factoring in?

Scott Leibrand
@scottleibrand
Nov 17 2015 03:08
Yep, that is exactly where you want to be. You'll be the first to use those updated docs, but most of us are on similar oref0 based loops now.
Dana Lewis
@danamlewis
Nov 17 2015 03:09
Check out my #35 in docs to see all of the docs I added last night, you already found part of it sounds like :) but the rest should help, too
Scott Leibrand
@scottleibrand
Nov 17 2015 03:09
There are some pretty good walkthroughs in there of the whole process: let us know how it goes and whether anything was too hard, or more importantly too easy.
Matt Pressnall
@logichammer
Nov 17 2015 03:11
Awesome and I am reading I need to upgrade / pull the dev version of openaps to 0.0.8 or can I get by with 0.0.7 until master is upgrade? Thanks, @danamlewis, I will! I was kind of sad / overwhelmed and then I found the updated docs and got happy again! :)
Scott Leibrand
@scottleibrand
Nov 17 2015 03:12
If @eyim confirms 0.0.8 fixes his issue I'm gonna merge openaps/openaps#64 as-is (without 67) and we can get 67 in later.
So you'll need to upgrade before you get to needing zoned pump data, but hopefully that'll be a easy_install -ZU rather than dev install.
Dana Lewis
@danamlewis
Nov 17 2015 03:14
@logichammer :) it's still needing to be reviewed by folks, so take with a grain of salt and realize it needs editing, but in the meantime better than what was there (nothing).
Matt Pressnall
@logichammer
Nov 17 2015 03:15
Perfect! I'm only going to reading / figuring stuff out before writing anything so I can do an update easily enough in a few days. Thanks, guys!
Scott Leibrand
@scottleibrand
Nov 17 2015 03:18
While you're at it, please note anything that needs improved. Best way is to fork a copy of the docs repo and edit that directly, then open a pull request to submit your edits back to the main dev branch.
eyim
@eyim
Nov 17 2015 03:19

Just to confirm 0.0.8 is the dev branch found here https://github.com/openaps/openaps/tree/dev

correct?

Ali Mazaheri
@amazaheri
Nov 17 2015 03:20
yes
that will fix ur issue
Matt Pressnall
@logichammer
Nov 17 2015 03:25
@scottleibrand, will do! Just did a pull and have all of Dana's latest documentation (did she just add it yesterday because it wasn't there earlier in the day?) so I can edit from here as needed...It's going to take me some time to go through this part.
eyim
@eyim
Nov 17 2015 03:26
Yes that worked !! So happy - I was pulling my hair out thinking I was so stupid that I couldn't figure it out
Dana Lewis
@danamlewis
Nov 17 2015 03:26
Yes, I did it late last night :)
@eyim It's often a bug in the code :)
Matt Pressnall
@logichammer
Nov 17 2015 03:27
Yes! Got lucky on the timing!
Ali Mazaheri
@amazaheri
Nov 17 2015 03:27
cool

undocumentedfeature

:shipit:
Jason Calabrese
@jasoncalabrese
Nov 17 2015 03:43
we should do a openaps version report as part of the loop
log the versions of everything
think I need to spend some time getting some networking things working right to prepare for our trip
Dana Lewis
@danamlewis
Nov 17 2015 03:47
Officially calling (n=1)*16, btw :)
scottleibrand @scottleibrand hands Jason his medal. ;-)
Ali Mazaheri
@amazaheri
Nov 17 2015 03:49
nice! about time @jasoncalabrese :)
Scott Leibrand
@scottleibrand
Nov 17 2015 03:50
Any objections to merging openaps/openaps#64 as-is? @bewest @loudnate @amazaheri @jasoncalabrese ?
Nathan Racklyeft
@loudnate
Nov 17 2015 03:51
I looked at the PR initially. It doesn't break backwards compatibility right?
Jason Calabrese
@jasoncalabrese
Nov 17 2015 03:53
I've be running all but the last commit I think
Scott Leibrand
@scottleibrand
Nov 17 2015 04:00
I've been running dev in production for weeks.
Ali Mazaheri
@amazaheri
Nov 17 2015 04:09
good to go
been running it for 2 weeks now
Scott Leibrand
@scottleibrand
Nov 17 2015 04:23
K, merging. We can get #67 as a follow-up.
Done.
Jim Matheson
@jmatheson
Nov 17 2015 04:26
Is anyone working on documenting the process of getting upload-recent-treatments working end to end? If not, i can work on a version from my notes.
Scott Leibrand
@scottleibrand
Nov 17 2015 04:28
Which is actually pretty good documentation, if you can read bash. ;-)
Jim Matheson
@jmatheson
Nov 17 2015 04:32
nice
guess we could document that the script exists :)
Scott Leibrand
@scottleibrand
Nov 17 2015 04:34
It needs someone to peer review it first, so we can at least merge it to dev
if you or anyone who's run it can give it a thumbs up, I'll merge.
Jim Matheson
@jmatheson
Nov 17 2015 04:36
alright, i will run it tonight and give it a once over as well.
Scott Leibrand
@scottleibrand
Nov 17 2015 04:40
Thx
Jim Matheson
@jmatheson
Nov 17 2015 06:02
@scottleibrand how should I give feedback related to the uploader-setup script?
Scott Leibrand
@scottleibrand
Nov 17 2015 06:17
Verbal, comment on the PR to dev. Edits, fork and PR your suggested changes.
Scott Leibrand
@scottleibrand
Nov 17 2015 06:32
Thx
Jim Matheson
@jmatheson
Nov 17 2015 06:39
np
Jason Calabrese
@jasoncalabrese
Nov 17 2015 07:59

I had a little bug in my loop, might have copied it from somewhere...

in the device I'm using to pull BG's from NS I had left out the svg filter, so it was pulling in mbgs and cals too, if the last entry isn't a BG it blows up

[device "ns-bgnow"]
fields =
cmd = ns-get
args = entries/sgv.json https://YOUR-SITE.com
so you need entries/sgv.json instead of just entries.json
eyim
@eyim
Nov 17 2015 08:43
This message was deleted
Jim Matheson
@jmatheson
Nov 17 2015 16:43
nice
eyim
@eyim
Nov 17 2015 17:13
Wow great to see.
Matt Pressnall
@logichammer
Nov 17 2015 18:20
Damn, @jasoncalabrese ! Look at all those in range numbers! I am stoked to get my loop up and running...
Scott Leibrand
@scottleibrand
Nov 17 2015 18:20
:-D
Jason Calabrese
@jasoncalabrese
Nov 17 2015 18:23
after switching to pumps he quickly went up to 200, need to find a way to send it to school
there still would have been a breakfast spike, but it would have been high temping an hour or more before the snack bolus
eyim
@eyim
Nov 17 2015 18:29
@jasoncalabrese Hi Jason - You mentioned that you were able to resolve the iob calculation in openaps not matching Nightscout or the pump. I'm running a test right now and 40 minutes after giving 1 unit of insulin openaps is saying there is .67 iob and .13 bolus iob while Nightscout and the pump is saying 0.9. I use a 5 hour DIA so .67 seems too low to be correct. I am sending the zoned clock and zoned pump-history to the iob calculation. Did you do something else to get them to line up more closely? It was an issue for us last night my son ate before he went to bed and after a couple of hours, openaps showed no iob while there were several units still in his system.
Jason Calabrese
@jasoncalabrese
Nov 17 2015 18:30
they still don't match, feels like openaps isn't really using my 4hr dia
but, so far it's been good that they don't match
I just switched to the 4hr dia, and had been using 3hr for the last 5 years, but looking at the data it does seem to take 4 hours for a correction bolus to fully finish
eyim
@eyim
Nov 17 2015 18:32
We found that as well. It seems to be somewhere between 4 and 5 hours for my son so I leave it at 5 just to be safe
Jason Calabrese
@jasoncalabrese
Nov 17 2015 18:35
might be that with openaps a lower dia works ok
bg seems to behave differently when looping
eyim
@eyim
Nov 17 2015 18:37
It was an issue for us last night. He was dropping with still a ton of insulin on board and the system was projecting still a reasonable blood sugar. With a more reasonable iob number, it would have enacted a temp basal if I understand the code correctly. But that was just one night. We'll see again tonight.
Jason Calabrese
@jasoncalabrese
Nov 17 2015 18:40
yeah, I can see that
and I think if you set a manual temp, it would cancel it
Scott Leibrand
@scottleibrand
Nov 17 2015 18:41
that depends on what the BGs are doing
We should get the iob.js tests from nightscout back into oref0
eyim
@eyim
Nov 17 2015 18:43
Looks like the DIA on the pump is pulled into openaps using the settings report in monitor/setting.json which we don't pass to the oref0-iob calculation - only clock and pump-history is sent in. I wonder how it figures how what the DIA is.
Jason Calabrese
@jasoncalabrese
Nov 17 2015 18:44
it's trying to use the dia on the pump, but there might be a bug
Scott Leibrand
@scottleibrand
Nov 17 2015 18:45
yeah, you should set up to refresh all the settings periodically in case you change basal rates or something
Jason Calabrese
@jasoncalabrese
Nov 17 2015 18:46
I'm checking that each loop, but feels like overkill, need a way to do it less often
eyim
@eyim
Nov 17 2015 18:46
Good to know - right now I have it refreshing all the settings and reports on each loop pass. Overkill I know but just being overly safe
Jason Calabrese
@jasoncalabrese
Nov 17 2015 18:47
2nd pi just showed up
some extra battery packs too
Scott Leibrand
@scottleibrand
Nov 17 2015 18:48
yay. :)
I think doing it on each loop is fine, but you can definitely deprioritize it to run after your main monitor/suggest/enact loop...
Jason Calabrese
@jasoncalabrese
Nov 17 2015 18:49
that makes sense
I moved things around some last night
to get the upload to NS sooner in the loop
even 30s after enact feels too slow
trying the Vilros kit this time
eyim
@eyim
Nov 17 2015 19:47

To answer my own question from above, look like information from monitor/settings.json where the dia from the pump lives - gets passed to predict/profile.json which is then passed to the iob calculation.

Also on my test, it is now 2 hours later and openaps show 0 iob and 0 bolus iob while both the pump and nightscout still show 0.6 left on board from the 1 unit bolus given 2 hours ago.

Scott Leibrand
@scottleibrand
Nov 17 2015 19:49
try changing the DIA manually in profile.json and re-run your iob.js report: see if you can narrow down what seems to be happening there
also, check the timestamps in clock.json and pumphistory.json
eszcloud
@eszcloud
Nov 17 2015 20:36
@jasoncalabrese fwiw w/o openaps, dia = 2 was best for me for eons; w/ openaps, 5 seems to be the magic number for my dia
Scott Leibrand
@scottleibrand
Nov 17 2015 20:43
I wonder if that variance has more to do with the mental algorithms different people use for corrections than anything physiological...
diabeticgonewild
@diabeticgonewild
Nov 17 2015 20:53
At the endo. Heart rate is going to be ridiculously high when they take my blood pressure. But endo knows what is causing it. I really need more immunosuppression.
eszcloud
@eszcloud
Nov 17 2015 20:55
there's definitely some of that @scottleibrand and how the other variables (e.g. sensitivity) are set.
diabeticgonewild
@diabeticgonewild
Nov 17 2015 20:56
Yeah I just took my heart rate right now using an app and I have been sitting down for awhile: 127 bpm
Well in the Hovorka AP modeling they have all of the variables accounted for...
And nonlinear model predictive control is the way to go...with respect to creating an artificial pancreas...
eyim
@eyim
Nov 17 2015 20:57
my profile.json shows the correct "dia":5 Just for kicks, I changed it to "dia":10 but it still shows iob 0 bolusiob 0 after rerunning it
diabeticgonewild
@diabeticgonewild
Nov 17 2015 20:59
Endo is going to be like WTF when they see my blood pressure and HR...it will be worse than 127 cause I have to get up (makes me way more tachycardic) to go get my blood pressure taken.
Scott Leibrand
@scottleibrand
Nov 17 2015 21:02
@eyim that's definitely not right. How do the time stamps look?
eyim
@eyim
Nov 17 2015 21:07
After the upgrade last night the time stamps all look correct with the -08:00 attached to them in both clock-zoned and pump-history-zoned. But clearly if no one else is seeing this then I have something messed up with my configuration
Jason Calabrese
@jasoncalabrese
Nov 17 2015 21:08
iob isn't looking right for me, was thinking it was falling back to 3hr
Scott Leibrand
@scottleibrand
Nov 17 2015 21:09
we really really really needs tests on oref0-calculate-iob.js
Jason Calabrese
@jasoncalabrese
Nov 17 2015 21:10
I started on it, but got distracted while trying to adjust the NS iob tests to oref0
eyim
@eyim
Nov 17 2015 21:10
I've been manually testing it this morning and oref0-calculate-iob.js shows all the insulin gone within 2 hours
Scott Leibrand
@scottleibrand
Nov 17 2015 21:12
what do you get with a 3h (or lower) DIA?
Jason Calabrese
@jasoncalabrese
Nov 17 2015 21:21
are you looking at the normal iob or the bolus iob?
the bolus iob is double speed
diabeticgonewild
@diabeticgonewild
Nov 17 2015 21:22
Heart rate was 138...
eyim
@eyim
Nov 17 2015 21:28
@jasoncalabrese I am looking at both. I will run a test and write down what happens to both of those measures compared to what NS says (which is close to the pump) for DIA 1 to 5 hours and see what the difference is
Scott Leibrand
@scottleibrand
Nov 17 2015 21:28
thx
prints tick should print glucose_status.avgdelta or both ?
I am very sorry, don't have setup tests on local to fix
eyim
@eyim
Nov 17 2015 22:42

@scottleibrand Okay definitely seeing some strange results. So at 1:15 pm I gave 1 unit of insulin. At that point both the pump, oref0-calculate-iob.js, and Nightscout showed correctly that there was 1 unit on board. oref0-calculate-iob.js was 1 unit for iob and 1 unit for bolus iob.

At 2:35 so 1 hr and 20 minutes later, NS showed 0.78, the pump .8 . Here is what oref0-calculate-iob.js showed for the various DIA:

2 hour DIA - iob 0.77 and bolus iob 0.27
3 hour DIA - iob 0.55 and bolus iob 0.04
5 hour DIA - iob 0.11 and bolus iob. 0.00

This is the exact opposite of what I would expect that as DIA gets longer I would expect iob to increase but it shows a decrease. Hopefully I did everything right in this test

Scott Leibrand
@scottleibrand
Nov 17 2015 22:50
I think you tested it right
what version of oref0 do you have?
I thought I fixed this bug awhile back
eyim
@eyim
Nov 17 2015 22:53
openaps 0.0.8
Scott Leibrand
@scottleibrand
Nov 17 2015 22:58
hmm
so as a workaround for now, set your DIA to 3 until we fix this
the way DIA calc works is that it uses the correct formula for 3h, and then attempts to scale it for longer or shorter
apparently my scaling is still broken
Scott Leibrand
@scottleibrand
Nov 17 2015 23:15
@LorelaiL: this fixes that, right? openaps/oref0#25
Lori
@LoriLori
Nov 17 2015 23:18
I think yes, thanks
eyim
@eyim
Nov 17 2015 23:19
Does oref0-calculate-iob.js handle dual wave / sq wave boluses? I doesn't look like the current version of NS handles that. We use the dual wave a lot for pizza and pasta, etc
Scott Leibrand
@scottleibrand
Nov 17 2015 23:26
not unless they're reported as temp basals, no
the main problem with square waves with openaps is the records don't actually get written until the bolus completes
and I think having a square wave active actually prevents you from setting temps
by default, openaps will treat a square wave bolus as a normal bolus, which means the iob calculation will assume the bolus all happened at the timestamp on the record
so you theoretically could do that, but I believe it would disable openaps until the bolus completes, and then iob would be off, depending on the duration
if you limited it to an hour or two, that might not be bad...
Scott Leibrand
@scottleibrand
Nov 17 2015 23:32
This message was deleted