A Full-Stack AI Public Health Decision Support System
π Docs Β· π Quick Start Β· ποΈ Architecture Β· π€ ML Models Β· π API Reference
FAST (Forecasting Aggregate-level Self-harm Trends) is a production-grade, full-stack web application that uses machine learning to forecast national self-harm trends from social media mental health signals (Fear, Anger, Sadness).
β οΈ Research Use Only β Predicts aggregate national trends. NOT for individual clinical risk assessment.
| Feature | Description |
|---|---|
| π€ AutoML Engine | Trains & compares 5 models: XGBoost, Random Forest, SVR, Bayesian Ridge, ARIMA |
| π JWT Authentication | Secure login/register with 24-hour access tokens |
| π Interactive Charts | Plotly.js visualizations β forecasts, signals, feature importance |
| π― Policy Simulator | What-If analysis by adjusting Fear/Anger/Sadness signals |
| π Explainable AI | Feature importance to understand prediction drivers |
| π Report Generator | Export full markdown analysis reports |
| π REST API | Full FastAPI backend with Swagger UI at /docs |
| πΎ Persistent Storage | SQLite database for users, datasets, and models |
| Layer | Technology |
|---|---|
| Frontend | React 18, Vite, React Router v6, Plotly.js, Axios |
| Backend | FastAPI, Uvicorn, SQLAlchemy, Pydantic v2 |
| Authentication | JWT (python-jose), bcrypt (passlib) |
| Machine Learning | Scikit-learn, XGBoost, Statsmodels, SHAP |
| Data | Pandas, NumPy, GeoPandas |
| Database | SQLite (SQLAlchemy ORM) |
| Deployment | Render.com, Railway (config included) |
- Python 3.11+
- Node.js 18+
git clone https://github.com/6673csm/FAST_Dashboard.git
cd FAST_Dashboardcd backend
pip install -r requirements.txt
python -m uvicorn main:app --reload --port 8000- API running at: http://localhost:8000
- Swagger docs at: http://localhost:8000/docs
cd frontend
npm install
npm run dev- App running at: http://localhost:5173
pip install -r requirements.txt
streamlit run app.py- Streamlit app at: http://localhost:8501
FAST_Dashboard/
β
βββ backend/ β FastAPI REST API
β βββ main.py β App entry, CORS, routers
β βββ database.py β SQLite + SQLAlchemy ORM
β βββ auth.py β JWT authentication
β βββ schemas.py β Pydantic request/response models
β βββ routers/
β βββ auth.py β POST /api/auth/register, /login
β βββ data.py β POST /api/data/upload, GET /list
β βββ models.py β POST /api/models/train
β βββ forecast.py β POST /api/forecast/run
β βββ simulator.py β POST /api/simulator/run
β βββ reports.py β GET /api/reports/generate/{id}
β
βββ frontend/ β React + Vite SPA
β βββ src/
β βββ pages/ β 10 page components
β βββ components/ β Sidebar, MetricCard, Spinner
β βββ context/ β AuthContext (JWT state)
β βββ api/client.js β Axios with JWT interceptor
β
βββ modules/ β Original Streamlit ML modules
βββ pages/ β Original Streamlit pages
βββ app.py β Original Streamlit entry
βββ render.yaml β Render.com deployment config
βββ Procfile β Railway/Heroku deployment
βββ .gitignore
| Method | Endpoint | Auth | Description |
|---|---|---|---|
POST |
/api/auth/register |
β | Create new user account |
POST |
/api/auth/login |
β | Get JWT access token |
GET |
/api/auth/me |
β | Get current user |
POST |
/api/data/upload |
β | Upload & auto-clean CSV |
GET |
/api/data/list |
β | List user datasets |
GET |
/api/data/{id}/summary |
β | Dataset stats + preview |
POST |
/api/models/train |
β | Train 5 AutoML models |
GET |
/api/models/list/{id} |
β | Model leaderboard |
GET |
/api/models/feature-importance/... |
β | Feature importance |
POST |
/api/forecast/run |
β | Generate future forecast |
POST |
/api/simulator/run |
β | What-If policy scenario |
GET |
/api/reports/generate/{id} |
β | Export analysis report |
π Full interactive docs at http://localhost:8000/docs (Swagger UI)
| Model | Type | Best For |
|---|---|---|
| XGBoost | Gradient Boosting | High accuracy, handles non-linearity |
| Random Forest | Ensemble | Robust, handles overfitting |
| SVR | Support Vector | Small datasets, kernel tricks |
| Bayesian Ridge | Linear | Uncertainty quantification |
| ARIMA | Time Series | Pure time-series baseline |
Automatically creates:
- Lag features: 1, 7, 14, 30-day lags for each signal
- Rolling stats: 7-day and 30-day moving averages & std deviations
- Evaluation metrics: MAE, RMSE, RΒ², MAPE
| Model | MAE | RMSE | RΒ² | MAPE |
|---|---|---|---|---|
| XGBoost | 2.14 | 2.67 | 0.94 | 5.23% |
| Random Forest | 2.38 | 2.91 | 0.92 | 6.12% |
| Bayesian Ridge | 2.67 | 3.15 | 0.89 | 7.45% |
| SVR | 2.89 | 3.40 | 0.87 | 8.21% |
| ARIMA | 3.12 | 3.65 | 0.84 | 9.34% |
date,me-fea,me-ang,me-sad,gh-death,gh-injure
2023-01-01,0.45,0.32,0.56,12.3,145.2
2023-01-02,0.48,0.35,0.58,13.1,148.5| Column | Description | Range |
|---|---|---|
date |
Date of observation | YYYY-MM-DD |
me-fea |
Fear signal (social media) | 0.0 β 1.0 |
me-ang |
Anger signal (social media) | 0.0 β 1.0 |
me-sad |
Sadness signal (social media) | 0.0 β 1.0 |
gh-death |
Self-harm death rate (per 100k) | β₯ 0 |
gh-injure |
Self-harm injury rate (per 100k) | β₯ 0 |
- Push to GitHub (already done!)
- Go to render.com β New Blueprint
- Connect your
6673csm/FAST_Dashboardrepository - Render reads
render.yamlβ auto-deploys both API and frontend
| β Intended Use | β Not For |
|---|---|
| National trend forecasting | Individual risk assessment |
| Public health policy planning | Clinical diagnosis |
| Intervention impact testing | Targeting individuals |
| Academic research | Medical advice |
MIT License β Free for educational and research use.
Sujay Β· B.Tech CSE 2026 Β· India