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

16th
Feb 2015
diabeticgonewild
@diabeticgonewild
Feb 16 2015 00:00
It's a syntax thing that he was correcting me on, so that is no big deal. I do appreciate the clarification from him.
diabeticgonewild
@diabeticgonewild
Feb 16 2015 00:30
Yeah, so after reading some of the papers I have to read. The math is going to get intense again, and kind of overwhelming. But fortunately programming and math are things I love.
Emma Black
@StephenBlackWasAlreadyTaken
Feb 16 2015 03:36
@mgranberry yupyup, all the share stuff is in the works, its a bit anoying as everything ble in android is async BUT only one gatt command can be pending at a time, this made for some interesting little step by step crazy callbacks
authentication with it is easy peasy, reconnecting after being bonded and then going out of range is a but flaky, but hopfully I can get that cleaned up a bit
diabeticgonewild
@diabeticgonewild
Feb 16 2015 04:22
Are you sure there isn't a friendlier way to do it with the Android OS framework (I wouldn't know--never programmed an Android app before)?
diabeticgonewild
@diabeticgonewild
Feb 16 2015 05:56

So I have some good news. Keep in mind that I have never took a class on controls, and I have learned "as I have went along". Since I already have a copy of a controller (updated version--not available--is being used at UVa and Stanford outpatient clinical trials), I can use that and I don't need to program Hovorka's models from scratch to use it on an "AP". There are issues with that though, as some components are missing or have to be modified (i.e. modeling the Dexcom G4 sensor error)

However, if we want an open-source controller, which I wholeheartedly want to do, and plus, I love this project, I will have to program the mathematical models and use MATLAB to design a new controller. This is not as difficult as it sounds. I have been watching webinars and it doesn't look remotely as hard as the stuff I have been doing.

Sulka Haro
@sulkaharo
Feb 16 2015 05:57
@diabeticgonewild ha, sounds you're on a roll. Awesome. :D
diabeticgonewild
@diabeticgonewild
Feb 16 2015 05:58
Thank you. Thesis can be found here, if anyone's interested. https://stacks.stanford.edu/file/druid:jf647rq8653/Thesis-augmented.pdf But honestly I am more interested in an open-source controller.
I think the mathematical models are all in the controller.
diabeticgonewild
@diabeticgonewild
Feb 16 2015 06:16

So there are technically three ways I can approach the open-source controller: 1. Program and design the mathematical models using statistical methods for solving for the parameters 2. Take a shortcut and use nonlinear recursive least squares regression in MATLAB using System Indentification Toolbox, which is way, way, easier and will save time. 3. Use both and have one override the other if there is less error.

I intend on doing option 3, but implementing option 2 first and just adding on from there. I have made it a long ways on the statistical stuff, and I am not afraid of it, but it's just not the nicest thing to do in MATLAB, so I want to proceed with care.

I am not getting distracted though. I am just modifying the design process.
I have programmed everything in a way that I can use it all again for different points in the design process.
Sulka Haro
@sulkaharo
Feb 16 2015 06:20
@diabeticgonewild I'd recommend you start as simple as possible. Code starts to sing only after it runs, and working on code that's not live it not fun. You'll get so much more out of this once the system works even partially.
diabeticgonewild
@diabeticgonewild
Feb 16 2015 06:21
Yeah, that's why I am going to go option 2 first. Like all of the differential equations can be solved for numerically easily. I think I can finish option 2 up in a week. Maybe I can finish up option 1 in a month. Of course I am talking about the controller, not a whole OpenAPS system.
The parameters can be solved for automatically using nonlinear recursive least squares regression using the System Identification Toolbox in MATLAB. The disadvantage of this is that it takes time to "adapt", but probably not that long. Option 1 is nicer, but analysis is required to make sure that the values of the parameters are correct.
diabeticgonewild
@diabeticgonewild
Feb 16 2015 08:15
Overwhelmed. Can't go to sleep until I figure out how to model the control system to solve for the parameters. I both like and dislike situations like this.
diabeticgonewild
@diabeticgonewild
Feb 16 2015 08:20
diabeticgonewild
@diabeticgonewild
Feb 16 2015 08:49
Blood sugar is like 50. Calling it quits for the night. :worried:
Ben West
@bewest
Feb 16 2015 09:07
glucose, stat ;-)
diabeticgonewild
@diabeticgonewild
Feb 16 2015 09:08
56 still due to gastroparesis
Eating gummy bears
diabeticgonewild
@diabeticgonewild
Feb 16 2015 09:17

83, ftw. Not going to bed. Feel too terrible.

I don't know which way of solving the models is easier, but a controller can be created straight from the models, of course. I think I am going to solve it the way the paper says to. I don't want to take any risks.

Sulka Haro
@sulkaharo
Feb 16 2015 09:37
Our dude did a day of puking and is now in the subsequent "nothing absorbs very fast" phase. Yesterday the sugars were pretty much either in the 50s or at 200, with very little in between. :(
diabeticgonewild
@diabeticgonewild
Feb 16 2015 09:49
That blows!
diabeticgonewild
@diabeticgonewild
Feb 16 2015 12:42
I see my endo this afternoon. I get to drop a bomb and tell her that my cardiologist thinks it's lupus and that I have been in the hospital for fun stuff. They did run an hbA1c on me when I was in the hospital with a blood clot in my lung in January and it went up in 6 weeks from a 6.4 % to 7.0 % and my neurologist told me to "watch out" at my appointment at the end of January. However, my neuro is never happy with my a1cs unless they are close to a 6.0. All of this health stuff makes my life interesting, to say the least.
I bet my A1c is a 7.2-7.3 if I take a guess, but that's OK because my life is complicated.
diabeticgonewild
@diabeticgonewild
Feb 16 2015 16:03
Anyways, this is important. If anyone needs to know how Medtronic's 522/722 series pumps deliver basal rates, it's in this thread http://forums.childrenwithdiabetes.com/showthread.php?25639-When-is-basal-delivered&highlight=minimed%20basal%20program
diabeticgonewild
@diabeticgonewild
Feb 16 2015 19:22
At the endo and I feel absolutely terrible. I hope my vital signs come back normal enough so there aren't any big red flags.
Normal for me that is.
Dana Lewis
@danamlewis
Feb 16 2015 19:23
Fingers crossed! (I need to go get my labs done, too.)
diabeticgonewild
@diabeticgonewild
Feb 16 2015 19:25
:D
diabeticgonewild
@diabeticgonewild
Feb 16 2015 19:31
Like I think I am dehydrated again and I am getting chest pain probably from the blood clot in my lung. Hopefully my blood pressure will be decent and I won't be ridiculously tachycardic like > 130 bpm
diabeticgonewild
@diabeticgonewild
Feb 16 2015 19:42
I also get to be like yay cardiologist thinks I have lupus. I bet I will be back at the endo in a month just due to the other medical stuff cause she worries
diabeticgonewild
@diabeticgonewild
Feb 16 2015 20:32
6.6 going back in 3 months. Relieved.