Repository navigation
Conversation
oliverstory
added a commit
to oliverstory/LoopWorkspace
that referenced
this pull request
Mar 9, 2026
oliverstory
reviewed
Mar 13, 2026
|
|
||
| var unitEffectsIndex = 0 | ||
|
|
||
| // For each prediction above target, determine the amount of insulin necessary to correct glucose based on the modeled effectiveness of the insulin at that time |
There was a problem hiding this comment.
This comment should now read something like:
// For each prediction above target, determine the amount of insulin necessary to correct glucose based on the modeled effectiveness of insulin over the dose duration
oliverstory
reviewed
Mar 13, 2026
| /// - correctionRange: The schedule of glucose values used for correction | ||
| /// - date: The date the insulin correction is delivered | ||
| /// - suspendThreshold: The glucose value below which only suspension is returned | ||
| /// - sensitivity: The insulin sensitivity at the time of delivery |
There was a problem hiding this comment.
This comment needs updating as 'sensitivity' is now the insulin sensitivity schedule (not sensitivity at the time of delivery)
oliverstory
reviewed
Mar 13, 2026
oliverstory
left a comment
There was a problem hiding this comment.
See comments on lines 226 and 252 of DoseMath.swift, where code comments need updating due to the switch from using ISF at the time of a dose to using the ISF schedule.
Collaborator
|
Mid-absorption ISF is part of the changes landing with the tidepool merge, and LoopAlgorithm package. |
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.
Loop has historically used the ISF at the start of a dose to determine the ISF for the lifetime of the dose, ignoring changes to ISF (whether according to the regular schedule or via overrides).
This contribution changes this to using ISF over the lifetime of the dose. It does this by splitting the calculation in 2 parts:
Dosage determination is handled by considering the glucose effect change that would happen if giving 1U, and then scaling this to match Loop's existing criteria.
Note that the interpolation during dose determination is done for consistency, even though unitGlucoseEffect should be aligned on the same dates. The interpolation logic was originally implemented in #562 before being generalized in motinis@3040b7b and simplified for 1 value - it is designed to support interpolation as part of a loop where we want to continue to search for the next relevant data point(s) from where we left off at the previous iteration (so as to have O(n) behavior in the length of the data and not O(n^2)).