-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Use maxBolus to set automaticDosingIOBLimit #1871
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 26 commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
5a4659c
Use maxBolus and ratio to set maxAutoIOB
marionbarker b022c4c
Merge branch 'dev' into wip/max-auto-iob
marionbarker a97e007
Merge branch 'dev' into wip/max-auto-iob
marionbarker 2afe19a
increase ratioMaxAutoInsulinOnBoardToMaxBolus to 2.0
marionbarker 0733eaf
remove print statements
marionbarker 90b0470
restore LoopContants
marionbarker 74fd253
modify name from maxAutoIOB to automaticDosingIOBLimit
marionbarker dd4ed94
Merge branch 'dev' into wip/max-auto-iob
marionbarker 34bf4cb
Code cleanup in DoseMath
marionbarker d6698c9
configure new optional commands with default nil
marionbarker 0c182a1
remove whitespace
marionbarker fc654ff
Add automaticIOBLimitTests
marionbarker 87478d8
DoseMathTests: add new args to all automated dosing tests
marionbarker fae59f4
remove defaults so new parameters are required
marionbarker 659a10d
Merge branch 'dev' into wip/max-auto-iob
marionbarker ea948df
Modify method for providing insulinOnBoard in LoopDataManager
marionbarker bdbd78f
Merge branch 'dev' into wip/max-auto-iob
marionbarker 800eba0
AlertManagerTests: add new parameter
marionbarker 9ac85c3
Merge branch 'dev' into wip/max-auto-iob
marionbarker 0ef5008
match whitespace
marionbarker c902fbe
`insulinOnBoardValue` -> `insulinOnBoard` for logging purposes
novalegra 8699730
Add test for autobolus clamping
novalegra 3c7c65b
Improve readability of dose clamping logic
novalegra 97b7d8d
Merge pull request #1 from novalegra/max-auto-iob
marionbarker 61bea9d
DoseMathTests: use non-zero value for insulinOnBoard
marionbarker 01c775c
DoseMathTests: move insulinOnBoard internal to test functions
marionbarker 027d5e8
Merge branch 'wip/max-auto-iob' of https://github.com/marionbarker/Lo…
ps2 c6323df
Move IOB limit handling into recommendedAutomaticDose, and recommende…
ps2 caf2709
Temp basals limited by iob max
ps2 374160f
Cleanup
ps2 e041840
Remove unintentional edit
ps2 6b83d2f
Fix maxThirtyMinuteRateToKeepIOBBelowLimit calculation
marionbarker cf808a8
Adjust IOB clamping for temp basals to be relative to scheduled basal
ps2 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
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
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
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
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
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we have a failure to get insulin on board, then dosing will not be limited. The
insulinOnBoardfunction parameter here should probably be non-optional and the loop fail with an error if it can't be retrieved.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I naively thought the code where self.insulinOnBoard is set:
https://github.com/marionbarker/Loop/blob/wip/max-auto-iob/Loop/Managers/LoopDataManager.swift#L1039-L1048
with the switch for result of .failure or .success handles the case where there is a failure to get insulin on board.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking more closely (and finding your earlier comment) - it does seem to be an a warning.
Changing this is beyond what I can do.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I totally agree that it should be non-optional if a manual bolus isn't being recommended. However, this means we'll also need to retrieve IOB when recommending a manual bolus, something that doesn't currently occur, and we won't end up using that data. Alternatively, I'm hesitant to just pass a junk IOB into
insulinCorrectioneven if it won't be used.Would it work to add the error check (which then would halt the recommendation for automatic dosing) and keep the IOB parameter as an optional for compatibility with manual bolusing? Also open to linking the
insulinOnBoardandautomaticDosingIOBLimitas one optional tuple at the call site with associated non-optional parameters, since this expresses the intent of limiting or not limiting a little better(something like
dosingLimit: (insulinOnBoard: Double, automaticDosingIOBLimit: Double)?)