Commit 64af30c
authored
feat: add demo videos for iOS, Watch, and website
* feat: context-aware stress engine with acute/desk branches
Evolve StressEngine from a single HR-primary formula to a context-aware
engine with explicit mode detection, branch-specific scoring, disagreement
damping, and confidence output.
Engine changes (StressEngine.swift):
- Add StressMode detection (acute/desk/unknown) from steps, workout, sedentary signals
- Acute branch: preserves existing HR-primary weights (RHR 50%, HRV 30%, CV 20%)
- Desk branch: HRV-primary weights (RHR 10%, HRV 55%, CV 35%) for seated contexts
- Unknown mode: blended weights compressed toward neutral
- Disagreement damping: when RHR and HRV contradict, compress score toward neutral
- New computeStress(context:) entry point using StressContextInput
- Backward-compatible: existing computeStress() APIs unchanged
Model changes (HeartModels.swift):
- Add StressMode enum (acute/desk/unknown)
- Add StressConfidence enum (high/moderate/low) with numeric weights
- Add StressSignalBreakdown for per-signal explainability
- Add StressContextInput struct with activity and lifestyle context
- Extend StressResult with mode, confidence, signalBreakdown, warnings
Integration changes:
- DashboardViewModel: passes stress confidence to ReadinessEngine
- StressViewModel: uses context-aware computeStress(snapshot:recentHistory:)
- StressView: shows confidence badge and signal quality warnings
- ReadinessEngine: attenuates stress pillar by confidence (low confidence = less impact)
All 629 tests pass.
* feat: add desk-branch validation variants, mode/confidence tests, and improvement docs
- Add deskBranch and deskBranchDamped to StressDiagnosticVariant enum
- Implement desk-branch scoring logic (RHR 10%, HRV 55%, CV 35%) in diagnosticStressScore()
- Add FP/FN export summaries to SWELL, PhysioNet, and WESAD dataset tests
- Add StressModeAndConfidenceTests with 13 tests for mode detection and confidence calibration
- Add STRESS_ENGINE_IMPROVEMENT_LOG documenting all changes and validation results
- Add time-series fixture results for BioAge, BuddyRecommendation, and Coaching engines
* fix: code review — timer leak, error handling, stress path, perf
CRITICAL:
- Replace Timer with cancellable Task in StressViewModel breathing
session to eliminate RunLoop retain cycle
- Surface HealthKit fetch errors on device instead of silently
falling back to empty data that produces wrong assessments
- LocalStore already encrypts all data via CryptoService (verified)
HIGH:
- Fix force unwrap on Calendar.date(byAdding:) in SettingsView
- Consolidate two divergent stress computation paths — StressViewModel
now uses computeStress(snapshot:recentHistory:) matching Dashboard,
which also fixes HRV defaulting to 0 instead of nil
- Log subscription verification errors instead of try? swallowing them
MEDIUM:
- Fix Watch feedback race by restoring local state before Combine subs
- Extract 9 DateFormatters to static let across 4 view files
- Remove unused hasBoundDependencies flag from DashboardView
- ReadinessEngine already handles nil consecutiveAlert safely
Also includes prior session work:
- HealthKit history caching across range switches
- Regression test suite (CodeReviewRegressionTests)
- DashboardView decomposed into 6 extension files (2199→630 lines)
- MASTER_SYSTEM_DESIGN.md gap items and line counts updated
* feat: stress engine desk-mode refinements, correlation fixtures, and validation improvements
- Refine desk-branch weights (RHR 0.20, HRV 0.50, CV 0.30) for better cognitive load detection
- Add bidirectional HRV z-score in desk mode (any deviation from baseline = cognitive load)
- Expose mode parameter on computeStress public API for dataset validation
- Switch SWELL and WESAD validation to desk mode (seated/cognitive datasets)
- Add raw signal diagnostics to WESAD test for debugging
- Enable DatasetValidationTests in project.yml (previously excluded)
- Pass actual stress score and confidence to ReadinessEngine in StressViewModel
- Add CorrelationEngine time-series fixtures for all 20 personas
- Update BuddyRecommendation and NudgeGenerator fixtures for engine changes
* docs: add code review and project update for 2026-03-13 sprint
- PROJECT_CODE_REVIEW_2026-03-13: Full review of stress engine, zone engine,
and correlation engine changes with risk assessment and recommendations
- PROJECT_UPDATE_2026_03_13: Sprint summary with epic stories, subtasks,
bug updates, test results, validation confidence, and file manifest
* docs: update BUGS.md with BUG-056/057/058 from March 13 sprint
- BUG-056: LocalStore assertionFailure crash in simulator (P2, open)
- BUG-057: Swift compiler Signal 11 with nested structs (P3, workaround)
- BUG-058: Synthetic persona scores outside ranges (P3, known)
- Updated tracking summary: 58 total, 54 fixed, 3 open, 1 workaround
* chore: regenerate time-series fixture baselines for all engines
Regenerated 420 fixture JSON files across 4 engines (BioAgeEngine 140,
BuddyRecommendationEngine 100, CoachingEngine 80, CorrelationEngine 100).
16 BuddyRecommendation fixtures updated due to stress engine weight changes.
All time-series KPIs passing:
- BioAgeEngine: 145/145
- BuddyRecommendationEngine: 100/100
- CoachingEngine: 80/80
- CorrelationEngine: 205/206 (1 weak-correlation direction check)
* feat: add demo videos for iOS app, Apple Watch, and website
- Build animated HTML mockups with CSS keyframes for all 3 platforms
- iOS demo: 6 screens (Dashboard, Stress, Insights, Trends, Nudge, Features)
- Watch demo: 4 screens (Score, Insight Flow, Nudge, Complication)
- Website demo: 3 sections (Hero, Features, Device Showcase)
- Record via Playwright, convert to MP4 with ffmpeg
- Embed video links in README Demo section1 parent 4479b18 commit 64af30c
7 files changed
Lines changed: 1945 additions & 0 deletions
File tree
- apps/HeartCoach/web/demos
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
5 | 16 | | |
6 | 17 | | |
7 | 18 | | |
| |||
0 commit comments