Skip to content

UAM algo updates: only use directly observed carb absorption#5

Merged
novalegra merged 10 commits into
aq/missed-meal-detectionfrom
only-ice-carb-autofill
Nov 28, 2022
Merged

UAM algo updates: only use directly observed carb absorption#5
novalegra merged 10 commits into
aq/missed-meal-detectionfrom
only-ice-carb-autofill

Conversation

@novalegra

@novalegra novalegra commented Nov 28, 2022

Copy link
Copy Markdown
Owner

This PR adds:

  1. only using the observed carb absorption to detect a missed meal (rather than looking at a projection into the future, as the previous version did)
  2. detection of the quality of carbohydrates in a UAM using observed absorption
  3. tests for the algorithm updates
  4. improved debug info

See also novalegra/Loop#6

novalegra and others added 10 commits November 20, 2022 15:06
* Plumb a customizable carb amount through UAM notification architecture

* Refactor carb effect threshold computation into helper function

* Add first draft of dynamic carb selection for meal

* Bump max carb autofill limit from 100 -> 150

* Add tests for carb autofill

* Bump max carb threshold limit because of dynamic autofill clamping
@novalegra novalegra marked this pull request as ready for review November 28, 2022 23:48
@novalegra novalegra merged commit a36d636 into aq/missed-meal-detection Nov 28, 2022
@novalegra novalegra deleted the only-ice-carb-autofill branch November 28, 2022 23:48
novalegra added a commit that referenced this pull request May 1, 2023
* Add unannounced meal func to CarbStoreProtocol

* V1 of UAM algo

* Fix issues with time intervals not lining up

* Fix issue with ICE not being cumulative

* Make carb threshold a static const

* Handle errors in fetching glucose effects

* Add date range unit test

* Style improvement

* Update build settings so watch can access LoopNotificationUserInfoKey

* Add debug info for feature to carbstore

* Remove unneeded variable set

* Save last UAM notification time in UserDefaults

* Add debug info

* Update naming to make constant transition easier

* Use constants instead of variables

* Only restrict notification delivery so we don't detect the same meal twice

* Retract UAM notifications after the carbs have expired

* Simplify change & meal checks into a single threshold

* Fix effects from outside of the search window being included & triggering false-positive UAM detections

* Improve function naming

* Add enhanced debug info

* Move notification logic from LoopKit to Loop

* Improve debug logs

* Make current date configurable

* Add preliminary tests

* Add test

* Fix carb entries being purged bc of current date not being set during unit testing

* Update UAM tests

* Update status enum naming for point-of-use clarity

* Fix observation start for unit testing

* Pull UAM constants into separate struct

* Fix unexpected effect not including all needed effects

* Fix carb effects not being carb _counteraction_ effects

* Update tests for algo changes

* Add noisy cgm testcase

* Add test for non-unannounced meal with COB

* Add realistic unannounced meal test

* Improve algo commenting

* Update UAM algo to detect more-aggressively

* Remove TODO

* Update debug information

* Schedule missed meal notifications to avoid notification during an microbolus (#2)

* Add ability to estimate delivery duration of bolus

* Add tests for UAM notification delay

* Update `estimatedDuration` function headers in response to PR feedback

* Add UAM banner to carb entry screen (#4)

* UAM algo updates: only use directly observed carb absorption (#5)

* Add ability to calculate the number of carbs in a missed meal (#3)

* Plumb a customizable carb amount through UAM notification architecture

* Refactor carb effect threshold computation into helper function

* Add first draft of dynamic carb selection for meal

* Bump max carb autofill limit from 100 -> 150

* Add tests for carb autofill

* Bump max carb threshold limit because of dynamic autofill clamping

* Lower the UAM max autofill

* Require that unannounced meals have ICE onboard that is >= the meal threshold, and only autofill observed ICE

* Lower ICE threshold for a UAM notification

* Update tests

* Improve debug info

* Update commenting

* Remove unused test

* Update test

* `dateRange` -> `simulationDateRange`

* Create `MealDetectionManager` from old UAM functions in `CarbStore`

* Add fixme

* Updates based on feedback for UAM PR (#6)

* `dateRange` -> `simulationDateRange`

* Create `MealDetectionManager` from old UAM functions in `CarbStore`

* Add fixme

* Move UAM test fixtures from LoopKit to Loop

* Unannounced meal / UAM -> missed meal
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.

1 participant