Carry the pump reservoir value across records that omit it - #746
Open
bjorkert wants to merge 1 commit into
Open
Conversation
Loop uploads pump.reservoir in only some device status records while an Omnipod is below 50U. The last exact reading is kept per pump and reused for 30 minutes when the field is missing, and the pump row shows an em dash once it is older than that. A missing reading reads as 50+U for pumps that report a volume only when it is low, and for records that name no pump at all, which is how Trio and iAPS upload. Pumps that name themselves and report a volume in every record get the em dash instead. A reading that arrives within 15 minutes of a pump first appearing can still be the previous pod's, so it is not taken as evidence that the pod is below its reporting limit. latestPumpVolume is optional so an unknown volume cannot reach the reservoir alarm as 50.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
LoopFollow reads the newest Nightscout device status record and treats a missing pump.reservoir as a reservoir above 50U. That is right for a full Omnipod, but Loop also leaves the field out of many records while the pod is below 50U.
I looked at 13 days of data from two Nightscout sites. There were 28 and 40 such gaps, median 25 minutes, the longest 85 minutes, and several of them happened while the pod held between 7 and 19 units. The pump row read 50+U through all of them, and since latestPumpVolume was pinned to 50 the low reservoir alarm could not fire either.
LoopFollow now keeps the last exact reading per pump and reuses it for 30 minutes when the field is missing. Once the reading is older than that the row shows an em dash. Replaying the same 13 days, the 172 and 228 records that read 50+U while the pod was below 50U drop to none, 127 and 157 records show the real volume, and 63 and 88 show the em dash.
Loop's first records for a new pod still carry the previous pod's final volume for up to 10 minutes, so a reading from the first 15 minutes after a pump appears is not taken as evidence that the pod is below 50U.
Trio and iAPS put no pumpID, manufacturer or model in the record, and they upload the reservoir without gaps, so records with no pump identity are resolved from the record alone. I checked six Trio and iAPS sites and no record resolves differently there. A Medtrum pump on Trio reports its volume in every record and is not affected.
Pumps that do name themselves and report a volume in every record show an em dash when the field is missing, since 50+U only makes sense for a pump that reports a volume solely when it is low.
Docs for the pump row will need a note about the em dash, in a separate PR.