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

15th
Jan 2015
diabeticgonewild
@diabeticgonewild
Jan 15 2015 07:19

As for carb prediction and IOB prediction, in the actual AP models that come from Roman Hovorka, the IOB and theoretically, the COB, can be calculated in the frequency domain (also known as the steady-state), instead of the time domain (typically in terms of seconds and is very short). I have done this before, like in 2011.

I am going to implement all of this in MATLAB, which can be converted into C/C++/Java through the compiler packages, and can even be packaged into a JAR file which can run on Android without mobile Internet. Also, the Simulink package (and other toolboxes) with MATLAB allow for repetitive test iterations and stress tests in order to ensure the program works as intended, so I am not extremely concerned about the complexity.

I intend on using MATLAB in the cloud for calculations remotely, via Amazon's AWS EC2 service.

Sulka Haro
@sulkaharo
Jan 15 2015 08:12
What'd be pure win for the community, is if someone collected a data set and created an API that allowed anyone to run an algorithm on the data with automated reporting on accuracy & error condition detection. The academic papers I've seen on CGM accuracy basically call for something like this, but the data and testing systems manufacturers use are all proprietary.
diabeticgonewild
@diabeticgonewild
Jan 15 2015 08:20

That's not the issue with respect to sensor error and accuracy, which essentially (not entirely) leads to all other errors. The only true representative sensor error that has been modeled to date occurred in an IEEE Xplore publication in 2014. Before they were using a standard Gaussian distribution (with zero mean and unit covariance), which cannot be correct, as glucose levels tend to be skewed in the upwards direction, as that was all they had.

I intend on modeling the glucose sensor error. That's an essential step to implementation, no matter what. I might also deconvolute the sensor signal to get a better accuracy than the 505 upgrade, but that is low on the priority list as it is non-essential for actual implementation.

Sulka Haro
@sulkaharo
Jan 15 2015 08:24
@diabeticgonewild I'd love to contribute our data if that's useful. We have continuous CGM data from ~11 months that can be pulled from CareLink, including the glucometer readings.
diabeticgonewild
@diabeticgonewild
Jan 15 2015 08:25

@sulkaharo , I am using an IEEE paper based off of Roman Hovorka's work, published Dec. 2013. Stochastic Virtual Population of Subjects With
Type 1 Diabetes for the Assessment of Closed-Loop Glucose Controllers, which includes the first and only models for carbohydrate absorption (no other model has this yet).

For what it's worth, here's what the paper says about sensor error:

  • For the purposes of parameter estimation, measurement errors were assumed to be normally distributed with zero mean. The measurement errors associated with plasma glucose and insulin were assumed to be multiplicative with a coefficient of variation (CV) of 2% and 6%, respectively.

  • A one compartment model was used to describe interstitial fluid glucose dynamics and glu- cose sensor error was represented by employing experimental data of FreeStyle Navigator system.

Sulka Haro
@sulkaharo
Jan 15 2015 08:26
That's Enlite-based, not Dex. Talking to the endo here on how to potentially switch to Dex, as we tried it and love the reliability over the ** medtronic puts out to the market. Based on my experience with Enlite, I'd never turn on an AP that used that CGM as the main decision point.
Yup, read a paper on the glucose compartment model. Made me wonder what's going on in our kid's body in regards to the sensor and the intravenous glucose. The oddities we're seeing are things like the sensor suddenly thinking the IVG went down by 1.4 mmol between two measures (extreme drop), where checking the BG using a glucometer immediately after shows the BG curve is perfectly stable.
diabeticgonewild
@diabeticgonewild
Jan 15 2015 08:35

@sulkaharo , it's not a matter of having an abundance sensor data. Nobody knew how to model the sensor interference, and thus the error could not be determined, until mid-2014. Modeling the Glucose Sensor Error. IEEE TRANSACTIONS ON BIOMEDICAL ENGINEERING, VOL. 61, NO. 3, MARCH 2014.

"We conclude remarking that the approach here presented to derive the components of CGM sensor error is general and is applicable to other sensors, including the recently launched Dexcom G4 Platinum, when datasets with frequent BG reference measurements and multiple CGM data, like the one employed for validation in this paper, are available."

This is the deconvolution paper, that gave an 8.84% MARD on the Dexcom 7+ even. Improving Accuracy and Precision of Glucose
Sensor Profiles: Retrospective Fitting by Constrained Deconvolution. IEEE TRANSACTIONS ON BIOMEDICAL ENGINEERING, VOL. 61, NO. 4, APRIL 2014.

Sulka Haro
@sulkaharo
Jan 15 2015 08:37
Ah yes, I know researchers have access to data through academic institutions, but AFAIK there's no data set available for Nightscout devs, is there?
I guess this all means that we could have significantly improved CGM accuracy on existing devices by uploading raw data to the cloud and using new algos. That's pretty awesome. :)
diabeticgonewild
@diabeticgonewild
Jan 15 2015 08:39
Even if we had access to the most accurate blood glucose meters and the most reliable CGMs, we would literally have to be mathematicians or professors in engineering doing research to deal with the noise from the sensor that comes from the glucose measurement from the interstitial fluid.

Yes. From Improving Accuracy and Precision of Glucose Sensor Profiles: Retrospective Fitting by Constrained Deconvolution:

The algorithm was tested on 24 datasets collected in a 20 h clinical trial where CGM records and a median of 13 BG samples per day were available. Mean absolute relative deviation was reduced (from 15.71% to 8.84%) with respect to unprocessed CGM and so did the error in the evaluation of the outcomes metrics (e.g., halved the error in the time-in-hypo as- sessment). The reconstructed BG profile, in view of its improved accuracy and precision, is suitable for clinical trial assessment, modeling and other offline applications.

Scott Leibrand
@scottleibrand
Jan 15 2015 17:11
You don't have to be a mathematician or professor to try things on a big data set and see what works. That's the whole point of #WeAreNotWaiting.
Jason Calabrese
@jasoncalabrese
Jan 15 2015 17:19
:+1: @scottleibrand
Jason Calabrese
@jasoncalabrese
Jan 15 2015 17:25
the way I look at it is I'm already trying to do all these calculations in my head, and that is really error prone and distracting, and tiresome. Any automation we can do and track the results of is huge improvement.
diabeticgonewild
@diabeticgonewild
Jan 15 2015 17:25
I know I am free to try things out, but I just don't trust models
Sulka Haro
@sulkaharo
Jan 15 2015 17:27
Trusting models is difficult, especially if they're complex. Hence I really like Scott's approach with DIYPS, which is to make it as simple as possible and only use the relatively safe temp basals
diabeticgonewild
@diabeticgonewild
Jan 15 2015 17:27
Sorry I don't trust models that I make on my own.
Jason Calabrese
@jasoncalabrese
Jan 15 2015 17:29
you only need to have some limited amount of trust, since you are monitoring the results, just like a bolus wizard
diabeticgonewild
@diabeticgonewild
Jan 15 2015 17:29
my phone updated the text box on its own when it shut off. I strongly believe in the models because my autonomic nervous system is shot due to a rare autoimmune disease. I have severe gastroparesis and I can't rely on self experimentation heavily
I am at the hospital getting treatment so the quality of my posts are low
Sulka Haro
@sulkaharo
Jan 15 2015 17:31
Sorry to hear that. :( Shows quite a bit of grit you're participating here at all!
Jason Calabrese
@jasoncalabrese
Jan 15 2015 17:33
feel better @diabeticgonewild, lets try not to overcomplicate things
diabeticgonewild
@diabeticgonewild
Jan 15 2015 17:35
Thank you @jasoncalabrese and @sulkahero . I am receiving intravenous immunoglobulin for chronic inflammatory demyelinating polyneuropathy and autoimmune autonomic ganglionopathy, as an outpatient. It will be sick for the next few days from it. :(
I will try not to over complicate things. Please tell me if I get too out of line.
Jason Calabrese
@jasoncalabrese
Jan 15 2015 17:37
:)
diabeticgonewild
@diabeticgonewild
Jan 15 2015 17:39
I did program an AP model in MATLAB in 2008 but I didn't comment much on it. GitHub.com/diabeticgonewild/Artificial_Pancreas
*2011...so sorry
Chris Oattes
@cjo20
Jan 15 2015 17:51
so is this room about trying to work out an AP algorithm?
diabeticgonewild
@diabeticgonewild
Jan 15 2015 17:59
DIYPS mostly here. Most people develop open source and original models to implement like Dana and Scott's DIYPS. I am kind of an outlier here as I am using published models that I intend on implementing. I have implemented older models in the past. I have a complicated medical situation and I am taking this approach due to robustness, although I am rooting for the DIYPS open source crowd.
Ben West
@bewest
Jan 15 2015 18:02
@cjo20 ah, you found us
@cjo20 my interest has always been safe and effective therapy by provider better tools.... so there's a set-temp-basal tool, tools for bolus/resume/suspend, key presses, latest history, etc...
it turns out if you want to do AP stuff, you need tools like those :-)
Jason Calabrese
@jasoncalabrese
Jan 15 2015 18:33
yes, I'd like to start will a good remote control and monitoring