Skip to content

Insulin Correction Safety and Fixes#545

Closed
motinis wants to merge 1 commit into
LoopKit:devfrom
motinis:dosage-safety
Closed

Insulin Correction Safety and Fixes#545
motinis wants to merge 1 commit into
LoopKit:devfrom
motinis:dosage-safety

Conversation

@motinis

@motinis motinis commented Sep 21, 2024

Copy link
Copy Markdown

Please see discussion in zulipchat.

This PR covers two important points:

  1. The effectedSensitivity calculation needs to sum over the segments - otherwise a change in ISF can result in discarding previous segment results and thus the minimum correction calculation may be too high.
  2. Calculate and apply a maxNonSuspendUnits - this is important for safety, for example in edge cases where there is a temporary higher target in play, which can result in some predicted values then having negative correction units (i.e., the weighted target is above the prediction). As a result, the final calculated dosage may result in glucose going below the suspend threshold in such regions. While not observed, it is definitely safer to implement a simple safeguard for this.

@ps2

ps2 commented Oct 5, 2024

Copy link
Copy Markdown
Collaborator

I think this might be covered in the LoopAlgorithm package, which will be landing soon in dev.

@motinis

motinis commented Oct 6, 2024

Copy link
Copy Markdown
Author

@ps2 looking through the LoopAlgorithm source code I think these changes are still relevant - would you prefer I open a PR against that repo instead? Or you want to merge that to dev first and then look at this PR?

marionbarker pushed a commit to loopandlearn/LoopKit that referenced this pull request Oct 28, 2024
loopkitdev pushed a commit to loopkitdev/LoopKit that referenced this pull request Mar 12, 2026
@ps2

ps2 commented May 19, 2026

Copy link
Copy Markdown
Collaborator

The main part of this ticket (effectedSensitivity calculation) was fixed a while ago. The second part is maybe not possible to hit. If you can construct a realistic situation where that change is needed, please update this PR with the test (or create a new one against LoopAlgorithm, more likely)

@ps2 ps2 closed this May 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants