Skip to content

Add cone of uncertainty for Trio predictions#605

Open
bjorkert wants to merge 1 commit intodevfrom
feature/cone-of-uncertainty
Open

Add cone of uncertainty for Trio predictions#605
bjorkert wants to merge 1 commit intodevfrom
feature/cone-of-uncertainty

Conversation

@bjorkert
Copy link
Copy Markdown
Contributor

@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
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