feat: enhance nutrition data processing and visualization with new correlation insights
- Refactored the `calculate_lag_correlation` function to normalize lag payloads and improve correlation calculations for various nutrition metrics. - Introduced a new function `build_nutrition_correlation_heuristic_items` to generate heuristic insights based on merged nutrition data, enhancing user understanding of dietary impacts on weight and body composition. - Updated the `get_nutrition_history_viz_bundle` function to include daily calorie balance and protein vs. lean mass data, providing a comprehensive view of nutrition trends. - Enhanced the frontend to visualize calorie balance and protein vs. lean mass insights, improving the user experience with clear graphical representations of dietary correlations.
This commit is contained in:
1 parent
45fb506a5e
commit
7ac9752c3d
9 files changed
+777
-195
No files matched your search
@@ -35,6 +35,7 @@ from data_layer.body_viz import get_body_history_viz_bundle
|
||||
from data_layer.nutrition_viz import get_nutrition_history_viz_bundle
|
||||
from data_layer.fitness_viz import get_fitness_dashboard_viz_bundle
|
||||
from data_layer.recovery_viz import get_recovery_dashboard_viz_bundle
|
||||
from data_layer.history_overview_viz import get_history_overview_viz_bundle
|
||||
from data_layer.recovery_chart_payloads import (
|
||||
build_recovery_score_chart_payload,
|
||||
build_hrv_rhr_baseline_chart_payload,
|
||||
@@ -336,6 +337,24 @@ def get_recovery_dashboard_viz(
|
||||
return serialize_dates(bundle)
|
||||
|
||||
|
||||
@router.get("/history-overview-viz")
|
||||
def get_history_overview_viz(
|
||||
days: int = Query(
|
||||
default=30,
|
||||
ge=7,
|
||||
le=9999,
|
||||
description="Analysefenster in Tagen (komponiert Körper/Ernährung/Fitness/Erholung)",
|
||||
),
|
||||
session: dict = Depends(require_auth),
|
||||
) -> Dict:
|
||||
"""
|
||||
Layer 2b: Gesamtansicht «Verlauf» — KPI-Kurzformen aus den vier History-Bundles + Lag-Korrelationen C1–C4 (Metadaten).
|
||||
"""
|
||||
profile_id = session["profile_id"]
|
||||
bundle = get_history_overview_viz_bundle(profile_id, days)
|
||||
return serialize_dates(bundle)
|
||||
|
||||
|
||||
@router.get("/circumferences")
|
||||
def get_circumferences_chart(
|
||||
max_age_days: int = Query(default=90, ge=7, le=365),
|
||||
|
||||
Reference in new issue
Block a user