feat: Phase 0c - migrate body_metrics calculations to data_layer (20 functions)
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>
This commit is contained in:
LarsandClaude Opus 4.6 committed 2026-03-28 19:51:08 +01:00
1 parent 26110d44b4
commit 504581838c
3 files changed
+537 -3

No files matched your search

+4 -2
View File
@@ -417,7 +417,8 @@ def _safe_int(func_name: str, profile_id: str) -> str:
import traceback
try:
# Import calculations dynamically to avoid circular imports
from calculations import scores, body_metrics, nutrition_metrics, activity_metrics, recovery_metrics, correlation_metrics
from calculations import scores, nutrition_metrics, activity_metrics, recovery_metrics, correlation_metrics
from data_layer import body_metrics
# Map function names to actual functions
func_map = {
@@ -479,7 +480,8 @@ def _safe_float(func_name: str, profile_id: str, decimals: int = 1) -> str:
"""
import traceback
try:
from calculations import body_metrics, nutrition_metrics, activity_metrics, recovery_metrics, scores
from calculations import nutrition_metrics, activity_metrics, recovery_metrics, scores
from data_layer import body_metrics
func_map = {
'weight_7d_median': body_metrics.calculate_weight_7d_median,