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

25th
Nov 2015
Matt Pressnall
@logichammer
Nov 25 2015 01:38

So I have my enact/suggested.json getting output.

Please don't freak out as this pump isn't hooked up to anybody as I test this but this is what I see:

{"delta":-12,"glucose":178,"avgdelta":-3.6666666666666665}
{"duration":0,"rate":0,"temp":"percent"}
{"iob":7.810327104474075,"activity":0.012622222222222222,"bolusiob":7.325463297896297}
{"max_iob":0,"type":"current","dia":4,"current_basal":0.15,"max_daily_basal":0.25,"max_basal":2,"min_bg":110,"max_bg":120,"sens":95}
IOB: 7.81, Bolus IOB: 7.33
Avg. Delta: -3.7, BGI: -6.0
15m deviation: 7
BG: 178-12 -> -557-487 (Unadjusted: -564-480)
Eventual BG -557<110bolus snooze: eventual BG range -557-487

I wasn't getting anything that looked like it had a temp basal to set so I bolus'd for 8 units which should send some down to -587? Correct? And ack! :) Shouldn't there be a temp basal to suspend the current normal basal? Does that say that here?

With my previous suggested.json, I go this:

got this:

{
  "requested": {
    "duration": 0, 
    "rate": 0, 
    "temp": "absolute"
  }, 
  "bg": 190, 
  "temp": "percent", 
  "snoozeBG": 278, 
  "timestamp": "2015-11-24T17:22:48.520910", 
  "rate": 0, 
  "reason": "Eventual BG 10<120+1, and temp 0 < basal 0.25", 
  "eventualBG": 10, 
  "recieved": false, 
  "duration": 0, 
  "tick": "+1"
}

But for the current environment with 8 units on board, when I try to run setting the temp basal things blow up:

pi@raspberrypi:~/openaps$ openaps use pump set_temp_basal enact/suggested.json
Traceback (most recent call last):
  File "/usr/local/bin/openaps-use", line 4, in <module>
    __import__('pkg_resources').run_script('openaps==0.0.7', 'openaps-use')
  File "build/bdist.linux-armv7l/egg/pkg_resources/__init__.py", line 742, in run_script
  File "build/bdist.linux-armv7l/egg/pkg_resources/__init__.py", line 1667, in run_script
  File "/usr/local/lib/python2.7/dist-packages/openaps-0.0.7-py2.7.egg/EGG-INFO/scripts/openaps-use", line 63, in <module>
    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-use", line 57, in run
    output = app(args, self)
  File "/usr/local/lib/python2.7/dist-packages/openaps-0.0.7-py2.7.egg/openaps/uses/__init__.py", line 92, in __call__
    return self.method.selected(args)(args, app)
  File "/usr/local/lib/python2.7/dist-packages/openaps-0.0.7-py2.7.egg/openaps/uses/__init__.py", line 31, in __call__
    return self.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/openaps-0.0.7-py2.7.egg/openaps/vendors/medtronic.py", line 306, in main
    results = self.upload_program(program)
  File "/usr/local/lib/python2.7/dist-packages/openaps-0.0.7-py2.7.egg/openaps/vendors/medtronic.py", line 315, in upload_program
    return self.pump.model.set_temp_basal(**program)
  File "/usr/local/lib/python2.7/dist-packages/decocare-0.0.19.dev0-py2.7.egg/decocare/models/__init__.py", line 187, in set_temp_basal
    result = self._set_temp_basal(**basals)
  File "/usr/local/lib/python2.7/dist-packages/decocare-0.0.19.dev0-py2.7.egg/decocare/models/__init__.py", line 25, in __call__
    self.response = inst.session.query(self.msg, **kwds)
  File "/usr/local/lib/python2.7/dist-packages/decocare-0.0.19.dev0-py2.7.egg/decocare/session.py", line 100, in query
    command = Command(serial=self.serial, **kwds)
  File "/usr/local/lib/python2.7/dist-packages/decocare-0.0.19.dev0-py2.7.egg/decocare/commands.py", line 277, in Program
    assert duration % 30 is 0, "duration {0} is not a whole multiple of 30".format(duration)
TypeError: unsupported operand type(s) for %: 'NoneType' and 'int'
pi@raspberrypi:~/openaps$

Ideas? Thanks!

Matt Pressnall
@logichammer
Nov 25 2015 01:43
And my current enact/suggested.json is:
{"temp":"absolute","bg":178,"tick":-12,"eventualBG":-557,"snoozeBG":487,"reason":"Eventual BG -557<110bolus snooze: eventual BG range -557-487"}
Scott Leibrand
@scottleibrand
Nov 25 2015 01:55
Bolus snooze says "oh, 8U? Maybe that's a meal bolus. Better wait and see." So no action recommended.
eyim
@eyim
Nov 25 2015 01:56
@logichammer Matt - it won't suspend just because the eventual BG is so low. The current system doesn't take into account carbs on board so it just looks at the impact of the insulin. They designed the system so that only in certain cases will it low temp - basically if you are falling faster than it would expect from the impact of the insulin. If you are falling slower than expected it assumes you have carbs on board or something else. Only when you fall faster than expected does it low temp you. It also isn't a straight up falling faster or slower than expected. They put some parameters around it that is more difficult to explain here. But they double the speed of the bolus insulin and make another adjustments as well. The devs can do a better job at that part than I can
Scott Leibrand
@scottleibrand
Nov 25 2015 01:56
You need to have your alias grep suggested.json for "rate" or "duration" and only enact if so.
Matt Pressnall
@logichammer
Nov 25 2015 01:56
Gotcha...and I think I know why things are blowing up...moved my config files and the hand made one is missing...I think
Jason Calabrese
@jasoncalabrese
Nov 25 2015 01:57
is that an mgdl/mmol conversion issue?
Scott Leibrand
@scottleibrand
Nov 25 2015 01:57
Over the next 2h bolus IOB will decay to zero. At some point (probably 30-45m from now) it will see you're not rising and start recommending low temp.
Matt Pressnall
@logichammer
Nov 25 2015 01:58
@eyim, thanks for the explanation and I get that now...still a little counter intuitive at first that you wouldn't low temp but right: no carb info to go off of.
Scott Leibrand
@scottleibrand
Nov 25 2015 01:58
Assuming you fix all the other issues. :-)
Matt Pressnall
@logichammer
Nov 25 2015 01:58
ha!
timomer
@timomer
Nov 25 2015 02:00
@fjungman ill get my version of oref0 updated tomorrow, as long as work is not too bad!
just testing some other changes, made a lot of improvements today
(re: HAPP update)
Matt Pressnall
@logichammer
Nov 25 2015 02:02

@scottleibrand , what about my original test where no IOB existed...still no temp basal even though she was 190...close enough to target with existing basals that it didn't need anything?

{
  "requested": {
    "duration": 0, 
    "rate": 0, 
    "temp": "absolute"
  }, 
  "bg": 190, 
  "temp": "percent", 
  "snoozeBG": 278, 
  "timestamp": "2015-11-24T17:22:48.520910", 
  "rate": 0, 
  "reason": "Eventual BG 10<120+1, and temp 0 < basal 0.25", 
  "eventualBG": 10, 
  "recieved": false, 
  "duration": 0, 
  "tick": "+1"
}

Am I keeping her too in range for my testing? :)

{"delta":0,"glucose":189,"avgdelta":-2.6666666666666665}
{"duration":0,"rate":0,"temp":"percent"}
{"iob":0,"activity":0,"bolusiob":0}
{"max_iob":0,"type":"current","dia":4,"current_basal":0.25,"max_daily_basal":0.25,"max_basal":2,"min_bg":120,"max_bg":140,"sens":60}
IOB: 0.00, Bolus IOB: 0.00
Avg. Delta: -2.7, BGI: 0.0
15m deviation: -8
BG: 189+0 -> 181-181 (Unadjusted: 189-189)
Eventual BG 181>120 but Delta +0 < BGI 0 / 2; no temp to cancel
Looks like it...
Scott Leibrand
@scottleibrand
Nov 25 2015 02:04
It cares a lot about delta: whether rising or falling.
You might want to get the latest dev or oref0: it has much clearer reasons, and some bug fixes.
plan to merge to master tomorrow.
In that case it wasn't high temping because he wasn't rising. Normally if there was IOB, it would check whether he was falling slower than expected from insulin activity. In this case, that (BGI) was zero.
eyim
@eyim
Nov 25 2015 02:07
I ran into that same error but forgot what fixed it. You might want to switch what type of temp basal your pump accepts. I had it on percentage change and I thought it worked for a while but then it had issues and wouldn't enact the changes. I switched to the absolute level change and it worked.
Scott Leibrand
@scottleibrand
Nov 25 2015 02:07
Ya, you have to be in absolute mode.
Matt Pressnall
@logichammer
Nov 25 2015 02:12
thanks, @eyim and @scottleibrand ...wife messed with pump setting and that changed under me. Sorry, what is the command to do upgrade again? sudo easy_install -ZU openaps?
I'm on .0.0.7 of openaps
Scott Leibrand
@scottleibrand
Nov 25 2015 02:14
That will get you latest master. If you want dev, use the "install from source" curl script.
Or just wait until tomorrow. :-)
Matt Pressnall
@logichammer
Nov 25 2015 02:18
Wait until tomorrow it is! And switching temp basals from percentage to "units per hour" fixed my problem!
Matt Pressnall
@logichammer
Nov 25 2015 02:30

Last question for tonight:

{"delta":0,"glucose":189,"avgdelta":-2.6666666666666665}
{"duration":0,"rate":0,"temp":"percent"}
{"iob":0,"activity":0,"bolusiob":0}
{"max_iob":0,"type":"current","dia":4,"current_basal":0.25,"max_daily_basal":0.25,"max_basal":2,"min_bg":120,"max_bg":140,"sens":60}
IOB: 0.00, Bolus IOB: 0.00
Avg. Delta: -2.7, BGI: 0.0
15m deviation: -8
BG: 189+0 -> 181-181 (Unadjusted: 189-189)
Eventual BG 181>120 but Delta +0 < BGI 0 / 2; no temp to cancel

I am trying to figure out what the last line (text explanation) means. She was 189 but the algo is predicting she will be 181 (correct? over what time period) which is greater than her target of 120 BUT her Delta is +0 " and then some other stuff I don't get. Did I get the first part right?

Assumptions:
Delta: her current change over the last 5(?) minutes was 0 or static or stable. This is what the algo cares about? Since it says it was 0 and mentioned this and not Avg Delta.
Avg Delta: average over some (?) time period. What is that time period? This is clearly used in some way but not referenced in the reason.
BGI: No freaking idea
Any place I can read more? Don't see it under Glossary.

Thanks so much!

Dana Lewis
@danamlewis
Nov 25 2015 02:32
BGi = blood glucose impact (how much you're expected to be dropping or rising from insulin)
Scott Leibrand
@scottleibrand
Nov 25 2015 02:32
Avg delta is over 15m, unless you're missing data
then it's just wrong. :-)
Dana Lewis
@danamlewis
Nov 25 2015 02:32
Can you pr that and anything else missing in glossary? We haven't touched that in a while
Scott Leibrand
@scottleibrand
Nov 25 2015 02:34
and yes, delta is 5m
Dana Lewis
@danamlewis
Nov 25 2015 02:36
Even if you don't know the full explanation, just a list of missing terms would be nice so we can flesh out more
Matt Pressnall
@logichammer
Nov 25 2015 03:37
Of course! So I forked the docs 9 days ago and I know I could delete my fork and then refork to get the latest but is there a way to update my fork with your latest changes? I have googled and can't figure it out. I suck at git. https://github.com/logichammer/docs
Dana Lewis
@danamlewis
Nov 25 2015 03:39
Yep. Just do a pr from master to pull the changes into yours.
Unless you've made any edits to yours...then it gets complicated. But if you haven't edited, pr should be simple
Look for green button for PR and keep clicking til it works :)
Matt Pressnall
@logichammer
Nov 25 2015 03:41
Do I start the PR in my repro or yours?
Scott Leibrand
@scottleibrand
Nov 25 2015 03:42
The pull request to your repo up I can just merge yourself. After you make your changes, a PR in the other direction will need to be merged by one of us (the repo owners).
There are at least three ways to start it. :-)
Dana Lewis
@danamlewis
Nov 25 2015 03:42
PR in yours makes it easier to make sure you've got yours
Then choose master from openAPS as the other fork
Dana Lewis
@danamlewis
Nov 25 2015 03:44
What's that text say :)
Try what it suggests
so I am behind 119 commits but I have nothing to pull? confused...
Dana Lewis
@danamlewis
Nov 25 2015 03:44
That's correct you are behind
Go find your PR now and approve it.
Might have to go back to your docs Pr list
nothing to approve or initiate...see I suck.
Dana Lewis
@danamlewis
Nov 25 2015 03:46
See the text about switching the base?
No, you don't suck. Just a learning curve.
Matt Pressnall
@logichammer
Nov 25 2015 03:47
ahh
yes
head fork?
which one?
ah
Dana Lewis
@danamlewis
Nov 25 2015 03:47
If you were doing it one way, and it wasn't working, try the other :)
Matt Pressnall
@logichammer
Nov 25 2015 03:51
Ha! I rule at git!
Got it and thanks, folks!
Dana Lewis
@danamlewis
Nov 25 2015 03:51
:)
Ben West
@bewest
Nov 25 2015 03:51
:-)
Matt Pressnall
@logichammer
Nov 25 2015 03:51
It's definitely backwards from the way my brain works though...thanks, Dana!
Ben West
@bewest
Nov 25 2015 03:52
I suggest gitting conact button at bottom and complaining to github to make that easier
Dana Lewis
@danamlewis
Nov 25 2015 03:52
you bet!
Ben West
@bewest
Nov 25 2015 03:52
they strive to be social platform, but catching up changes is harder than it should be
gitting, heh, freudian slip
Matt Pressnall
@logichammer
Nov 25 2015 03:53
Glad to have this piece figure out at least...nice, @bewest ! And have all the latest changes to the docs now locally...nice!
Dana Lewis
@danamlewis
Nov 25 2015 03:54
a few helpful things that @bewest @scottleibrand & others have told me (repeatedly) which helps me be willing to try things/feel more comfortable with Github over the years: 1) it's really hard to break things, so doesn't hurt to keep pushing buttons and see what happens. 2) follow the trail of green buttons for PRs. (and my add is if you don't see a green button, go back to #1 ;))
@logichammer lots to PR in there, I know - looking forward to seeing edits on anything else you find in addition to glossary :)
Matt Pressnall
@logichammer
Nov 25 2015 03:54
:)
Oh, yeah, I have found a bunch already but thought some of it might be intentional...to show a level of intent on folks part.
but there might be a few unintentional barriers in there, too
will hit you up to make sure we are hitting the right balance
Dana Lewis
@danamlewis
Nov 25 2015 03:57
Edit away, and we'll catch anything that we wanted to intentially leave out (and talk about why). But mostly because I did a ton of work in a vaccum and it's time for people to fill in the blanks (and most things are probably unintentional). I worked under the theory that people will happily edit "what's wrong/missing", but otherwise ignore things if it's an empty page ;), and I wanted to annoy people into making this next round better :)
perfect, thanks! and glad you updated your fork before you started editing :)
Matt Pressnall
@logichammer
Nov 25 2015 04:01
Awesome! I'll go with that assumption and you can remove / kill things that I might add. I have some notes already that I want to address and will do so in the next couple of days. Just finally have the system making suggestions and need to work with it a bit to get my first actual temp basal recorded...Luckily, Thanksgiving is around the corner so hopefully she'll drift out of range when I can work on this!
Dana Lewis
@danamlewis
Nov 25 2015 04:01
hahaha
Matt Pressnall
@logichammer
Nov 25 2015 04:01
Kidding...kind of...
Dana Lewis
@danamlewis
Nov 25 2015 04:01
Scott has been known to 'complain' about good BGs when he's got something he wants to test and I'm not cooperating ;)
the other range is usually carelink stick rage, so careful for what you wish for re: 'ranges' ;p
Scott Leibrand
@scottleibrand
Nov 25 2015 04:02
FWIW, even when BGs are in range, it will end up temping for about half the night
Matt Pressnall
@logichammer
Nov 25 2015 04:03
Ha...and I know but right now we are mimicking her Animas Vibe setup and boluses on the 522 so we're good there...just keeping her near enough Dexie to pick up numbers
Scott Leibrand
@scottleibrand
Nov 25 2015 04:03
and you can always manually set a slightly high or low temp to get it to cancel that if you want to see it do something
Matt Pressnall
@logichammer
Nov 25 2015 04:03
Ohhh....good idea!
Thanks!
Scott Leibrand
@scottleibrand
Nov 25 2015 04:03
if you're still running the 522 disconnected, you can also skip entering the boluses, and watch it try to catch up with high temps. :)
Matt Pressnall
@logichammer
Nov 25 2015 04:04
That is tomorrow's game plan...and maybe cookies...
Scott Leibrand
@scottleibrand
Nov 25 2015 04:04
of course you will want to test boluses as well to make sure bolus snooze works the way you want. that can get boring, though, as it will do nothing for an hour or more
Dana Lewis
@danamlewis
Nov 25 2015 04:05
@logichammer I recommend gluten free doughnut holes. Which reminds me - RylieCakes (supposedly Kent, really the edge of Renton) is 100% GF and also does all the other allergy accomodations if needed, if ya'll don't have a favorite go-to bakery, might want to check them out.
Matt Pressnall
@logichammer
Nov 25 2015 04:05
Yeah, I'm going to be testing this like crazy over the next month...bolus snooze, another bit to document
it may not be in docs but we've got a prelim writeup there that you could copy and paste and then edit away on.
Matt Pressnall
@logichammer
Nov 25 2015 04:08
Nice...she won't mind going on sugar runs...and I need to re-review all that documentation again...been awhile and I think it does make sense to include at the phase that I am at (or at least a link out) because I am at the "why is it recommending that? and what does that even mean?" phase.
Dana Lewis
@danamlewis
Nov 25 2015 04:09
yea, we updated the reference design page in early october, so pretty much in line with the key oref0 stuff, so skimming that might find some other stuff we need to pull into the docs
(i remember adding bolus snooze, but can't remember what else changed from the prior version)
Can you tell I love fresh eyeballs on all of this? :)
Matt Pressnall
@logichammer
Nov 25 2015 04:11
Ha! Happy to have some to refer to...can't imagine trying to set this up without documentation and this channel! Love being able to bounce in and ask questions...
Jim Matheson
@jmatheson
Nov 25 2015 04:52
@danamlewis i read the reference design ylast night and it was pretty good. The only feedback I have is
Jim Matheson
@jmatheson
Nov 25 2015 04:57
Around bgi. I conceptually get the jist or if, but the content could be more clear. ....." which is simply the current insulin activity (first derivative of IOB) * insulin sensitivity. When expressed in units of mg/dL/5m, this represents" .... I don't understand current insulin activity.
Dana Lewis
@danamlewis
Nov 25 2015 04:59
Ah. Yes. That's the insulin taking effect in your body right then.
Probably a lot of ways to describe it, not sure which is most clear and succinct
Scott Leibrand
@scottleibrand
Nov 25 2015 04:59
insulin activity is how much insulin is getting "used up" (taking effect) over a given period (say 5m)
if your IOB dropped from 1.3U to 1.2U, you should see BG dropping by 0.1U * ISF (so 4mg/dL for an ISF of 40)
that is BGI (-4mg/dL per 5m, in this example)
now, if your BG is actually flat (+0), then we can assume that something (maybe carbs) is forcing BG up by an equivalent rate (+4mg/dL per 5m)
Scott Leibrand
@scottleibrand
Nov 25 2015 05:07
guess we should check the openaps reference design into docs so people can PR it and suggest improvements to stuff like that
Pete Schwamb
@ps2
Nov 25 2015 05:09
:+1:
Jim Matheson
@jmatheson
Nov 25 2015 05:12
makes sense
the last time i heard the word derivative was about 20 years ago :)
so to call it simple made me chuckle
Dana Lewis
@danamlewis
Nov 25 2015 05:16
:) it's simple compared to the 18+ factor equations the black box closed loops use ;)
Scott Leibrand
@scottleibrand
Nov 25 2015 05:17
"ordinary differential equations" says it all IMO
only someone who knows way too much math would classify diffEq as "ordinary" :)
Jim Matheson
@jmatheson
Nov 25 2015 05:19
exactly. i knew all those years of calculus would come in handy some day. sadly it was well after i forgot the concept.
Scott Leibrand
@scottleibrand
Nov 25 2015 05:21
I completely forgot how to do calculus, but the concepts of derivative and integral (and what they mean graphically) stuck
Jim Matheson
@jmatheson
Nov 25 2015 05:22
and thought….yeah makes total sense. lol
Scott Leibrand
@scottleibrand
Nov 25 2015 05:22
yeah, that is by far the most opaque part of OpenAPS
it's an activity curve that goes from 0 activity at t=0 to peak activity at t=75m, and then drops back to 0 at t=180m (for 3h DIA)
the IOB curve is the integral of that
to calculate it all, I used curve fit in excel cause I couldn't remember how to do the calculus. :)
Jim Matheson
@jmatheson
Nov 25 2015 05:24
nice
Scott Leibrand
@scottleibrand
Nov 25 2015 05:41
Proposed oref0 Meal Assist algorithm: https://gist.github.com/scottleibrand/df1019f8e12bac9030dc
Dana Lewis
@danamlewis
Nov 25 2015 05:42
(^potential change we could make to oref0 to support meal time if you have entered carbs somewhere in the system. Take a look, and provide feedback, please!)
Scott Leibrand
@scottleibrand
Nov 25 2015 05:43
credit to @jasoncalabrese for sparking the idea. :)
Scott Leibrand
@scottleibrand
Nov 25 2015 07:08
also just pushed some tests to https://github.com/openaps/oref0/blob/meal-assist/tests/determine-basal.test.js#L246-L331 capturing what we want it to do in the two scenarios described in the write-up
Chris Oattes
@cjo20
Nov 25 2015 14:12
related to what jmatheson linked, I hate this line of code: var activityContrib=treatment.insulin(2/dia/60-(minAgo-peak)2/dia/60/(60*dia-peak));
It's so completely unclear what it is actually doing
Chris Oattes
@cjo20
Nov 25 2015 14:18
I thinkthat should be replaced with something like walsh's curves
It's all simple polynomial stuff, so actually integrating it properly is easy
Jason Calabrese
@jasoncalabrese
Nov 25 2015 14:27
@scottleibrand in those tests I was expecting to see a partial bolus for the 120g meal, guess that test just isn't written yet
Jason Calabrese
@jasoncalabrese
Nov 25 2015 14:46
just made the mistake of correcting a high instead of letting OpenAPS handle it, but now that he's coming down it won't low temp because of the bolus snooze
wondering if there is a mode where we only do the bolus snooze if carbs are entered
Lori
@LoriLori
Nov 25 2015 15:27
:( same issue
Matthias Granberry
@mgranberry
Nov 25 2015 15:28
@jasoncalabrese I think that's important. Most non-food causes of spikes trail off very quickly and BG can fall sharply. I find that anger/fear/short-term stress bumps are almost not worth correcting because they often come back down on their own.
LadyViktoria
@LadyViktoria
Nov 25 2015 15:44
Chris Oattes
@cjo20
Nov 25 2015 15:46
Not a fan of that GPU :P
How is the performance compared to the pi?
Lori
@LoriLori
Nov 25 2015 15:47
@jasoncalabrese I tried high temp manual instead of bolus, its not that bad
or I could mark bolus as correction and add code to skip bolus snooze ala disable low predicted suspend , would like to stay near in code base
LadyViktoria
@LadyViktoria
Nov 25 2015 15:49
@cjo20 i don't know. but 8$ is a nice price and its debian based too. i order one ^^
Lori
@LoriLori
Nov 25 2015 15:54
wow it has battery charger build in and BLE and it is so small
Jason Calabrese
@jasoncalabrese
Nov 25 2015 15:59
Screen Shot 2015-11-25 at 8.58.43 AM.png
worked out ok, but had to correct with carbs
was having lots of carelink range issues last night, think it would have high temped more if it wasn't for that
Lori
@LoriLori
Nov 25 2015 16:03
c.h.i.p. has integrated batter power gauge for batter, it will know when it will require to charge
Chris Oattes
@cjo20
Nov 25 2015 16:20
@scottleibrand It might be worth looking at Kenstack's implementation of Walsh's activity curves that give amount of insulin remaining after time X. I think the derivative of that gives IOB
Scott Leibrand
@scottleibrand
Nov 25 2015 17:10
I also know @loudnate has one. I've considered switching to his, but then we can't share IOB calculations with NS, since his are in Python. What are @kenstack's written in?
and taking the derivative to get the IOB is just A Math.pow(g, n) -> nA*Math.pow(g, n-1)
for each term of the eqn
Scott Leibrand
@scottleibrand
Nov 25 2015 17:13
Nice. Maybe someone should write some IOB tests, and then port those formulas
I refuse to make any more blind code changes without tests to make sure we're not breaking anything. Our oref0-calculate-iob refactor caused all kinds of issues because we had no tests
Chris Oattes
@cjo20
Nov 25 2015 17:15
sounds reasonable
I haven't looked at the structure of oref0 yet
cjo20 @cjo20 has been a bit afk
Scott Leibrand
@scottleibrand
Nov 25 2015 17:19
@jasoncalabrese bolus snooze is designed to work for people who don't want to enter carbs. Maybe once we do meal assist and get it reading carbs, we can add some config file that lets you indicate "I solemnly swear to always enter my carbs" :-) so it knows to low-temp if you bolus too much w/o covering carbs.
or maybe we could do some logic to only bolus snooze for 30m or so unless we see the BGI effect of carbs absorbing...
or we could leave it as is and force people to learn to stop rage bolusing. :-p
Nathan Racklyeft
@loudnate
Nov 25 2015 17:22
I've got IOB tests in my code, which is encourage you to use if you're porting.
Openaps-predict is using the Ken's Walsh curves
Scott Leibrand
@scottleibrand
Nov 25 2015 17:24
Any volunteers to port Nate's IOB tests? If you don't know how, several of us would be happy to show you.
Chris Oattes
@cjo20
Nov 25 2015 17:25
If someone hasn't started it when I end up with some free time, I'll take it on
but I don't know when that will be, so don't let that stop anyone else picking it up
the fixtures are in the ../fixtures directory
and these tests for limiting the IOB schedule to a single data point: https://github.com/loudnate/openaps-predict/pull/33/files#diff-d54d7ac860faca6f0a464c5ddfdfcb59R1088
I should probably cut a release for you to try @scottleibrand,
Chris Oattes
@cjo20
Nov 25 2015 17:28
sorry, "Limiting the IOB schedule to a single data point"?
Nathan Racklyeft
@loudnate
Nov 25 2015 17:28
yeah the IOB calculation gives you a timeline of IOB by default
@scottleibrand asked for a way to get a momentary value, so you can now specify --start-at and --end-at to do that
I actually don't use IOB in my algorithm, because it's impossible to go from IOB schedule to Insulin Effect schedule since you've flattened the individual doses at that point
I use it for graphing just as a visual aid
Screen Shot 2015-11-25 at 9.30.57 AM.png
Chris Oattes
@cjo20
Nov 25 2015 17:33
can't you go from IOB to Insulin Effect by calculating the area under the IOB curve?
Lori
@LoriLori
Nov 25 2015 17:33
curios from what were Walsh curves aproximated?
Welsh is name of method to aproximate?
Chris Oattes
@cjo20
Nov 25 2015 17:33
LorelaiL: I think from printed graphs. They seem to match the medtronic curves reasonably well
Lori
@LoriLori
Nov 25 2015 17:34
so we just want same curve different impl?
Chris Oattes
@cjo20
Nov 25 2015 17:34
kenstack/ihawk#3
LorelaiL: Personally, I'm not convinced by having "var activityContrib=treatment.insulin(2/dia/60-(minAgo-peak)2/dia/60/(60*dia-peak));" in the code
Lori
@LoriLori
Nov 25 2015 17:35
yes we can put x^7 polynom :)
Chris Oattes
@cjo20
Nov 25 2015 17:35
there is a way to get a similar curve from a simple polynomial equation, which would probably be easier to maintain
Lori
@LoriLori
Nov 25 2015 17:35
that looks much better :)
Nathan Racklyeft
@loudnate
Nov 25 2015 17:36
@cjo20 not if I remember correctly,
Lori
@LoriLori
Nov 25 2015 17:36
or just array in 5 mins?
1 min?
Chris Oattes
@cjo20
Nov 25 2015 17:36
loudnate: why not?
Nathan Racklyeft
@loudnate
Nov 25 2015 17:36
I integrate the IOB of each dose
and sum those results for each dt
I guess I can't see why that wouldn't be communicative though
Chris Oattes
@cjo20
Nov 25 2015 17:38
I think sum of integrals between X and Y is the same as the integral of the sum between X and Y
Lori
@LoriLori
Nov 25 2015 17:38
what about each of us measuring curve 10 - 20 times?
Nathan Racklyeft
@loudnate
Nov 25 2015 17:38
:D
Lori
@LoriLori
Nov 25 2015 17:38
would make predictions 10% more predictible :)
Nathan Racklyeft
@loudnate
Nov 25 2015 17:38
I'm proud I remembered the definition of the communicative property just there
Chris Oattes
@cjo20
Nov 25 2015 17:39
commutative :)
how good are those? did somebody compare to actual?
Chris Oattes
@cjo20
Nov 25 2015 17:42
Thatmight be one of the things that are based on empirical data from dana
Milos Kozak
@MilosKozak
Nov 25 2015 17:42
IOB curves are very nice displayed in reports
Lori
@LoriLori
Nov 25 2015 17:43
yes, but those are not actual curves in report
Milos Kozak
@MilosKozak
Nov 25 2015 17:43
how actual?
Lori
@LoriLori
Nov 25 2015 17:43
I mean what is in report is not measured curve
it is just what we expect is happning in the body
Scott Leibrand
@scottleibrand
Nov 25 2015 17:44
Yes, we verified that those curves match actual insulin activity much better than linear. Too much variation to really tell whether Walsh's would be better, but I would assume so.
Milos Kozak
@MilosKozak
Nov 25 2015 17:44
yeap calculated. there is another PR which allow grab IOB data from pump and then are properly displayed in reports too
Scott Leibrand
@scottleibrand
Nov 25 2015 17:46
Also worth noting that the lambda-shaped activity curve "fits" within the error bars of the clamp studies I read
but it was a simplification
More accurate activity curve would be more bell shaped.
Lori
@LoriLori
Nov 25 2015 17:46
yes, I think with variation curve is fine
not sure how good it is with DIA=3 or 5, I mean it is just zoom +/- on curve
thus a method to measure curve with CGM would be nice
kenstack
@kenstack
Nov 25 2015 18:17
Hey guys sorry been offline for a bit - on Walsh's curves I would say they are a bit agressive in the first 30 min (ie they use s bit d insulin - reality is its still absorbing through tissue) but after that it matches mdt's curves really close - I think I put a graph of the match in the repo - I haven't gotten around to it but from many conversations with people using this stuff there is good reason to create a 3.5 hour curve - I know for us that is closest to my sons real duration - if people have interest I can do that. Also on the integral / the code in glucodyn has an integration function for Simpsons rule to calc temp basal etc / you can also do it closed form easily but @bustsvo and I left it as a numerical calculation in case someone wanted to use a non easy to integrate form
mannixlab
@mannixlab
Nov 25 2015 18:30
Hey folks. What's up? I'm about to go to bed and I am yet to hook up my stuff, but I have a question and a suggestion if you are not already doing my idea in the equations that you use to release the basal rates with. I know you adjust the basal rate, so if you blood sugar is a little high, you make the basal rate like 120% or whatever over say the course of an hour. Have you given thought to (or are you already doing it this way)---to Prime the basal rate?
Meaning if you're giving 20% additional basal over an hour, might it not be cool to basically say of that 20 additional percent we're going to give 75% of it in the first 15 minutes and let the rest of 35% left of the 20% increase to take place over the next 45 minutes.
It seems to make sense to me and it seems that you could then have a much finer way of releasing the basal. Maybe you do this, but if not, couldn't you just find the rate of change and adjust the slope of the graph of the release in equal and opposite slope and time of the original either downward or upward slope of the graph?
Dana Lewis
@danamlewis
Nov 25 2015 18:33
Have you seen that we only do temp basal rates for 30 minutes? Have to assume you will lose communication with the pump.
So every basal we issue, it's a 30 min temp and we have to assume it's the last comm it will receive and be the safest possible thing to do given the current data it has
Chris Oattes
@cjo20
Nov 25 2015 18:35
kenstack: trying to do a comparison between openaps and your curves at the moment. Got the IOB curve right, but failing at the activity curve atm :P
Scott Leibrand
@scottleibrand
Nov 25 2015 18:36
That said, we do use "deviation" to predict that BG will continue to rise/fall at a similar rate to what it's been doing, which means we will do something similar to what you describe.
mannixlab
@mannixlab
Nov 25 2015 18:39
Can you break down the basal rates into time periods shorter or longer than 30 minutes?
Lori
@LoriLori
Nov 25 2015 18:39
Think we calculate basal as it would be split into 0.05 steps
imagine basal is +.5 that would 10 steps in 30 minutes
do you have different pump then Medt?
mannixlab
@mannixlab
Nov 25 2015 18:43
No. I'm guess, I'm basically suggesting that we develop our own algorithm to essentially make it easier and more precise to do what we are trying to do. Right now Medtronic has 30, 60, etc intervals for basal rate. I'm suggesting that we change the pump design or the time intervals for the basal rate from 30 minute increments to 1 minute increments.
Then, once we do that we give ourselves a slope like we used to do for the bolus.
Scott Leibrand
@scottleibrand
Nov 25 2015 18:44
If you could design your own pump you could do all kinds of things.
Or even if you could attach a controller to the pump that is guaranteed not to lose connectivity.
mannixlab
@mannixlab
Nov 25 2015 18:44
Basically if we had minute by minute controls for the basal instead of just 30 minute intervals, we could sculpt the release of the basal much more precisely. For example, I just wanted to give 120% of my basal rate for 47 minutes.
Scott Leibrand
@scottleibrand
Nov 25 2015 18:44
Otherwise, 30m is what we have to work with.
mannixlab
@mannixlab
Nov 25 2015 18:44
I was unable to do this. I had to choose either 30 minutes or 60 minutes.
What if we didn't have to choose and I could have given 120% for 47 minutes.
It's more precise.
Lori
@LoriLori
Nov 25 2015 18:45
new 640g has 15 min basal I think or accu check insigh
Matthias Granberry
@mgranberry
Nov 25 2015 18:45
@mannixlab that's hard to do mechanically. The control of motors is only so fine.
Scott Leibrand
@scottleibrand
Nov 25 2015 18:45
That said, 30m basals enforce some useful discipline, and make it much harder to overreact to erroneous CGM readings etc.
mannixlab
@mannixlab
Nov 25 2015 18:46
Essentially my BG was fine until 47 minutes, but because I did it for 60 minutes, the last 13 minutes were more elevated than if I had just stopped and flatlined after 47 minutes.
Scott Leibrand
@scottleibrand
Nov 25 2015 18:46
if we were willing to give boluses, we could also get more insulin delivered faster, but that has all kinds of safety concerns.
Dana Lewis
@danamlewis
Nov 25 2015 18:46
Remember too - insulin has a 60-90 min peak time. So it's correlated with the previous hour's insulin and activity rather than your current.
mannixlab
@mannixlab
Nov 25 2015 18:46
But with less time on the basal rate time choices, the faster AND slower we can attack rising and falling BG.
Scott Leibrand
@scottleibrand
Nov 25 2015 18:46
We never do >30m basals either. A lot can change in that time.
If you go live on openaps, I think you'll find that 30m basals, adjustable every 5m if CGM values warrant, are plenty good enough.
mannixlab
@mannixlab
Nov 25 2015 18:50
It seems to me that the slope of the "attack" of the insulin should ironically be stacked toward the second half of the time period when the blood sugar is falling at the highest rate of change (unless of course you're reaching a dangerous level, because, as you would flatline the release of insulin for a static or almost static number, it seems you could stack it all up front for a high rate of rising, but that would actually cause a dramatic rebound, where we won't to slope the insulin in such a way that we catch it when rising, hold onto it for a bit, before we release, so that the rebound effect doesn't actually take place, and we can achieve more subtely sloped curves than a more quick and drastic effect of the change of the slope of the blood sugar. We essentially want to eliminate the curve entirely. It would seem that by having more control of the time of the basal rate release AND by being able to Prime, or stagger the release of the basal rate, we would almost have an actual pancreas.
Chris Oattes
@cjo20
Nov 25 2015 18:50
If you try and adjust something with a 60-90 minute peak time and a 240 min action time on a minute-by-minute basis, you'll end up on a roller coaster, you'll just be constantly correcting corrections
mannixlab
@mannixlab
Nov 25 2015 18:51
@cjo20 Not if there is not a high rate of change.
No?
Chris Oattes
@cjo20
Nov 25 2015 18:52
To be able to match curves more precisely, you need faster insulin, not finer delivery controls
if you had insulin that acted over 4 minutes instead of 4 hours, sure, adjust it every minute
Matthias Granberry
@mgranberry
Nov 25 2015 18:53
@cjo20 that's the real problem for a hell of a lot of control issues. BG looks like a ringing oscillator if there isn't a lot of prediction applied.
Scott Leibrand
@scottleibrand
Nov 25 2015 18:54
IOB does a really good job of completely dampening oscillations.
Chris Oattes
@cjo20
Nov 25 2015 18:54
mgranberry: yup, and you can't predict accurately enough what your BG will be in an hour to say "I need to start/stop this now" at 1-minute intervals
plus you only have data coming in every 5 minutes
Scott Leibrand
@scottleibrand
Nov 25 2015 18:55
We've had IOB disabled before, and the algorithm still works (keeps BG in range), but it oscillates a lot more.
mannixlab
@mannixlab
Nov 25 2015 18:55
I haven't set the OpenAPS up, but @scottleibrand you indicated in a previous post that the 30 minute basal was adjustable in 5 minute increments? Is that true or do those 5 minute increments all of to be the same percentage over the course of those 30 minutes?
Matthias Granberry
@mgranberry
Nov 25 2015 18:55
@scottleibrand because IOB is acting as a predictor. COB gives another dimension, although my experience is that food is pretty variable unless I give up fatty food.
mannixlab
@mannixlab
Nov 25 2015 18:55
I guess I'm saying why not write a code that makes those five minute steps adjustable.
Scott Leibrand
@scottleibrand
Nov 25 2015 18:56
Every 5m when you get a new BG you can set a new 30m basal
Chris Oattes
@cjo20
Nov 25 2015 18:56
mannixlab: it can set a new basal rate every 5 minutes, as i understand it
Scott Leibrand
@scottleibrand
Nov 25 2015 18:56
but you have to assume that'll be the last one you set and it'll run to completion.
So you can't "plan to cancel it"
so you set the basal as best you can based on what you know, and adjust if new info comes in.
mannixlab
@mannixlab
Nov 25 2015 18:57
@scottleibrand so isn't that basically a 5 minute basal if you can give a 30 minute basal of 120% basal rate for the first five minutes and then keep it that for 10 total minutes and then set a new 30 minute basal rate for 115% for 2, 5 minute steps and then after those 10 minutes are done, reset the 30 minute basal to 103% or whatever?
Isn't the goal to try to automate it at that fine a level?
Scott Leibrand
@scottleibrand
Nov 25 2015 18:58
Yes, but you can't front-load too much, because running that rate for 30m would be unsafe.
mannixlab
@mannixlab
Nov 25 2015 18:59
@scottleibrand so, if it's automated, why wouldn't we just have it recalculate and reissue the insulin every 5 minutes based on IOB and change rate?
Ben West
@bewest
Nov 25 2015 18:59
as-is, right now, we assume that whatever code just ran is the last thing that will happen... the code/pi may now be dead
Matthias Granberry
@mgranberry
Nov 25 2015 18:59
@mannixlab it doesn't make sense to do so. Even if a by-the-second indicator was available, it would make more sense to filter and process that info than adjust the control at that interval. Gentle corrections applied early to target a range work better in real systems than to aim for perfect up front.
@mannixlab it does recalculate it and it will cancel early if it must.
Ben West
@bewest
Nov 25 2015 18:59
or you may be on a train going into a tunnel...
mannixlab
@mannixlab
Nov 25 2015 19:00
Of course you can front load too much, but you can also front load to little. Isn't our goal to just find the right lope for every rate of change when compared to current IOB?
Ben West
@bewest
Nov 25 2015 19:00
with dense rf environment and lose communication to pump
Scott Leibrand
@scottleibrand
Nov 25 2015 19:00
@mannixlab that's pretty much what we do, yes.
To explore this, check out the determine-basal tests, and write some new ones for your scenarios of interest.
You'll find that most of the time it probably already does what you want. For any cases it doesn't, would love to have specifics to discuss what is ideal in that case.
Dana Lewis
@danamlewis
Nov 25 2015 19:03
Also, check out the reference design page on openAPS.org to see some of the assumptions we are dealing with, such as losing pump communication as you've heard us all mention here.
Scott Leibrand
@scottleibrand
Nov 25 2015 19:03
You just provide the scenario (BG, delta, IOB, etc.) and it will run the algorithm. You can also define parameters for what an acceptable action would be, and make sure it passes the test.
mannixlab
@mannixlab
Nov 25 2015 19:05
@scottleibrand I can talk about it, but I have absolutely no clue how to write the code for it. I haven't even seen what you're using now, so I cannot even almost make an attempt at it, but it just seems like shorter duration of changes to the basal rate based on current BG would be beneficial. @mgranberry I'm a newbie, but I guess it seems weird to me to say that we wouldn't want a second by second indicator. It just seems to me that you would only say that if there was also no difference between a 30 minute basal interval and a 60 minute one. It seems like it would make a difference if that choice was changed and it just seems to me like the smaller we can make the loop with the basal changes the better, even if we are swimming down an RF jamming river ; )
Anyway, folks, I am more than excited to be here, to face a possibly new and more effeective approach to combatting a disease I've had for 38 years and quite frankly I'm pretty darn sick of. I guess for the first, if you people are not waiting, I know that I am not waiting, so I think I'm pretty safe in saying for the first time that #WeAreNotWaiting.
Ben West
@bewest
Nov 25 2015 19:07
:-)
mannixlab
@mannixlab
Nov 25 2015 19:07
I am smart enough to know that I have to get some sleep ; ) and I am cooking my first Thanksgiving tomorrow for my three boys. Can wait to get this thing starting. Can't wait!
Matthias Granberry
@mgranberry
Nov 25 2015 19:07
I'm not saying that I don't want it, I'm saying that I don't think it's useful. :)
Dana Lewis
@danamlewis
Nov 25 2015 19:07
There's a balance between designing our "if we had no limitations" system and a "I can make a closed loop but have to use 30 min temp basal rates, how do I make the best loop with that?" :) (so just know many of us are in the second camp, but @bewest can also point you to people who are exploring building pumps and other things, too)
Scott Leibrand
@scottleibrand
Nov 25 2015 19:08
@mannixlab no need to write code. The tests are almost English. :-)
Matthias Granberry
@mgranberry
Nov 25 2015 19:09
and the t:slim allows 15-minute basals and sets them by the minute (millisecond in C), but I haven't had any luck teasing out a way to issue insulin via the serial interface.
Lori
@LoriLori
Nov 25 2015 19:10
yes bright future of open aps t:slim :+1:
Dana Lewis
@danamlewis
Nov 25 2015 19:10
:)
Lori
@LoriLori
Nov 25 2015 19:11
and wire connection, no more connection lost :)
Scott Leibrand
@scottleibrand
Nov 25 2015 19:11
it('should temp to 0 when low w/o IOB', function () {
        var glucose_status = {"delta":-5,"glucose":75,"avgdelta":-5};
        var output = determinebasal.determine_basal(glucose_status, currenttemp, iob_data, profile);
        output.rate.should.equal(0);
        output.duration.should.equal(30);
    });
Chris Oattes
@cjo20
Nov 25 2015 19:11
Wanting per-minute control of basal doses is like trying to change the thermostat in your house every minute to try and keep it at the right temperature
mannixlab
@mannixlab
Nov 25 2015 19:12
@danamlewis I'm totally with you. Don't get me wrong, I'm not complaining. I know I don't have to write code to implement it, but if I could improve it by learning to write code and make the changes that I think would improve Medtronic's next pump, then I guess I'm just hoping you guys know how to write the equations. I certainly don't, but after 38 year, I'm willing to learn code, French and learn how to wrestle a buttered pig if it is going to make an amazing thing that all of you has put together to the rest of the world. I hope that that can happen in my lifetime and I guess, what I'm saying is that I'm pretty freaking psyched about how much the OpenAPS will help me, but I have to tell you, I'm much more psyched about all of the young kids who are going to be helped by all the frankly, incredible work you have all done here. I cannot tell you how grateful and hopeful I am.
Matthias Granberry
@mgranberry
Nov 25 2015 19:12
I wouldn't hold your breath on it. It looks like the command I thought was to issue insulin is probably a command to calibrate the pressure sensor used to read reservoir volume during setup, but I'm still digging through code to see if I've missed anything.
mannixlab
@mannixlab
Nov 25 2015 19:13
@cjo20 O
@cjo20 I'm not saying it has to be per minute, but I would think that 15 minutes and 10 minutes intervals would just make it a little easier to attack.
Scott Leibrand
@scottleibrand
Nov 25 2015 19:13
@mannixlab there shouldn't be much of a learning curve to start writing those it('should tests. :)
Matthias Granberry
@mgranberry
Nov 25 2015 19:14
@cjo20 it's worse than that. It's like trying to adjust the boiler that controls the radiant heating system installed under your floorboards to keep the house at the right temperature.
when someone keeps opening windows at random.
and blows on your thermostat
Ben West
@bewest
Nov 25 2015 19:14
lol
mannixlab
@mannixlab
Nov 25 2015 19:15
@scottleibrand I'm not ready yet. I believe the Carelinks should be arriving today or Friday and then I will have everything. @scottleibrand where should I go now to read the code, download it or whatever so I can prepare myself for this.
Dana Lewis
@danamlewis
Nov 25 2015 19:15
@mannixlab :)
Chris Oattes
@cjo20
Nov 25 2015 19:15
mgranberry: sometimes a volcano happens
Dana Lewis
@danamlewis
Nov 25 2015 19:15
Make sure you look at the reference design and the docs - will help you wrap your head around it as you get started
Scott Leibrand
@scottleibrand
Nov 25 2015 19:16
@mannixlab the tests are at https://github.com/openaps/oref0/blob/master/tests/determine-basal.test.js, but yeah, read through OpenAPS.org and all the https://github.com/openaps/docs first before you dive into tests. :)
there is in fact a link to the tests toward the end of the docs. :)
Chris Oattes
@cjo20
Nov 25 2015 19:17
mannixlab: it's more a question of how much difference getting that 0.2u of insulin 15 minutes earlier is going to make spread out over the next 4 hours that the insulin is active for
mannixlab
@mannixlab
Nov 25 2015 19:17
@scottleibrand I hate to say it, I need to sleep, it was a ridiculously long night and then Thanksgiving, but I'm in. I'll read all of the stuff. Can't wait to get started. Have an amazing Thanksgiving folks. Wish me luck with the bird. It could get ugly ; ) Peace.
Dana Lewis
@danamlewis
Nov 25 2015 19:18
:) happy thanksgiving!
Chris Oattes
@cjo20
Nov 25 2015 19:18
o/
mannixlab
@mannixlab
Nov 25 2015 19:18
You too.
Scott Leibrand
@scottleibrand
Nov 25 2015 19:18
:-) enjoy your holidays!
mannixlab
@mannixlab
Nov 25 2015 19:23
One more thought. I feel like you guys, or some doctors or better yet the whole Diabetes Community Wikipedia'd up could basically be online advisors for people to analyze and help in making basal rate decisions based on the data. If we log all of our blood sugars, stream it to the cloud and to the group, which will grow as time goes on, why couldn't we pull a Khan Academy type of thing where instead of just one person, or two people (even a happy couple ; ) we could have a crowsourced group that almost votes on suggestions for algarithmic decisions. That way, people entering this automated and basal rate adjusting world could have a ton of more experienced eyes on the data as well as tons of case studies from our of the "wiki's" past decisions and how effective they were. Essentially Bill Gates, gave this guy, Salvador Khan a ton of money to practically re-invent teaching by offering interactive videos on math and socials studies all "written and lectured" by one guy.
I guess I thought of this because after following some of you on Twitter for about a year, and now getting notificiations in real time as you analyze data and answer questions, it seems like a pretty good darn model, not just for Diabetes, but for any disease where data analysis and action is of high importance.
Anyway, "Food for thought" before Thanksgiving.
Sorry, I couldn't resist ; )
Dana Lewis
@danamlewis
Nov 25 2015 19:34
Heh. Yes. It's on the idea board, but with all the ideas we need more hands to make this and other things happen :)
kenstack
@kenstack
Nov 25 2015 20:07
@cjo20 let me know if you need any help on the curves - I've never compared Walsh to ooenaps just to the Medtronic curves and once to one of the other pumps ... I think tslim ... All 3 are really close
Peter Miller
@ochenmiller
Nov 25 2015 20:12
Am I hearing that someone is close to cracking open the tslim?!! Now that we're on openaps 24/7, we have a tslim "in the drawer". I'd love to experiment. Is it taking any kind of commands via serial - other than dumping history?
Dana Lewis
@danamlewis
Nov 25 2015 20:16
@ochenmiller -> @mgranberry Said don't get hopes up..but.. :)
Chris Oattes
@cjo20
Nov 25 2015 20:17
kenstack: I think the problem wit hthe activity curve is that it's comparing against a 5-minute activity curve for openaps
Matthias Granberry
@mgranberry
Nov 25 2015 20:17
@ochenmiller I've decompiled the firmware and I have been going through it. I can get the ambient pressure and temperature, but nothing too exciting.
I can also read the battery level.
Chris Oattes
@cjo20
Nov 25 2015 20:18
mgranberry: ambient pressure? Auto-detect taking off on a plane and reduce delivery to account for the extra amount delivered due to drop in air pressure :P
Matthias Granberry
@mgranberry
Nov 25 2015 20:18
Factory reset and clear flash too. Nothing I'd actually want to do, though.
Peter Miller
@ochenmiller
Nov 25 2015 20:21
That's all progress in my book! Holy grail: turn on the bluetooth transceiver that we all know is built in but shut down.
Matthias Granberry
@mgranberry
Nov 25 2015 20:23
There is what appears to be a peek/poke command pair and a buffer overflow too, so I can do it if I want to play dangerously.
Peter Miller
@ochenmiller
Nov 25 2015 20:23
I gather that the iLet folks were testing with Tslim, and that Tandem gave them units with bluetooth enabled.
Matthias Granberry
@mgranberry
Nov 25 2015 20:24
yes. They have a firmware build that enables ble comms. I've found a block of code (that I can't access) that appears to turn on a special mode that allows different commands to run. I suspect that's all BLE related
that block of code generates ack packets like the rest of the protocol does, so it is clearly comm-related. If I used the peek commands to dump all of the pump's memory and looked for some of the basal delivery structures I could make changes to those with the peek command, but who knows what side effects there would be.
there isn't any malloc going on, so I'm pretty sure it would be visible.
Matthias Granberry
@mgranberry
Nov 25 2015 20:32
maybe there is a command to jump to a location. If such a thing exists it might be possible to do it all safely.
Peter Miller
@ochenmiller
Nov 25 2015 20:36
I think maxbasal on tandem is only 200%, so one might need to alter that aspect in order to use it with openaps. Or be willing to bolus...
though, even a lowbg basal suspend could be worthwhile for some people...
Dana Lewis
@danamlewis
Nov 25 2015 20:41
Is there not an absolute amount setting? There is on Medtronic
Ali Mazaheri
@amazaheri
Nov 25 2015 20:42
not on tSlim :(
Dana Lewis
@danamlewis
Nov 25 2015 20:42
Or could you game it with a pattern with a high basal you don't use. But would configure the max to be higher?
Ali Mazaheri
@amazaheri
Nov 25 2015 20:42
its % only
Dana Lewis
@danamlewis
Nov 25 2015 20:43
% of current, or % of highest basal?
Ali Mazaheri
@amazaheri
Nov 25 2015 20:43
current
catching up on all the convo here !
Dana Lewis
@danamlewis
Nov 25 2015 20:43
Lame :/
Peter Miller
@ochenmiller
Nov 25 2015 20:43
This message was deleted
Scott Leibrand
@scottleibrand
Nov 25 2015 20:44
200% of current is probably sufficient for overnight
Matthias Granberry
@mgranberry
Nov 25 2015 20:44
@danamlewis I have a 11:59-12:00 basal minute that disables the hard limit. There is a warning beep when temps go high, but only a warning.
Ali Mazaheri
@amazaheri
Nov 25 2015 20:44
had a night of hell, after being in range for 3 days first a site failure, then sensor failure and fighting a nasty high all day. Had 5 shots of Espresso and all good reading lol
i have gone %250
not over night
Ben West
@bewest
Nov 25 2015 20:45
oy
Dana Lewis
@danamlewis
Nov 25 2015 20:45
Poor Sam, poor parents :/
Ali Mazaheri
@amazaheri
Nov 25 2015 20:45
I jinxed myself
after the tweet lol
Peter Miller
@ochenmiller
Nov 25 2015 20:46
@mgranberry , so the max % is based on the highest rate? Nice hack!
Ali Mazaheri
@amazaheri
Nov 25 2015 20:46
all good he is finally back in 150s
Peter Miller
@ochenmiller
Nov 25 2015 20:48
@amazaheri , I sympathize! Site and sensor failures are way more upsetting with openaps in the mix. I find myself watching (obsessing) over the noise in the raw cgm data. Hoping hoping it will settle down.
Ali Mazaheri
@amazaheri
Nov 25 2015 20:48
its a monster called diabetes! but all of us are kicking its behind!
Matthias Granberry
@mgranberry
Nov 25 2015 20:49
This message was deleted
Peter Miller
@ochenmiller
Nov 25 2015 20:49
Ssshhhh! It can hear you!
This message was deleted
Ali Mazaheri
@amazaheri
Nov 25 2015 20:50
:shipit:
Dana Lewis
@danamlewis
Nov 25 2015 20:52
Lol
kenstack
@kenstack
Nov 25 2015 20:53
@cjo20 feel free to send me the data happy to take a look
Dana Lewis
@danamlewis
Nov 25 2015 21:10
@eyim how have things been going? have you been running full overnights without problems yet?
Chris Oattes
@cjo20
Nov 25 2015 21:27
@kenstack I think comparing against the 5-minute activity curve from oref is a pain :P
kenstack
@kenstack
Nov 25 2015 21:30
could be :)
Chris Oattes
@cjo20
Nov 25 2015 21:30
@kenstack http://imgur.com/mbuBm6i is what I come up with. The Walsh Act 5 min is done by summing the activity over the next 5 minutes
Lori
@LoriLori
Nov 25 2015 21:33
then it needs to normalize to sensitivy?
Jim Matheson
@jmatheson
Nov 25 2015 21:44
@scottleibrand , looking at https://gist.github.com/scottleibrand/df1019f8e12bac9030dc in the Algo Desc "For example, 40g / (10g/U) - 2U boluses - 0.5U basal IOB = 1.5U worth of uncovered carbs.” I don’t understand why you are subtracting out the basal. The basal is working and needed in the background and unrelated to the 2 units needed for the carbs.
Chris Oattes
@cjo20
Nov 25 2015 21:46
Does Basal IOB mean additional bolus?
Jim Matheson
@jmatheson
Nov 25 2015 21:46
it could, but i would then assume it was some sort of correction temp
Scott Leibrand
@scottleibrand
Nov 25 2015 21:50
The whole point of meal assist is for basal to assist with covering for meals instead of boluses. So you have to count net IOB against carbs to see if you've gotten to the point where you've completed the meal bolus.
Jim Matheson
@jmatheson
Nov 25 2015 21:52
ok, but don’t we need to factor in that some of that Basal is present for traditional background basal reasons?
Dana Lewis
@danamlewis
Nov 25 2015 21:54
This is net, not gross, basal iob. so only reflects temp adjustments to normal
Peter Miller
@ochenmiller
Nov 25 2015 22:01
I've been thinking a lot lately about the idea of meal assist, particularly about a super easy mechanism to let openaps know a meal is about to happen. Pebble makes sense, of course, but I wanted an item that could be carried and signal the unit in the same way other elements do. I was thinking a building a wixel based fob set to transmit a code (much like the G4) transmitter. The wixel onboard openaps would listen (just as it does for cgm info). Perhaps the fob would have two buttons, first to activate, second to count up: no meal, snack, medium, large, etc. Then the wixel would retransmit the info over the next five minutes to be sure it was received.
There are also a lot of IOT devices out there that might be able to do this via BT
Ben West
@bewest
Nov 25 2015 22:03
yeah, looking at adding mqtt to openaps
that will allow bidirectional messaging
kenstack
@kenstack
Nov 25 2015 22:03
@cjo20 cool I'll look tonight - so what you are trying to calc (sorry if I misunderstood) is based on a 1u "bolus" or some reference amount of insulin what would the effect be in the next 5 min from any point in time ? Ie the local 5 minute integral of the job curve x sensitivity ?
Ben West
@bewest
Nov 25 2015 22:03
also looking at ble endpoints for openaps
this is embedded device, would be nice to configure it via app over ble
linux makes creating ble devices relatively easy
Peter Miller
@ochenmiller
Nov 25 2015 22:04
based on @LorelaiL 's work, I added a ble dongle to the RPi a few days ago
starting to play with ways to talk amongst local devices, including iPhone
wish Pebble would pair with linux
Lori
@LoriLori
Nov 25 2015 22:05
ow its just PoC, found it can't do big files, like 90bytes more
Chris Oattes
@cjo20
Nov 25 2015 22:05
kenstack: trying to get a comparison between openaps curves and yours. The openaps curves for IOB are based on a 5 minute period
Lori
@LoriLori
Nov 25 2015 22:06
@ochenmiller would need to pause between packets, just starting to learn advanced JS
may be @bewest Bluez would be more reliable
and ond @bewest finishes Bluez dex share, bleno can't be running, it requires exclusive access to hci
Peter Miller
@ochenmiller
Nov 25 2015 22:08
was thinking of GATT serial profile, so that the phone could receive items just like xDrip
Ben West
@bewest
Nov 25 2015 22:08
I can try bleno instead
hmmm
Lori
@LoriLori
Nov 25 2015 22:08
bleno is single device :(
Ben West
@bewest
Nov 25 2015 22:08
yeah working with bluez through their dbus interface right now
Lori
@LoriLori
Nov 25 2015 22:08
you can't connect more devices with bleno
Ben West
@bewest
Nov 25 2015 22:09
that's what they expect/want people to do
figure it'll be more reliable than the gatttlib and other techniques like bleno, where they are mucking around in the internals
Lori
@LoriLori
Nov 25 2015 22:09
but bluez is nice can do as many devices as adapter supports
Ben West
@bewest
Nov 25 2015 22:09
ah, right, bleno will bind to your entire hardware stack
but there's environment variable you can tell it to use stack 2 or whatever
the "first" stack"
Lori
@LoriLori
Nov 25 2015 22:10
with 2nd adapter?
Ben West
@bewest
Nov 25 2015 22:10
believe so
bluez is confusing me plenty though
Lori
@LoriLori
Nov 25 2015 22:11
bleno talks to chip directlly, doesn't allow more then 1 talking to chip
Ben West
@bewest
Nov 25 2015 22:11
at one time
the proc will bind to the adapter you specify
Lori
@LoriLori
Nov 25 2015 22:11
where bluez does multiplexing for you
Ben West
@bewest
Nov 25 2015 22:11
sudo BLENO_HCI_DEVICE_ID=1 node <your file>.js
yeah
Lori
@LoriLori
Nov 25 2015 22:11
yes but 1 USB BLE is one hci0
Ben West
@bewest
Nov 25 2015 22:11
bluez + dbus handles a lot
right
so will bluez do both clients and server at same time on same chip?
I wasn't clear on that
Lori
@LoriLori
Nov 25 2015 22:12
do you write bluez in C?
Ben West
@bewest
Nov 25 2015 22:12
no, I'm using dbus API
Lori
@LoriLori
Nov 25 2015 22:12
from py?
Ben West
@bewest
Nov 25 2015 22:12
yeah
dbus takes care of threading and whatnot
Lori
@LoriLori
Nov 25 2015 22:12
library ? or writing own?
Ben West
@bewest
Nov 25 2015 22:12
in previous thing, gatttlib, they were doing that underhood sort of
hmmm
Lori
@LoriLori
Nov 25 2015 22:13
wish I know .py
Chris Oattes
@cjo20
Nov 25 2015 22:14
@kenspike that kick in the tail of "activity" from your curves looks a little viscious
Ben West
@bewest
Nov 25 2015 22:14
I can do js instead
I have a js driver better suited for this
can use bleno o bluez via https://github.com/sidorares/node-dbus
Lori
@LoriLori
Nov 25 2015 22:16
wish there was dbus and bluez on win :(
Ben West
@bewest
Nov 25 2015 22:16
they have com/Framework/registry
dbus seems organized around nice human readable names
kenstack
@kenstack
Nov 25 2015 22:22
@cjo20 yeah :) guessing it's a slope issue you don't see when you use it because the amount left is so small - but I'll check it out - weird for a polynomial to do that .. Will check it out
Ben West
@bewest
Nov 25 2015 22:24
thoughts on setting up first-timers-only or up-for-grabs labels to issues? https://medium.com/@kentcdodds/first-timers-only-78281ea47455#.2mygsihxc
Chris Oattes
@cjo20
Nov 25 2015 23:39
kenstack: it's the ^4 term kicking in i think
Chris Oattes
@cjo20
Nov 25 2015 23:47
quartics have 3 turning points. which means it'll always start heading back up at some point
kenstack
@kenstack
Nov 25 2015 23:48
Could be round off too at that level - will check it later - was that the 3 hour or 4 hour curve
Chris Oattes
@cjo20
Nov 25 2015 23:48
ideally, that 3rd turning point would be after the end of dia
3 hour