Skip to content

Conversation

@scottleibrand
Copy link
Contributor

As detailed at #1257, a failing Libre sensor, uploaded to Nightscout via LimiTTer/xDrip+, can result in falsely high and too-flat CGM readings and incorrect insulin delivery. The existing mitigation for this, to avoid looping on completely unchanging CGM data, was insufficient in this case. To further mitigate this and similar issues, this PR changes that check to look for CGM data that is changing less than 1 mg/dL/5m for 45m. As shown at https://gist.github.com/scottleibrand/4c8c84d9989afc98bc92214a08e849f0, that would have been sufficient to prevent further insulin dosing in this case after CGM data falsely flattened out at 290 mg/dL.

This will likely result in occasional false-positives when BG is truly flat for an extended period of time, or transiently when both the short_avgdelta and long_avgdelta are between -1 and 1 mg/dL/5m. However, such false-positives should be brief, and will simply result in OpenAPS refraining from SMBs or high-temps until more-plausible CGM data arrives.

@scottleibrand
Copy link
Contributor Author

Fixed tests. Have been running without issue on our rigs for over a week now. Ready to merge if no objections.

@scottleibrand
Copy link
Contributor Author

Also reviewed all the logs from the rigs this was running on, and confirmed that the largest microbolus delivered after a period of too-flat CGM data was 0.1U. Also updated the too-flat logic to only kick in when BG > 60, to avoid the possibility of a zero-temp expiring prematurely when BG is low and flat.

@scottleibrand
Copy link
Contributor Author

Since 5962202 this is now looking good on our rigs. Ready to merge if no objections.

@scottleibrand scottleibrand merged commit c2e85b9 into dev Jun 24, 2019
@scottleibrand scottleibrand deleted the too-flat-dev branch June 24, 2019 02:46
@danamlewis danamlewis mentioned this pull request Dec 4, 2019
mountrcg added a commit to mountrcg/oref0 that referenced this pull request Nov 21, 2021
bjornoleh pushed a commit to bjornoleh/oref0 that referenced this pull request Dec 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants