From 289b132b8faac04db3f305da4e6db49f505077a8 Mon Sep 17 00:00:00 2001 From: Lars Date: Sat, 28 Mar 2026 09:53:59 +0100 Subject: [PATCH] fix: Phase 0b - map_focus_to_score_components English keys --- backend/calculations/scores.py | 62 ++++++++++++++++++++++------------ 1 file changed, 40 insertions(+), 22 deletions(-) diff --git a/backend/calculations/scores.py b/backend/calculations/scores.py index 076de8d..fea07da 100644 --- a/backend/calculations/scores.py +++ b/backend/calculations/scores.py @@ -56,34 +56,52 @@ def get_focus_area_category(focus_area_id: str) -> Optional[str]: def map_focus_to_score_components() -> Dict[str, str]: """ Map focus areas to score components - Returns: {'körpergewicht': 'body', 'proteinzufuhr': 'nutrition', ...} + Keys match focus_area_definitions.key (English lowercase) + Returns: {'weight_loss': 'body', 'strength': 'activity', ...} """ return { - # Körper-Kategorie → body_progress_score - 'körpergewicht': 'body', - 'körperfett': 'body', - 'muskelmasse': 'body', - 'umfänge': 'body', + # Body Composition → body_progress_score + 'weight_loss': 'body', + 'muscle_gain': 'body', + 'body_recomposition': 'body', - # Ernährung-Kategorie → nutrition_score - 'ernährung_basis': 'nutrition', - 'ernährung_makros': 'nutrition', - 'proteinzufuhr': 'nutrition', - 'kalorienbilanz': 'nutrition', + # Training - Strength → activity_score + 'strength': 'activity', + 'strength_endurance': 'activity', + 'power': 'activity', - # Aktivität-Kategorie → activity_score - 'kraftaufbau': 'activity', - 'cardio': 'activity', - 'bewegungsumfang': 'activity', - 'trainingsqualität': 'activity', - 'ability_balance': 'activity', + # Training - Mobility → activity_score + 'flexibility': 'activity', + 'mobility': 'activity', - # Recovery-Kategorie → recovery_score - 'schlaf': 'recovery', - 'erholung': 'recovery', - 'ruhetage': 'recovery', + # Endurance → activity_score (could also map to health) + 'aerobic_endurance': 'activity', + 'anaerobic_endurance': 'activity', + 'cardiovascular_health': 'health', - # Vitalwerte-Kategorie → health_risk_score + # Coordination → activity_score + 'balance': 'activity', + 'reaction': 'activity', + 'rhythm': 'activity', + 'coordination': 'activity', + + # Mental → recovery_score (mental health is part of recovery) + 'stress_resistance': 'recovery', + 'concentration': 'recovery', + 'willpower': 'recovery', + 'mental_health': 'recovery', + + # Recovery → recovery_score + 'sleep_quality': 'recovery', + 'regeneration': 'recovery', + 'rest': 'recovery', + + # Health → health + 'metabolic_health': 'health', + 'blood_pressure': 'health', + 'hrv': 'health', + 'general_health': 'health', + } 'herzgesundheit': 'health', 'blutdruck': 'health', 'vo2max': 'health',