Diet / Bulk Calorie Analyzer – Full Breakdown

This Python application merges nutrition, training, and wearable data to forecast weight‑change trends and validate whether a diet or bulk is actually on track.

Download health_bot.py

1. Problem → Solution

Pain point: lifters and dieters track calories but rarely validate predictions against the scale. Spreadsheet workflows are manual, error‑prone, and skip workout expenditure.

Solution: a CLI tool that automatically ingests three CSV streams, models daily energy balance, graphs predicted vs actual weight, and flags when the deviation exceeds 3 %.

2. Data Pipeline

All three CSVs are normalised with Pandas, merged on date, then passed to a calorie‑balance model that adds activity expenditure from workouts and steps.

Data flow diagram

3. Core Logic (40 lines)

# simplified excerpt
energy_in  = crono_df['calories']
energy_out = 0.9 * hevy_df['kcal_est'] + 0.04 * steps_df['steps']

def predict_weight(start_wt, kcal_deficit):
    return start_wt + kcal_deficit / 7700  # kcal per kg fat

daily_deficit = energy_in - energy_out - tdee
weight_pred   = predict_weight(start_weight, daily_deficit.cumsum())

Full annotated code lives in health_bot.py.

4. Visual Output

The script exports a PNG plotted with Matplotlib. Blue line = scale weight, dotted line = model prediction; grey band = ±3 % tolerance.

Weight prediction chart

5. Challenges & Lessons

6. Future Improvements

← Back to Projects