Repository navigation
Compare outcomes since the last setup change with the period before it - #2619
Merged
Merged
Conversation
The Current Setup screen now opens with a summary, e.g. "It's been 5 days since your last setup change: Carb Ratios. Compared with the 2 weeks before it, time in range rose from 68% to 79%, and time below 70 mg/dL stayed about the same at 5.6%." Below it are time-in-range bars for both periods, before and after values for time in range, time below 70, average glucose and insulin per day, and the median glucose by time of day before (dashed) and since (solid) the change. The before period is the 14 days before the change, cut short at the change before it so it covers one setup. It's left out with less than a day or less than 70% CGM data. Results start a day after the change, and while the setup has run under 2 weeks the summary says the numbers can still change a lot. Insulin per day is shown only where the dose records cover the period.
Merges feature/current-setup (#2618), whose SetupHistory replaces this branch's single latest change. The Current Setup screen gets a Setup History list: every change, newest first, with its date, how long that setup ran, what changed and its time in range. Tapping one compares that setup, from its change to the next one, with the period before it. The latest is selected at first. Glucose and insulin are read once for the whole history, so switching is instant.
Collaborator
Author
|
Added ed32171, which merges #2618's branch and adds Setup History:
The history now comes from the settings history plus the experiments recorded on each dosing decision (#2618, LoopKit/LoopKit#669). Changes made before this build show up too.
Tests: 21 setup tests pass, including a new one for a past setup ending at the next change. |
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.


Builds on #2618 (based on its branch; retarget to
next-devonce it merges).The Current Setup screen now shows how things have gone since the last setup change, compared with the period before it.
Screenshots use synthetic glucose for 19 days, injected by a local patch that isn't in this PR, since the simulator only has two days of history.
What it shows
How it's computed
SetupChangenow carriespreviousDatefor this. Settings history provides it for settings changes; for an experiment change, the latest settings change before it is used.GlucoseStatistics.Testing
SetupComparisonTests: windows, the previous-change cutoff, missing before data, the one-day wait, lower bounds, insulin per day and dose coverage. All 19 setup tests pass.LoopWorkspacescheme and checked in the simulator against real history (after the insulin type fix in Show how long the current setup has been unchanged, and its last change #2618, the row reports the real last change) and with the synthetic data above.