Commit Graph

14 Commits

Author SHA1 Message Date
5b7d7ec3bb fix: Phase 0c - update all in-function imports to use data_layer
All checks were successful
Deploy Development / deploy (push) Successful in 44s
Build Test / lint-backend (push) Successful in 0s
Build Test / build-frontend (push) Successful in 14s
Critical bug fix: In-function imports were still referencing calculations/ module.
This caused all calculated placeholders to fail silently.

Fixed imports in:
- activity_metrics.py: calculate_activity_score (scores import)
- recovery_metrics.py: calculate_recent_load_balance_3d (activity_metrics import)
- scores.py: 12 function imports (body/nutrition/activity/recovery metrics)
- correlations.py: 11 function imports (scores, body, nutrition, activity, recovery metrics)

All data_layer modules now reference each other correctly.
Placeholders should resolve properly now.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-28 20:36:50 +01:00
befa060671 feat: Phase 0c - migrate correlation_metrics to data_layer/correlations (11 functions)
All checks were successful
Deploy Development / deploy (push) Successful in 44s
Build Test / lint-backend (push) Successful in 0s
Build Test / build-frontend (push) Successful in 12s
- Created NEW data_layer/correlations.py with all 11 correlation functions
- Functions: Lag correlation (main + 3 helpers: energy/weight, protein/LBM, load/vitals)
- Functions: Sleep-recovery correlation
- Functions: Plateau detection (main + 3 detectors: weight, strength, endurance)
- Functions: Top drivers analysis
- Functions: Correlation confidence helper
- Updated data_layer/__init__.py to import correlations module and export 5 main functions
- Refactored placeholder_resolver.py to import correlations from data_layer (as correlation_metrics alias)
- Removed ALL imports from calculations/ module in placeholder_resolver.py

Module 6/6 complete. ALL calculations migrated to data_layer!
Phase 0c Multi-Layer Architecture COMPLETE.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-28 20:28:26 +01:00
dba6814bc2 feat: Phase 0c - migrate scores calculations to data_layer (14 functions)
All checks were successful
Deploy Development / deploy (push) Successful in 45s
Build Test / lint-backend (push) Successful in 0s
Build Test / build-frontend (push) Successful in 13s
- Created NEW data_layer/scores.py with all 14 scoring functions
- Functions: Focus weights & mapping (get_user_focus_weights, get_focus_area_category, map_focus_to_score_components, map_category_de_to_en)
- Functions: Category weight calculation
- Functions: Progress scores (goal progress, health stability)
- Functions: Health score helpers (blood pressure, sleep quality scorers)
- Functions: Data quality score
- Functions: Top priority/focus (get_top_priority_goal, get_top_focus_area, calculate_focus_area_progress)
- Functions: Category progress
- Updated data_layer/__init__.py to import scores module and export 12 functions
- Refactored placeholder_resolver.py to import scores from data_layer

Module 5/6 complete. Single Source of Truth for scoring metrics established.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-28 20:26:23 +01:00
2bc1ca4daf feat: Phase 0c - migrate recovery_metrics calculations to data_layer (16 functions)
All checks were successful
Deploy Development / deploy (push) Successful in 46s
Build Test / lint-backend (push) Successful in 0s
Build Test / build-frontend (push) Successful in 15s
- Migrated all 16 calculation functions from calculations/recovery_metrics.py to data_layer/recovery_metrics.py
- Functions: Recovery score v2 (main + 7 helper scorers)
- Functions: HRV vs baseline (percentage calculation)
- Functions: RHR vs baseline (percentage calculation)
- Functions: Sleep metrics (avg duration 7d, sleep debt, regularity proxy, quality 7d)
- Functions: Load balance (recent 3d)
- Functions: Data quality assessment
- Updated data_layer/__init__.py with 9 new exports
- Refactored placeholder_resolver.py to import recovery_metrics from data_layer

Module 4/6 complete. Single Source of Truth for recovery metrics established.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-28 20:24:27 +01:00
dc34d3d2f2 feat: Phase 0c - migrate activity_metrics calculations to data_layer (20 functions)
All checks were successful
Deploy Development / deploy (push) Successful in 44s
Build Test / lint-backend (push) Successful in 0s
Build Test / build-frontend (push) Successful in 14s
- Migrated all 20 calculation functions from calculations/activity_metrics.py to data_layer/activity_metrics.py
- Functions: Training volume (minutes/week, frequency, quality sessions %)
- Functions: Intensity distribution (proxy-based until HR zones available)
- Functions: Ability balance (strength, endurance, mental, coordination, mobility)
- Functions: Load monitoring (internal load proxy, monotony score, strain score)
- Functions: Activity scoring (main score with focus weights, strength/cardio/balance helpers)
- Functions: Rest day compliance
- Functions: VO2max trend (28d)
- Functions: Data quality assessment
- Updated data_layer/__init__.py with 17 new exports
- Refactored placeholder_resolver.py to import activity_metrics from data_layer

Module 3/6 complete. Single Source of Truth for activity metrics established.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-28 20:18:49 +01:00
7ede0e3fe8 feat: Phase 0c - migrate nutrition_metrics calculations to data_layer (16 functions)
All checks were successful
Deploy Development / deploy (push) Successful in 53s
Build Test / lint-backend (push) Successful in 0s
Build Test / build-frontend (push) Successful in 14s
- Migrated all 16 calculation functions from calculations/nutrition_metrics.py to data_layer/nutrition_metrics.py
- Functions: Energy balance (7d calculation, deficit/surplus classification)
- Functions: Protein adequacy (g/kg, days in target, 28d score)
- Functions: Macro consistency (score, intake volatility)
- Functions: Nutrition scoring (main score with focus weights, calorie/macro adherence helpers)
- Functions: Energy availability warning (with severity levels and recommendations)
- Functions: Data quality assessment
- Functions: Fiber/sugar averages (TODO stubs)
- Updated data_layer/__init__.py with 12 new exports
- Refactored placeholder_resolver.py to import nutrition_metrics from data_layer

Module 2/6 complete. Single Source of Truth for nutrition metrics established.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-28 19:57:13 +01:00
504581838c feat: Phase 0c - migrate body_metrics calculations to data_layer (20 functions)
All checks were successful
Deploy Development / deploy (push) Successful in 52s
Build Test / lint-backend (push) Successful in 0s
Build Test / build-frontend (push) Successful in 15s
- Migrated all 20 calculation functions from calculations/body_metrics.py to data_layer/body_metrics.py
- Functions: weight trends (7d median, 28d/90d slopes, goal projection, progress)
- Functions: body composition (FM/LBM changes)
- Functions: circumferences (waist/hip/chest/arm/thigh deltas, WHR)
- Functions: recomposition quadrant
- Functions: scoring (body progress, data quality)
- Updated data_layer/__init__.py with 20 new exports
- Refactored placeholder_resolver.py to import body_metrics from data_layer

Module 1/6 complete. Single Source of Truth for body metrics established.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-28 19:51:08 +01:00
26110d44b4 fix: rest_days schema - use 'focus' column instead of 'rest_type'
All checks were successful
Deploy Development / deploy (push) Successful in 52s
Build Test / lint-backend (push) Successful in 0s
Build Test / build-frontend (push) Successful in 15s
Problem: get_rest_days_data() queried non-existent 'rest_type' column
Fix: Changed to 'focus' column with correct values (muscle_recovery, cardio_recovery, etc.)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-28 19:28:46 +01:00
6c23973c5d feat: Phase 0c - body_metrics.py module complete
All checks were successful
Deploy Development / deploy (push) Successful in 46s
Build Test / lint-backend (push) Successful in 0s
Build Test / build-frontend (push) Successful in 14s
Data Layer:
- get_latest_weight_data() - most recent weight with date
- get_weight_trend_data() - already existed (PoC)
- get_body_composition_data() - already existed (PoC)
- get_circumference_summary_data() - already existed (PoC)

Placeholder Layer:
- get_latest_weight() - refactored to use data layer
- get_caliper_summary() - refactored to use get_body_composition_data
- get_weight_trend() - already refactored (PoC)
- get_latest_bf() - already refactored (PoC)
- get_circ_summary() - already refactored (PoC)

body_metrics.py now complete with all 4 functions.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-28 19:17:02 +01:00
b4558b0582 feat: Phase 0c - health_metrics.py module complete
All checks were successful
Deploy Development / deploy (push) Successful in 53s
Build Test / lint-backend (push) Successful in 0s
Build Test / build-frontend (push) Successful in 14s
Data Layer:
- get_resting_heart_rate_data() - avg RHR with min/max trend
- get_heart_rate_variability_data() - avg HRV with min/max trend
- get_vo2_max_data() - latest VO2 Max with date

Placeholder Layer:
- get_vitals_avg_hr() - refactored to use data layer
- get_vitals_avg_hrv() - refactored to use data layer
- get_vitals_vo2_max() - refactored to use data layer

All 3 health data functions + 3 placeholder refactors complete.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-28 19:15:31 +01:00
432f7ba49f feat: Phase 0c - recovery_metrics.py module complete
All checks were successful
Deploy Development / deploy (push) Successful in 53s
Build Test / lint-backend (push) Successful in 1s
Build Test / build-frontend (push) Successful in 15s
Data Layer:
- get_sleep_duration_data() - avg duration with hours/minutes breakdown
- get_sleep_quality_data() - Deep+REM percentage with phase breakdown
- get_rest_days_data() - total count + breakdown by rest type

Placeholder Layer:
- get_sleep_avg_duration() - refactored to use data layer
- get_sleep_avg_quality() - refactored to use data layer
- get_rest_days_count() - refactored to use data layer

All 3 recovery data functions + 3 placeholder refactors complete.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-28 19:13:59 +01:00
6b2ad9fa1c feat: Phase 0c - activity_metrics.py module complete
All checks were successful
Deploy Development / deploy (push) Successful in 51s
Build Test / lint-backend (push) Successful in 1s
Build Test / build-frontend (push) Successful in 16s
Data Layer:
- get_activity_summary_data() - count, duration, calories, frequency
- get_activity_detail_data() - detailed activity log with all fields
- get_training_type_distribution_data() - category distribution with percentages

Placeholder Layer:
- get_activity_summary() - refactored to use data layer
- get_activity_detail() - refactored to use data layer
- get_trainingstyp_verteilung() - refactored to use data layer

All 3 activity data functions + 3 placeholder refactors complete.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-28 19:11:45 +01:00
e1d7670971 feat: Phase 0c - nutrition_metrics.py module complete
All checks were successful
Deploy Development / deploy (push) Successful in 45s
Build Test / lint-backend (push) Successful in 0s
Build Test / build-frontend (push) Successful in 14s
Data Layer:
- get_nutrition_average_data() - all macros in one call
- get_nutrition_days_data() - coverage tracking
- get_protein_targets_data() - 1.6g/kg and 2.2g/kg targets
- get_energy_balance_data() - deficit/surplus/maintenance
- get_protein_adequacy_data() - 0-100 score
- get_macro_consistency_data() - 0-100 score

Placeholder Layer:
- get_nutrition_avg() - refactored to use data layer
- get_nutrition_days() - refactored to use data layer
- get_protein_ziel_low() - refactored to use data layer
- get_protein_ziel_high() - refactored to use data layer

All 6 nutrition data functions + 4 placeholder refactors complete.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-28 18:45:24 +01:00
c79cc9eafb feat: Phase 0c - Multi-Layer Data Architecture (Proof of Concept)
All checks were successful
Deploy Development / deploy (push) Successful in 47s
Build Test / lint-backend (push) Successful in 0s
Build Test / build-frontend (push) Successful in 15s
- Add data_layer/ module structure with utils.py + body_metrics.py
- Migrate 3 functions: weight_trend, body_composition, circumference_summary
- Refactor placeholders to use data layer
- Add charts router with 3 Chart.js endpoints
- Tests: Syntax , Confidence logic 

Phase 0c PoC (3 functions): Foundation for 40+ remaining functions

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-28 18:26:22 +01:00