mitai-jinkendo/backend/data_layer/__init__.py
Lars 6c23973c5d
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
feat: Phase 0c - body_metrics.py module complete
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

76 lines
2.0 KiB
Python

"""
Data Layer - Pure Data Retrieval & Calculation Logic
This module provides structured data functions for all metrics.
NO FORMATTING. NO STRINGS WITH UNITS. Only structured data.
Usage:
from data_layer.body_metrics import get_weight_trend_data
data = get_weight_trend_data(profile_id="123", days=28)
# Returns: {"slope_28d": 0.23, "confidence": "high", ...}
Modules:
- body_metrics: Weight, body fat, lean mass, circumferences
- nutrition_metrics: Calories, protein, macros, adherence
- activity_metrics: Training volume, quality, abilities
- recovery_metrics: Sleep, RHR, HRV, recovery score
- health_metrics: Blood pressure, VO2Max, health stability
- goals: Active goals, progress, projections
- correlations: Lag-analysis, plateau detection
- utils: Shared functions (confidence, baseline, outliers)
Phase 0c: Multi-Layer Architecture
Version: 1.0
Created: 2026-03-28
"""
# Core utilities
from .utils import *
# Metric modules
from .body_metrics import *
from .nutrition_metrics import *
from .activity_metrics import *
from .recovery_metrics import *
from .health_metrics import *
# Future imports (will be added as modules are created):
# from .goals import *
# from .correlations import *
__all__ = [
# Utils
'calculate_confidence',
'serialize_dates',
# Body Metrics
'get_latest_weight_data',
'get_weight_trend_data',
'get_body_composition_data',
'get_circumference_summary_data',
# Nutrition Metrics
'get_nutrition_average_data',
'get_nutrition_days_data',
'get_protein_targets_data',
'get_energy_balance_data',
'get_protein_adequacy_data',
'get_macro_consistency_data',
# Activity Metrics
'get_activity_summary_data',
'get_activity_detail_data',
'get_training_type_distribution_data',
# Recovery Metrics
'get_sleep_duration_data',
'get_sleep_quality_data',
'get_rest_days_data',
# Health Metrics
'get_resting_heart_rate_data',
'get_heart_rate_variability_data',
'get_vo2_max_data',
]