fix: Phase 0b - correct all SQL column names in calculation engine
Schema corrections applied: - weight_log: weight_kg → weight - nutrition_log: calories → kcal - activity_log: duration → duration_min, avg_heart_rate → hr_avg, max_heart_rate → hr_max - rest_days: rest_type → type (aliased for backward compat) - vitals_baseline: resting_heart_rate → resting_hr - sleep_log: total_sleep_min → duration_minutes, deep_min → deep_minutes, rem_min → rem_minutes, waketime → wake_time - focus_area_definitions: fa.focus_area_id → fa.key (proper join column) Affected files: - body_metrics.py: weight column (all queries) - nutrition_metrics.py: kcal column + weight - activity_metrics.py: duration_min, hr_avg, hr_max, quality via RPE mapping - recovery_metrics.py: sleep + vitals columns - correlation_metrics.py: kcal, weight - scores.py: focus_area key selection All 100+ Phase 0b placeholders should now calculate correctly. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
53969f8768
commit
4817fd2b29
6 files changed
+61
-52
No files matched your search
@@ -65,7 +65,7 @@ def _correlate_energy_weight(profile_id: str, max_lag: int) -> Optional[Dict]:
|
||||
|
||||
# Get energy balance data (daily calories - estimated TDEE)
|
||||
cur.execute("""
|
||||
SELECT n.date, n.calories, w.weight_kg
|
||||
SELECT n.date, n.kcal, w.weight
|
||||
FROM nutrition_log n
|
||||
LEFT JOIN weight_log w ON w.profile_id = n.profile_id
|
||||
AND w.date = n.date
|
||||
|
||||
Reference in new issue
Block a user