-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Display the previous day's carb entries on the carb absorption screen. #2182
base: dev
Are you sure you want to change the base?
Conversation
This involves several changes: 1) Change Loop to calculate insulin counteraction effects for the previous 48 hours (was 24 hours). This is necessary so that dynamic carb absorption can be calculated for the previous day's entries. 2) Fetch carb entries up to the previous midnight, plus any entries that might still be absorbing at that time - previous day's entries are not shown prior to any counteraction effects if these are missing 3) Filter these entries to only display up to the previous midnight 4) Add the (localised) phrase 'Yesterday' in front of the date for yesterday's entries
SummaryThis provided additional ICE screen rows.
Questions?
Test DetailsAdded this to my personal phone because my test phones don't have many carb entries.
Other Test Details
|
I can adjust the thresholds easily enough. The midnight cut-off is a bit arbitrary but for most people means you have a break with no overlapping carb entries. Options could be:
There was some previous discussion in #738 Some technical considerations are:
Without the patch, current loop dev shows entries up to and including midnight of today, plus anything that might still be absorbing on the left edge of the glucose change graph. So in the early part of the day you sometimes get the tail end of a late night snack of fat-protein entry. This disappears later in the day. |
From a feature perspective I think this is fine. From a code perspective; the code here has already changed on the Tidepool side to work with the new LoopAlgorithm package. Once that is landed in dev, this should be updated to work against those changes, and then this can be landed. |
@@ -992,7 +992,7 @@ extension LoopDataManager { | |||
|
|||
let retrospectiveStart = lastGlucoseDate.addingTimeInterval(-type(of: retrospectiveCorrection).retrospectionInterval) | |||
|
|||
let earliestEffectDate = Date(timeInterval: .hours(-24), since: now()) | |||
let earliestEffectDate = Date(timeInterval: .hours(-48), since: now()) |
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.
Proposed change to see a week of data in the table (need this and the next one):
let earliestEffectDate = Date(timeInterval: .hours(-7*24), since: now())
The data store contains 7 days of data. Perhaps this should be a variable tied to the days of storage parameter. (not sure where that is - just remember that it exists)
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.
Making this 7 days, makes the app very slowly on iPhone 11. It took a good 30-60sec before the UI got updated (aka the charts got filled with data). Maybe we should find a middle ground?
@@ -139,7 +139,7 @@ final class CarbAbsorptionViewController: LoopChartsTableViewController, Identif | |||
charts.updateEndDate(chartStartDate.addingTimeInterval(.hours(totalHours+1))) // When there is no data, this allows presenting current hour + 1 | |||
|
|||
let midnight = Calendar.current.startOfDay(for: Date()) | |||
let listStart = min(midnight, chartStartDate, Date(timeIntervalSinceNow: -deviceManager.carbStore.maximumAbsorptionTimeInterval)) | |||
let previousMidnight = midnight - .hours(24) |
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.
Proposed change to see a week of data in the table (need this and the previous one):
let previousMidnight = midnight - .hours(6*24)
Probably should also change previousMidnight
to a new name - just in this one file.
Edited my comment to indicate @oliverstory suggestion of earliestMidnight
.
I understand this will not be a suitable PR to go with |
Do you think the slow down affects operation, or just initial start up?
…On Sun, 4 Aug 2024 at 7:29 PM, Bastiaan Verhaar ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In Loop/Managers/LoopDataManager.swift
<#2182 (comment)>:
> @@ -992,7 +992,7 @@ extension LoopDataManager {
let retrospectiveStart = lastGlucoseDate.addingTimeInterval(-type(of: retrospectiveCorrection).retrospectionInterval)
- let earliestEffectDate = Date(timeInterval: .hours(-24), since: now())
+ let earliestEffectDate = Date(timeInterval: .hours(-48), since: now())
Making this 7 days, makes the app very slowly on iPhone 11. It took a good
30-60sec before the UI got updated (aka the charts got filled with data).
Maybe we should find a middle ground?
—
Reply to this email directly, view it on GitHub
<#2182 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABFRGMMO2DUAFWPH6W54O5DZPXX7RAVCNFSM6AAAAABKQVCRR6VHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZDEMJXGUYTIOJVGM>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
It was the initial start and getting the app in foreground |
I did some tests today in response to @bastiaanv comments. I added and removed the customization for a week of meals and did some testing.This was done by counting - so not super precise. This is using my real phone (15 pro) and I enter all my carbs.
|
The primary purpose of this change, as expressed in several comments on the issue report, is to allow review of carb absorption from the previous day.
This involves several changes:
Change Loop to calculate insulin counteraction effects for the previous 48 hours (was 24 hours). This is necessary so that dynamic carb absorption can be calculated for the previous day's entries.
Fetch carb entries up to the previous midnight, plus any entries that might still be absorbing at that time
Filter these entries to only display up to the previous midnight
Add the (localised) phrase 'Yesterday' in front of the date for yesterday's entries
I have tested this on a simulator over several days with flat glucose simulator.
To test, you can add a series of carb entries and:
Closes #1861