# abdallahelraey/fitness-chatbot architecture

> Architecture diagram of the GitHub repository abdallahelraey/fitness-chatbot, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/abdallahelraey/fitness-chatbot
- Repository: https://github.com/abdallahelraey/fitness-chatbot

## Overview

AI Personal Coach combines document-grounded fitness chat with user profiles, fitness assessments, and API-backed authentication. The primary flow is a user query through the chat interface/API, retrieval from prepared fitness documents, then personalized response generation using conversation memory and an LLM. Document ingestion and assessment reporting are distinct supporting workflows. The route, viewer, configuration, and assessment-phase implementations were not sampled, so their internal wiring is shown only where supported by the README or sampled callers.

Main entry points: [`src/models/BaseDataModel.py`](https://github.com/abdallahelraey/fitness-chatbot/blob/main/src/models/BaseDataModel.py) (RAG data model), [`main.py`](https://github.com/abdallahelraey/fitness-chatbot/blob/main/main.py) (FastAPI app), [`src/controllers/ProcessController.py`](https://github.com/abdallahelraey/fitness-chatbot/blob/main/src/controllers/ProcessController.py) (Query processing), [`src/routes/LoginResponseParser.py`](https://github.com/abdallahelraey/fitness-chatbot/blob/main/src/routes/LoginResponseParser.py) (Login parsing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Interfaces and API"]
  node_api["FastAPI app<br/>[main.py]"]
  node_chat_ui["Chat interfaces"]
  node_chat_route["Chat route<br/>[Chatbot.py]"]
  node_data_route["Data routes<br/>[data.py]"]
  node_base_route["Base routes<br/>[base.py]"]
end

subgraph group_knowledge["Knowledge and Chat"]
  node_docs["Fitness documents"]
  node_doc_controller["Document handling"]
  node_processor["Query processing"]
  node_data_model["RAG data model<br/>[BaseDataModel.py]"]
  node_vector_store[("Chroma index")]
  node_memory[("Conversation memory")]
end

subgraph group_personal["User and Assessments"]
  node_profile["User profile<br/>[UserProfile.py]"]
  node_assessment_manager["Assessment manager"]
  node_assessment_phases["Assessment phases"]
  node_assessment_service["Assessment reporting"]
  node_login_parser["Login parsing"]
end

subgraph group_integrations["External Services"]
  node_embeddings["Embedding model"]
  node_llm["Groq LLM"]
  node_auth_service["Authentication service"]
  node_assessment_endpoint["Assessment endpoint"]
end

node_user(("User"))

node_user -->|"asks fitness question"| node_chat_ui
node_user -->|"uses API"| node_api
node_chat_ui -->|"sends chat request"| node_api
node_api -->|"dispatches chat"| node_chat_route
node_api -->|"dispatches data"| node_data_route
node_api -->|"dispatches base"| node_base_route
node_chat_route -->|"processes query"| node_processor
node_data_route -->|"handles documents"| node_doc_controller
node_processor -->|"loads and searches"| node_data_model
node_data_model -->|"reads documents"| node_docs
node_data_model -->|"upserts and queries"| node_vector_store
node_data_model -->|"embeds content"| node_embeddings
node_processor -->|"reads and updates"| node_memory
node_processor -->|"invokes model"| node_llm
node_data_model -->|"requests login"| node_login_parser
node_login_parser -->|"posts credentials"| node_auth_service
node_assessment_manager -->|"runs assessments"| node_assessment_phases
node_assessment_service -->|"posts scores"| node_assessment_endpoint
node_assessment_service -->|"parses response"| node_login_parser
node_profile -->|"supplies user data"| node_assessment_manager

click node_api "https://github.com/abdallahelraey/fitness-chatbot/blob/main/main.py"
click node_chat_ui "https://github.com/abdallahelraey/fitness-chatbot/tree/main/src/viewers"
click node_chat_route "https://github.com/abdallahelraey/fitness-chatbot/blob/main/src/routes/Chatbot.py"
click node_data_route "https://github.com/abdallahelraey/fitness-chatbot/blob/main/src/routes/data.py"
click node_base_route "https://github.com/abdallahelraey/fitness-chatbot/blob/main/src/routes/base.py"
click node_docs "https://github.com/abdallahelraey/fitness-chatbot/tree/main/src/assets/files"
click node_doc_controller "https://github.com/abdallahelraey/fitness-chatbot/blob/main/src/controllers/DocumentController.py"
click node_processor "https://github.com/abdallahelraey/fitness-chatbot/blob/main/src/controllers/ProcessController.py"
click node_data_model "https://github.com/abdallahelraey/fitness-chatbot/blob/main/src/models/BaseDataModel.py"
click node_vector_store "https://github.com/abdallahelraey/fitness-chatbot/tree/main/src/assets/chroma"
click node_memory "https://github.com/abdallahelraey/fitness-chatbot/blob/main/src/controllers/ProcessController.py"
click node_profile "https://github.com/abdallahelraey/fitness-chatbot/blob/main/src/models/UserData/UserProfile.py"
click node_assessment_manager "https://github.com/abdallahelraey/fitness-chatbot/blob/main/src/controllers/AssessmentManager.py"
click node_assessment_phases "https://github.com/abdallahelraey/fitness-chatbot/tree/main/src/models/OPTAssessments"
click node_assessment_service "https://github.com/abdallahelraey/fitness-chatbot/blob/main/src/routes/AssessmentService.py"
click node_login_parser "https://github.com/abdallahelraey/fitness-chatbot/blob/main/src/routes/LoginResponseParser.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_api,node_chat_ui,node_chat_route,node_data_route,node_base_route,node_user toneBlue
class node_docs,node_doc_controller,node_processor,node_data_model,node_vector_store,node_memory toneAmber
class node_profile,node_assessment_manager,node_assessment_phases,node_assessment_service,node_login_parser toneMint
class node_embeddings,node_llm,node_auth_service,node_assessment_endpoint toneRose
```

## Components

### Interfaces and API

- [FastAPI app](https://github.com/abdallahelraey/fitness-chatbot/blob/main/main.py): `main.py`
- [Chat interfaces](https://github.com/abdallahelraey/fitness-chatbot/tree/main/src/viewers): `src/viewers`
- [Chat route](https://github.com/abdallahelraey/fitness-chatbot/blob/main/src/routes/Chatbot.py): `src/routes/Chatbot.py`
- [Data routes](https://github.com/abdallahelraey/fitness-chatbot/blob/main/src/routes/data.py): `src/routes/data.py`
- [Base routes](https://github.com/abdallahelraey/fitness-chatbot/blob/main/src/routes/base.py): `src/routes/base.py`

### Knowledge and Chat

- [Fitness documents](https://github.com/abdallahelraey/fitness-chatbot/tree/main/src/assets/files): `src/assets/files`
- [Document handling](https://github.com/abdallahelraey/fitness-chatbot/blob/main/src/controllers/DocumentController.py): `src/controllers/DocumentController.py`
- [Query processing](https://github.com/abdallahelraey/fitness-chatbot/blob/main/src/controllers/ProcessController.py): `src/controllers/ProcessController.py`
- [RAG data model](https://github.com/abdallahelraey/fitness-chatbot/blob/main/src/models/BaseDataModel.py): `src/models/BaseDataModel.py`
- [Chroma index](https://github.com/abdallahelraey/fitness-chatbot/tree/main/src/assets/chroma): `src/assets/chroma`
- [Conversation memory](https://github.com/abdallahelraey/fitness-chatbot/blob/main/src/controllers/ProcessController.py): `src/controllers/ProcessController.py`

### User and Assessments

- [User profile](https://github.com/abdallahelraey/fitness-chatbot/blob/main/src/models/UserData/UserProfile.py): `src/models/UserData/UserProfile.py`
- [Assessment manager](https://github.com/abdallahelraey/fitness-chatbot/blob/main/src/controllers/AssessmentManager.py): `src/controllers/AssessmentManager.py`
- [Assessment phases](https://github.com/abdallahelraey/fitness-chatbot/tree/main/src/models/OPTAssessments): `src/models/OPTAssessments`
- [Assessment reporting](https://github.com/abdallahelraey/fitness-chatbot/blob/main/src/routes/AssessmentService.py): `src/routes/AssessmentService.py`
- [Login parsing](https://github.com/abdallahelraey/fitness-chatbot/blob/main/src/routes/LoginResponseParser.py): `src/routes/LoginResponseParser.py`

### External Services

- **Embedding model**
- **Groq LLM**
- **Authentication service**
- **Assessment endpoint**

### Other components

- **User**

## Connections

- User → Chat interfaces: asks fitness question
- User → FastAPI app: uses API
- Chat interfaces → FastAPI app: sends chat request
- FastAPI app → Chat route: dispatches chat
- FastAPI app → Data routes: dispatches data
- FastAPI app → Base routes: dispatches base
- Chat route → Query processing: processes query
- Data routes → Document handling: handles documents
- Query processing → RAG data model: loads and searches
- RAG data model → Fitness documents: reads documents
- RAG data model → Chroma index: upserts and queries
- RAG data model → Embedding model: embeds content
- Query processing → Conversation memory: reads and updates
- Query processing → Groq LLM: invokes model
- RAG data model → Login parsing: requests login
- Login parsing → Authentication service: posts credentials
- Assessment manager → Assessment phases: runs assessments
- Assessment reporting → Assessment endpoint: posts scores
- Assessment reporting → Login parsing: parses response
- User profile → Assessment manager: supplies user data
