Description
Under some circumstances, Loop will display basal rate spikes on the "Insulin Delivery" graph that have very large values, much greater than the max basal rate allowed by the pump. Those of us who have been using Loop for some time know that these are actually boluses, and that Loop will update the graph eventually when it reads the full pump history.
However, these graphs continue to confuse new users, and to cause some consternation, since they lead people to think that Loop has actually somehow delivered huge amounts of insulin somehow. Thus, avoiding them if possible would be less confusing to users.
Since we know the max basal rate, in theory it should be possible to identify such events and to plot them more or less correctly. I say "more or less" because it's probably not completely possible to separate out what the actual basal rate was at the time, i.e. how much of the very large "basal" rate during that window was really basal, and how much was bolus. However, we can say with confidence that any delivery above the allowed max basal rate surely included a bolus component.
So my proposal would be to flag these events while parsing the dose entries, and plot them as boluses. The parsing is here, and right now the logic is "if entry is labeled as bolus, plot as bolus, otherwise plot as basal." We could add another check there: "if entry is labeled as bolus, plot as bolus; if entry has a delivery rate greater than max basal, plot as bolus (possibly with a different symbol to indicate it was estimated - open triangle?); otherwise, plot as basal."
I'd be willing to tackle this, but I'm curious to hear comments from others. Any downsides to this? Or things to think about if I implement it? One thing that would be useful to know is under what circumstances this effect appears. I would think it's when Loop is relying on reservoir data that are newer than the latest event history data, but I don't know exactly when that happens.