Skip to content

Use full ICE history for displaying estimated carbohydrate effects #2163

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 1 commit into from
Apr 17, 2025

Conversation

oliverstory
Copy link
Contributor

The 'predicted' dataset on the 'glucose change' graph was calculated using insulin counteraction effects that had been truncated to the width of the chart. This meant that carb entries early in the timeline may not have dynamic carb absorption applied as the implied ICE was zero for the first part of the carb entry's history.

Addresses the different behaviour in landscape and portrait view of the glucose change graph in the carbohydrate screen. so that dynamic carb effects are always shown when they are in effect.

For discussion (but not included in this pull request), for clarity the graph dataset label could be changed from 'Predicted' to 'Estimated and predicted' given that it already incorporates dynamic glucose effects (when these are in effect), so is partly based on observation.

Does not address what I described as 'desired' behaviour of showing a static prediction for the 'predicted' dataset; I am not sure how you would achieve that.

Closes #2159

The 'predicted' dataset on the 'glucose change' graph was calculated using insulin counteraction effects that had been truncated to the width of the chart. This meant that carb entries early in the timeline may not have dynamic carb absorption applied as the implied ICE was zero for the first part of the carb entry's history.
@marionbarker
Copy link
Contributor

I cannot reproduce the issue reported in #2159 with my test phone.
I can apply the patch to dev, commit 47450c1.
It applies cleanly, builds with no problem and the ICE screens are unchanged.

If there's an additional test that would be helpful, I could try again.
(I ran for about 6 hours with 3 carb entries.)
Do you know of specific configuration I could try to reproduce to make the inconsistency show up?

@oliverstory
Copy link
Contributor Author

oliverstory commented May 18, 2024

Based on my understanding of the maths, to reproduce the issue prior to the patch you need:

  1. A carb entry where ICE is slightly larger than minimum rate absorption but not hugely larger.
  2. To set this up on a test phone you could try adding an insulin entry and have glucose flat. Add a matching carb entry at a similar time. Make the carb entry slightly smaller than you'd normally have for that amount of insulin (or conversely, make the insulin entry slightly larger than your settings would recommend for that carb amount). You could enter this at a time close to the earliest time on the portrait view glucose change graph to make subsequent steps shorter.
  3. Carb entry should initially show dynamic carb absorption - ie ‘predicted’ curve will follow ‘observed’ curve - on both graphs.
  4. Wait until the start time of the carb entry moves off the left of the portrait view graph. At a certain point, the sum of minimum rate absorption over time for the entry will be more than the sum of ICE (because prior to the patch, ICE is truncated at the left edge of the graph). Now the predicted curve will follow minimum rate absorption and be below ICE on the portrait view. But on landscape view, the it should still show dynamic carb absorption (because the landscape view uses a longer series of ICE values).

@Trpl7ca
Copy link

Trpl7ca commented Jul 11, 2024

I would like to try this, if I use your commt number and git hub info and add line to my yum file, would that work for browser build?

@oliverstory
Copy link
Contributor Author

oliverstory commented Jul 11, 2024 via email

Copy link
Contributor

@itsmojo itsmojo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did not try to reproduce, but this simple change seems reasonable and safe to do with my limited understanding of this code.

@oliverstory
Copy link
Contributor Author

This code will change with the tidepool-merge (and I think this display bug may not exist in that branch, from reading the code - I have not tested tidepool-merge)

@marionbarker
Copy link
Contributor

I did test tidepool-merge (if you look at LoopWorkspace PR 513, you will see some testing summary comments.)

We plan a new release from dev before merging tidepool-merge. Whether this PR is merged as part of that process is under discussion.

Copy link
Collaborator

@ps2 ps2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this is already fixed in the tidepool merge. We can merge this into dev for now, since it looks like it should fix the issue there, and I'll just have to resolve the conflicts before tidepool-merge lands.

@marionbarker marionbarker merged commit ca9776c into LoopKit:dev Apr 17, 2025
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Glucose change graph 'predicted' effects are inconsistent at different times or between orientations
5 participants