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

4th
Mar 2015
diabeticgonewild
@diabeticgonewild
Mar 04 2015 00:24
Yeah, I am not going to post much more to the OpenAPS group about verifying my work, on how I derived that equation, but it is correct. These are the 2 lines of code I used to test my code. 0 represents time of initial bolus dose, 300 represents the DIA in minutes, and time represents the time elapsed from initial bolus dose. I used 110 for the "time" as that represents 50% IOB left. I used anonymous functions which can sometimes make life easy.
This message was deleted
IOB is 5 units....
fun = @(time,IOB) IOB.*exp(-(time-0)/300);
1-(integral(@(time)fun(time,5),0,120)/integral(@(time)fun(time,5),0,300))
diabeticgonewild
@diabeticgonewild
Mar 04 2015 00:39
As for representing the equation from the euglycemic clamp study, you would interpolate the values on the graph at set points, for the x and y values, and fit a function to those values, from the Glucose Infusion Rate (GIR) graph versus time at 0.3 or 0.4 U/kg in healthy subjects, for the insulin you want ( for example, see this: http://www.ncbi.nlm.nih.gov/pmc/articles/PMC2293970/figure/fig3/ )
So, with the numbers interpolated and the function fitted from the data, you:
IOB % Remaining = 1 - ((integral of GIR function from t=0 to t=desired point)/(integral of GIR function from t=0 to t=final point at approximately 420 minutes))
To get IOB in units you just multiply the IOB % remaining times the initial insulin dose. From there, you can fit a function, for IOB.
diabeticgonewild
@diabeticgonewild
Mar 04 2015 00:47
But, IOB is not a function of rate of appearance of insulin in the plasma. If you check the units for that, there is no way it is correct. Also, uptake of insulin into the cells, which is at the point in time when blood sugar drops (not when glucose enters the blood stream) is when the potential aka IOB is lost because it is being utilized AKA uptake, but not when it is in the blood stream.
diabeticgonewild
@diabeticgonewild
Mar 04 2015 00:54
Actually it the t = final point would be at around 480 minutes.
I was in a rush because I was being called for dinner.
diabeticgonewild
@diabeticgonewild
Mar 04 2015 04:39
So yeah, I was playing around with the Novolog IOB curve that I made (I have to make it into a % IOB remaining function...) and if my work is correct, which I haven't verified, it looks like the pump companies may have leftover IOB excessively to prevent lows. And an 8 hour IOB function is realistic, believe it or not, based both on the exponential decay function and the Novolog IOB curve
but I need to get working on my project soon. 1.5 weeks left and need to email that author dude.
Matthias Granberry
@mgranberry
Mar 04 2015 04:51
A lot of Walsh's papers and continuing education talks discuss insulin activity 6-8h out from dosing times, especially for T1DM patients with extremely low residual insulin production. I know that I see some 6+ hours out if I really pig out, although the major activity has clearly occurred by then.
diabeticgonewild
@diabeticgonewild
Mar 04 2015 04:53
So like, here is the exponential function at 240 minutes, with 24 units of insulin, to compare against the Novolog approximation for the euglycemic clamp study, which used that quantity.

1-(integral(@(time)fun(time,24),240,480)/integral(@(time)fun(time,24),0,480))

ans =

0.250000000000000

This is the approximation that I used for Novolog for the Euglycemic clamp study

1-integral(@iaredumb,(0-240)/145,(240-240)/145)/integral(@iaredumb,(0-240)/145,(480-240)/145)

ans =

0.262538624362438

"ans" is % IOB remaining
And like for the Medtronic 530G at 240 minutes
Matthias Granberry
@mgranberry
Mar 04 2015 04:54
The rest of the academic work is less vocal on the issue, but I found some info on ultra-rapid insulin analogs in development that puts novolog and humalog out at 6-8h for the tail of activity.
diabeticgonewild
@diabeticgonewild
Mar 04 2015 04:54
% Remaining IOB = 45.75%
These are all for DIA of 8 hours
and I haven't completely verified my work, but, it looks like I am right
actually ans is fractional % remaining IOB. I wasn't paying attention. There is no way that I made a "bunch of mistakes". I put in at least 8 values for both the euglycemic clamp study and the exponential function to approximate IOB, and they compare. I also cross-referenced my Medtronic 530G for IOB set to 8 hours
Matthias Granberry
@mgranberry
Mar 04 2015 04:58
Why are you setting it at 8h? That's very conservative even for humalin R.
and etc.
Matthias Granberry
@mgranberry
Mar 04 2015 05:01
Ah. You are pointing out that IOB is flawed. I think we will all agree that it isn't a great model, just that it works better than a SWAG
Matthias Granberry
@mgranberry
Mar 04 2015 05:09
I got into an argument with the CNS/nurse educator about the difference in insulin action in T1DM patients vs. non-insulin-dependent T2s vs. healthy patients. I think a note got in my file because they now talk pubmed and research with me.
At least the doctors at the research heavy practice do.
diabeticgonewild
@diabeticgonewild
Mar 04 2015 05:27
well all we talk about is like what doctor is doing what with respect to my medical care...like keeping her in the loop pretty much
Anyways, make sure to click on "first", "second", and "third" images
Image 1 is the % IOB remaining in the euglycemic clamp study
Image 2 is the % IOB remaining in the exponential function (certainly wrong!)
Image 3 is the % IOB remainng in the Medtronic 530G pump
All DIA = 8 h
Owww joints hurt
Matthias Granberry
@mgranberry
Mar 04 2015 06:36
(1) looks reasonable to me and (3) looks overly conservative, but maybe a good match at 4.5h
diabeticgonewild
@diabeticgonewild
Mar 04 2015 06:36
Yeah, well I would want to "test it out" some more
I can copy/paste the function if you want to play around with it
Toby Canning
@TC2013
Mar 04 2015 11:10
.3 and .4U per kg are big doses of insulin. 18.6 and 24.8 respectively for my son who is 62kg. Or, 167g and 223g of carbohydrate.
Toby Canning
@TC2013
Mar 04 2015 11:17
We practice set amount carbohydrate meals, with one or two splurge meals. He is at .1U/kg for breakfast and lunch which are his big meals (60g CHO) and .05U/kg for dinner.
diabeticgonewild
@diabeticgonewild
Mar 04 2015 13:28
Well, they do that to get rid of the endogenous glucose production/basal insulin production in healthy subjects, which can't be measured.
A smaller insulin dose (0.1 U/kg) cannot suppress basal insulin as long as a larger dose (0.2 or 0.3 U/kg), making smaller doses appear to have a shorter DIA. We believe DIAs determined using larger doses measure true DIA more accurately in insulin dependent individuals who receive ongoing basal replace-ment. More research is needed to confirm actual DIA times in type 1 diabetes where basal delivery is not suppressed.
It tells it all here, pretty much: http://www.ncbi.nlm.nih.gov/pmc/articles/PMC3045234/
Also see "unmeasured basal suppression": 0.2 to 0.3 U/kg is what they use to "get rid of it" : http://www.ncbi.nlm.nih.gov/pmc/articles/PMC3045234/figure/fig1/
diabeticgonewild
@diabeticgonewild
Mar 04 2015 13:43
So, I am having fun right now. I am scanning labs from January, which I have a ton of, so my GI doctor who I see at the local cancer hospital can review them so she doesn't have to draw more labs. Also, the one test that she ordered came back abnormal for lactoferrin, which means I have inflammation in my intestines. Great way to start out the morning!
14 pages of labs to scan...plus two PDFs I have to print from Quest Diagnostics and upload
diabeticgonewild
@diabeticgonewild
Mar 04 2015 14:01
Alright done scanning. FWIW, I scan textbooks when I can't get digital copies. I go to Kinko's/FedEx Office and I get the spine of the book cut for $1.50. Then I take the book home and scan it, page by page on the platten, in 600 DPI color, on a multifunction printer that probably cost around $120, and it turns out absolutely stellar. Like I watch hockey when I do it. I think the absolute max that I can scan without losing my sanity is like 400 pages, but I don't like to go more that 150 pages/day.
diabeticgonewild
@diabeticgonewild
Mar 04 2015 14:32
The Novolog euglycemic clamp curve that I used was 24 U/73.7 kg = 0.325 U/kg, just FYI.
Scott Leibrand
@scottleibrand
Mar 04 2015 14:42
Have you ever tried a sheet-fed scanner? I digitized an entire filing box of paperwork that way. Just had to reload the feeder every 10-20 pages or so. Obviously a better scanner would have a bigger feed tray...
diabeticgonewild
@diabeticgonewild
Mar 04 2015 14:54
Yeah, but it like skews the page, always, especially if the binding was cut. It just takes more time, well a lot more time...but I don't mind, because using the platten, all of the pages are guaranteed to be recognized via OCR
Scott Leibrand
@scottleibrand
Mar 04 2015 14:58
I wonder if there are wider ones where you could put it in landscape, so the previously-bound side is at the top and comes out last.
diabeticgonewild
@diabeticgonewild
Mar 04 2015 14:59
yeah, but they cost a lot....like a lot
Scott Leibrand
@scottleibrand
Mar 04 2015 15:00
That seems silly. They shouldn't cost more than 50% more to make than narrow ones. May be a business opportunity for someone...
diabeticgonewild
@diabeticgonewild
Mar 04 2015 15:00
True.
Scott Leibrand
@scottleibrand
Mar 04 2015 15:00
or you could provide "book digitization as a service"...
once you digitize the first copy of each edition, you can skip the actual scanning process for subsequent copies
diabeticgonewild
@diabeticgonewild
Mar 04 2015 15:02
There are services. For school I can get all of my books digitized via Bookshare.org from a US government grant because I am eligible. Even my STEM books, which are more difficult to digitize.
Scott Leibrand
@scottleibrand
Mar 04 2015 15:02
Ah nice.
diabeticgonewild
@diabeticgonewild
Mar 04 2015 15:02
But, I prefer to do it on my own, my way. DP
:P
Thanks
Scott Leibrand
@scottleibrand
Mar 04 2015 15:02
:-)
Matthias Granberry
@mgranberry
Mar 04 2015 20:14
huh. I just plugged my t:slim in to finish up the tidepool uploader work and it gave me a "Pump reset. Insulin delivery stopped. Contact support." error message. I would feel like that's almost reasonable if I had actually sent any commands to it that session, but no data had yet been transferred.
seems to be working after reloading the cartridge except for forgetting IOB and some of the day's history
diabeticgonewild
@diabeticgonewild
Mar 04 2015 23:53
Yeah, I intend on emailing that author dude tomorrow. Didn't feel good all day, but I think tomorrow might be better.