Worked example · Python, Flask and SQLite
Student Performance Prediction System source code
A web system for a university Department of Computer Science that predicts student academic performance bands from records using a decision tree classifier, with role-based access for lecturers, students, and administrators.
A real system made by the same builder you would use. Yours is built for your own topic and answers, so its screens and tables will differ. This example is not a source-code download.
The problem it solves
Lecturers need a reliable way to identify students at risk of failing or underperforming early, using stored marks and attendance, while students need private feedback on their predicted outcome. Manual review of records is slow and inconsistent.
Project topic: Student Academic Performance Prediction System Using Machine Learning
Who uses it
admin
Manages user accounts and course lists, and triggers model retraining.
- Add or remove users
- Manage courses
- Trigger model retraining
- View all records
lecturer
Records marks and views predictions for courses they teach.
- Add or upload records
- View predictions for assigned courses
- Export CSV and print report
student
Views their own predicted grade band and advice.
- View own prediction and explanation
What it does
Login and role access
Standard login with hashed passwords and role-based redirects.
Student record management
Form to add one record and CSV upload with line-numbered error reporting.
Prediction list and student detail
Filtered list sorted with at-risk students first, with drill-down to confidence and top factors.
Model training and metrics
Trains decision tree on held-out split, shows accuracy, precision and recall, and retrains on demand.
CSV export and printable report
Download filtered predictions as CSV and view a printer-friendly class report.
User and course administration
Manage accounts and course lists.
Screenshots
Screenshots of the running system, taken by our checks. The records are sample data and are labelled so on each page.






Database tables
- usersLogin accounts and role assignments.id, username, password_hash, full_name, role, created_at
- studentsStudent personal details.id, matric_no, name, level, user_id
- coursesCourse catalogue.id, code, title, unit, lecturer_id
- enrolmentsOne row per student per course per semester.id, student_id, course_id, semester, attendance, assignment_avg, test_score, exam_score, final_grade_band
- predictionsPrecomputed predictions and explanations for display.id, enrolment_id, predicted_band, confidence, top_factors, created_at
- model_metricsLatest evaluation metrics for display.id, accuracy, precision, recall, trained_at
Technology
- Python. Required by the kit and suitable for the machine learning code.
- Flask. Lightweight and easy to explain, with one blueprint per feature area.
- SQLite through sqlite3. No server to set up and it works fully offline.
- Plain Python decision tree in app/model.py. Keeps the project self-contained and offline, and the tree rules can be read out at defence.
- Jinja templates and Bootstrap locally. Responsive pages that work on a projector and a phone, with all files held in app/static/vendor.
- Werkzeug security and Flask-WTF CSRF. Kit defaults for security, used on every form.
How to run it: running a Python project on Windows. Not sure which language to pick? Python or PHP.
How it was tested
31 of 31 tests passed, 24 of them automated. The system was also installed from scratch and every screen was opened as the right kind of user before it was accepted.
What it does not do
- The sample data is small and fictional, so the reported accuracy, precision and recall describe the sample only and are not a claim about real students.
- The decision tree uses fixed hyperparameters, a fixed maximum depth of four and a fixed random split, so results are repeatable but not tuned.
- Predictions are estimates and are never official grades. Every screen that shows a prediction carries a disclaimer.
- The plan says the administrator retrains on demand, so a prediction is not refreshed automatically after a single new record.
- A row cannot be edited or deleted after upload, so a mistake is corrected by reseeding or by adding the correct semester instead.
- The model trains on the final grade band already stored in the enrolments table, so the labels come from the same marks used as inputs.
- The interface is a responsive web page only. There is no mobile app.
Chapters 3 and 4 from this system
With the MonoEd FYP Generator, signed in with the same Google account, press “Use my working system” when you write Chapter 3 or 4. Its real users, 6 database tables, screenshots and 31 test results go into the chapters, laid out under your supervisor's headings. Nothing is invented: anything the system cannot show, such as a user test, is left for you to fill in.
Want a student performance prediction system for your own school or business case?
Get a system built for your topic, with a guide, defence questions and screenshots. Plan it free, then ₦13,500 only if you want it built. View pricing.
Start with this topic