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>
60 lines
1.6 KiB
Python
60 lines
1.6 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 *
|
|
|
|
# Future imports (will be added as modules are created):
|
|
# from .activity_metrics import *
|
|
# from .recovery_metrics import *
|
|
# from .health_metrics import *
|
|
# from .goals import *
|
|
# from .correlations import *
|
|
|
|
__all__ = [
|
|
# Utils
|
|
'calculate_confidence',
|
|
'serialize_dates',
|
|
|
|
# Body Metrics
|
|
'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',
|
|
]
|