# aakash-tech/mental-health-score architecture

> Architecture diagram of the GitHub repository aakash-tech/mental-health-score, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-05). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/aakash-tech/mental-health-score
- Repository: https://github.com/aakash-tech/mental-health-score

## Overview

This is a web app that predicts a mental-health score from student lifestyle and social-media inputs. The workflow runs from a browser form through client-side validation and a prediction request to a FastAPI endpoint, which prepares model features and returns a score for display. The sampled code supports the backend’s prediction stages and the frontend request/result behavior; the exact frontend-to-endpoint wiring is not shown, so that link is marked unverified. The README provides no additional capability details.

Main entry points: [`main.py`](https://github.com/aakash-tech/mental-health-score/blob/main/main.py) (Prediction endpoint), [`frontend/index.html`](https://github.com/aakash-tech/mental-health-score/blob/main/frontend/index.html) (Input form), [`frontend/js/script.js`](https://github.com/aakash-tech/mental-health-score/blob/main/frontend/js/script.js) (Validation and payload), [`ML_Model.pkl`](https://github.com/aakash-tech/mental-health-score/blob/main/ML_Model.pkl) (Trained model)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Browser app"]
  node_form["Input form<br/>[index.html]"]
  node_form_logic["Validation and payload<br/>[script.js]"]
  node_api_client["API request<br/>[script.js]"]
  node_result["Score display<br/>[script.js]"]
end

subgraph group_backend["Prediction service"]
  node_endpoint["Prediction endpoint<br/>[main.py]"]
  node_input_schema["Input validation<br/>[main.py]"]
  node_country_grouping["Country grouping<br/>[main.py]"]
  node_feature_row["Feature preparation<br/>[main.py]"]
  node_score_response["Score response<br/>[main.py]"]
end

subgraph group_modeling["Model inference"]
  node_model[("Trained model<br/>[ML_Model.pkl]")]
end

node_user(("Student"))

node_user -->|"enters inputs"| node_form
node_form -->|"validates input"| node_form_logic
node_form_logic -->|"builds request"| node_api_client
node_api_client -.->|"posts prediction"| node_endpoint
node_endpoint -->|"validates input"| node_input_schema
node_endpoint -->|"groups country"| node_country_grouping
node_endpoint -->|"builds features"| node_feature_row
node_endpoint -->|"loads and predicts"| node_model
node_endpoint -->|"returns score"| node_score_response
node_score_response -->|"displays score"| node_result

click node_form "https://github.com/aakash-tech/mental-health-score/blob/main/frontend/index.html"
click node_form_logic "https://github.com/aakash-tech/mental-health-score/blob/main/frontend/js/script.js"
click node_api_client "https://github.com/aakash-tech/mental-health-score/blob/main/frontend/js/script.js"
click node_result "https://github.com/aakash-tech/mental-health-score/blob/main/frontend/js/script.js"
click node_endpoint "https://github.com/aakash-tech/mental-health-score/blob/main/main.py"
click node_input_schema "https://github.com/aakash-tech/mental-health-score/blob/main/main.py"
click node_country_grouping "https://github.com/aakash-tech/mental-health-score/blob/main/main.py"
click node_feature_row "https://github.com/aakash-tech/mental-health-score/blob/main/main.py"
click node_model "https://github.com/aakash-tech/mental-health-score/blob/main/ML_Model.pkl"
click node_score_response "https://github.com/aakash-tech/mental-health-score/blob/main/main.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_form,node_form_logic,node_api_client,node_result toneBlue
class node_endpoint,node_input_schema,node_country_grouping,node_feature_row,node_score_response toneAmber
class node_model toneMint
class node_user toneIndigo
```

## Components

### Browser app

- [Input form](https://github.com/aakash-tech/mental-health-score/blob/main/frontend/index.html): `frontend/index.html`
- [Validation and payload](https://github.com/aakash-tech/mental-health-score/blob/main/frontend/js/script.js): `frontend/js/script.js`
- [API request](https://github.com/aakash-tech/mental-health-score/blob/main/frontend/js/script.js): `frontend/js/script.js`
- [Score display](https://github.com/aakash-tech/mental-health-score/blob/main/frontend/js/script.js): `frontend/js/script.js`

### Prediction service

- [Prediction endpoint](https://github.com/aakash-tech/mental-health-score/blob/main/main.py): `main.py`
- [Input validation](https://github.com/aakash-tech/mental-health-score/blob/main/main.py): `main.py`
- [Country grouping](https://github.com/aakash-tech/mental-health-score/blob/main/main.py): `main.py`
- [Feature preparation](https://github.com/aakash-tech/mental-health-score/blob/main/main.py): `main.py`
- [Score response](https://github.com/aakash-tech/mental-health-score/blob/main/main.py): `main.py`

### Model inference

- [Trained model](https://github.com/aakash-tech/mental-health-score/blob/main/ML_Model.pkl): `ML_Model.pkl`

### Other components

- **Student**

## Connections

- Student → Input form: enters inputs
- Input form → Validation and payload: validates input (evidence: `frontend/js/script.js`)
- Validation and payload → API request: builds request (evidence: `frontend/js/script.js`)
- API request → Prediction endpoint: posts prediction
- Prediction endpoint → Input validation: validates input (evidence: `main.py`)
- Prediction endpoint → Country grouping: groups country (evidence: `main.py`)
- Prediction endpoint → Feature preparation: builds features (evidence: `main.py`)
- Prediction endpoint → Trained model: loads and predicts (evidence: `main.py`)
- Prediction endpoint → Score response: returns score (evidence: `main.py`)
- Score response → Score display: displays score (evidence: `frontend/js/script.js`)
