You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have noticed on occasion the IOB calculation in Loop is incorrect. We are using a 722 pump with an iPhone 4s. The preferred data source is set to Event History. Here's one example.
Bolus of 1.4 U at 6:21 PM resulted in a jump in IOB of 2.8 U (I imagine it was counted twice) and immediate temp to zero:
The reservoir history does not show a drop of this magnitude:
and the history shows a single bolus at 6:21 PM:
Manually deleting the reservoir history list seems to force Loop to recalculate IOB using pump history alone, resulting in the correct IOB:
No, I just deleted all of them (I think they went back to 12 am) but my son
wasn't using Loop during the day at school so there was a gap in the
middle. I'm not sure how many need to be deleted to force a recalculation.
@ps2 I haven't noticed this again since filing the issue, but I also haven't tried to reproduce it, as I don't have a second rig for testing. Could easily have happened again on small boluses without us knowing. I'll have a look at the code to see if there's any way a bolus could be counted twice. Where should I start looking? Somewhere in LoopKit/InsulinKit?
Thanks @ps2 I'm wondering if there's an edge case where the dose is counted once from pump history and then a second time from recent reservoir values. Might have to do with the speed of bolus delivery and the timing of pump bolus events vs reservoir events.
@ps2 After a careful read of DoseStore.swift I've realized that the IOB is based on reservoir history alone (if continuous) or pump history alone, so I don't think it's possible for the dose to be counted once on reservoir data and then again on pump history. My best guess for what is happening here is that the reservoir data wasn't continuous, so the IOB was based on event history, and there was some error in deduping the bolus events. Clearing the reservoir history caused loop to crash which deleted the dose caches and forced a recalculation that fixed the problem. Sound plausible?
Activity
loudnate commentedon Sep 15, 2016
Thanks for filing this.
Do you remember how many entries you needed to delete?
thebookins commentedon Sep 15, 2016
No, I just deleted all of them (I think they went back to 12 am) but my son
wasn't using Loop during the day at school so there was a gap in the
middle. I'm not sure how many need to be deleted to force a recalculation.
On Thu, Sep 15, 2016 at 2:40 PM, Nathan Racklyeft notifications@github.com
wrote:
loudnate commentedon Sep 15, 2016
Do you remember what time the gap ended?
Just try deleting one reservoir entry next time and let me know what you see.
thebookins commentedon Sep 15, 2016
The gap would have ended around 3pm. Will try deleting one entry next time.
Cheers.
On 15 Sep 2016 3:07 PM, "Nathan Racklyeft" notifications@github.com wrote:
ps2 commentedon Nov 24, 2016
@thebookins Have you been able to reproduce this issue?
thebookins commentedon Nov 24, 2016
@ps2 I haven't noticed this again since filing the issue, but I also haven't tried to reproduce it, as I don't have a second rig for testing. Could easily have happened again on small boluses without us knowing. I'll have a look at the code to see if there's any way a bolus could be counted twice. Where should I start looking? Somewhere in LoopKit/InsulinKit?
ps2 commentedon Nov 24, 2016
https://github.com/LoopKit/Loop/blob/master/Loop/Managers/LoopDataManager.swift#L195 is the top level entry point into calculating IOB in Loop.
thebookins commentedon Nov 24, 2016
Thanks @ps2 I'm wondering if there's an edge case where the dose is counted once from pump history and then a second time from recent reservoir values. Might have to do with the speed of bolus delivery and the timing of pump bolus events vs reservoir events.
thebookins commentedon Nov 28, 2016
@ps2 After a careful read of DoseStore.swift I've realized that the IOB is based on reservoir history alone (if continuous) or pump history alone, so I don't think it's possible for the dose to be counted once on reservoir data and then again on pump history. My best guess for what is happening here is that the reservoir data wasn't continuous, so the IOB was based on event history, and there was some error in deduping the bolus events. Clearing the reservoir history caused loop to crash which deleted the dose caches and forced a recalculation that fixed the problem. Sound plausible?
jmatheson commentedon May 18, 2017
Can this be closed?
ps2 commentedon May 18, 2017
Yes. I think if this was an ongoing issue, we'd be hearing at least some reports of it.
LOOP-1628: make func for suspend threshold calculations (#166)