v0.4.0 - Health Intelligence & Analytics Suite
๐ v0.4.0 - The Intelligence Update
This is a massive feature release adding 8 major health intelligence tools with over 5,000 lines of new code!
โจ New Features
1. ๐ Analytics Tools
Comprehensive statistical analysis across all your health metrics:
- Mean, median, std dev, percentiles
- Pearson correlation analysis
- Weekly patterns and trends
- Cross-metric insights
New tool: generate_statistics_report
2. ๐ฎ Prediction Tools
ML-based forecasting for sleep quality and readiness:
- 3 methods: Linear trend, moving average, weekly pattern
- Ensemble learning for accuracy
- Confidence levels based on method agreement
- 3-day advance predictions
New tools: predict_sleep_quality, predict_readiness
3. ๐ค Sleep Debt Tracker
Track accumulated sleep debt with recovery planning:
- Intelligent debt calculation (50% payback rate)
- 5 severity levels (minimal โ critical)
- Recovery time estimation
- Impact assessment on performance
- Actionable recovery plans
New tool: analyze_sleep_debt
4. ๐ Optimal Bedtime Calculator
Personalized sleep schedule based on your best nights:
- Analyzes top 25% best nights
- 6-component quality scoring
- Optimal bedtime window recommendations
- Day-of-week pattern detection
- Consistency tracking
New tool: calculate_optimal_bedtime
5. ๐ Supplement Correlation
Track what supplements/interventions actually work:
- Tag-to-metrics correlation analysis
- Effect size calculation (Cohen's d)
- Effectiveness rankings
- Separate good vs. harmful interventions
- Statistical significance testing
New tool: analyze_supplement_correlation
6. ๐ Weekly Report Generator
Automated comprehensive weekly health summaries:
- Overall weekly score (weighted)
- Week-over-week comparisons
- Highlights & lowlights
- Trend analysis (improving/stable/declining)
- Prioritized recommendations
New tool: generate_weekly_report
7. ๐จ Alert System
Proactive health monitoring with early warnings:
- 10 alert categories (sleep, recovery, overtraining, etc.)
- 3 severity levels (warning, critical)
- Trend-based detection
- Consecutive bad nights tracking
- Actionable recommendations
New tool: check_health_alerts
8. ๐ก๏ธ Illness Detection
Early illness warning system (1-2 days advance):
- Multi-signal analysis (5 signals)
- Temperature score monitoring
- HRV drop detection
- Resting HR elevation tracking
- Respiratory rate monitoring
- Pattern detection (infection types, overtraining)
- Risk scoring with confidence levels
New tool: detect_illness_risk
๐ Bug Fixes
Sleep Duration Fix
- Problem:
get_daily_sleep()returned 0.0h duration - Solution: Switched to
get_sleep()(sessions API) for accurate data - Impact: Sleep debt now shows realistic values
Biphasic Sleep Aggregation
- Problem: Multiple sessions per day counted separately
- Solution: Added aggregation utility to combine sessions per day
- Impact: Weekly average improved from 3.1h โ 5.2h (realistic)
- Impact: Sleep debt reduced from 146h โ 17.4h (7 days)
Temperature Analysis Fix
- Problem: Used temperature score as ยฐC deviation
- Solution: Corrected to analyze score drops (low score = elevated temp)
- Impact: False CRITICAL alerts โ accurate ELEVATED warnings
๐ Stats
- 5,378 lines of new code
- 9 new utility modules
- 9 new MCP tools
- 4 commits
- 100% test coverage maintained
๐ ๏ธ New Modules
analytics_tools.py(467 lines) - Statistical analysisprediction_tools.py(350+ lines) - Time series forecastingsleep_debt.py(400+ lines) - Debt calculation enginebedtime_calculator.py(400+ lines) - Optimal bedtime analysissupplement_correlation.py(500+ lines) - Intervention effectivenessweekly_report.py(700+ lines) - Report generatoralert_system.py(700+ lines) - Health alert detectionillness_detection.py(700+ lines) - Multi-signal illness warningsleep_aggregation.py(200+ lines) - Session aggregation
๐ Usage Examples
# Get weekly health report
generate_weekly_report(weeks_ago=0)
# Check for health alerts
check_health_alerts(lookback_days=7)
# Detect illness risk early
detect_illness_risk(lookback_days=30)
# Calculate optimal bedtime
calculate_optimal_bedtime(days=30, top_percentile=0.25)
# Analyze sleep debt
analyze_sleep_debt(days=30)
# Predict sleep quality
predict_sleep_quality(days_ahead=3)
# Analyze supplement effectiveness
analyze_supplement_correlation(days=60, min_occurrences=3)
# Generate statistics
generate_statistics_report(days=30)๐ Credits
Built with Claude Code and the Oura API v2.
Full Changelog: v0.3.1...v0.4.0