-
Notifications
You must be signed in to change notification settings - Fork 717
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Improved Duplicate Handling in Nightscout BG Data Processing #365
Conversation
Code ReviewThis does what it says. But is this the right thing? TestTest dual uploadsUpload the same fixed glucose pattern from two different Terminal windows. Test one minute uploadsNow just one trace, but upload at 60 sec intervals.
|
The problematic double uploads are probably very close in time, would you like to re-do the test having |
Modify minIntervalBuilt after changing minInterval to 50 // sec Not the right change. I believe func ProcessDexBGData needs to be rewritten. If it gets one minute intervals, the 5 minute delta should be (val2-val1)/(timedelta) normalized to 5 minutes and reported as integer mg/dL. Test one minute uploadsNow just one trace, but upload at 60 sec intervals.
|
Adjusted the duplicate check method for glucose readings. |
Test one minute uploads againOne glucose trace, upload at 60 sec intervals.
IMO this is good enough. LoopFollow - reports successive deltas for any numbers more than 30 sec apart. It does not convert to a a 5 minute effective delta but I think that's fine too. Test with dual uploads, started a few sec apartupload 1 started at: 2025-01-30T15:44:58.000Z Let it run for for 4 pairs of uploads and observe only one of each pair shows up in LoopFollow and the delta is always appropriate. |
One last test - confirm that if there really is a repeated glucose value, it is reported appropriately Create a new trace with constant CGM value (120 mg/dL) and upload it at 5 minute intervals.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed, tested and approved.
Resolves #357
This update fixes an issue where duplicate glucose readings (nightscout dexcom bridge and Loop or Trio) were were sometimes included, resulting in a delta of 0. The new logic ensures that readings are spaced at least 4 minutes apart, preventing duplicate values from affecting calculations.
Additionally, the previous method, which iterated through multiple time buckets and filtered the closest reading, has been replaced with a more efficient single-pass approach. This results in faster processing while maintaining accurate data selection.
Fixes:
• Eliminates near-duplicate readings that caused incorrect delta calculations.
• Improves performance by removing unnecessary filtering operations.