Skip to content

Add cone of uncertainty for Trio predictions#605

Merged
marionbarker merged 2 commits intodevfrom
feature/cone-of-uncertainty
Apr 26, 2026
Merged

Add cone of uncertainty for Trio predictions#605
marionbarker merged 2 commits intodevfrom
feature/cone-of-uncertainty

Conversation

@bjorkert
Copy link
Copy Markdown
Member

@bjorkert bjorkert commented Apr 12, 2026

Summary

  • Adds a "cone of uncertainty" visualization for Trio predictions, matching Trio's native forecast display. Instead of four individual prediction lines (ZT, IOB, COB, UAM), a filled band shows the min/max envelope across all prediction arrays at each 5-minute time step.
  • Adds a Prediction Style setting (Cone/Lines) for Trio users. Loop users are locked to its single prediction line with the picker hidden.
  • Reactively monitors device type changes via Combine to auto-set the appropriate default (cone for Trio, lines for Loop) while preserving manual user preference across Nightscout refreshes.
image

Replace individual prediction lines (ZT, IOB, COB, UAM) with a filled
cone that shows the min/max envelope across all prediction arrays,
matching Trio's native forecast visualization.

- ConeChartDataEntry and ConeOfUncertaintyRenderer draw the filled band
  via a custom CGContext polygon in the Charts library
- PredictionDisplayType setting (.cone / .lines) lets Trio users switch
  between styles; Loop users are locked to lines
- Reactive Combine subscription auto-sets the display type when the
  device changes (Loop -> lines, Trio -> cone) while preserving manual
  user preference across Nightscout refreshes
- Cone dataset added at index 18 in both main and small BG graphs
@bjorkert bjorkert changed the title Add cone of uncertainty for Trio/OpenAPS predictions Add cone of uncertainty for Trio predictions Apr 12, 2026
@bjorkert bjorkert requested a review from marionbarker April 12, 2026 19:59
Copy link
Copy Markdown
Collaborator

@marionbarker marionbarker left a comment

Choose a reason for hiding this comment

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

Approve by test.

Loop phone - no difference in LoopFollow, Settings, Graph in the PREDICTION section.

Trio phone - new row, Prediction Style in LoopFollow, Settings, Graph in the PREDICTION section.

  • The default setting is Cone - I guess that will get people's attention when they build this plus it matches the Trio default
  • Modify setting to Lines for both LoopFollow and the Trio phone it is following. The lines visually look the same
  • Restore to cone and displays are consistent in the two apps.

@marionbarker marionbarker merged commit 762e4ae into dev Apr 26, 2026
1 check passed
@marionbarker marionbarker deleted the feature/cone-of-uncertainty branch April 26, 2026 19:06
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.

2 participants