feat: add body history visualization endpoint and frontend integration
- Introduced a new API endpoint `/body-history-viz` to retrieve body history visualization data. - Updated the frontend to fetch and display body history data in the `BodySection` component. - Enhanced the `EvaluationTileGrid` to include related placeholder keys for improved data interpretation. - Refactored existing logic to streamline data handling and improve user experience.
This commit is contained in:
1 parent
157afd10b9
commit
461c358dc2
5 files changed
+1089
-256
No files matched your search
@@ -31,6 +31,7 @@ from data_layer.body_metrics import (
|
||||
get_body_composition_data,
|
||||
get_circumference_summary_data
|
||||
)
|
||||
from data_layer.body_viz import get_body_history_viz_bundle
|
||||
from data_layer.nutrition_metrics import (
|
||||
get_nutrition_average_data,
|
||||
get_protein_targets_data,
|
||||
@@ -240,6 +241,30 @@ def get_body_composition_chart(
|
||||
}
|
||||
|
||||
|
||||
@router.get("/body-history-viz")
|
||||
def get_body_history_viz(
|
||||
days: int = Query(
|
||||
default=90,
|
||||
ge=7,
|
||||
le=9999,
|
||||
description="Analysefenster in Tagen (9999 = gesamte Historie im Rohdatensatz)",
|
||||
),
|
||||
session: dict = Depends(require_auth),
|
||||
) -> Dict:
|
||||
"""
|
||||
Layer 2b: Ein Bundle für Verlauf «Körper» — Charts, Kennzahlen, Bewertungskacheln.
|
||||
|
||||
Alle Reihen und Kennzahlen stammen aus Layer 1 (dieselben Tabellen wie die
|
||||
Körper-Platzhalter / body_metrics). Interpretationskacheln sind mit
|
||||
``related_placeholder_keys`` an Layer 2a ausgewiesen.
|
||||
|
||||
Frontend: ausschließlich Darstellung — keine parallele Berechnung.
|
||||
"""
|
||||
profile_id = session["profile_id"]
|
||||
bundle = get_body_history_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