Dropouts is a Flask-based web application that predicts student dropout risk from institutional data and presents results in an educator-friendly dashboard.
This project was built for SIH problem statement 25102.
- Overview
- Key Features
- Tech Stack
- Project Structure
- How It Works
- Data Requirements
- Local Setup
- Run with Docker
- Configuration
- Application Routes
- Model Artifacts and Scripts
- Known Limitations
- Dataset Source
Many institutions keep attendance, fee, and performance data in separate files. This application merges those records using a common student identifier, runs a trained machine learning model, and classifies students as low/medium/high dropout risk.
The goal is to help teachers and mentors intervene earlier with students who need support.
- Upload 3 input files (Attendance, Marks, Fees) in
.csv,.xls, or.xlsxformat. - Automatically merge data using
Roll_No. - Predict dropout probability with a pre-trained model (
dropout_prediction.pkl). - Show risk level categories:
- Low:
<= 40% - Medium:
> 40% and < 70% - High:
>= 70%
- Low:
- Display model confidence per student.
- Provide student-level details with Chart.js visualizations.
- User registration/login with password hashing.
- PostgreSQL-backed user storage (SQLAlchemy ORM).
- Dockerized deployment with
docker-compose.
Backend
- Python 3.11
- Flask
- SQLAlchemy / Flask-SQLAlchemy
- Pandas, NumPy
- scikit-learn, XGBoost
- psycopg2-binary
Frontend
- Jinja2 templates
- HTML/CSS/JavaScript
- Bootstrap (login/register pages)
- Chart.js (student charts)
Database
- PostgreSQL 17 (containerized in compose setup)
Dropouts/
├── README.md
└── SIH_Project/
├── app.py
├── ml_model.py
├── update_metrics.py
├── requirements.txt
├── Dockerfile
├── docker-compose.yml
├── .env
├── dropout_prediction.pkl
├── xgboost_model.json
├── Datasets/
│ ├── Dataset1.csv
│ └── student_records_weighted.csv
├── templates/
│ ├── index.html
│ ├── student_details.html
│ ├── login.html
│ └── register.html
└── migrations/
- User uploads attendance, marks, and fees files from the main page.
- Backend reads each file and merges on
Roll_No. - Required features are extracted and passed to the loaded model.
- Model predicts classes/probabilities (
predict+predict_proba). - App maps dropout probability to risk tiers and renders a result table.
- Clicking a student row opens detailed visual performance charts.
The merged dataset must include:
Roll_NoName- All model input fields listed below:
Marital statusApplication modeDaytime/evening attendancePrevious qualificationMother's occupationFather's occupationDisplacedDebtorTuition fees up to dateScholarship holderAge at enrollmentInternationalCurricular units 1st sem (evaluations)Curricular units 1st sem (approved)Curricular units 1st sem (grade)Curricular units 2nd sem (evaluations)Curricular units 2nd sem (approved)Curricular units 2nd sem (grade)Attendance
If required columns are missing, the app returns a validation error.
From /home/runner/work/Dropouts/Dropouts/SIH_Project:
-
Create and activate a virtual environment:
python -m venv .venv source .venv/bin/activate # Linux/macOS
-
Install dependencies:
pip install -r requirements.txt
-
Ensure PostgreSQL is running and create database
user_db. -
Configure environment variables (see Configuration).
-
Start the app:
python app.py
-
Open:
http://localhost:5000
From /home/runner/work/Dropouts/Dropouts/SIH_Project:
docker compose up --buildThis starts:
webservice onhttp://localhost:5000dbservice (PostgreSQL) on port5432
Stop services:
docker compose downEnvironment variables used by the app:
| Variable | Purpose | Example |
|---|---|---|
DB_USER |
PostgreSQL username | sih_demo |
DB_PASSWORD |
PostgreSQL password | SIH_DEMO |
DB_HOST |
PostgreSQL host | localhost or db |
DB_NAME |
PostgreSQL database name | user_db |
DB_PORT |
PostgreSQL port | 5432 |
Notes:
.envis loaded viapython-dotenv.- For Docker Compose,
DB_HOST=db. - For local host-based DB,
DB_HOST=localhost.
| Route | Method(s) | Description |
|---|---|---|
/ |
GET, POST | Main page; upload files and view predictions |
/login |
GET, POST | User login |
/register |
GET, POST | User registration |
/student_details/<roll_no> |
GET | Student details + charts |
/model_info |
GET | Returns model metric JSON |
/send_mentor_alert |
POST | Sends email alert for high-risk students |
dropout_prediction.pkl: Serialized trained model used in app inference.xgboost_model.json: Model artifact from training workflow.ml_model.py: SHAP-based interpretability analysis script.update_metrics.py: Utility to compute model metrics and updateMODEL_METRICSinapp.py.prediction.ipynb: Notebook for experimentation/training workflow.
- Email alert route uses placeholder sender credentials and must be configured before production use.
students_datais an in-memory list and is not populated from/prediction results; as a result, mentor alerts and directstudent_details/<roll_no>lookups may return no student data unless the app explicitly assigns uploaded prediction rows tostudents_dataduring request handling.- Input schema is strict; uploaded files must match expected field names.
- Production security hardening is still needed (for example: HTTPS/TLS termination, secure cookie/session settings, CSRF protection on form routes, rotation of secrets outside
.env, and running behind a production WSGI server instead of Flask debug mode).
- Kaggle:
https://www.kaggle.com/datasets/thedevastator/higher-education-predictors-of-student-retention
If you use this project in institutional pilots or SIH demonstrations, consider sharing improvements for data quality checks, model explainability, and intervention workflows.