Skip to content

Latest commit

 

History

History
40 lines (22 loc) · 2.92 KB

README.md

File metadata and controls

40 lines (22 loc) · 2.92 KB

CGM calibration

The cgm-calibration-react directory contains the React app which is currently supported. A live version is available at https://cgm-calibration-stats.azurewebsites.net/.

The app does not store any user data. Data from Nightscout is requested from and processed locally on the user's browser.

The app uses the new Nightscout v3 API, which requires a token for login. The user must create a token with the readable role by following this guide: http://www.nightscout.info/wiki/welcome/website-features/0-9-features/authentication-roles. Due to the use of the new API, Nightscout version 13.0.0 or more recent is required. Use this tool to update your Nightscout site if required: http://nightscout.github.io/pages/update-fork/.

What does it do

Currently the app allows users to see the calibration slopes generated by Spike for each calibration of the current sensor. In each chart, the slope generated by Spike, the calibration points, and the best fit line for the calibration points are displayed. The user can click on calibration points to disable/enable them. A disabled point is excluded when calculating the best fit slope.

Future work

I'm currently working to get calibration information uploaded from xDrip4iOS to Nightscout and make the app work with data from xDrip4iOS. I'm already testing this, but most likely will not create pull requests until I get the chance to test for a few weeks.

Options to see data for previous sensors will also be added in the future. This is not a priority.

Better error handling which is currently minimal.

Some information about the repo

I use the code here to explore and analyze continuous glucose monitoring calibration data from Spike app (https://spike-app.com/).

Read this article to understand what the slope and intercept are and how they work: https://bionicwookiee.com/2018/11/15/cgm-accuracy-calibration-is-king/ Note that in the article the raw and glucose values are reversed compared to Spike. In Spike, raw values are on the Y axis and glucose = (raw - intercept) / slope, in the article glucose values are on Y axis and glucose = raw * slope + intercept. Thus, in the article, a steeper slope means higher highs and lower lows. In Spike, a steeper slope means lower highs and higher lows.

I use slope to refer both to slope parameter of a straight line, as in y = x * slope + intercept, and to the line itself. What I'm refering to should be obvious from the context (e.g.: steeper refers to the line, higher refers to the parameter).

Spike offers 2 calibration modes:

  • fixed slope - where the slope value is always 1000 and only the intercept is changed. Only the last calibration value is used
  • non-fixed slope - where the slope value changes based on the calibration values. Spike keeps all calibration values and tries to fit a line through them

In Spike:

  • raw = glucose * slope + intercept
  • glucose = (raw - intercept) / slope