# hasanorkan156/grad2 architecture

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

- Interactive diagram: https://gitdiagram.com/hasanorkan156/grad2
- Repository: https://github.com/hasanorkan156/grad2

## Overview

This appears to be a diabetes-tracking backend with a Flutter mobile client, but the README provides no product detail and the tree includes no Dart application source. The sampled backend shows API setup, authentication, and a separate diabetes-risk prediction API; other major capabilities are indicated by router names and registration comments, but their internals and client wiring are not evidenced. The graph therefore preserves those feature modules without guessing their internal calls.

Main entry points: [`backend/main.py`](https://github.com/hasanorkan156/grad2/blob/main/backend/main.py) (API application), [`backend/routers/auth.py`](https://github.com/hasanorkan156/grad2/blob/main/backend/routers/auth.py) (Authentication), [`backend/db/session.py`](https://github.com/hasanorkan156/grad2/blob/main/backend/db/session.py) (DB sessions), [`backend/core/firebase.py`](https://github.com/hasanorkan156/grad2/blob/main/backend/core/firebase.py) (Firebase verification)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["Backend API"]
  node_api_entry["API application<br/>[main.py]"]
end

subgraph group_features["Tracking Features"]
  node_auth["Authentication<br/>[auth.py]"]
  node_glucose["Glucose records<br/>[glucose.py]"]
  node_sync["Offline sync<br/>[sync.py]"]
  node_reminders["Reminders<br/>[reminders.py]"]
  node_reports["Reports<br/>[reports.py]"]
  node_risk_route["Risk route<br/>[risk.py]"]
end

subgraph group_identity["Identity and Data"]
  node_db_access["DB sessions<br/>[session.py]"]
  node_db_models["Data models<br/>[models.py]"]
  node_security["Token security<br/>[security.py]"]
  node_firebase["Firebase verification<br/>[firebase.py]"]
  node_database[("Application database")]
end

subgraph group_ml["Risk Modeling"]
  node_model_training["Model training<br/>[train_pipeline.py]"]
  node_risk_api["Prediction API<br/>[app.py]"]
  node_model_file["Trained pipeline"]
end

node_user(("Mobile user"))
node_firebase_service["Firebase"]

node_user -->|"sends requests"| node_api_entry
node_api_entry -->|"registers route"| node_auth
node_api_entry -->|"registers route"| node_glucose
node_api_entry -->|"registers route"| node_sync
node_api_entry -->|"registers route"| node_reminders
node_api_entry -->|"registers route"| node_reports
node_api_entry -->|"registers route"| node_risk_route
node_api_entry -->|"creates tables"| node_db_access
node_db_access -->|"connects"| node_database
node_api_entry -->|"creates tables from"| node_db_models
node_auth -->|"queries users"| node_db_access
node_auth -->|"hashes and issues tokens"| node_security
node_auth -->|"verifies login token"| node_firebase
node_firebase -->|"verifies token"| node_firebase_service
node_model_training -->|"saves pipeline"| node_model_file
node_risk_api -->|"loads pipeline"| node_model_file

click node_api_entry "https://github.com/hasanorkan156/grad2/blob/main/backend/main.py"
click node_auth "https://github.com/hasanorkan156/grad2/blob/main/backend/routers/auth.py"
click node_glucose "https://github.com/hasanorkan156/grad2/blob/main/backend/routers/glucose.py"
click node_sync "https://github.com/hasanorkan156/grad2/blob/main/backend/routers/sync.py"
click node_reminders "https://github.com/hasanorkan156/grad2/blob/main/backend/routers/reminders.py"
click node_reports "https://github.com/hasanorkan156/grad2/blob/main/backend/routers/reports.py"
click node_risk_route "https://github.com/hasanorkan156/grad2/blob/main/backend/routers/risk.py"
click node_db_access "https://github.com/hasanorkan156/grad2/blob/main/backend/db/session.py"
click node_db_models "https://github.com/hasanorkan156/grad2/blob/main/backend/db/models.py"
click node_security "https://github.com/hasanorkan156/grad2/blob/main/backend/core/security.py"
click node_firebase "https://github.com/hasanorkan156/grad2/blob/main/backend/core/firebase.py"
click node_model_training "https://github.com/hasanorkan156/grad2/blob/main/backend/ml_models/train_pipeline.py"
click node_risk_api "https://github.com/hasanorkan156/grad2/blob/main/backend/ml_models/app.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_entry,node_user toneBlue
class node_auth,node_glucose,node_sync,node_reminders,node_reports,node_risk_route toneAmber
class node_db_access,node_db_models,node_security,node_firebase,node_database toneMint
class node_model_training,node_risk_api,node_model_file toneRose
class node_firebase_service toneIndigo
```

## Components

### Backend API

- [API application](https://github.com/hasanorkan156/grad2/blob/main/backend/main.py): `backend/main.py`

### Tracking Features

- [Authentication](https://github.com/hasanorkan156/grad2/blob/main/backend/routers/auth.py): `backend/routers/auth.py`
- [Glucose records](https://github.com/hasanorkan156/grad2/blob/main/backend/routers/glucose.py): `backend/routers/glucose.py`
- [Offline sync](https://github.com/hasanorkan156/grad2/blob/main/backend/routers/sync.py): `backend/routers/sync.py`
- [Reminders](https://github.com/hasanorkan156/grad2/blob/main/backend/routers/reminders.py): `backend/routers/reminders.py`
- [Reports](https://github.com/hasanorkan156/grad2/blob/main/backend/routers/reports.py): `backend/routers/reports.py`
- [Risk route](https://github.com/hasanorkan156/grad2/blob/main/backend/routers/risk.py): `backend/routers/risk.py`

### Identity and Data

- [DB sessions](https://github.com/hasanorkan156/grad2/blob/main/backend/db/session.py): `backend/db/session.py`
- [Data models](https://github.com/hasanorkan156/grad2/blob/main/backend/db/models.py): `backend/db/models.py`
- [Token security](https://github.com/hasanorkan156/grad2/blob/main/backend/core/security.py): `backend/core/security.py`
- [Firebase verification](https://github.com/hasanorkan156/grad2/blob/main/backend/core/firebase.py): `backend/core/firebase.py`
- **Application database**

### Risk Modeling

- [Model training](https://github.com/hasanorkan156/grad2/blob/main/backend/ml_models/train_pipeline.py): `backend/ml_models/train_pipeline.py`
- [Prediction API](https://github.com/hasanorkan156/grad2/blob/main/backend/ml_models/app.py): `backend/ml_models/app.py`
- **Trained pipeline**

### Other components

- **Mobile user**
- **Firebase**

## Connections

- Mobile user → API application: sends requests
- API application → Authentication: registers route
- API application → Glucose records: registers route
- API application → Offline sync: registers route
- API application → Reminders: registers route
- API application → Reports: registers route
- API application → Risk route: registers route
- API application → DB sessions: creates tables
- DB sessions → Application database: connects
- API application → Data models: creates tables from
- Authentication → DB sessions: queries users
- Authentication → Token security: hashes and issues tokens
- Authentication → Firebase verification: verifies login token
- Firebase verification → Firebase: verifies token
- Model training → Trained pipeline: saves pipeline
- Prediction API → Trained pipeline: loads pipeline
