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

17th
Jan 2015
Dana Lewis
@danamlewis
Jan 17 2015 00:07
Heh, pre bolus makes more sense than Pepe :) although how much prebolus do you do? Is it based on carbs that he thinks he's eating? Still want some others to test eating-soon concept as a way to spike insulin activity, but it's not dependent on amount of carbs and this a lot safer
Chris Oattes
@cjo20
Jan 17 2015 00:14
how far in advance is the pre-bolus?
diabeticgonewild
@diabeticgonewild
Jan 17 2015 00:14
Deleted...too long for a chat. Sorry
Ben West
@bewest
Jan 17 2015 00:15
oh wow, lot there
Dana Lewis
@danamlewis
Jan 17 2015 00:16
@cjo20 For me, I set eating-soon mode up to an hour before the meal. It resets my target to 80. That's usually enough time for insulin activity to be spiking when eating, but not enough to cause a low or not be able to avoid with a low temp if something delays or ruins a meal
diabeticgonewild
@diabeticgonewild
Jan 17 2015 00:16
Sorry, I don't know of a more appropriate place to put this content. I know I have to try to minimize overload.
Ben West
@bewest
Jan 17 2015 00:16
blog post is good
I use gist to prep things a lot
diabeticgonewild
@diabeticgonewild
Jan 17 2015 00:16
Got it, next time I will turn to Gist. Sorry, all.
Ben West
@bewest
Jan 17 2015 00:16
something where the content can be referenced/reused if your going to put that much work into it
put it in a chat room, it just goes poof ;-)
Chris Oattes
@cjo20
Jan 17 2015 00:18
I'm not sure we're ever going to get insulin that can act in 2 minutes
Dana Lewis
@danamlewis
Jan 17 2015 00:18
I was originally taught prebolus meant 15 min before a meal, and whatever your meal bolus was you did then. Because I don't always know how much I can/will eat, that caused a lot of lows or forced me to eat rescue carbs more than I'd like. Want more people to test eating-soon style preboluses and see if that's more effective for more people than doing preboluses based on carbs alone
Chris Oattes
@cjo20
Jan 17 2015 00:19
@danamlewis so what exactly do you do an hour before you eat?
diabeticgonewild
@diabeticgonewild
Jan 17 2015 00:20

I deleted the long post, and I apologize for it.

@danamlewis , @scottleibrand , and others here is what I was trying to explain for the logic of low carb with "closed-loop", which is really a misnomer (I use closed-loop too, fwiw).

https://gist.github.com/diabeticgonewild/38c6fdd42a512c73d678

Dana Lewis
@danamlewis
Jan 17 2015 00:22
@cjo20 I hit the eating soon button on #DIyPS (not always precisely an hour but usually anything is better than nothing) Instead of targeting me to 100, #DIYPS then changed the targets to 80, and thus recommends a bolus to correct me to 80. I then do that bolus. And then I don't think about prebolus ing until I sit down and start eating and do a regular #DIYPS meal bolus
Chris Oattes
@cjo20
Jan 17 2015 00:23
ah, ok
Dana Lewis
@danamlewis
Jan 17 2015 00:23
But that extra insulin peaks usually as the first carbs of my meal are starting to hit, so the rise from the meal is minimal and rarely see a true /\ type of spike anymore
Ben West
@bewest
Jan 17 2015 00:24
yeah, that's good idea
change the target just before meal is likely to happen
Chris Oattes
@cjo20
Jan 17 2015 00:24
what are your pre-meal BGs usually?
Dana Lewis
@danamlewis
Jan 17 2015 00:27
Usually I am running 110 or 120? if I'm high, or if I was on the higher end of normal (like 120), I usually have .5-1.5 that I do for a prebolus. The challenge is if I wake up at flat 80s and decide to eat a huge carby breakfast, I am more conservative because it's so easy to slip from 80 down to a low from other factors like pooled insulin. But rarely have that problem with any other meal, when I'm "correcting" down to 80 from 110 or higher as my before-meal bolus strategy to get some insulin activity going
@bewest exactly. Eating soon mode changes the target for 1 hour, or As soon as I enter carbs, it reverts to normal target levels as they were previously set.
Chris Oattes
@cjo20
Jan 17 2015 00:29
so are you usually 110 or 120 when you correct down to 80, or by the time you sit down to eat are you 110-120?
Ben West
@bewest
Jan 17 2015 00:29
there's a command for that
I often try to set up descending trend just before eating
Dana Lewis
@danamlewis
Jan 17 2015 00:30
120 and correct to 80. So when I sit down to eat, I would be starting to drop or about to start, but still have time to stop it from crossing low threshold if I need it.
Ben West
@bewest
Jan 17 2015 00:30
yeah, just starting to drop
Dana Lewis
@danamlewis
Jan 17 2015 00:30
@bewest yup. But this automates and is More precise than me as a human wants to be every single time I want to eat something :)
Ben West
@bewest
Jan 17 2015 00:30
but you get some time to handle it
Dana Lewis
@danamlewis
Jan 17 2015 00:31
Exactly. And if something unexpected happens or changes drastically, as it often does because, diabetes, you get a warning when the projected drop drastically changes. Like flight simulator :)
Chris Oattes
@cjo20
Jan 17 2015 00:34
what would be really cool is a device with a 2.4GHz and 838MHz transceivers, so people could use dexcom sensors with medtronic pumps
Dana Lewis
@danamlewis
Jan 17 2015 00:34
:)
Chris Oattes
@cjo20
Jan 17 2015 00:35
have you considered trying to get apidra?
diabeticgonewild
@diabeticgonewild
Jan 17 2015 00:35
I am looking more for something closer to autopilot, which is not theoretically possible with the sensors or the insulin (moreso than the sensors), so I intend on eliminating unnecessary variables, for me, which would be CHO intake
@cjo20 , you would need to get a RF translator. There are some sold on Digikey
Dana Lewis
@danamlewis
Jan 17 2015 00:37
@cjo20, can't tell who you're asking that to?
diabeticgonewild
@diabeticgonewild
Jan 17 2015 00:39
Actually, you could get Dexcom readings on an iPhone, directly from the transmitter, using an RF to Bluetooth translator
Chris Oattes
@cjo20
Jan 17 2015 00:39
@danamlewis you :)
@diabeticgonewild I mean an mmcommander with a 2.4GHz radio on it too. Then you'd have one small device which is compatiable with everything on the market
kenstack
@kenstack
Jan 17 2015 00:40
@danalewis pre bolus if I can make it happen is 20-25 min for a big fast carby breakfast or lunch (we have less spike issues afternoon to evening - not sure if it's digestion, sensitivity or what - maybe just have too much basal ....) - if he eats for example his 60g of white rice and I pre bolus say 20 min beforehand I can reduce the spike to maybe 50 vs closer to 100 Pts from steady state
And I prebolus the whole amount
Dana Lewis
@danamlewis
Jan 17 2015 00:41
@cjo20 gotcha :) no, I use Humalog, have never seen a need to switch insulin
kenstack
@kenstack
Jan 17 2015 00:42
Remeeber too he is a hormonal teen - sometimes I'll get a bigger spike sometimes less ... Ugh :)
Dana Lewis
@danamlewis
Jan 17 2015 00:42
@kenstack gotcha. (Still vote for ya'll trying an eating soon mode in addition and see if that does anything, but obviously you can/will do whatever you want and think is best. And in accordance with your health care provider. </disclosure language> ;))
Chris Oattes
@cjo20
Jan 17 2015 00:43
@danamlewis I was thinking that with the faster action profile, you could activate the pre-meal mode closer to meal time, so you'd have more certainty about when food will be ready and could then match the peak better.
kenstack
@kenstack
Jan 17 2015 00:43
@danalewis +1 for making me laugh at disclosure :)
Yes wil try - in fact im thinking of sending Ryan to live with you and Scott - I think about that every time he drives me nuts :)
Ben West
@bewest
Jan 17 2015 00:44
@cjo20 I think people are working at combining the two already
Dana Lewis
@danamlewis
Jan 17 2015 00:44
Lol! We are looking for a 2 bedroom place for after we are married, so we'd have a guest room ;) (or we need a Hawaii trip to do this?! :))
Ben West
@bewest
Jan 17 2015 00:44
@cjo20 my $0.02 is to add test strip holder and module to do the DSP onto the same device
I like hawaii
Chris Oattes
@cjo20
Jan 17 2015 00:45
@bewest add a 4G modem and you wouldn't need to carry a phone any more either :P
Dana Lewis
@danamlewis
Jan 17 2015 00:45
@cjo20 Ya. Although for me the uncertainty for food is related to gluten free availability because of celiac. That's the biggest factor.
Ben West
@bewest
Jan 17 2015 00:45
exactly :-)
Dana Lewis
@danamlewis
Jan 17 2015 00:46
I think a pancreas would be less weight than all this gear we carry...? ;)
Ben West
@bewest
Jan 17 2015 00:46
would love to add SIM card and gsm/cdma module also
Chris Oattes
@cjo20
Jan 17 2015 00:46
I'm not sure how many radios you can fit on one device before it explodes :P
Ben West
@bewest
Jan 17 2015 00:46
whatever, they put 6 radios on that amazon fire
sorry
Dana Lewis
@danamlewis
Jan 17 2015 00:46
Hahaha
Ben West
@bewest
Jan 17 2015 00:46
6 cameras
we don't need 6 cameras
there's 2 or three on moto-g I think
but we do need 6 radios
Dana Lewis
@danamlewis
Jan 17 2015 00:47
But what if the cameras did carb counts? :p
Ben West
@bewest
Jan 17 2015 00:47
ok, we need one maybe
if the 6 cameras can increase accuracy to 100% then cool :-)
but otherwise, I'll gladly trade some of those cameras in for radios
Chris Oattes
@cjo20
Jan 17 2015 00:48
diabeticgonewild
@diabeticgonewild
Jan 17 2015 00:48

@danamlewis , I wish!

This is the best we have, and it's huge and expensive! It allows custom recipes and stuff.

Jason Calabrese
@jasoncalabrese
Jan 17 2015 00:50
just a scale and barcode reader?
diabeticgonewild
@diabeticgonewild
Jan 17 2015 00:51
@jasoncalabrese , I am pretty sure it allows you to enter custom recipes, one way or another. The perfect portions scale is another option.
Jason Calabrese
@jasoncalabrese
Jan 17 2015 00:53
we have the perfect portions scale, almost never enter the codes
diabeticgonewild
@diabeticgonewild
Jan 17 2015 01:21
I feel so lazy! I need to really start programming my particular AP project, instead of writing documentation, reading, and hanging out here (even though all of you are awesome!). I don't have much of an excuse as I am not technically in school right now and I am taking time off. Going to open up MATLAB right now, to start modeling with dummy values
Chris Oattes
@cjo20
Jan 17 2015 01:22
hmm, does anyone know (or want to work out) their carb to bg ratio?
diabeticgonewild
@diabeticgonewild
Jan 17 2015 01:25
"Carbohydrates needed to dose 1 unit of insulin" divided by "insulin sensitivity factor"
So my ICR is 1:12, and my ISF is 55, so it would be 12:55
The inverse of that gives you the approximate value of how much 1 gram of CHO raises your BG in mg/dL. For example, 1 gram of CHO raises my by ~4.58 mg/dL
Chris Oattes
@cjo20
Jan 17 2015 01:28
3.6mg/dl here
1:9, ISF is 32.4/9
err
not /9 :P
diabeticgonewild
@diabeticgonewild
Jan 17 2015 01:31
Yeah, I would tell you how much I weigh to give you an idea about the insulin/CHO/sensitivity relationships, but I gained weight due to being sick with rare autoimmune diseases and I don't like talking about that. :/
Chris Oattes
@cjo20
Jan 17 2015 01:32
which weight system do you use?
diabeticgonewild
@diabeticgonewild
Jan 17 2015 01:32
Pounds. I'm in the US and we use a customary system, obviously.
Chris Oattes
@cjo20
Jan 17 2015 01:33
I'm 212 lb
I'm about 178cm tall (5' 10")()
diabeticgonewild
@diabeticgonewild
Jan 17 2015 01:34
yeah, I'm 5'9" and female but everyone in my family is tall.
Chris Oattes
@cjo20
Jan 17 2015 01:34
I'm trying to lose weight. At least i don't seem to be particularly insulin resistant
my TDD is about 40u at the moment
maybe 50 at a push
diabeticgonewild
@diabeticgonewild
Jan 17 2015 01:35
Yeah, I'm lucky with that respect too. But I roll, so obviously I need to lose weight! I'll leave it at that!!!! :-1:
Chris Oattes
@cjo20
Jan 17 2015 01:36
I might do a cho absorbtion test tomorrow, before the amazing sensor I have dies
It's been spot on for 9-10 days, which for a medtronic sensor is amazing
Dana Lewis
@danamlewis
Jan 17 2015 01:38
@cjo20 would love to know the results of your carbohydrate absorption test if you're willing to share! Looking for more data.
Chris Oattes
@cjo20
Jan 17 2015 01:39
If my BG is sensible and my sensor hasn't died I'd be very willing to share
@danamlewis so is the code that does your BG predictions / dose guessing closed source at the moment?
-guessing. My typing is terrible tonight. Not quite sure how random extra words get in
Dana Lewis
@danamlewis
Jan 17 2015 01:41
We baked the predictions back into a branch of NS, which is the IOB-cob branch - the purple line shows the visualizations Of the prediction
The dose recommendations are not baked in, because that's where it crosses into FDA area if we were to let someone use that as-is. (And there's quite a bit of set up including carb absorption to make sure that you can get good recommendations out of the system).
So we've been suggesting that people get started with IOB-cob branch.
Chris Oattes
@cjo20
Jan 17 2015 01:45
i don't have a setup at the moment, I'm more interested in the code :P How does it deal with multiple stacked meals with regards to tracking carbs left to absorb?
Dana Lewis
@danamlewis
Jan 17 2015 01:46
It stacks the carb decay just like IOB is calculated, based on the initial time entry of each set of carbs. (IMO it does spectacular for stacking food)
Chris Oattes
@cjo20
Jan 17 2015 01:49
i wish I could understand JS better. I'm a C programmer
Dana Lewis
@danamlewis
Jan 17 2015 01:50
My beginnings were c++ and FORTRAN 90, fwiw :)
Chris Oattes
@cjo20
Jan 17 2015 01:51
heh, my very early beginnings were Visual Basic while at school, then Java + C mainly at uni, combined with small projects in a ton of other languages, then I've been developing in C for the last 6 years at work
I'll work it out eventually; just takes a bit to context switch to a new language
diabeticgonewild
@diabeticgonewild
Jan 17 2015 02:03
You almost have to use OOP, in this project. I intend on using MATLAB, using symbolic math (via the toolboxes) to solve for things, instead of numerical methods, to avoid risks in my project. But I am using published AP models, and it's a nonlinear model predictive control.
Chris Oattes
@cjo20
Jan 17 2015 02:06
@danamlewis so with diyps as it stands, you end up getting more adjustments post-meal with higher fat or protein meals?
Dana Lewis
@danamlewis
Jan 17 2015 02:07
Nope. I don't see a difference after meals, unless I goof on my carb guessing by more than ~15 carbs or so.
Chris Oattes
@cjo20
Jan 17 2015 02:08
so it doesn't have much of an impact on your carbohydrate absorbtion rate?
Dana Lewis
@danamlewis
Jan 17 2015 02:08
Correct.
Chris Oattes
@cjo20
Jan 17 2015 02:11
is there a limit to how frequently it can adjust your basal / give boluses?
Dana Lewis
@danamlewis
Jan 17 2015 02:13
I assume you're talking about #DIYPS closed loop? We don't let it do boluses, just higher or lower temp basals. It read/writes from the pump every 3 minutes, so it can adjust temp basals every 3 min if needed
Chris Oattes
@cjo20
Jan 17 2015 02:14
why so frequently if you only have a 30 minute granularity on the basal rates?
Dana Lewis
@danamlewis
Jan 17 2015 02:15
Because it can constantly set the basals higher or lower, based on CGM data and IOB and carb decay. If I'm dropping faster, it'll lower the temp (ie from .7 to .5, setting another 30 min temp)
diabeticgonewild
@diabeticgonewild
Jan 17 2015 02:15
I am pretty sure because Medtronic pumps deliver basal every 3 minutes, too. :smile:
Dana Lewis
@danamlewis
Jan 17 2015 02:15
and sometimes I don't need the full 30 min temp it originally sets, so it readjusts higher or lower or cancels it when needed
Those minute micro adjustments make for really awesome flat BG lines. This was one of my nights this week on the closed loop where I went to bed around midnight and got up at 8! https://twitter.com/danamlewis/status/555426651257847808
diabeticgonewild
@diabeticgonewild
Jan 17 2015 02:18
:+1:
Chris Oattes
@cjo20
Jan 17 2015 02:23
so does it treat each basal delivery as a bolus too then to work out IOB? or the delta between the original basal and the adjusted one?
Dana Lewis
@danamlewis
Jan 17 2015 02:25
Any temp is tracked as a bolus, either pos or negative, and used to calculate iob. So for me, IOB is ALWAYS net, because I manually use temp to zero as a negative correction, and closed loop does the same, although with much more precision of what kind of temps I need.
Chris Oattes
@cjo20
Jan 17 2015 02:28
I'm tempted to write a standalone program to do something similar, see how well it works for me
obviously I'm not going to change my temp basal every 3 minutes :P But if I just stick to entering my enlite BG every 5 minutes
Dana Lewis
@danamlewis
Jan 17 2015 02:28
You should :) there's several folks working on various versions!
Chris Oattes
@cjo20
Jan 17 2015 02:29
how did you verify your duration of action as 3 hours?
just do a bolus with no food and see when BG stops dropping?
diabeticgonewild
@diabeticgonewild
Jan 17 2015 02:30
@danamlewis , I was just playing with a 522 pump and the maximum basal rate that can be set is 35.0 U/h, so I don't think I really need to manually bolus in my case, unless an unexpected high BG crisis occurs! (I am sure there are safety concerns about that, but I don't think I personally will have to worry much about that and low carbing, with some of things I am implementing in MATLAB, which can throw out bad values pretty well.)
Chris Oattes
@cjo20
Jan 17 2015 02:31
I need to work out where Iput my old pumps at some point
diabeticgonewild
@diabeticgonewild
Jan 17 2015 02:32
It's about organizing diabetes
Dana Lewis
@danamlewis
Jan 17 2015 02:33
I highly recommend setting a safety limit by making a reasonable level as the high temp cap (only 2 or 3u for example)
Ben West
@bewest
Jan 17 2015 02:34
there's a command for bolus
I would recommend using it for normal bolus corrections over high jacking your basal
Dana Lewis
@danamlewis
Jan 17 2015 02:35
If you're looping, you shouldn't need "normal bolus" corrections..IMO
Chris Oattes
@cjo20
Jan 17 2015 02:35
@diabeticgonewild I've got a set of shelves just behind me, they're probably buried under a pile of stuff on there somewhere :P As for the rest of the stuff, I can see my pile of pump supplies from where I'm sitting so I place an online order when I see it's low. And I don't really log other than what the pump records by itself
Ben West
@bewest
Jan 17 2015 02:36
even for carbs once we've got good predictors, I plan on showing myself graph of curves, and hitting "dose" button
Chris Oattes
@cjo20
Jan 17 2015 02:36
@danamlewis oh, btw, my question aobut duration of action was directed at you, I forgot the @
diabeticgonewild
@diabeticgonewild
Jan 17 2015 02:36
@danamlewis , what if your program throws out the bad values on its own. Correct, it applies a "correction basal"
Ben West
@bewest
Jan 17 2015 02:36
that's where the safety limits come in handy
Dana Lewis
@danamlewis
Jan 17 2015 02:37
@bewest, true, but for me 'dose' would be implemented as a series of varying high temps. Outcome is same (extra insulin), but safely distributed over time with margins for stopping and reversing. (I'm happy to manually bolus based on its recommendations.)
Ben West
@bewest
Jan 17 2015 02:38
bit part of what I'm interested in is increasing fidelity by reducing errors in transcription
Chris Oattes
@cjo20
Jan 17 2015 02:38
errors in transcription?
Ben West
@bewest
Jan 17 2015 02:38
like entering in data incorrectly
Dana Lewis
@danamlewis
Jan 17 2015 02:39
@cjo20 mine was 4 then based on watching the recommendations vs what actually happened in DIYPS we changed it... Don't remember exactly how we tested that one beyond that, tagging @scottleibrand for extra detail
*sorry, based on the predictions vs what actually happened
Chris Oattes
@cjo20
Jan 17 2015 02:42
@danamlewis just for more information about how it treats temp basals, is it recorded as a series of 'treatment' insulin doses, one every 3 minutes, having given you (temp_basal - default_basal)/20 units?
diabeticgonewild
@diabeticgonewild
Jan 17 2015 02:42

@danamlewis , @bewest , this is one of several things I intend on using for safety limits: http://www.mathworks.com/help/mpc/ref/review.html

An overview of general functionality can be found here: http://www.mathworks.com/products/mpc/features.html#controlling-plants-over-a-range-of-operating-conditions

Ben West
@bewest
Jan 17 2015 02:42
add it to your gist :-)
Chris Oattes
@cjo20
Jan 17 2015 02:43
@diabeticgonewild You don't want to put all of the safety stuff in code you've written. There will be bugs. Having seen code I've written, I'm not sure I'd ever completely trust something I wrote :P
Dana Lewis
@danamlewis
Jan 17 2015 02:43
Btw, the other reason I like the loop to only use temps and have caps on max temps it can do = extra safety thresholds for if you're rising or dropping much faster than expected and it can reasonably happen, easier to alarm and notify me to wake up/jump in and take needed action, either deciding to manually bolus or do rescue carbs.
diabeticgonewild
@diabeticgonewild
Jan 17 2015 02:44
@cjo20 , MATLAB control models with toolboxes and Simulink are used in high-stakes places like refineries all the time.
I am not nervous about errors. More complicated controls are used with MATLAB all the time.
Dana Lewis
@danamlewis
Jan 17 2015 02:45
@cjo20 that's pretty much it. Can't post a screenshot in Gitter from my phone, but my DIYPS IOB log shows varying "doses" of -.05, .03, .05, etc (mixed in with recorded of manual boluses that I do)
Scott Leibrand
@scottleibrand
Jan 17 2015 02:46
@cjo20 in mongodb we record actual temp basal events. For calculations we treat it as micro boluses (+ or -) every 3 minutes, starting 1.5m in.
Dana Lewis
@danamlewis
Jan 17 2015 02:47
@cjo20 big theory here is NEt IOB like I was talking about. No pumps today use temps to give a net number. Dangerous!
Scott Leibrand
@scottleibrand
Jan 17 2015 02:47
For DIA, we basically just eyeballed it against the retrospective predictions in wip/iob-cob
Chris Oattes
@cjo20
Jan 17 2015 02:47
@scottleibrand "temp basal events" being programming a temp basal?
Dana Lewis
@danamlewis
Jan 17 2015 02:47
Trying to talk Medtronic into incorporating this into all their models, starting with threshold suspend - if it suspends and then resumes later, it better track and tell you how much negative IOB you have
Scott Leibrand
@scottleibrand
Jan 17 2015 02:48
ya, they come straight off the pump. Temp basal rate and duration. For cancels, duration is 0.
Ben West
@bewest
Jan 17 2015 02:48
did the temp reporting get fixed the way you wanted?
I seem to remember someone wanting something
Dana Lewis
@danamlewis
Jan 17 2015 02:49
UGH, not yet, and yes that was me!
Ben West
@bewest
Jan 17 2015 02:49
thought it was you
Scott Leibrand
@scottleibrand
Jan 17 2015 02:49
I think so, can't remember what. It basically decided it's good enough. :-)
assuming you mean from decocare.
Dana Lewis
@danamlewis
Jan 17 2015 02:50
You still have zero evidence of a temp basal on the pump unless you hack and pull data off real time
Oh, I thought you meant by Medtronic :)
Chris Oattes
@cjo20
Jan 17 2015 02:50
@danamlewis sorry about all of the questions, thanks for the patience :)
Scott Leibrand
@scottleibrand
Jan 17 2015 02:51
Focus now for us is visualizing what the closed loop is doing with temp basals so we can evaluate it in more detail.
Dana Lewis
@danamlewis
Jan 17 2015 02:51
@cjo20 no worries at all, that's what we/this is here for! :)
Scott Leibrand
@scottleibrand
Jan 17 2015 02:51
And see where normal basals need adjusting etc.
diabeticgonewild
@diabeticgonewild
Jan 17 2015 02:51
@cjo20 , @danamlewis , I don't think I will need the max basal rate with the Model Predictive Toolbox, as I can set minimums and maximums natively for the output variables: http://www.mathworks.com/cmsimages/93626_wl_ModelPredictiveControl_fig3_wl.jpg
Scott Leibrand
@scottleibrand
Jan 17 2015 02:51
but mostly just have pretty pictures to show how it works. :-)
you need a max basal.
If you misplace a decimal point you don't want 20U/hr.
Chris Oattes
@cjo20
Jan 17 2015 02:52
@diabeticgonewild why not just use the extra safety feature of having it on the pump too?
Dana Lewis
@danamlewis
Jan 17 2015 02:52
@scottleibrand and so I can answer more Qs about how it works, since no one seems to want to read my blog post ;) with my crappy excel slide pics :)
Scott Leibrand
@scottleibrand
Jan 17 2015 02:52
Heh
diabeticgonewild
@diabeticgonewild
Jan 17 2015 02:52
@scottleibrand , maybe for sanity's sake
Scott Leibrand
@scottleibrand
Jan 17 2015 02:53
always assume your inputs will be total crap. First principle of QA
Ben West
@bewest
Jan 17 2015 02:53
how were you thinking of looking at insulin action dana?
yes, I always assume my code has bugs
Chris Oattes
@cjo20
Jan 17 2015 02:53
@scottleibrand "and see where normal basals need adjusting etc." being "you end up with +X u/hr at this point every day, maybe your basal is wrong"?
Ben West
@bewest
Jan 17 2015 02:53
everytime I implement tests I find bugs
I've managed to crash meraki.com couple of times
Dana Lewis
@danamlewis
Jan 17 2015 02:53
@cjo20 he was talking about DIA, but Ya, that's how we'll adjust basals from closed looping
diabeticgonewild
@diabeticgonewild
Jan 17 2015 02:54
I know, but the outputs will always be limited no matter what. The only problem I would expect is if it isn't translated properly from MATLAB to the RF signal.
Scott Leibrand
@scottleibrand
Jan 17 2015 02:54
@cjo20: exactly.
Dana Lewis
@danamlewis
Jan 17 2015 02:54
@bewest you mean on the pump, or what we were talking about visualizing?
Scott Leibrand
@scottleibrand
Jan 17 2015 02:54
Dont assume your error checking won't get bypassed somehow. Validate input, not just output
Ben West
@bewest
Jan 17 2015 02:54
like on nightscout or on watch or whatever
Chris Oattes
@cjo20
Jan 17 2015 02:54
@diabeticgonewild thats part of the point of why you need the max basal on the pump.
Ben West
@bewest
Jan 17 2015 02:55
to actually see what the insulin is probably doing
Dana Lewis
@danamlewis
Jan 17 2015 02:55
Ah. On NS I want to use space at top to graph deltas in basal activity to show when it's looping and how much.
Scott Leibrand
@scottleibrand
Jan 17 2015 02:55
Or more generally, show any time a temp basal or extended bolus is active.
Ben West
@bewest
Jan 17 2015 02:55
so scott was mentioning this... you dont want to see the scheduled increase during the day?
Dana Lewis
@danamlewis
Jan 17 2015 02:56
I manually did that for the blog post, but would love to auto visualize it so you can match it to NS display of BGs. Over time you'll be able to spot trends for basal tweaking and also start seeing patterns of what happens for various meals
Ben West
@bewest
Jan 17 2015 02:56
maybe I missed that nuance in your previous post, which post/picture?
it drips down?
Dana Lewis
@danamlewis
Jan 17 2015 02:57
The how looP post works. This is my manual hack to visualize: https://twitter.com/danamlewis/status/544899136701874177
diabeticgonewild
@diabeticgonewild
Jan 17 2015 02:57
I can test it in MATLAB, a lot: You can use functions or the MPC Designer app to run closed-loop simulations of your model predictive controller against linear plant models. The app lets you set up multiple simulation scenarios. For each scenario, you can specify controller set points and disturbances by choosing from several common signal profiles. Examples are step, ramp, sine wave, and random signal.
Ben West
@bewest
Jan 17 2015 02:57
everything would drip down from top
Chris Oattes
@cjo20
Jan 17 2015 02:57
the excel one showing BG vs temp basal / net basal?
Yea
Dana Lewis
@danamlewis
Jan 17 2015 02:58
Yup that one
Ben West
@bewest
Jan 17 2015 02:58
was thinking like wave coming off the top
Chris Oattes
@cjo20
Jan 17 2015 02:58
@diabeticgonewild thats great, really it is. You still shouldn't trust your inputs and outputs
Ben West
@bewest
Jan 17 2015 02:58
and dripping down even more for bolus's bolae?
Chris Oattes
@cjo20
Jan 17 2015 02:59
@diabeticgonewild The maximum on the pump is the safety limit that is least likely to fail
Ben West
@bewest
Jan 17 2015 02:59
red is scheduled?
Dana Lewis
@danamlewis
Jan 17 2015 02:59
I still think there should be a line that is net zero. And then above below to show temp impact
Ya red was my normal basal
Ben West
@bewest
Jan 17 2015 02:59
I was thinking trying to get everything forced in one direction
Dana Lewis
@danamlewis
Jan 17 2015 02:59
Blue was temp, green was net impact compared to usual
diabeticgonewild
@diabeticgonewild
Jan 17 2015 03:00
@cjo20 , how is that, when we are all using the pump in an unintended way in the first place?
Chris Oattes
@cjo20
Jan 17 2015 03:01
@diabeticgonewild How is what? It just seems arrogant to assume that all of the data you produce will be so accurate that you couldn't possibly need the 'last line of defense' on the pump itself when its there anyway
Ben West
@bewest
Jan 17 2015 03:02
dunno, so one I idea i had was to combine
@cjo20 she can do whatever she wants with it :-)
diabeticgonewild
@diabeticgonewild
Jan 17 2015 03:03
I know I will fail. It's a design project. Fail often, succeed sooner.
as IDEO (the design firm) says it
Ben West
@bewest
Jan 17 2015 03:04
somehow it'd be nice to get visual feedback: you're getting 1.0U over next hour, it should decrease bg by 45 points-ish
diabeticgonewild
@diabeticgonewild
Jan 17 2015 03:06
@bewest , the problem with that is there are no agreed upon models for that, although it can be solved for in the steady-state (frequency domain), at 1 minute intervals, which is processor-intensive.
Chris Oattes
@cjo20
Jan 17 2015 03:06
@bewest don't you know how much it should decrease it by; it's aiming for the target you set
Ben West
@bewest
Jan 17 2015 03:06
crux of whole therapy is you take 1.0 unit and it goes down by some amount in some amount of time
sure, in theory if it did that you could simply use bolus wizard every time
as-is, i'm wondering if it's visually obvious (with experience) when the wizard would fail
or if the predictors as dana has them will help visually reveal what's happening and why
worst case is just line, but it'd be nice to have swirls coming off treatment events, like directly off bg marker
swirls coming off bgs showing likely thing to happen
so you end up with a bg fog almost, with waves of stuff kind of pushing it up or down
diabeticgonewild
@diabeticgonewild
Jan 17 2015 03:11
Probably the most reliable CGM value prediction model comes from this, but it determines CGM values independently of insulin. A Novel Adaptive-Weighted-Average Framework for Blood Glucose Prediction
(let me upload a photo of how it works)
taking a screenshot
Ben West
@bewest
Jan 17 2015 03:12
this is the visualization though... you can swap out the math to do it
diabeticgonewild
@diabeticgonewild
Jan 17 2015 03:12
yeah, implement the math, and graphically produce the BG prediction model
Ben West
@bewest
Jan 17 2015 03:13
I don't want a wall of numbers, do want something that shows uncertainty when it's present
diabeticgonewild
@diabeticgonewild
Jan 17 2015 03:13
so displacement?
All you really need is a test for the developed model losing stability. Once that is flagged, you take action as a human with overrides. MATLAB does that for you.
Chris Oattes
@cjo20
Jan 17 2015 03:16
what could you gain information about uncertainty from? Rapidly varying sensor values (i.e. bad sensor) and adjustments that are increasing in magnitude each time
not sure if i can think of anything else
Ben West
@bewest
Jan 17 2015 03:16
if you look at nightscout's current predictor
I'm the one that added the fading out
diabeticgonewild
@diabeticgonewild
Jan 17 2015 03:17
cool
Ben West
@bewest
Jan 17 2015 03:17
that's what I mean... after 15 minutes, it's really not as a certain
it hit at the same time they took out the single prediction and put in the 90% confidence cone
but in theory we could color the cone the same way with gradient/fading
Chris Oattes
@cjo20
Jan 17 2015 03:17
I've not actually seen a live nightscout page...
Ben West
@bewest
Jan 17 2015 03:17
ah
diabeticgonewild
@diabeticgonewild
Jan 17 2015 03:18

is it autoregressive?

So far weighted averages of multiple models has been the most promising, but the programming is labor-intensive and math intensive.

Ben West
@bewest
Jan 17 2015 03:18
lemme se
Chris Oattes
@cjo20
Jan 17 2015 03:18
what is the red dot on the graph?
it's playing music!
Ben West
@bewest
Jan 17 2015 03:21
the blue dots fade out
red dot is finger sticks
Chris Oattes
@cjo20
Jan 17 2015 03:27
@bewest if you want to display a measure of uncertainty, colour the dots
Ben West
@bewest
Jan 17 2015 03:27
was thinking of ditching the dot shape
smearing the ink up or down due to carbs/insulin
diabeticgonewild
@diabeticgonewild
Jan 17 2015 03:28
what about visually representing displacement
Ben West
@bewest
Jan 17 2015 03:28
so getting used to think of glycemia as behavior, less about one number
it's probably in some range in there, meters are +/- 20% anyway, right?
Chris Oattes
@cjo20
Jan 17 2015 03:29
isn't that what the cone represents now? or am I missing something?
Ben West
@bewest
Jan 17 2015 03:29
right, but that's one algorithm based on last 2 glucose
diabeticgonewild
@diabeticgonewild
Jan 17 2015 03:31
that's why weighted averages of different models is the way to go, at this point of time, except the programming of that is very math and labor intensive
At least that's my opinion
Chris Oattes
@cjo20
Jan 17 2015 03:32
@bewest sorry, I think I'm being dense here, is it the representation or the calculation you want to change? Because they seem like two seperate problems
Ben West
@bewest
Jan 17 2015 03:33
they are different
I don't care about how it works underneath
there need to be dozens of choices probably
I'm interested in the visualization... how it gets represented
I like dana's idea of using net basal instead somehow
diabeticgonewild
@diabeticgonewild
Jan 17 2015 03:35
convert IOB to the actual magnitude of blood glucose displacement that is theoretically going to occur against predicted weighted average BG values from different models
Chris Oattes
@cjo20
Jan 17 2015 03:38
net basal would just show how much the pump was having to auto-correct for you
diabeticgonewild
@diabeticgonewild
Jan 17 2015 03:41
correct. You have to relate all of the variables to a universal magnitude measurement. The independent variable is the CGM glucose, so focusing on converting the other measures to correspond to that independent variable, both in the current, past and predicted forms would likely be the most valuable way of utilizing visualization techniques.
Kind of like an Ambulatory Glucose Profile for all of the variables with respect to CGM values and insulin.
also COB

Actually @bewest , I think I found your answer, and it's an open-source pub. This motivated the introduction of the so-called Control Variability Grid Analysis (CVGA) [279], which associates to each patient a point in a plane (Fig. 33). The two coordinates correspond, via a nonlinear transformation, to the minimal and maximal glucose value in the considered time interval.

http://www.ncbi.nlm.nih.gov/pmc/articles/PMC2951686/

Chris Oattes
@cjo20
Jan 17 2015 03:46
I'm not convinced that the cone isn't the best way of showing the future uncertainty, however that number is generated. I would think that viewing net basal would be something for a different screen/graph
diabeticgonewild
@diabeticgonewild
Jan 17 2015 03:47
Instead of using patients as points, use time points (another independent variable) in representation for the control variability grid analysis.
Chris Oattes
@cjo20
Jan 17 2015 03:47
a display of the last couple of hours of net basal might be useful from the perspective of "hmm, that doesn't look right, I might have to intervene"
diabeticgonewild
@diabeticgonewild
Jan 17 2015 03:48
@cjo20 , I don't think the cone is the best way of displaying future uncertainty either. We all agree on that, I think.
Chris Oattes
@cjo20
Jan 17 2015 03:48
@diabeticgonewild that isn't what I said
Ben West
@bewest
Jan 17 2015 03:49
indeed net basal only shows you the deltas away from nominal
Chris Oattes
@cjo20
Jan 17 2015 03:55
@bewest you could average the net basal for the last 3 hours, and display that as a single item (circle that changes colour / size next to current BG perhaps) to give an indication of recent volitility
diabeticgonewild
@diabeticgonewild
Jan 17 2015 04:32
@bewest , this is the best visualization example that I have found so far http://www.ncbi.nlm.nih.gov/pmc/articles/PMC3369012/figure/F3/
Chris Oattes
@cjo20
Jan 17 2015 05:01
@scottleibrand should line 1513 of client.js have an "else if" instead of "if"?
(looking at the iob-cob branch)
Scott Leibrand
@scottleibrand
Jan 17 2015 05:06
Probably? I think that is an error check that doesn't ever actually get triggered.
Chris Oattes
@cjo20
Jan 17 2015 05:08
fair enough. Thought i'd point it out. Ah, yeah, it checks the treatment created time is in the past before it calls iobCalc
Scott Leibrand
@scottleibrand
Jan 17 2015 05:38
Please do go ahead and submit a pull request to fix it though.
Chris Oattes
@cjo20
Jan 17 2015 05:47
@scottleibrand done
Scott Leibrand
@scottleibrand
Jan 17 2015 05:55
Thanks. Are you running wip/iob-cob yet?
(have you tested the fix, or does that still need to be done before merging?)
Chris Oattes
@cjo20
Jan 17 2015 05:58
I'm not running nightscout at all at the moment, I don't have the devices
so it needs to be tested by someone
I need to go and get some sleep, being 6am :P
Scott Leibrand
@scottleibrand
Jan 17 2015 06:05
K. Thanks and g'night/morning. :-)
Sulka Haro
@sulkaharo
Jan 17 2015 13:12
We really need to refactor the code to be much more modular asap to enable easy implementation of multiple IOB/COB/ISIG algos and multiple contributors in the first place. Any recommendations / decisions on which framework to use?
Chris Oattes
@cjo20
Jan 17 2015 13:42
could you not just make and IOBCalc class, and have different algorithms inherit from that?
Chris Oattes
@cjo20
Jan 17 2015 14:45
@danamlewis I've got an excel file with my carb absorbtion test results if you're interested
Chris Oattes
@cjo20
Jan 17 2015 15:04
Scott Leibrand
@scottleibrand
Jan 17 2015 15:45
Sweet thx.
Chris Oattes
@cjo20
Jan 17 2015 15:56
@scottleibrand let me know if you want any more info
Sulka Haro
@sulkaharo
Jan 17 2015 16:44
@cjo20 Sure that'd probably be part of it. But how to split the code to files and only loading things as needed etc is a solved problem, and using a ready made dependency injection framework might be better than rolling one's own. I guess this would be a good question for Stack Overflow - how to allow people to work on the same project coming up with alternate implementations with minimal hassle.
Chris Oattes
@cjo20
Jan 17 2015 17:48
@danamlewis @scottleibrand do you have many data points for different people for carb absorbtion rate?
Dana Lewis
@danamlewis
Jan 17 2015 20:03
@cjo20 thanks! Will take a look. Only had 1-2 others run full test, and a few others played around with it in order to use IOB-cob and get results that matched, so they did it that way without running test
Scott Leibrand
@scottleibrand
Jan 17 2015 20:10
Wow, so with a 15m delay, you have a ~44g/hr carb absorption rate. That's the highest we've seen so far. You must have a workhorse of a GI system. ;-)
Guess that makes some sense given that you're a normal size adult male. :-)
Dana Lewis
@danamlewis
Jan 17 2015 20:14
I'd love more data if anyone else wants to run it/encourage others to run it!
Ben West
@bewest
Jan 17 2015 20:15
@sulkaharo d3 has a factory function pattern
this uses the factory pattern a bit https://gist.github.com/bewest/cdef7a53f9af5e2286bc
the also part I guess
so in theory every predictor would be a bit like d3 code
some function that takes options
that probably gives you a function that you then use to process the data
Chris Oattes
@cjo20
Jan 17 2015 20:38
@scottleibrand what was the highest you'd seen from the 1-2 others?
also, isn't it closer to 60g/hr, given that the peak is about 0.97g/min?
ah, sorry, misread what you said earlier, you mean 15 mins delay then 45 mins at 0.97g/min
Ben West
@bewest
Jan 17 2015 21:22
they've taken the factory pattern and hidden most of the nasty stuff
Dana Lewis
@danamlewis
Jan 17 2015 22:04
@cjo20 found someone with 30, one with 36, and then another person who found their basals were too high and they were waiting to fix that to redo the test :)
Chris Oattes
@cjo20
Jan 17 2015 22:07
is that including the 15 min lag?
Dana Lewis
@danamlewis
Jan 17 2015 22:08
Yes
Scott Leibrand
@scottleibrand
Jan 17 2015 22:10
Not sure what you mean by "including". We model a 20m delay (0g/hr), then 30g/ hr until all the carbs are decayed.
That's an average rate (after the delay, which is more like 15m from your test), not a peak rate.
I took the time to absorb all your carbs, subtracted the 15m, and then divided the consumed carbs by that. I didn't want to use the interpolated g/hr from the ISF, because we actually know how many carbs were consumed.
Ben West
@bewest
Jan 17 2015 22:13
I think part of question might be are you using dexcom raw sensor data or the exported glucose values ;-)
Chris Oattes
@cjo20
Jan 17 2015 22:14
I was using medtronic glucose values
Scott Leibrand
@scottleibrand
Jan 17 2015 22:14
So, (45m-15m)/30m*22g = 44g/hr
diabeticgonewild
@diabeticgonewild
Jan 17 2015 22:14
Stupid question, but is there a way to access the raw values via NS?
Scott Leibrand
@scottleibrand
Jan 17 2015 22:14
sorry, that's not quite right
you can with wip/iob-cob
diabeticgonewild
@diabeticgonewild
Jan 17 2015 22:15

nice! (I should know the answer to that anyways.)

But does it give the sensor signal, like in nA (nanoamps)?

Scott Leibrand
@scottleibrand
Jan 17 2015 22:16
22g/(60m/(45m-15m))=44g/hr
it's an ISIG value. Dunno the units.
Ben West
@bewest
Jan 17 2015 22:17
you should try it out and see if it's what you want
diabeticgonewild
@diabeticgonewild
Jan 17 2015 22:17
yeah ISIG is typically in nanoamps. The sensing system is amperometric
I will.
Chris Oattes
@cjo20
Jan 17 2015 22:17
@scottleibrand doesn't that make the absorbtion rate dependant on the number of carbs in the test? If I'd had more carbs, I'd have probably been at the peak rate for longer with the ramp at the start/end being a similar length, which would push it up further?
diabeticgonewild
@diabeticgonewild
Jan 17 2015 22:18
There really would be no reason why the ISIG value would not be in the form of --Amps.
An oldie, but a goodie (Guardian concepts) http://myparadigm.eu/ENUS/Layout.htm
ISIG is the averaged sensor current in nA
click on Continuous glucose monitoring system principles (there are frames)
Ben West
@bewest
Jan 17 2015 22:20
is it in that gist?
diabeticgonewild
@diabeticgonewild
Jan 17 2015 22:20
no, sorry
does it need to be in a gist? Am I annoying people (sorry if I am)?
Ben West
@bewest
Jan 17 2015 22:21
doesn't need to be, but seems useful
diabeticgonewild
@diabeticgonewild
Jan 17 2015 22:21
OK, will do.
Chris Oattes
@cjo20
Jan 17 2015 22:22
@diabeticgonewild I think bewest is trying to get you to keep useful links in a gist, rather than just pasting them here and then them scrolling off the screen and being lost forever
diabeticgonewild
@diabeticgonewild
Jan 17 2015 22:22
kk, thank you, @cjo20 :)