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

5th
Feb 2015
diabeticgonewild
@diabeticgonewild
Feb 05 2015 01:57
So, I have been sick all day, but I am feeling better now. I managed to get a bunch of randomly distributed numbers to essentially converge via a crazy function, which is a good sign. However, due to unit conversion stuff (some of it is confusing--but the values tend to meet the tolerances used in an old paper), I cannot confirm if it's correct. It looks good though. http://imgur.com/3NtwvjL
I have to make a multivariate normal distribution of that via MATLAB, and I will find out more from there.
diabeticgonewild
@diabeticgonewild
Feb 05 2015 02:59
Actually, @danamlewis and @scottleibrand , in the paper that I am using for the values that I had to cross-reference, there is an excellent way of displaying stability of blood glucose shown, which is dependent on multiple variables on the "second derivative test". All of this can be calculated through the work I am doing, but the DiffEqs cannot be calculated easily in C/C++/Java/JS with open-source packages, I believe. I have to retrieve the paper from my 5 year old Mac which will take some time, but give me 15 minutes to upload screenshots.
It's from 2001(!)
diabeticgonewild
@diabeticgonewild
Feb 05 2015 03:13
OK, so this comes from Partitioning glucose distribution/transport, disposal,
and endogenous production during IVGTT. All three images are representative of 6 patients that are modeled off of old Hovorka models, but this can be modeled again in his updated models as the variables don't really change. You have to know DiffEQ to solve for the points in time. Otherwise you cannot get the graphs. All equations and graphs are related, at least, by time. The first and third images (look for the first, second, and thrid image buttons) are most important. http://imgur.com/AqISamp,cAeV5mn,AVqYjav#0
All of these three images could technically be represented on a single graph as a system.
Scott Leibrand
@scottleibrand
Feb 05 2015 03:14
What are they showing?
diabeticgonewild
@diabeticgonewild
Feb 05 2015 03:14
Oh, and the second graph on image 3 is insulin flux, which is an overall displacement in a point of time, so it looks like horizontal lines at points.
Basically, various variables that can be solved in Hovorka's equations. The second derivative test for those respective variables (or the intersection points, particularly in the first image), would show when the DIA is relatively insignificant and would only cause "drift" and not "fluxes" in blood glucose
*vertical
Scott Leibrand
@scottleibrand
Feb 05 2015 03:48
These models make no sense to me. I hope you can get them developed to the point where they can actually be used to make BG predictions that outperform my simplistic ones.
diabeticgonewild
@diabeticgonewild
Feb 05 2015 04:02
I will. I just can't be sick
Jason Calabrese
@jasoncalabrese
Feb 05 2015 04:08
Simple and understandable are pretty important things to me, I don't want a black box
Scott Leibrand
@scottleibrand
Feb 05 2015 05:03
It's (a)live! OpenAPS.org is up, with all the details about how #WeAreNotWaiting to change the world of artificial pancreas research. :-)
diabeticgonewild
@diabeticgonewild
Feb 05 2015 05:04
wow :D
Dana Lewis
@danamlewis
Feb 05 2015 05:04
Hashtag is #OpenAPS :)
diabeticgonewild
@diabeticgonewild
Feb 05 2015 07:21
Will do. Haven't been on Facebook since starting this project full-force, but I am about to.
I guess I need to make a Twitter account too.
Scott Leibrand
@scottleibrand
Feb 05 2015 07:25
Definitely. :-)
diabeticgonewild
@diabeticgonewild
Feb 05 2015 08:17
Made a Facebook post on my personal account, so far. Have to get Twitter going full speed though.
Mikael Rinnetmäki
@mrinnetmaki
Feb 05 2015 14:48
@danamlewis @scottleibrand OpenAPS.org certainly with all the details. Did not have the energy to read through all of it, although I'm certainly really, really, interested. Some pics / illustrations would probably help. :)
Well, it's been a long day and it's getting late. I'll continue tomorrow.
Congrats for getting all of that out there! :)
Dana Lewis
@danamlewis
Feb 05 2015 16:22
Thanks @mrinnetmaki!
Jason Calabrese
@jasoncalabrese
Feb 05 2015 18:07
@scottleibrand @danamlewis didn't see it in all the other details, will there be a github org? Will code be open/public from the beginning?
Scott Leibrand
@scottleibrand
Feb 05 2015 18:38
No, we can't share code for actually building an APS publicly if we want any chance with the FDA. As outlined, we plan to share implementation code directly with other independent researchers. Design is obviously completely open.
Once we get to the point of actually publishing in scientific journals, we might be able to share code that way...
Jason Calabrese
@jasoncalabrese
Feb 05 2015 18:51
the FDA is a tax on innovation
Scott Leibrand
@scottleibrand
Feb 05 2015 19:00
Actually, what I just said is too simplistic.
We can and should publish things open source before approval, but as components, not a complete system.
And we absolutely must not publish easy directions for putting it all together in a way that random users from Facebook can start doing it.
Ben's approach here is good: publish all the tools, but don't make it explicit how they can be used to make an APS.
Then, we can publish in the methods section of our paper how we put the tools together, so we're just doing scientific publishing, not distributing a medical device.
in the mean time, we definitely need to get feedback on the design itself. Would it be useful to have that on github? It's certainly not code...
i really would like feedback from people like you, Ken, and others who've actually thought through the issues.
Sulka Haro
@sulkaharo
Feb 05 2015 19:09
@danamlewis Ha, blatantly abused knowing Cory to get him to retweet the OpenAPS. Assume you'll get a ton of pings :D
Dana Lewis
@danamlewis
Feb 05 2015 20:11
@sulkaharo thanks :)
Ben West
@bewest
Feb 05 2015 20:23
@scottleibrand thought plan was to break it up into small pieces so the pieces are ok to release
you can't share if it there's one block of code and it does everything
if the only thing some block of code is calculate something with unit tests, that's both a candidate for publishing in journal and github, as it does nothing risky
Scott Leibrand
@scottleibrand
Feb 05 2015 20:39
exactly
diabeticgonewild
@diabeticgonewild
Feb 05 2015 22:03

So, I am pretty much 100% confident I caught 2 computational errors in the paper (and a thesis) that I am programming the mathematical models from in the AP. I have all of the data I need to actually correct the error on my own. They wrote down the mean value of 2 numbers instead of writing down the log(mean values), like the rest of the data set.

Should I email the authors (as long as I am low key--calling it a "senior design project", because I might use it as one) or not? I have a feeling the answer is no.

I am just trying to evaluate risk.
diabeticgonewild
@diabeticgonewild
Feb 05 2015 22:08
I have a feeling the answer is no though. Also, it was not initially obvious that the data set was the log(mean values)/ln(mean values), but I guess it's good that I was able to figure that out.
Sulka Haro
@sulkaharo
Feb 05 2015 22:09
Article on close loop testing results on kids: http://care.diabetesjournals.org/content/36/2/222.full.pdf+html
diabeticgonewild
@diabeticgonewild
Feb 05 2015 22:09
*log(mean values) aka ln(mean values), no division involved (above may be misleading)
nice find @sulkaharo !
Sulka Haro
@sulkaharo
Feb 05 2015 22:09
Conclusion there is, yes it works and improves control
But also, looking at the data in the article, the patients would need better diets to get the BGs to shape
diabeticgonewild
@diabeticgonewild
Feb 05 2015 22:11
no surprise, technically to have an actual closed loop AP style, which is a cascading control, the insulin would have to be able to respond 6 times faster than the fastest rate of change of blood glucose.
So minimizing excursions (such as limiting CHO to a certain degree--whatever is acceptable to the individual--I don't want to make this into a debate) might be a good idea.
Sulka Haro
@sulkaharo
Feb 05 2015 22:27
I can't seem to find any definite answers anywhere on this but looks to me like the pancreatic glycogen release upon eating is much stronger on T1 kids than on most T1 adults, which makes control extremely hard
The curves on the article look very familiar and I we can get a sharp raise on BG with a near-zero carb meal, due to the glycogen release.
diabeticgonewild
@diabeticgonewild
Feb 05 2015 22:28
yeah, well all of the modeling (at least with Hovorka) have been mostly with adults, until around 2013...
Sulka Haro
@sulkaharo
Feb 05 2015 22:28
Only way to reduce that, that we're found is limiting carbs and never eating the stomach super full (as the stomach and gut will then trigger the release)
Makes bolusign challenging, as if you bolus assuming glycogen release and it doesn't happen, the kid goes low. If you bolus for it not happening and it does, the kid goes high and does't come down. Woot.
Dana Lewis
@danamlewis
Feb 05 2015 22:32
Yea, that's why I started multi-bolusing for meals. Matches carb absorption rate better and also the insulin is stacked and easier to ward off with temps rather than single larger bolus
But I still eat
But I still eat carbs. Good to figure out how to handle carbs and less carbs scenario
diabeticgonewild
@diabeticgonewild
Feb 05 2015 22:33
yeah, that's smart @danamlewis , also I read that the Cambridge trials do meal boluses through basal rates. You definitely got your system down.
diabeticgonewild
@diabeticgonewild
Feb 05 2015 22:46
I mean, like the 2 numerical/computational errors written down in the paper will throw others off if anyone else (somebody will) tries to program his most updated models, which means that almost everyone (other than me) loses. I don't think I would have caught it if I wasn't a numbers freak. I do want to point out that I corrected the errors from the paper in my program and I am totally getting expected values, after putting the corrected values through multiple functions, which is a good "stress test" and indicator that this is definitely right (even after recognizing the pattern before doing the tests). It was overwhelming trying to figure out what was actually wrong though.
I can snail mail the authors (I have their mailing and email addresses, just FYI), so they can update the paper on IEEE Xplore (the database where the paper is on)
But it is risky.
Should I do it or not, honestly? I want opinions.
diabeticgonewild
@diabeticgonewild
Feb 05 2015 23:26
Like pay attention to columns 8 and 9. This is the correct data, with the corrected values which matches the information that he used: http://imgur.com/xE3mGaC
This is the incorrect data: http://imgur.com/KfYKbEh
It is so obvious (looking back now) that those two numbers threw off columns 8 and 9. I was stuck for a long time, and the stuff wasn't even conceptually hard. I am glad I was persistent.
Darrell Wright
@beached
Feb 05 2015 23:38
Is there a document with the mongo document fields. I saw the testing folder but that only had sgv, so glucose. Or does the basal/bolus/carb values not exist in it
Ben West
@bewest
Feb 05 2015 23:46
@beached are you getting data from your pump?
NS as-is doesn't do pump data yet
you can look at the minimed branch on android-uploader to see how that's coming
Darrell Wright
@beached
Feb 05 2015 23:50
Ah ok. I can work with the csv data I have right now to get the equations in http://care.diabetesjournals.org/content/37/5/1216.full.pdf+html that
@TC2013 linked to