# jiashinnn/fatigue_classification_system architecture

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

- Interactive diagram: https://gitdiagram.com/jiashinnn/fatigue_classification_system
- Repository: https://github.com/jiashinnn/fatigue_classification_system

## Overview

FatiQ is a fatigue-monitoring product for cadets and coaches, with a Flutter client, PHP API, and training-data backend. The main domain flow is account access, pre- and post-training capture, metric computation, fatigue prediction, and later review; coaches also have roster and dashboard views. Endpoint names and sampled PHP support the API and database relationships, while the prediction script documents its dependency on computed metrics and an external ML service. Flutter application logic is not present in the supplied tree, so client-to-endpoint wiring is not shown.

Main entry points: [`fatigue_cs/database/php backend/dbconnect.php`](https://github.com/jiashinnn/fatigue_classification_system/blob/main/fatigue_cs/database/php%20backend/dbconnect.php) (Database connection), [`fatigue_cs/database/php backend/Auth/login_user.php`](https://github.com/jiashinnn/fatigue_classification_system/blob/main/fatigue_cs/database/php%20backend/Auth/login_user.php) (Login and registration), [`fatigue_cs/database/php backend/Auth/verify_otp.php`](https://github.com/jiashinnn/fatigue_classification_system/blob/main/fatigue_cs/database/php%20backend/Auth/verify_otp.php) (OTP verification), [`fatigue_cs/database/php backend/predict_fatigue_ml.php`](https://github.com/jiashinnn/fatigue_classification_system/blob/main/fatigue_cs/database/php%20backend/predict_fatigue_ml.php) (Fatigue prediction)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Client apps"]
  node_flutter["Flutter client"]
  node_portfolio["Portfolio website<br/>[script.js]"]
end

subgraph group_identity["Identity and email"]
  node_auth["Login and registration<br/>[login_user.php]"]
  node_otp["OTP verification<br/>[verify_otp.php]"]
  node_email["Email delivery<br/>[email_config.php]"]
  node_mailer["PHPMailer<br/>[PHPMailer.php]"]
end

subgraph group_training["Training and insights"]
  node_pre["Pre-training capture"]
  node_post["Post-training capture"]
  node_metrics["Metric computation"]
  node_prediction["Fatigue prediction"]
  node_cadetdata["Cadet session API"]
  node_coachdata["Coach dashboard API"]
end

subgraph group_persistence["Backend storage"]
  node_dbconnect["Database connection<br/>[dbconnect.php]"]
  node_database[("Application database<br/>[dbconnect.php]")]
end

node_cadet(("Cadet"))
node_coach(("Coach"))
node_mlservice{{"ML prediction service"}}

node_cadet -->|"uses"| node_flutter
node_coach -->|"uses"| node_flutter
node_cadet -->|"authenticates"| node_auth
node_coach -->|"authenticates"| node_auth
node_auth -->|"queries"| node_dbconnect
node_otp -->|"uses"| node_dbconnect
node_otp -->|"requests delivery"| node_email
node_email -->|"sends through"| node_mailer
node_pre -->|"writes"| node_dbconnect
node_post -->|"writes"| node_dbconnect
node_metrics -->|"reads and writes"| node_dbconnect
node_prediction -->|"reads and writes"| node_dbconnect
node_prediction -.->|"requests prediction"| node_mlservice
node_cadetdata -->|"reads"| node_dbconnect
node_coachdata -->|"reads"| node_dbconnect
node_dbconnect -->|"connects"| node_database

click node_flutter "https://github.com/jiashinnn/fatigue_classification_system/tree/main/fatigue_cs"
click node_auth "https://github.com/jiashinnn/fatigue_classification_system/blob/main/fatigue_cs/database/php%20backend/Auth/login_user.php"
click node_otp "https://github.com/jiashinnn/fatigue_classification_system/blob/main/fatigue_cs/database/php%20backend/Auth/verify_otp.php"
click node_email "https://github.com/jiashinnn/fatigue_classification_system/blob/main/fatigue_cs/database/php%20backend/email_config.php"
click node_mailer "https://github.com/jiashinnn/fatigue_classification_system/blob/main/fatigue_cs/database/php%20backend/PHPMailer/src/PHPMailer.php"
click node_pre "https://github.com/jiashinnn/fatigue_classification_system/blob/main/fatigue_cs/database/php%20backend/Cadet/save_pre_training_data.php"
click node_post "https://github.com/jiashinnn/fatigue_classification_system/blob/main/fatigue_cs/database/php%20backend/Cadet/save_post_training_data.php"
click node_metrics "https://github.com/jiashinnn/fatigue_classification_system/blob/main/fatigue_cs/database/php%20backend/compute_metrics.php"
click node_prediction "https://github.com/jiashinnn/fatigue_classification_system/blob/main/fatigue_cs/database/php%20backend/predict_fatigue_ml.php"
click node_cadetdata "https://github.com/jiashinnn/fatigue_classification_system/blob/main/fatigue_cs/database/php%20backend/Cadet/get_training_session_details.php"
click node_coachdata "https://github.com/jiashinnn/fatigue_classification_system/blob/main/fatigue_cs/database/php%20backend/Coach/get_coach_dashboard_data.php"
click node_dbconnect "https://github.com/jiashinnn/fatigue_classification_system/blob/main/fatigue_cs/database/php%20backend/dbconnect.php"
click node_database "https://github.com/jiashinnn/fatigue_classification_system/blob/main/fatigue_cs/database/php%20backend/dbconnect.php"
click node_portfolio "https://github.com/jiashinnn/fatigue_classification_system/blob/main/website/script.js"

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_flutter,node_portfolio toneBlue
class node_auth,node_otp,node_email,node_mailer toneAmber
class node_pre,node_post,node_metrics,node_prediction,node_cadetdata,node_coachdata toneMint
class node_dbconnect,node_database toneRose
class node_cadet,node_coach,node_mlservice toneIndigo
```

## Components

### Client apps

- [Flutter client](https://github.com/jiashinnn/fatigue_classification_system/tree/main/fatigue_cs): `fatigue_cs`
- [Portfolio website](https://github.com/jiashinnn/fatigue_classification_system/blob/main/website/script.js): `website/script.js`

### Identity and email

- [Login and registration](https://github.com/jiashinnn/fatigue_classification_system/blob/main/fatigue_cs/database/php%20backend/Auth/login_user.php): `fatigue_cs/database/php backend/Auth/login_user.php`
- [OTP verification](https://github.com/jiashinnn/fatigue_classification_system/blob/main/fatigue_cs/database/php%20backend/Auth/verify_otp.php): `fatigue_cs/database/php backend/Auth/verify_otp.php`
- [Email delivery](https://github.com/jiashinnn/fatigue_classification_system/blob/main/fatigue_cs/database/php%20backend/email_config.php): `fatigue_cs/database/php backend/email_config.php`
- [PHPMailer](https://github.com/jiashinnn/fatigue_classification_system/blob/main/fatigue_cs/database/php%20backend/PHPMailer/src/PHPMailer.php): `fatigue_cs/database/php backend/PHPMailer/src/PHPMailer.php`

### Training and insights

- [Pre-training capture](https://github.com/jiashinnn/fatigue_classification_system/blob/main/fatigue_cs/database/php%20backend/Cadet/save_pre_training_data.php): `fatigue_cs/database/php backend/Cadet/save_pre_training_data.php`
- [Post-training capture](https://github.com/jiashinnn/fatigue_classification_system/blob/main/fatigue_cs/database/php%20backend/Cadet/save_post_training_data.php): `fatigue_cs/database/php backend/Cadet/save_post_training_data.php`
- [Metric computation](https://github.com/jiashinnn/fatigue_classification_system/blob/main/fatigue_cs/database/php%20backend/compute_metrics.php): `fatigue_cs/database/php backend/compute_metrics.php`
- [Fatigue prediction](https://github.com/jiashinnn/fatigue_classification_system/blob/main/fatigue_cs/database/php%20backend/predict_fatigue_ml.php): `fatigue_cs/database/php backend/predict_fatigue_ml.php`
- [Cadet session API](https://github.com/jiashinnn/fatigue_classification_system/blob/main/fatigue_cs/database/php%20backend/Cadet/get_training_session_details.php): `fatigue_cs/database/php backend/Cadet/get_training_session_details.php`
- [Coach dashboard API](https://github.com/jiashinnn/fatigue_classification_system/blob/main/fatigue_cs/database/php%20backend/Coach/get_coach_dashboard_data.php): `fatigue_cs/database/php backend/Coach/get_coach_dashboard_data.php`

### Backend storage

- [Database connection](https://github.com/jiashinnn/fatigue_classification_system/blob/main/fatigue_cs/database/php%20backend/dbconnect.php): `fatigue_cs/database/php backend/dbconnect.php`
- [Application database](https://github.com/jiashinnn/fatigue_classification_system/blob/main/fatigue_cs/database/php%20backend/dbconnect.php): `fatigue_cs/database/php backend/dbconnect.php`

### Other components

- **Cadet**
- **Coach**
- **ML prediction service**

## Connections

- Cadet → Flutter client: uses
- Coach → Flutter client: uses
- Cadet → Login and registration: authenticates
- Coach → Login and registration: authenticates
- Login and registration → Database connection: queries
- OTP verification → Database connection: uses
- OTP verification → Email delivery: requests delivery
- Email delivery → PHPMailer: sends through
- Pre-training capture → Database connection: writes
- Post-training capture → Database connection: writes
- Metric computation → Database connection: reads and writes
- Fatigue prediction → Database connection: reads and writes
- Fatigue prediction → ML prediction service: requests prediction
- Cadet session API → Database connection: reads
- Coach dashboard API → Database connection: reads
- Database connection → Application database: connects
