# moshikvarmaa/veerufit-varmaa architecture

> Architecture diagram of the GitHub repository moshikvarmaa/veerufit-varmaa, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-21). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/moshikvarmaa/veerufit-varmaa
- Repository: https://github.com/moshikvarmaa/veerufit-varmaa

## Overview

VeeruFit turns an athlete’s blood report and training preferences into a biomarker-aware weekly workout plan, rationale, downloadable PDF, and optional email. The main path is the React dashboard or Streamlit interface through the API or local orchestrator, then report extraction, parsing, relevance validation, safety rules and routine generation, and report delivery. SQLite stores report and routine data. The README documents the React/FastAPI product capabilities; source excerpts establish most backend calls, while UI-to-API wiring is documented rather than shown in code.

Main entry points: [`main.py`](https://github.com/moshikvarmaa/veerufit-varmaa/blob/main/main.py) (Pipeline orchestrator), [`api.py`](https://github.com/moshikvarmaa/veerufit-varmaa/blob/main/api.py) (REST API), [`app.py`](https://github.com/moshikvarmaa/veerufit-varmaa/blob/main/app.py) (Streamlit interface), [`ingestion/db_loader.py`](https://github.com/moshikvarmaa/veerufit-varmaa/blob/main/ingestion/db_loader.py) (Report and routine storage)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["User interfaces"]
  node_web_ui["React dashboard<br/>[App.jsx]"]
  node_streamlit_ui["Streamlit interface<br/>[app.py]"]
end

subgraph group_service["Request orchestration"]
  node_api["REST API<br/>[api.py]"]
  node_pipeline["Pipeline orchestrator<br/>[main.py]"]
end

subgraph group_ingest["Report ingestion"]
  node_extract["Report extraction<br/>[extractor.py]"]
  node_parse["Biomarker parsing<br/>[parser.py]"]
end

subgraph group_training["Clinical training"]
  node_validator["Panel relevance<br/>[validator.py]"]
  node_routine["Safety and routine engine<br/>[routine_engine.py]"]
end

subgraph group_delivery["Storage and delivery"]
  node_db_loader["Report and routine storage<br/>[db_loader.py]"]
  node_sqlite[("SQLite database")]
  node_pdf["PDF report exporter<br/>[pdf_exporter.py]"]
  node_email["Email sender<br/>[gmail_sender.py]"]
end

node_athlete(("Athlete"))
node_gemini{{"Gemini AI"}}
node_apps_script{{"Apps Script webhook"}}

node_athlete -->|"submits profile"| node_web_ui
node_athlete -->|"provides report"| node_streamlit_ui
node_web_ui -.->|"requests plan"| node_api
node_streamlit_ui -->|"starts workflow"| node_pipeline
node_api -->|"generates plan"| node_pipeline
node_api -->|"loads saved report"| node_db_loader
node_pipeline -->|"extracts text"| node_extract
node_pipeline -->|"parses biomarkers"| node_parse
node_pipeline -->|"checks relevance"| node_validator
node_pipeline -->|"generates routine"| node_routine
node_pipeline -->|"saves and reads"| node_db_loader
node_db_loader -->|"reads and writes"| node_sqlite
node_routine -->|"generates plan"| node_gemini
node_parse -.->|"extracts structured data"| node_gemini
node_pipeline -->|"exports report"| node_pdf
node_api -->|"sends requested report"| node_email
node_streamlit_ui -->|"sends report"| node_email
node_email -->|"posts email payload"| node_apps_script

click node_web_ui "https://github.com/moshikvarmaa/veerufit-varmaa/blob/main/frontend/src/App.jsx"
click node_streamlit_ui "https://github.com/moshikvarmaa/veerufit-varmaa/blob/main/app.py"
click node_api "https://github.com/moshikvarmaa/veerufit-varmaa/blob/main/api.py"
click node_pipeline "https://github.com/moshikvarmaa/veerufit-varmaa/blob/main/main.py"
click node_extract "https://github.com/moshikvarmaa/veerufit-varmaa/blob/main/ingestion/extractor.py"
click node_parse "https://github.com/moshikvarmaa/veerufit-varmaa/blob/main/ingestion/parser.py"
click node_validator "https://github.com/moshikvarmaa/veerufit-varmaa/blob/main/ingestion/validator.py"
click node_routine "https://github.com/moshikvarmaa/veerufit-varmaa/blob/main/engine/routine_engine.py"
click node_db_loader "https://github.com/moshikvarmaa/veerufit-varmaa/blob/main/ingestion/db_loader.py"
click node_pdf "https://github.com/moshikvarmaa/veerufit-varmaa/blob/main/engine/pdf_exporter.py"
click node_email "https://github.com/moshikvarmaa/veerufit-varmaa/blob/main/engine/gmail_sender.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_web_ui,node_streamlit_ui toneBlue
class node_api,node_pipeline toneAmber
class node_extract,node_parse,node_apps_script toneMint
class node_validator,node_routine toneRose
class node_db_loader,node_sqlite,node_pdf,node_email,node_athlete,node_gemini toneIndigo
```

## Components

### User interfaces

- [React dashboard](https://github.com/moshikvarmaa/veerufit-varmaa/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Streamlit interface](https://github.com/moshikvarmaa/veerufit-varmaa/blob/main/app.py): `app.py`

### Request orchestration

- [REST API](https://github.com/moshikvarmaa/veerufit-varmaa/blob/main/api.py): `api.py`
- [Pipeline orchestrator](https://github.com/moshikvarmaa/veerufit-varmaa/blob/main/main.py): `main.py`

### Report ingestion

- [Report extraction](https://github.com/moshikvarmaa/veerufit-varmaa/blob/main/ingestion/extractor.py): `ingestion/extractor.py`
- [Biomarker parsing](https://github.com/moshikvarmaa/veerufit-varmaa/blob/main/ingestion/parser.py): `ingestion/parser.py`

### Clinical training

- [Panel relevance](https://github.com/moshikvarmaa/veerufit-varmaa/blob/main/ingestion/validator.py): `ingestion/validator.py`
- [Safety and routine engine](https://github.com/moshikvarmaa/veerufit-varmaa/blob/main/engine/routine_engine.py): `engine/routine_engine.py`

### Storage and delivery

- [Report and routine storage](https://github.com/moshikvarmaa/veerufit-varmaa/blob/main/ingestion/db_loader.py): `ingestion/db_loader.py`
- **SQLite database**
- [PDF report exporter](https://github.com/moshikvarmaa/veerufit-varmaa/blob/main/engine/pdf_exporter.py): `engine/pdf_exporter.py`
- [Email sender](https://github.com/moshikvarmaa/veerufit-varmaa/blob/main/engine/gmail_sender.py): `engine/gmail_sender.py`

### Other components

- **Athlete**
- **Gemini AI**
- **Apps Script webhook**

## Connections

- Athlete → React dashboard: submits profile (evidence: `README.md`)
- Athlete → Streamlit interface: provides report (evidence: `app.py`)
- React dashboard → REST API: requests plan (evidence: `README.md`)
- Streamlit interface → Pipeline orchestrator: starts workflow (evidence: `app.py`)
- REST API → Pipeline orchestrator: generates plan (evidence: `api.py`)
- REST API → Report and routine storage: loads saved report (evidence: `api.py`)
- Pipeline orchestrator → Report extraction: extracts text (evidence: `main.py`)
- Pipeline orchestrator → Biomarker parsing: parses biomarkers (evidence: `main.py`)
- Pipeline orchestrator → Panel relevance: checks relevance (evidence: `main.py`)
- Pipeline orchestrator → Safety and routine engine: generates routine (evidence: `main.py`)
- Pipeline orchestrator → Report and routine storage: saves and reads (evidence: `main.py`)
- Report and routine storage → SQLite database: reads and writes (evidence: `ingestion/db_loader.py`)
- Safety and routine engine → Gemini AI: generates plan (evidence: `engine/routine_engine.py`)
- Biomarker parsing → Gemini AI: extracts structured data (evidence: `ingestion/parser.py`)
- Pipeline orchestrator → PDF report exporter: exports report (evidence: `main.py`)
- REST API → Email sender: sends requested report (evidence: `api.py`)
- Streamlit interface → Email sender: sends report (evidence: `app.py`)
- Email sender → Apps Script webhook: posts email payload (evidence: `engine/gmail_sender.py`)
