Skip to content

Show and record what Guard + Runway did - #2611

Merged
ps2 merged 1 commit into
next-devfrom
feature/guard-and-runway-display
Oct 25, 2026
Merged

ps2 merged 1 commit into
next-devfrom
feature/guard-and-runway-display

Conversation

@ps2

@ps2 ps2 commented Oct 25, 2026

Copy link
Copy Markdown
Collaborator

Shows and records what Guard + Runway did on each run. It uses AlgorithmOutput.guardAndRunway from LoopKit/LoopAlgorithm#12 (merged); LoopKit/LoopAlgorithm#13 makes its bandDepth the actual lowering.

Predicted Glucose screen (only with Guard + Runway on)

  • A new Guard + Runway row shows "Forecast lowered up to X (recent volatility Y)", or "Forecast not lowered while carbs are active". It also shows "Automatic dosing target lowered Z", or "not lowered".
  • Checking or unchecking the row draws the comparison curve with or without the guard. Until now, with everything checked, the comparison curve could differ from the forecast with no explanation, because the forecast includes the guard and the comparison curve didn't.
  • The Retrospective Correction row notes when the post-low rise cut is active.

Dosing decisions
The guardAndRunway entry in each decision's algorithmExperiments now records volatility, bandApplied, bandGain, bandDepth, runwayShift and postLowRiseCutActive alongside volatilityBaseline. That entry is already stored and uploaded to Nightscout and Tidepool, so the new values go there with no service changes. The decision recorded after a bolus is entered still has only the baseline.

Tested

  • LoopTests pass (344).
  • Checked in the simulator with the mock CGM and pump: the row shows the values, and unchecking it draws the comparison curve without the guard.
  • The runway and rise-cut text were not seen in the simulator, because that needs a calm high or a recent low. The values behind them are covered by LoopAlgorithm's tests.

With Guard + Runway on, the Predicted Glucose screen gets a Guard + Runway row.
It shows how far the forecast was lowered and the recent volatility (or that
active carbs kept the guard off), and how far the automatic dosing target was
lowered. Checking or unchecking the row draws the comparison curve with or
without the guard. The retrospective correction row notes when the post-low
rise cut is active.

Each dosing decision's guardAndRunway experiment entry now also records
volatility, bandApplied, bandGain, bandDepth, runwayShift and
postLowRiseCutActive alongside volatilityBaseline, so they are stored and
uploaded to Nightscout and Tidepool with the decision.
@ps2
ps2 merged commit 417d966 into next-dev Oct 25, 2026
Trpl7ca pushed a commit to Trpl7ca/LoopWorkspace that referenced this pull request Oct 25, 2026
- LoopKit/LoopAlgorithm#12: AlgorithmOutput.guardAndRunway
- LoopKit/LoopAlgorithm#13: Report the guard band's actual depth
- LoopKit/Loop#2611: Show and record what Guard + Runway did
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