Skip to content

Suspend threshold uses predicted BGs but not current BG #653

@elnjensen

Description

@elnjensen

When determining whether or not to recommend a bolus for carbs entered, Loop appears to be ignoring the current BG value and only using the array of predicted BG values. This can lead to unexpected behavior when the current BG is slightly below the suspend threshold and carbs are entered. If all of the predicted BG values are above the threshold, Loop will recommend a bolus even if the current BG is below the threshold.

Steps to reproduce:

  1. Wait until BG is flat or rising.
  2. Set suspend threshold to a value just slightly above the current BG (e.g. just 1 mg/dl or 0.1 mmol/L larger).
  3. Enter a large number of carbs. Typically this will result in a bolus recommendation even though current BG is below threshold. (If it doesn't, scroll over the glucose prediction graph and you'll see that the first predicted value is above the threshold you set.)
  4. Delete the fake carbs and set your suspend threshold back to a normal value! 😄

This is admittedly an edge case, but nonetheless doesn't match the documented function of the suspend threshold. I tried to follow the logic through the code, but I had a hard time figuring out where the current BG value is stored. There are some comments (e.g. this) that imply that it is included as the first element in the array of predicted BG values, but if that were the case, then I think the code should work as-is.

This seems like possibly where the current BG needs to be considered if it is not in fact part of the prediction array.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions