Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix rawbg calculations #3360

Closed

Conversation

jpcunningh
Copy link
Collaborator

Change the rawbg calculations to simply use the noise value to determine whether to use the calibrated filtered value vs the calibrated unfiltered value to display. It was creating a ratio that had the effect of exaggerating acceleration when BG was changing.

@nightscout nightscout deleted a comment Feb 14, 2018
@jpcunningh jpcunningh force-pushed the wip/fix-rawbg-calculations branch from 9816ecd to 5643aa0 Compare April 14, 2018 17:25
@nightscout nightscout deleted a comment Apr 14, 2018
@sulkaharo
Copy link
Member

This might have unexpected side-effects in situations like when a new sensor is inserted and calibrated values aren't yet available. How extensively have you tested this?

@jpcunningh
Copy link
Collaborator Author

Yes. We've been running it for about 3 months now.

I submitted this modification because the old code was always exaggerating SGV trajectory changes which was providing incorrect data to the user.

Regarding when new sensors are inserted, I am running Lookout, which I changed to send a unity calibration value to NS when a new sensor is inserted. This allows continuing to send the SGV entries with the calibrated glucose value set to 5, and NS displays the raw values exactly as they come out of the transmitter rather than using the previous sensor's last know calibration value.

@sulkaharo
Copy link
Member

We have a lot of users still on G4 and other solutions; need someone to test how those behave

@jpcunningh
Copy link
Collaborator Author

jpcunningh commented May 18, 2018 via email

@PieterGit
Copy link
Contributor

PieterGit commented Jun 26, 2018

@jpcunningh We use a G4 but no raw and a single rig that is connected to the CGM by USB. I believe that will use the CGM readings from the device.
Is it possible to find testers for this feature, or should we postpone it to 0.11 Nightscout release?

@sulkaharo What side effects are you worried about with this PR? What nees to be tested in this PR?

@jpcunningh
Copy link
Collaborator Author

jpcunningh commented Jun 27, 2018 via email

@PieterGit
Copy link
Contributor

@jpcunningh : i think this can be merged to dev, but would like a 👍 on it from the other core committers like @sulkaharo or @jasoncalabrese or @MilosKozak

@PieterGit PieterGit added this to the 0.10.3 milestone Jul 10, 2018
@TwistaTim
Copy link
Member

Support the move to merge into dev as I want to test :)

@jpcunningh
Copy link
Collaborator Author

I think we determine the rational for the original behavior over in gitter's oref0/hardware-dev channel, so more discussion is probably needed.

It unsmoothes the raw data and doing so makes the white dots for raw bg visible more often and gives early indication of trend trajectory changes. Whereas, I am more interested in accurate plotting of the values rather than use them for trend indications.

@PieterGit PieterGit modified the milestones: 0.10.3, 0.11.0 Jul 18, 2018
@PieterGit
Copy link
Contributor

Based on @jpcunningh remark I postponed this to 0.11 milestone. I think this can be merged to dev as soon as 0.10.3 is out of the door.
@Tornado-Tim you can already test by using the https://github.com/jpcunningh/cgm-remote-monitor/tree/wip/fix-rawbg-calculations branch

@nightscout nightscout deleted a comment Aug 17, 2018
@jpcunningh
Copy link
Collaborator Author

@PieterGit, to move this forward, I modified it to be controllable by an extended setting for the rawbg plugin that defaults to existing behavior and added some text in the README to describe the new option.

I've tested the various option configuration scenarios and believe this is good to merge into dev.

@jpcunningh
Copy link
Collaborator Author

I think I've missed a place that needs to be called with extended settings, so please don't merge just yet.

@jpcunningh
Copy link
Collaborator Author

@PieterGit, it's functioning as intended, now. Without setting the new extended settings environment variables, rawbg continues to operate as it did. The new extended settings environment variables provide control over how the rawbg values are calculated.

@jasoncalabrese
Copy link
Member

jasoncalabrese commented Aug 18, 2018

I haven't tested this, and I'm using the G6 now, but the code changes look good

@PieterGit
Copy link
Contributor

@jpcunningh is this ready to merge to dev? How should we proceed with PR's that need testing, but nobody seems to have time to do proper testing.

@jpcunningh
Copy link
Collaborator Author

I believe it is ready. It should be an invisible change to those currently using raw BG.

To change the behavior to use the corrected calculation, the user has to set an extended settings flag. This prevents unfamiliar users from thinking the update broke the raw display due to the raw BGs overlaying on top of the calibrated BGs a much larger percentage of values than previously.

I'm not sure how to address the general need to test PRs. I'll try to start testing other PRs tagged as needing test where I can to help.

@PieterGit
Copy link
Contributor

This PR has been integrated with the https://github.com/nightscout/cgm-remote-monitor/tree/needs_testing
branch. Please test that branch and report at this issue or at #4169

lib/plugins/rawbg.js Outdated Show resolved Hide resolved
README.md Show resolved Hide resolved
Copy link
Contributor

@PieterGit PieterGit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jpcunningh I don't understand the configuration parameters enough. Can you elaborate more on what the differences are and what parameters you should use advice in what situation. I think the docs should be expanded that you should not set both UNFILTERED and SMOOTH to true at the same time. Or perhaps it's better to convert it to a tri-state variable (similar to BASAL_RENDER)

@jpcunningh
Copy link
Collaborator Author

@PieterGit, I changed it to a tri-state variable and updated the README. Great suggestion.

Does the new setting help? Thanks!

@nightscout nightscout deleted a comment Jan 1, 2019
@PieterGit
Copy link
Contributor

This PR has been tested as part of the need_testing branch of #4169
@blocklist_twitter @balshor @sulkaharo @jpcunningh @unsoluble @veryfancy @balshor @tynbendad have run this PR for a week.
No negative stuff popped up. Gitter link: https://gitter.im/nightscout/public?at=5c2f33d12863d8612bd78eb0

If you encounter success or failure with this PR, please reopen the issue and share your findings.

Closing PR, will be merged with #4169

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants