Skip to content

[Feature]: restingHRDrift is declared but nothing ever raises it #112

Description

@ak710

What problem does this solve?

CoachAnomalyKind.restingHRDrift has existed since the proactive-alert path landed, with a comment explaining why nothing fires it:

Reserved for a future baseline-aware detector (needs multi-day history).

That's accurate — CoachAnomalyDetector reads a 12-hour NotificationContextPacket, and drift is only meaningful against a multi-day baseline. But the baseline already exists: RestingHRBaselineService learns and persists the 10th percentile of 30 days on UserProfile.hrRestingBaseline. It just never reaches the packet.

An elevated resting heart rate is the signal that moves first under infection, alcohol, heat and under-recovery — typically about a day before you notice anything — so this is a cheap, high-value detector sitting one field away from working.

Proposed solution

Carry the learned baseline and last night's resting figure in the notification packet, and implement the detector.

Measure both sides the same way — the interpolated 10th percentile, sharing RestingHRBaselineService's own helper. Comparing a night's mean against a 30-day percentile would produce a difference that is mostly an artefact of the two formulas.

Bound the night by the sleep session rather than a clock window, so a late night or a shift schedule is measured over the hours actually slept.

Area

AI Coach (tools, prompts, on-device LLM)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions