# joe-josephhh/calorie-tracker- architecture

> Architecture diagram of the GitHub repository joe-josephhh/calorie-tracker-, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-15). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/joe-josephhh/calorie-tracker-
- Repository: https://github.com/joe-josephhh/calorie-tracker-

## Overview

This is a Flask calorie-tracking and weight-management application. Users maintain a profile, log food and activity, and review calorie budgets, history, and weight forecasts; food-image classification supports food logging. The sampled sources show the route layer coordinating domain services, with SQLite for user records and CSV/model assets for nutrition, activity, and image inference. Several UI and forecast capabilities are apparent from the repository tree and module names, but the minimal README and partial excerpts limit confirmation of their exact runtime wiring.

Main entry points: [`app.py`](https://github.com/joe-josephhh/calorie-tracker-/blob/main/app.py) (Flask routes), [`services/coach_service.py`](https://github.com/joe-josephhh/calorie-tracker-/blob/main/services/coach_service.py) (Calorie coach), [`services/diary_service.py`](https://github.com/joe-josephhh/calorie-tracker-/blob/main/services/diary_service.py) (Food diary), [`services/nutrition_service.py`](https://github.com/joe-josephhh/calorie-tracker-/blob/main/services/nutrition_service.py) (Nutrition lookup)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web application"]
  node_routes["Flask routes<br/>[app.py]"]
  node_account["Accounts and profile<br/>[app.py]"]
  node_views["Tracker views"]
end

subgraph group_tracking["Food and activity tracking"]
  node_diary["Food diary<br/>[diary_service.py]"]
  node_nutrition["Nutrition lookup"]
  node_scan["Food image classifier"]
  node_activity["Activity calorie burn"]
end

subgraph group_insights["Coaching and predictions"]
  node_coach["Calorie coach<br/>[coach_service.py]"]
  node_forecast["Weight forecasting"]
end

subgraph group_data["Data and models"]
  node_fooddata["Food datasets"]
  node_classifier["Classifier model"]
  node_metdata["MET activity data<br/>[met.csv]"]
  node_database[("SQLite records<br/>[database.py]")]
  node_configuration["App configuration<br/>[config.py]"]
end

node_user(("Tracker user"))

node_user -->|"submits requests"| node_routes
node_routes -->|"handles account"| node_account
node_routes -->|"uses diary service"| node_diary
node_routes -->|"uses nutrition service"| node_nutrition
node_routes -->|"uses classifier"| node_scan
node_routes -->|"uses burn service"| node_activity
node_routes -->|"uses forecast service"| node_forecast
node_routes -->|"uses coach service"| node_coach
node_routes -->|"uses database"| node_database
node_routes -->|"renders pages"| node_views
node_diary -->|"looks up nutrients"| node_nutrition
node_diary -->|"stores and reads entries"| node_database
node_nutrition -->|"loads food tables"| node_fooddata
node_activity -->|"loads MET table"| node_metdata
node_scan -->|"loads model"| node_classifier
node_scan -->|"reads model settings"| node_configuration
node_nutrition -->|"reads dataset paths"| node_configuration
node_coach -->|"reads food totals"| node_diary
node_coach -->|"uses metabolism calculations"| node_forecast
node_coach -->|"reads profile and activity"| node_database
node_forecast -->|"reads user history"| node_database

click node_routes "https://github.com/joe-josephhh/calorie-tracker-/blob/main/app.py"
click node_account "https://github.com/joe-josephhh/calorie-tracker-/blob/main/app.py"
click node_views "https://github.com/joe-josephhh/calorie-tracker-/tree/main/templates"
click node_diary "https://github.com/joe-josephhh/calorie-tracker-/blob/main/services/diary_service.py"
click node_nutrition "https://github.com/joe-josephhh/calorie-tracker-/blob/main/services/nutrition_service.py"
click node_fooddata "https://github.com/joe-josephhh/calorie-tracker-/tree/main/data"
click node_scan "https://github.com/joe-josephhh/calorie-tracker-/blob/main/services/prediction_service.py"
click node_classifier "https://github.com/joe-josephhh/calorie-tracker-/blob/main/outputs/checkpoints/best_model_finetuned.keras"
click node_activity "https://github.com/joe-josephhh/calorie-tracker-/blob/main/services/calorie_burn_service.py"
click node_metdata "https://github.com/joe-josephhh/calorie-tracker-/blob/main/data/met.csv"
click node_coach "https://github.com/joe-josephhh/calorie-tracker-/blob/main/services/coach_service.py"
click node_forecast "https://github.com/joe-josephhh/calorie-tracker-/blob/main/services/weight_prediction_service.py"
click node_database "https://github.com/joe-josephhh/calorie-tracker-/blob/main/database.py"
click node_configuration "https://github.com/joe-josephhh/calorie-tracker-/blob/main/config.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_routes,node_account,node_views,node_user toneBlue
class node_diary,node_nutrition,node_scan,node_activity toneAmber
class node_coach,node_forecast toneMint
class node_fooddata,node_classifier,node_metdata,node_database,node_configuration toneRose
```

## Components

### Web application

- [Flask routes](https://github.com/joe-josephhh/calorie-tracker-/blob/main/app.py): `app.py`
- [Accounts and profile](https://github.com/joe-josephhh/calorie-tracker-/blob/main/app.py): `app.py`
- [Tracker views](https://github.com/joe-josephhh/calorie-tracker-/tree/main/templates): `templates`

### Food and activity tracking

- [Food diary](https://github.com/joe-josephhh/calorie-tracker-/blob/main/services/diary_service.py): `services/diary_service.py`
- [Nutrition lookup](https://github.com/joe-josephhh/calorie-tracker-/blob/main/services/nutrition_service.py): `services/nutrition_service.py`
- [Food image classifier](https://github.com/joe-josephhh/calorie-tracker-/blob/main/services/prediction_service.py): `services/prediction_service.py`
- [Activity calorie burn](https://github.com/joe-josephhh/calorie-tracker-/blob/main/services/calorie_burn_service.py): `services/calorie_burn_service.py`

### Coaching and predictions

- [Calorie coach](https://github.com/joe-josephhh/calorie-tracker-/blob/main/services/coach_service.py): `services/coach_service.py`
- [Weight forecasting](https://github.com/joe-josephhh/calorie-tracker-/blob/main/services/weight_prediction_service.py): `services/weight_prediction_service.py`

### Data and models

- [Food datasets](https://github.com/joe-josephhh/calorie-tracker-/tree/main/data): `data`
- [Classifier model](https://github.com/joe-josephhh/calorie-tracker-/blob/main/outputs/checkpoints/best_model_finetuned.keras): `outputs/checkpoints/best_model_finetuned.keras`
- [MET activity data](https://github.com/joe-josephhh/calorie-tracker-/blob/main/data/met.csv): `data/met.csv`
- [SQLite records](https://github.com/joe-josephhh/calorie-tracker-/blob/main/database.py): `database.py`
- [App configuration](https://github.com/joe-josephhh/calorie-tracker-/blob/main/config.py): `config.py`

### Other components

- **Tracker user**

## Connections

- Tracker user → Flask routes: submits requests (evidence: `app.py`)
- Flask routes → Accounts and profile: handles account (evidence: `app.py`)
- Flask routes → Food diary: uses diary service (evidence: `app.py`)
- Flask routes → Nutrition lookup: uses nutrition service (evidence: `app.py`)
- Flask routes → Food image classifier: uses classifier (evidence: `app.py`)
- Flask routes → Activity calorie burn: uses burn service (evidence: `app.py`)
- Flask routes → Weight forecasting: uses forecast service (evidence: `app.py`)
- Flask routes → Calorie coach: uses coach service (evidence: `app.py`)
- Flask routes → SQLite records: uses database (evidence: `app.py`)
- Flask routes → Tracker views: renders pages (evidence: `app.py`)
- Food diary → Nutrition lookup: looks up nutrients (evidence: `services/diary_service.py`)
- Food diary → SQLite records: stores and reads entries (evidence: `services/diary_service.py`)
- Nutrition lookup → Food datasets: loads food tables (evidence: `services/nutrition_service.py`)
- Activity calorie burn → MET activity data: loads MET table (evidence: `services/calorie_burn_service.py`)
- Food image classifier → Classifier model: loads model (evidence: `services/prediction_service.py`)
- Food image classifier → App configuration: reads model settings (evidence: `services/prediction_service.py`)
- Nutrition lookup → App configuration: reads dataset paths (evidence: `services/nutrition_service.py`)
- Calorie coach → Food diary: reads food totals (evidence: `services/coach_service.py`)
- Calorie coach → Weight forecasting: uses metabolism calculations (evidence: `services/coach_service.py`)
- Calorie coach → SQLite records: reads profile and activity (evidence: `services/coach_service.py`)
- Weight forecasting → SQLite records: reads user history (evidence: `services/weight_prediction_service.py`)
