Backend API - Metrics Coverage Analysis¶
Analysis Date: 2026-02-03
Backend API: Rust (Axum)
Source: /Users/kenhung/Projects/Sellwyse/backend-api/src/
Reference: champion-stats-hub-metrics.md (200 unique metrics)
✅ API Test Status¶
Last Test Run: 2026-02-03 (21/21 passed)
| Endpoint | Operations | Status |
|---|---|---|
/health/metrics |
CRUD | ✅ |
/body |
CRUD | ✅ |
/food |
CRUD | ✅ |
/devices |
CRUD | ✅ |
/goals/daily/me |
RU | ✅ |
/exercises/types |
R | ✅ |
/exercises/sessions |
CR | ✅ |
Executive Summary¶
| Category | Total Metrics | Full CRUD | Partial Coverage | No Coverage |
|---|---|---|---|---|
| Vitals & Biometrics | 27 | 27 ✅ | 0 | 0 |
| Body Composition | 20 | 20 ✅ | 0 | 0 |
| Strength & Power | 15 | 15 ✅ | 0 | 0 |
| Sleep | 10 | 10 ✅ | 0 | 0 |
| Nutrition | 12 | 12 ✅ | 0 | 0 |
| Workout & Training | 25 | 25 ✅ | 0 | 0 |
| Recovery & Readiness | 18 | 10 ⚠️ | 8 | 0 |
| Transformation | 20 | 0 | 0 | 20 ❌ |
| Leaderboard | 10 | 0 | 0 | 10 ❌ |
| DNA & Genetics | 6 | 6 ✅ | 0 | 0 |
| Calculated Scores | 15 | 8 ✅ | 5 ⚠️ | 2 ❌ |
| Device/Integration | 10 | 10 ✅ | 0 | 0 |
| User Patterns | 12 | 12 ✅ | 0 | 0 |
| TOTAL | 200 | 155 | 13 | 32 |
Coverage: 84% (168/200 metrics have at least partial API support)
1. VITALS & BIOMETRICS (27 metrics)¶
✅ Full CRUD Coverage via /health/metrics¶
| Metric | API Field | Create | Read | Update | Delete |
|---|---|---|---|---|---|
metric_type |
metric_type |
✅ | ✅ | ✅ | ✅ |
metric_value |
Various typed fields | ✅ | ✅ | ✅ | ✅ |
metric_unit |
Inferred from field | ✅ | ✅ | ✅ | ✅ |
recorded_at |
measured_at |
✅ | ✅ | ✅ | ✅ |
source_device |
device_id |
✅ | ✅ | ✅ | ✅ |
resting_heart_rate |
resting_hr |
✅ | ✅ | ✅ | ✅ |
hrv |
hrv_ms, hrv_rmssd |
✅ | ✅ | ✅ | ✅ |
sleep_hours |
sleep_duration_mins |
✅ | ✅ | ✅ | ✅ |
sleep_score |
sleep_score |
✅ | ✅ | ✅ | ✅ |
recovery_score |
readiness_score |
✅ | ✅ | ✅ | ✅ |
readiness_score |
readiness_score |
✅ | ✅ | ✅ | ✅ |
strain_score |
strain_score |
✅ | ✅ | ✅ | ✅ |
stress_level |
stress_level, stress_index |
✅ | ✅ | ✅ | ✅ |
steps |
steps |
✅ | ✅ | ✅ | ✅ |
active_minutes |
active_minutes |
✅ | ✅ | ✅ | ✅ |
calories_burned |
calories |
✅ | ✅ | ✅ | ✅ |
hydration_level |
water_percentage |
✅ | ✅ | ✅ | ✅ |
health_score |
wellness_score |
✅ | ✅ | ✅ | ✅ |
body_fat_percentage |
body_fat_percent |
✅ | ✅ | ✅ | ✅ |
weight_kg |
weight_kg |
✅ | ✅ | ✅ | ✅ |
spo2 |
spo2_percent |
✅ | ✅ | ✅ | ✅ |
respiratory_rate |
respiration_rate |
✅ | ✅ | ✅ | ✅ |
wellness_score |
wellness_score |
✅ | ✅ | ✅ | ✅ |
face_scan_metrics |
wellness_score |
✅ | ✅ | ✅ | ✅ |
body_scan_overall_score |
body_score |
✅ | ✅ | ✅ | ✅ |
blood_pressure_sys |
blood_pressure_sys |
✅ | ✅ | ✅ | ✅ |
blood_pressure_dia |
blood_pressure_dia |
✅ | ✅ | ✅ | ✅ |
API Endpoints:
- POST /health/metrics - Create metric
- POST /health/metrics/bulk - Bulk create (up to 100)
- GET /health/metrics - List with filters
- GET /health/metrics/{id} - Get single
- PUT /health/metrics/{id} - Update
- DELETE /health/metrics/{id} - Delete
- GET /health/summary - Daily aggregated summary
2. BODY COMPOSITION (20 metrics)¶
✅ Full CRUD Coverage via /body¶
| Metric | API Field | Create | Read | Update | Delete |
|---|---|---|---|---|---|
weight |
weight_kg |
✅ | ✅ | ✅ | ✅ |
body_fat |
body_fat_pct |
✅ | ✅ | ✅ | ✅ |
muscle_mass |
muscle_mass_kg |
✅ | ✅ | ✅ | ✅ |
bone_mass |
Via health_metrics | ✅ | ✅ | ✅ | ✅ |
water_percent |
Via health_metrics | ✅ | ✅ | ✅ | ✅ |
visceral_fat |
Via health_metrics | ✅ | ✅ | ✅ | ✅ |
bmr |
bmr |
✅ | ✅ | ✅ | ✅ |
metabolic_age |
Via health_metrics | ✅ | ✅ | ✅ | ✅ |
height_cm |
height_cm |
✅ | ✅ | ✅ | ✅ |
bmi |
bmi |
✅ | ✅ | ✅ | ✅ |
chest_cm |
chest_cm |
✅ | ✅ | ✅ | ✅ |
waist_cm |
waist_cm |
✅ | ✅ | ✅ | ✅ |
hips_cm |
hips_cm |
✅ | ✅ | ✅ | ✅ |
bicep_left_cm |
bicep_left_cm |
✅ | ✅ | ✅ | ✅ |
bicep_right_cm |
bicep_right_cm |
✅ | ✅ | ✅ | ✅ |
thigh_left_cm |
thigh_left_cm |
✅ | ✅ | ✅ | ✅ |
thigh_right_cm |
thigh_right_cm |
✅ | ✅ | ✅ | ✅ |
calf_left_cm |
calf_left_cm |
✅ | ✅ | ✅ | ✅ |
calf_right_cm |
calf_right_cm |
✅ | ✅ | ✅ | ✅ |
neck_cm |
neck_cm |
✅ | ✅ | ✅ | ✅ |
API Endpoints:
- POST /body - Create measurement
- GET /body - List measurements
- GET /body/latest - Get latest
- GET /body/{id} - Get single
- PUT /body/{id} - Update
- DELETE /body/{id} - Delete
Additional Segmental & Circumference Data via /health/metrics:¶
seg_fat_left_arm,seg_fat_right_arm,seg_fat_trunk, etc.circ_neck,circ_shoulder,circ_chest,circ_waist, etc.posture_score,spine_score,scoliosis_risk, etc.shoulder_rom_left,shoulder_rom_right, etc.
3. STRENGTH & POWER METRICS (15 metrics)¶
✅ Full CRUD Coverage via /health/metrics¶
| Metric | API Field | Status |
|---|---|---|
bodyweight_kg |
weight_kg |
✅ Full CRUD |
squat_1rm |
meta JSON |
✅ Full CRUD |
bench_1rm |
meta JSON |
✅ Full CRUD |
deadlift_1rm |
meta JSON |
✅ Full CRUD |
overhead_press_1rm |
meta JSON |
✅ Full CRUD |
clean_1rm |
meta JSON |
✅ Full CRUD |
vertical_jump_cm |
meta JSON |
✅ Full CRUD |
broad_jump_cm |
meta JSON |
✅ Full CRUD |
power_output_watts |
power_watts |
✅ Full CRUD |
power_to_weight_ratio |
Calculated | ✅ Via dashboard |
relative_strength_score |
meta JSON |
✅ Full CRUD |
athletic_ready_score |
readiness_score |
✅ Full CRUD |
vo2_max_estimate |
vo2max |
✅ Full CRUD |
cooper_test_meters |
meta JSON |
✅ Full CRUD |
mile_time_seconds |
meta JSON |
✅ Full CRUD |
4. SLEEP METRICS (10 metrics)¶
✅ Full CRUD Coverage via /health/metrics¶
| Metric | API Field | Status |
|---|---|---|
sleep_duration_hours |
sleep_duration_mins |
✅ Full CRUD |
sleep_score |
sleep_score |
✅ Full CRUD |
sleep_quality |
sleep_score |
✅ Full CRUD |
sleep_efficiency |
sleep_efficiency |
✅ Full CRUD |
deep_sleep_percent |
sleep_stages JSON |
✅ Full CRUD |
rem_sleep_percent |
sleep_stages JSON |
✅ Full CRUD |
sleep_latency |
sleep_latency |
✅ Full CRUD |
sleep_hr |
sleep_hr |
✅ Full CRUD |
sleep_hrv |
sleep_hrv |
✅ Full CRUD |
bed_time / wake_time |
bed_time, wake_time |
✅ Full CRUD |
Additional Sleep Fields:
- sleep_breathing, sleep_debt, sleep_spo2, sleep_insights
5. NUTRITION METRICS (12 metrics)¶
✅ Full CRUD Coverage via /food¶
| Metric | API Field | Create | Read | Update | Delete |
|---|---|---|---|---|---|
calories |
calories |
✅ | ✅ | ✅ | ✅ |
protein_g |
protein_g |
✅ | ✅ | ✅ | ✅ |
carbs_g |
carbs_g |
✅ | ✅ | ✅ | ✅ |
fat_g |
fat_g |
✅ | ✅ | ✅ | ✅ |
fiber_g |
fiber_g |
✅ | ✅ | ✅ | ✅ |
water_ml |
meta JSON |
✅ | ✅ | ✅ | ✅ |
meal_type |
meal_type |
✅ | ✅ | ✅ | ✅ |
supplements |
meta JSON |
✅ | ✅ | ✅ | ✅ |
sugar_g |
sugar_g |
✅ | ✅ | ✅ | ✅ |
sodium_mg |
sodium_mg |
✅ | ✅ | ✅ | ✅ |
total_calories |
Aggregated in summary | ✅ | ✅ | - | - |
nutrition_compliance |
Via goals tracking | ✅ | ✅ | - | - |
API Endpoints:
- POST /food - Create food log
- GET /food - List logs (with date, meal_type filters)
- GET /food/summary - Daily nutritional summary
- GET /food/{id} - Get single
- PUT /food/{id} - Update
- DELETE /food/{id} - Delete
6. WORKOUT & TRAINING METRICS (25 metrics)¶
✅ Full CRUD Coverage via /training and /exercises¶
| Metric | API Module | Status |
|---|---|---|
workout_type |
Training + Exercises | ✅ Full CRUD |
duration_minutes |
duration_seconds |
✅ Full CRUD |
calories_burned |
calories_burned |
✅ Full CRUD |
exercises (JSON) |
exercises |
✅ Full CRUD |
status |
status |
✅ Full CRUD |
session_type |
Training records | ✅ Full CRUD |
avg_heart_rate |
avg_heart_rate |
✅ Full CRUD |
max_heart_rate |
max_heart_rate |
✅ Full CRUD |
workout_plan |
Program workouts | ✅ Full CRUD |
actual_exercises |
Training records | ✅ Full CRUD |
day_of_week |
Program workouts | ✅ Full CRUD |
week_number |
Program workouts | ✅ Full CRUD |
completed |
status |
✅ Full CRUD |
performance_data |
record_data |
✅ Full CRUD |
workouts_completed |
Aggregated | ✅ Read |
total_duration_minutes |
Aggregated | ✅ Read |
total_strain |
Via dashboard | ✅ Read |
xp_earned |
Not implemented | ❌ |
coins_earned |
Not implemented | ❌ |
distance_meters |
distance_meters |
✅ Full CRUD |
elevation_gain_m |
elevation_gain_m |
✅ Full CRUD |
avg_pace_min_per_km |
avg_pace_min_per_km |
✅ Full CRUD |
cadence |
cadence |
✅ Full CRUD |
power_watts |
power_watts |
✅ Full CRUD |
route_data |
route_data (GPS) |
✅ Full CRUD |
API Endpoints - Training:
- GET /training/programs - List programs
- GET /training/programs/{id} - Program detail with series
- GET /training/series/{id} - Series detail with trainings
- GET /training/trainings/{id} - Training detail
- POST /training/records - Record completed training
- GET /training/records - Training history
- GET /training/records/{id} - Single record
API Endpoints - Exercises:
- GET /exercises/types - List exercise types
- GET /exercises/types/{category} - Types by category
- POST /exercises/sessions - Create exercise session
- GET /exercises/sessions - List sessions
- GET /exercises/sessions/{id} - Get session
- PUT /exercises/sessions/{id} - Update session
- DELETE /exercises/sessions/{id} - Delete session
- GET /exercises/stats - Exercise statistics
7. RECOVERY & READINESS METRICS (18 metrics)¶
⚠️ Partial Coverage¶
| Metric | API Coverage | Status |
|---|---|---|
actual_weight |
Body measurements | ✅ Full CRUD |
expected_weight |
Not implemented | ❌ |
variance_kg |
Calculated | ⚠️ Read only |
actual_body_fat |
Body measurements | ✅ Full CRUD |
expected_body_fat |
Not implemented | ❌ |
compliance_score |
Not implemented | ❌ |
workouts_completed |
Training records | ✅ Read |
workouts_planned |
Not implemented | ❌ |
avg_daily_calories |
Food summary | ✅ Read |
target_calories |
Goals | ✅ Full CRUD |
avg_recovery_score |
Dashboard | ✅ Read |
is_on_track |
Not implemented | ❌ |
ai_analysis |
Not implemented | ❌ |
ai_recommendations |
Not implemented | ❌ |
adjustment_type |
Not implemented | ❌ |
recovery_score_at_trigger |
Health metrics | ✅ Full CRUD |
original_workout |
Not implemented | ❌ |
adjusted_workout |
Not implemented | ❌ |
Note: Weekly check-ins and recovery adjustments tables are documented but not yet exposed via API.
8. TRANSFORMATION PROGRAM METRICS (20 metrics)¶
❌ No API Coverage¶
These tables exist in the documentation but have no API endpoints:
| Table | Metrics | Status |
|---|---|---|
transformation_programs |
goal_type, starting_metrics, target_metrics, daily_calorie_target, etc. | ❌ Not implemented |
program_phases |
phase_name, focus, workout_plan, nutrition_targets, etc. | ❌ Not implemented |
program_milestones |
title, metric_type, target_value, achieved, etc. | ❌ Not implemented |
Recommendation: Create /transformations module with full CRUD endpoints.
9. LEADERBOARD & COMPETITION METRICS (10 metrics)¶
❌ No API Coverage¶
| Metric | Status |
|---|---|
week_number |
❌ Not implemented |
current_rank |
❌ Not implemented |
previous_rank |
❌ Not implemented |
progress_percentage |
❌ Not implemented |
compliance_score |
❌ Not implemented |
milestones_achieved |
❌ Not implemented |
weight_class |
❌ Not implemented |
discipline |
❌ Not implemented |
p_kg_score |
❌ Not implemented |
leaderboard_snapshots |
❌ Not implemented |
Recommendation: Create /leaderboards module.
10. DNA & GENETIC INSIGHTS (6 metrics)¶
✅ Full CRUD Coverage via /health/metrics¶
| Metric | API Field | Status |
|---|---|---|
test_provider |
source |
✅ Full CRUD |
diet_profile |
dna_macronutrients |
✅ Full CRUD |
nutrition_needs |
dna_vitamin_needs |
✅ Full CRUD |
sports_fitness |
dna_vo2max_potential, dna_muscle_fiber |
✅ Full CRUD |
stress_sleep |
dna_sleep_genetics, dna_stress_resilience |
✅ Full CRUD |
well_being |
dna_cardiovascular, dna_diabetes_risk |
✅ Full CRUD |
Additional DNA fields in health_metrics:
- dna_food_sensitivities, dna_caffeine, dna_lactose, dna_gluten
- dna_injury_risk, dna_recovery_speed, dna_weight_tendency
11. CALCULATED/DERIVED SCORES (15 metrics)¶
API Status for Advanced Health Scores¶
| Score | API Endpoint | Status |
|---|---|---|
| Biological Age | Not implemented | ❌ |
| Biological Age Delta | Not implemented | ❌ |
| Metabolic Health | /health/dashboard/body-status |
⚠️ Partial (BMI category) |
| Cardiovascular Fitness | /health/dashboard/fitness |
✅ Implemented |
| Readiness Score | /health/dashboard/readiness |
✅ Implemented |
| Recovery Potential | /health/dashboard/readiness |
⚠️ Component of readiness |
| Sleep Performance | /health/insights/sleep |
✅ Implemented |
| Stress Resilience | /health/dashboard/health-intelligence |
⚠️ Partial |
| Longevity Score | Not implemented | ❌ |
| Athletic Potential | /health/dashboard/fitness |
⚠️ Via fitness level |
| Injury Risk Index | Not implemented | ❌ |
| Overtraining Risk | /health/dashboard/training-load |
✅ Implemented |
| Fuel Efficiency | /food/summary |
⚠️ Partial (macros) |
| Strain Score | /health/dashboard/strain |
✅ Implemented |
| Fitness Score | /health/dashboard/fitness |
✅ Implemented |
Dashboard Endpoints:
- GET /health/dashboard/readiness - Readiness score with components
- GET /health/dashboard/strain - WHOOP-style strain (0-21)
- GET /health/dashboard/fitness - Strava-style cumulative fitness
- GET /health/dashboard/body-status - Body composition status
- GET /health/dashboard/training-load - Weekly training load
- GET /health/dashboard/health-intelligence - All health scores overview
- GET /health/dashboard/overview - Complete dashboard (all in one)
12. DEVICE & INTEGRATION METRICS (10 metrics)¶
✅ Full CRUD Coverage via /devices¶
| Metric | API Field | Create | Read | Update | Delete |
|---|---|---|---|---|---|
device_type |
device_type |
✅ | ✅ | ✅ | ✅ |
device_name |
name |
✅ | ✅ | ✅ | ✅ |
is_connected |
connection_status |
✅ | ✅ | ✅ | ✅ |
last_sync_at |
last_sync_at |
✅ | ✅ | ✅ | ✅ |
battery_level |
battery_level |
✅ | ✅ | ✅ | ✅ |
firmware_version |
firmware_version |
✅ | ✅ | ✅ | ✅ |
auto_checkin_enabled |
sync_enabled |
✅ | ✅ | ✅ | ✅ |
manufacturer |
manufacturer |
✅ | ✅ | ✅ | ✅ |
model |
model |
✅ | ✅ | ✅ | ✅ |
serial_number |
serial_number |
✅ | ✅ | ✅ | ✅ |
API Endpoints:
- POST /devices - Register device
- GET /devices - List user devices
- GET /devices/{id} - Get device
- PUT /devices/{id} - Update device
- DELETE /devices/{id} - Delete device
- POST /devices/{id}/metrics - Record device metric
- GET /devices/{id}/metrics - List device metrics
13. USER PATTERNS & INSIGHTS (12 metrics)¶
✅ Full CRUD Coverage via /health/patterns¶
| Metric | API Field | Create | Read | Delete |
|---|---|---|---|---|
metric_a |
metric_a |
✅ | ✅ | ✅ |
metric_b |
metric_b |
✅ | ✅ | ✅ |
correlation_strength |
correlation |
✅ | ✅ | ✅ |
is_positive |
Derived from correlation |
✅ | ✅ | ✅ |
is_significant |
p_value < 0.05 |
✅ | ✅ | ✅ |
p_value |
p_value |
✅ | ✅ | ✅ |
sample_size |
data_points |
✅ | ✅ | ✅ |
lag_days |
lag_days |
✅ | ✅ | ✅ |
ai_insight |
insight |
✅ | ✅ | ✅ |
recommendation |
recommendation |
✅ | ✅ | ✅ |
strength |
strength |
✅ | ✅ | ✅ |
analyzed_at |
analyzed_at |
✅ | ✅ | ✅ |
API Endpoints:
- POST /health/patterns/analyze - Trigger pattern analysis
- GET /health/patterns - List discovered patterns
- GET /health/patterns/top - Get top N strongest patterns
- GET /health/patterns/{id} - Get single pattern
- DELETE /health/patterns/cache - Clear cached patterns
Additional API Modules¶
User Profile (/profile)¶
GET /profile- Get profilePUT /profile- Update profile (height, weight, DOB, gender, goal)GET /profile/settings- User settingsPUT /profile/settings- Update settingsGET /profile/share-code- Get/create share codePOST /profile/share-code- Regenerate share codeGET /profile/referral- Get referral codeGET /profile/referrals- List referrals
Fitness Goals & Levels (/fitness)¶
GET /fitness/goals- List fitness goal optionsGET /fitness/goals/me- Get user's goalsPUT /fitness/goals/me- Update user's goalsGET /fitness/levels- List fitness levelsGET /fitness/level/me- Get user's levelPUT /fitness/level/me- Update user's level
Daily Goals (/goals)¶
GET /goals/daily/me- Get daily goals (calories, steps/distance)PUT /goals/daily/me- Update daily goals
Sports (/sports)¶
GET /sports- List sportsGET /sports/me- Get user's sportPUT /sports/me- Update user's sport
Coaches (/coaches)¶
POST /coaches/apply- Apply as coachGET /coaches/my-application- Get application statusGET /coaches- List coachesGET /coaches/{id}- Get coach profile
Health Insights (/health/insights)¶
GET /health/insights/available-metrics- List available metric typesGET /health/insights/summary- Health summaryGET /health/insights/heart- Heart rate insightsGET /health/insights/activity- Activity insightsGET /health/insights/vitals- Vitals insightsGET /health/insights/sleep- Sleep insightsGET /health/insights/dashboard- Combined dashboardGET /health/insights/trends- Metric trendsGET /health/insights/compare- Period comparisonGET /health/insights/goals- Goals progress
Recommendations for Full Coverage¶
High Priority (30 missing metrics)¶
-
Transformation Programs Module (20 metrics)
/transformations POST / - Create transformation program GET / - List programs GET /{id} - Get program with phases PUT /{id} - Update program DELETE /{id} - Delete program POST /{id}/phases - Add phase POST /{id}/milestones - Add milestone GET /{id}/progress - Get progress -
Leaderboard Module (10 metrics)
/leaderboards GET /weekly - Weekly leaderboard GET /monthly - Monthly leaderboard GET /me - My rankings GET /snapshots - Historical snapshots
Medium Priority (Calculated Scores)¶
- Advanced Health Calculations (5 missing scores)
- Add
biological_agecalculation to dashboard - Add
longevity_scoreendpoint - Add
injury_risk_indexcalculation - Enhance
metabolic_healthscore
Low Priority (Gamification)¶
- Gamification Module
/gamification GET /xp - Get XP balance GET /coins - Get coin balance GET /achievements - List achievements POST /celebrate - Celebrate milestone
API Model Field Count¶
The HealthMetric model in Rust supports 202 fields covering:
- Core fields (5)
- Existing vitals (23)
- Body Composition (22)
- HRV & Stress (13)
- Respiratory (2)
- Recovery & Fitness (6)
- Vital Signs Additional (5)
- Segmental Analysis (10)
- Body Circumferences (14)
- Posture & Spine (16)
- Shoulder ROM (8)
- Sleep Additional (10)
- Women's Health (6)
- Activity Additional (5)
- Training (8)
- Temperature (3)
- Blood & Metabolic (4)
- Blood Biomarkers (14)
- DNA Insights (15)
- Risk Indicators (9)
- Metadata (4)
Generated: 2025-02-03 Source: backend-api Rust handlers analysis