These are chat archives for nightscout/intend-to-bolus
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.
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.
@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.
@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.
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.