How princeyadaav/mental-health-score-predictor works
This is a student mental-health score prediction web application. A student enters lifestyle and social-media data in the browser; the JavaScript client submits it to the FastAPI prediction endpoint, which validates and shapes the request, invokes the serialized RandomForest model, combines its score with rule-based risk analysis, estimates confidence, and returns a result for display and sharing. The repository also documents the offline dataset-training workflow, while sampled source evidence is strongest for the serving path.
Components 17
Web Client
- Prediction Form
index.html - Client Controller
script.js - Result View
script.js - Interface Styles
style.css
Prediction API
- Prediction Endpoint
main.py - Input Validation
main.py - Feature Row Builder
main.py - Risk Scoring
main.py - Response Contract
main.py
ML Runtime
- Serialized Model
Mental_Health_Model.pkl - Forest Predictor
main.py - Confidence Estimator
main.py
Model Training
- Training Workflow
Machine_learning_project.ipynb - Student Dataset
Student Social Media And Mental Health Impact.csv
Other components
- Student User
- Browser Storage
- Share Service
Connections 18
- Student User → Prediction Form: enters data
- Prediction Form → Client Controller: collects fields
- Client Controller → Prediction Endpoint: POSTs prediction
- Prediction Endpoint → Input Validation: validates input
- Prediction Endpoint → Feature Row Builder: builds features
- Feature Row Builder → Forest Predictor: supplies row
- Forest Predictor → Serialized Model: reads model
- Forest Predictor → Prediction Endpoint: returns score
- Prediction Endpoint → Risk Scoring: scores risk
- Prediction Endpoint → Confidence Estimator: estimates confidence
- Confidence Estimator → Serialized Model: reads forest
- Prediction Endpoint → Response Contract: formats response
- Response Contract → Client Controller: returns result
- Client Controller → Result View: renders result
- Client Controller → Browser Storage: stores theme
- Result View → Share Service: shares result
- Training Workflow → Student Dataset: reads dataset
- Training Workflow → Serialized Model: serializes model