docs: document DaytimeStress, StressIndex, HRVFreqDomain, StressOnsetDetector - #411
docs: document DaytimeStress, StressIndex, HRVFreqDomain, StressOnsetDetector#411vishk23 wants to merge 3 commits into
Conversation
…Detector The "What is actually wired into the app" inventory omitted the Stress screen's live analytics entirely. DaytimeStress (intraday hourly stress timeline), StressIndex + HRVFreqDomain (additive HRV lenses), and StressOnsetDetector (opt-in L3 stress check-in) are all wired and live, but had zero mention in the doc. Confirmed each call site by reading the source: - DaytimeStress.analyze(...) is called from StressView.loadDaytime(), rendering the "Today's Timeline" card and sustained-high Breathe suggestion. Reachable on iOS via More -> Stress (RootTabView.swift). - StressIndex.components(...) / stressIndex(...) is called from both StressView.loadDaytime() (Advanced HRV card) and AICoach.swift's stressIndexLine() (AI Coach context). - HRVFreqDomain.freqDomain(...) is called from the same StressView.loadDaytime() as StressIndex, found undocumented during this pass. - StressOnsetDetector.evaluate(...) is called from AppModel's evaluateStress(), gated behind a default-off "stress check-ins" toggle, surfaced via StressCheckInCard/StressNudgeCenter. Documents DaytimeStress as day-relative (scored against the day's own waking-hour calm reference), not yet baseline-relative like the daily Stress score.
…alidated Clean merge — the 3-way correctly kept upstream's later edits to the two regions this branch originally rewrote, so the stale `HRVAnalyzer` table row and the "RMSSD for the stress nudge" section (documenting an `AppModel.rmssd` and a `behavior.stressNudge` toggle upstream has since deleted) dropped out on their own. What survives is the still-missing part: the four engine table rows and the Stress-analytics section. One correction to this branch's own text, which the same upstream work invalidated: `StressOnsetDetector` no longer runs "alongside (not replacing) the legacy inline nudge" — `AppModel.evaluateStress()` is now the detector's only caller and the legacy inline nudge is gone. Re-verified every other claim in the section against current `main`: `StressView.loadDaytime()` still calls `DaytimeStress.analyze` / `StressIndex.components` / `HRVFreqDomain.freqDomain`, `AICoach.stressIndexLine()` still exists, and `BiofeedbackPrefs.stressConfig()` still carries the `enabled` + `autoNudge` gates. Docs-only; no code touched.
|
Merged current What dropped out on its own. The 3-way merge kept upstream's later edits to the two regions this branch originally rewrote, so two now-wrong pieces disappeared without my touching them:
One correction I made by hand. This branch's own text said Re-verified as still accurate on current Docs-only, 1 file. Two notes for whoever lands it:
|
Summary
docs/ANALYTICS.md's "What is actually wired into the app" section omitted the Stress screen's live analytics entirely:DaytimeStress,StressIndex,HRVFreqDomain, andStressOnsetDetectorhad zero mention despite all being wired and live.DaytimeStress(Packages/StrandAnalytics/Sources/StrandAnalytics/DaytimeStress.swift) — buckets waking hours (06:00-22:00) from the day'shrSample+rrIntervalstreams, z-scores hourly HR-elevation / RMSSD-suppression against the day's own calm hours (not a personal baseline), and squashes onto the same 0-3 logistic the daily Stress score uses. Day-relative today; documented as such without promising a future baseline-relative mode.StressIndex(Baevsky Stress Index) andHRVFreqDomain(LF/HF) — two additive, on-demand HRV lenses, purely informational (don't feed the 0-3 score).StressOnsetDetector— the L3 edge-triggered, exercise-gated stress check-in, opt-in and default-off.Wired call sites confirmed by reading source
DaytimeStress.analyze(hr:rr:tzOffsetSeconds:)<-Strand/Screens/StressView.swiftloadDaytime(), rendering the "Today's Timeline" card (DaytimeLoadLine,StressTotalsBar) and the sustained-high Breathe-suggestion card. Reachable on iOS via More -> Stress (StrandiOS/App/RootTabView.swift,.stress->StressView()).StressIndex.components(rr:)/StressIndex.stressIndex(rr:)<-StressView.loadDaytime()(Advanced HRV card) andStrand/AI/AICoach.swift'sstressIndexLine()(folded into the AI Coach context, consent-gated).HRVFreqDomain.freqDomain(rr:)<- the sameStressView.loadDaytime()call asStressIndex— found wired-but-undocumented alongside it during this pass (not explicitly asked for, flagging it since it shares the exact call site).StressOnsetDetector.evaluate(...)<-Strand/App/AppModel.swift'sevaluateStress(), gated behind a default-off "stress check-ins" toggle (BiofeedbackPrefs.stressConfig()), state persisted viaBiofeedbackPrefs, surfaced viaStressCheckInCard/StressNudgeCenter.Test plan
docs/ANALYTICS.md,DaytimeStress.swift,StressView.swift,StressIndex.swift,StressOnsetDetector.swift,RootTabView.swift,AppModel.swift,AICoach.swift,BiofeedbackPrefs.swift,StressCheckInCard.swiftin full.DaytimeStress.,StressIndex.,HRVFreqDomain.,StressOnsetDetector.acrossStrand,StrandiOS,Packagesto confirm nothing else was missed and nothing claimed here is speculative.