# ranveerd/neuro-balance architecture

> Architecture diagram of the GitHub repository ranveerd/neuro-balance, 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/ranveerd/neuro-balance
- Repository: https://github.com/ranveerd/neuro-balance

## Overview

Neuro-Balance is a web-based student mental-health score predictor. A user enters student and social-media details in the web form; the browser sends them to a FastAPI endpoint, which validates the fields, prepares a model input, runs the bundled model, and returns a score for display. The graph reflects the sampled API and browser code; the README provides no further capability details, and the HTML and model internals were not sampled.

Main entry points: [`main.py`](https://github.com/ranveerd/neuro-balance/blob/main/main.py) (Predict endpoint), [`script.js`](https://github.com/ranveerd/neuro-balance/blob/main/script.js) (Form handling), [`index.html`](https://github.com/ranveerd/neuro-balance/blob/main/index.html) (Prediction form), [`Mental_Health_Model.pkl`](https://github.com/ranveerd/neuro-balance/blob/main/Mental_Health_Model.pkl) (Trained model)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web interface"]
  node_form["Prediction form<br/>[index.html]"]
  node_browser["Form handling<br/>[script.js]"]
  node_result["Score display<br/>[script.js]"]
end

subgraph group_api["Prediction API"]
  node_endpoint["Predict endpoint<br/>[main.py]"]
  node_input["Input validation<br/>[main.py]"]
  node_preparation["Feature preparation<br/>[main.py]"]
end

subgraph group_model["Scoring model"]
  node_model["Trained model"]
end

node_user(("Student"))

node_user -->|"enters details"| node_form
node_form -->|"handles submit"| node_browser
node_browser -->|"POSTs prediction"| node_endpoint
node_endpoint -->|"validates"| node_input
node_endpoint -->|"builds features"| node_preparation
node_endpoint -->|"runs prediction"| node_model
node_endpoint -->|"returns score"| node_browser
node_browser -->|"renders score"| node_result

click node_form "https://github.com/ranveerd/neuro-balance/blob/main/index.html"
click node_browser "https://github.com/ranveerd/neuro-balance/blob/main/script.js"
click node_endpoint "https://github.com/ranveerd/neuro-balance/blob/main/main.py"
click node_input "https://github.com/ranveerd/neuro-balance/blob/main/main.py"
click node_preparation "https://github.com/ranveerd/neuro-balance/blob/main/main.py"
click node_model "https://github.com/ranveerd/neuro-balance/blob/main/Mental_Health_Model.pkl"
click node_result "https://github.com/ranveerd/neuro-balance/blob/main/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_form,node_browser,node_result toneBlue
class node_endpoint,node_input,node_preparation toneAmber
class node_model toneMint
class node_user toneIndigo
```

## Components

### Web interface

- [Prediction form](https://github.com/ranveerd/neuro-balance/blob/main/index.html): `index.html`
- [Form handling](https://github.com/ranveerd/neuro-balance/blob/main/script.js): `script.js`
- [Score display](https://github.com/ranveerd/neuro-balance/blob/main/script.js): `script.js`

### Prediction API

- [Predict endpoint](https://github.com/ranveerd/neuro-balance/blob/main/main.py): `main.py`
- [Input validation](https://github.com/ranveerd/neuro-balance/blob/main/main.py): `main.py`
- [Feature preparation](https://github.com/ranveerd/neuro-balance/blob/main/main.py): `main.py`

### Scoring model

- [Trained model](https://github.com/ranveerd/neuro-balance/blob/main/Mental_Health_Model.pkl): `Mental_Health_Model.pkl`

### Other components

- **Student**

## Connections

- Student → Prediction form: enters details
- Prediction form → Form handling: handles submit
- Form handling → Predict endpoint: POSTs prediction
- Predict endpoint → Input validation: validates
- Predict endpoint → Feature preparation: builds features
- Predict endpoint → Trained model: runs prediction
- Predict endpoint → Form handling: returns score
- Form handling → Score display: renders score
