លំហសិក្សាកម្ពុជា លំហសិក្សាកម្ពុជា V1.0
ចូល ចុះឈ្មោះ

'Study Sprout' Gamified Learning Management System

មូលសង្ខេប / Abstract

This project presents a gamified Learning Management System (LMS) designed using the Flask Application Factory Pattern and standard Blueprint architecture to isolate system responsibilities across presentation, business logic and data access layers. The platform incorporates gamification features including experience points (XP), character leveling, daily login streaks, course boss combat systems and Pomodoro focus timers to boost student engagement. Security is established using standard Role-Based Access Control (RBAC) via route decorators, secure password hashing, Bcrypt/Argon2 and encrypted, flag-protected session cookies to track student performance. The database architecture links core user profiles, enrollments, course lessons, focus logs and metrics using a relational schema to track academic progress and platform interaction.

ពាក្យគន្លឹះ






Development Of an Interactive Learning Management System with Role Based User Control Using Object-Oriented Programming and Flask Application 3.0.3



for



Course: Object-Oriented Programming 

Class CSM1


Authors


Bun Sahanou (ID: ST-00057), Thy Lyyong (ID: ST-00017 ), Ty Reaksa (ID: ST-00118), 

Vichet Thody (ID: ST-00064 )



Lecturer


Sek Socheat



Academic Year


2026 - 2027




  1. Introduction


1.1. Problem Statement

Many university student management systems lack interactive and user-friendly UI/UX designs, particularly within their dashboards. This can negatively affect productivity, user experience, engagement, motivation, and overall interactivity. With traditional management systems, it may also have unclear role-based separation, resulting in dashboards that provide irrelevant or insufficient functions for different users. For example, lecturers may not have direct access to information about a student's progress, while students may be presented with unnecessary features that do not support their learning needs. Additionally, administrators may have limited visibility to important statistics, such as the number of active lecturers, as some older systems lack tools for generating and monitoring data. These limitations can lead to insufficient information for administrators to evaluate university performance and identify areas for further improvement.


1.2. Objectives

  • Daily Active Usage: Increase daily student portal engagement around 40 percent through automated streak tracking, daily rewards, and login incentives that encourage students to access the platform consistently.

  • Procrastination Reduction: Elevate student productivity around 25 percent and encourage earlier task completion by transforming academic submissions into interactive challenges that reward students with XP, progress points, and leaderboard recognition.

  • Focus Volume: Achieve an average of at least 2 hours of study time per student per week through a built-in, server-validated Pomodoro timer that records study sessions and includes pause detection and session completion verification.

  • Course Completion Rate: Increase the overall completion rate of assignments, quizzes, and learning modules to over 80 percent across registered courses by rewarding milestones with profile level progression, cosmetic unlocks, XP, and leaderboard recognition.


1.3. Scope and Significance 

In scope 

  • Web Application: Developed using Flask 3.0.3 as a web-based student management platform.

  • Role-Based Access Control (RBAC): Provides separate access and functionalities for students, teachers, and administrators.

  • Student Dashboard: Provides students with an interactive dashboard to view assignments, quizzes, progress, achievements, and study activities.

  • Gamification: Implements XP, levels, achievements, rewards, and leaderboards to make academic activities more engaging.

  • Pomodoro Focus Tracker: Allows students to record focused study sessions and monitor their study habits.

  • Assignment and Quiz Management: Enables teachers to create, manage, and monitor assignments and quizzes.

  • Progress Monitoring: Allows teachers and students to track academic progress and task completion.

  • Analytics Dashboard: Provides administrators with statistics and insights regarding users, courses, and system activity.

  • Daily Engagement: Includes streak tracking, login incentives, and milestone rewards to encourage consistent platform usage.

Out of scope 

  • iOS or Android mobile applications

  • Video streaming or hosting services

  • Microtransactions or real-money purchases

  • Multiplayer real-time gameplay or character movement

  • Custom chat or messaging engines

  • Advanced AI-based automated teaching systems

Significance

  • Students: Encourages consistent study habits and task completion through XP, rewards, achievements, streaks, and leaderboard competition.

  • Teachers: Provides clearer visibility into student performance, assignment completion, and academic progress.

  • Administrators: Provides centralized statistics and analytics to support monitoring and system improvement.

  • Educational Institutions: Offers a more interactive and engaging alternative to traditional student management systems.

  • Overall Learning Experience: Combines academic management with gamification and productivity tools to create a more motivating and user-friendly learning environment.


  1. Users & Features


2.1. Target Users and System Roles


This platform defines a strict separation across three distinct user roles to maintain data integrity, enforce secure access controls and preserve core system functionality. Each role interacts with the system through specialized interfaces and permission sets within the Role-based access control (RBAC) design. Targeted users includes:

       Student user (Primary):

  • Core Function: Acts as the primary end-user interacting with both educational modules and gamification mechanics.


  • Functional Capabilities:

    • Academic Engagement: Enrolls in assigned courses, views learning materials, downloads files and submits coursework prior to assigned deadlines.


  • Gamification Progress: Collect Experience Points (XP) upon task completion, increase character levels, maintain daily login streaks and unlock milestone-based for profile rewards.


  • Productivity Management: Allows students to record study duration using Pomodoro technique and earn rewards based on their verified study time.


  • Collaborative Raids: Offers interactive challenges such as contributing to course wide boss raids by executing homework submissions, where timely task completions directly map to damage-dealing algorithms applied against active boss entities.


Lecturers User:

  • Core Function: Oversees course administration, curriculum delivery and the contextual balancing of course-level gamification mechanics. 


  • Functional Capabilities: 

    • Course & Content Management: Publishes course structures, uploads study materials, creates assignment entries and defines submission criteria. 


  • Gamification Controls: Establishes XP reward values per assignment, sets submission deadline scaling vectors, and configures Boss Raid parameters—such as setting maximum Boss Health ($HP$) proportional to class enrollment size. 

  • Performance Analytics: Accesses real-time analytical dashboards detailing individual student metrics, class-wide assignment completion rates, average Pomodoro study volumes and active streak counts. 


Administrator:

  • Core Function: Ensures system stability, user provisioning, global platform security, and system-wide economy configuration. 


  • Function Capabilities:

    • User Provisioning & RBAC Management: Manages account lifecycle operations (creation, activation, suspension), assigns role scopes and updates credential policies. 


  • System Configuration & Maintenance: Allows administrators to manage system settings, database updates, activity logs, system performance and security controls such as rate limiting and password protection.


  • Global Balance Tuning: Adjusts macro-level gamification parameters, including global XP leveling formulas, maximum allowable daily XP caps, streak rules, and global multiplier tables to maintain a fair distribution of rewards. 


2.2. User Stories & Acceptance Criteria

User Story 1: Submitting Assignments for XP

  • As a Student, I want to submit my completed assignments through the portal, so that I can earn XP and level up my profile.

  • Acceptance Criteria:

    • The system accepts valid file uploads before the deadline.

    • Upon successful submission, the system automatically adds the assignment's base XP to the student's total profile balance.

User Story 2: Running a Pomodoro Study Session

  • As a Student, I want to use a built-in focus timer, so that I can track my study hours and earn extra rewards.

  • Acceptance Criteria:

    • The user can start a preset 25-minute timer.

    • When the timer finishes, the system logs the focus session as complete and awards a fixed amount of XP.

User Story 3: Attacking Course Bosses

  • As a Student, I want to deal damage to the active class Boss whenever I finish learning tasks, so that my class can defeat the Boss together.

  • Acceptance Criteria:

    • Completing any assignment or focus session deducts Health Points (HP) from the active Boss.

    • The Boss health bar updates immediately on the class dashboard.

User Story 4: Creating Bosses (Instructor)

  • As an Instructor, I want to set up a class Boss with custom Health Points, so that I can create interactive goals for my course.

  • Acceptance Criteria:

    • The instructor inputs a Boss name and total HP in the course settings.

    • The system displays the new Boss on the student dashboard once saved.


2.3. Feature Metrics 

  • Must Have: User Auth & RBAC, Course/Assignment Modules, Core Gamification Engine (XP, Leveling), Boss Raid combat system, Streak counter logic.


  • Should Have: Integrated Pomodoro timer API, Cosmetic item inventory, Class-wide XP leaderboards, System notifications.


  • Could Have: Dynamic ambient soundscapes for timers, Customizable student virtual pets, Achievements/Badges system.


  • Won't Have (v1): Direct user-to-user private messaging, Mobile push notifications, Third-party tool integrations (LTI standard).



  1. OOP Design


3.1. Class Responsibilities & Class Diagrams

The system follows an object-oriented design approach in which each major class has a clearly defined responsibility. The classes are organized around the main functions of the platform, including user management, course and assignment management, gamification, productivity tracking, and course-wide Boss Raids. This design improves maintainability by separating responsibilities and reducing unnecessary dependencies between components.  


3.2. OOP Design Patterns Applied 


  • Strategy Pattern (Dynamic XP Calculation): Encapsulates different XP reward algorithms into interchangeable strategies. This allows the system to compute base XP, streak bonus XP, or event-based multipliers dynamically at runtime without altering the core submission logic.

  • Observer Pattern (Event-Driven State Updates): Implements a publish-subscribe mechanism triggered by core student actions. When an assignment is submitted, subject events automatically notify attached observer services to deal boss damage, award profile XP, and update daily streaks.

  • Factory Pattern (Dynamic Boss Generation): Provides an interface for instantiating different Boss entities based on course configuration parameters (e.g., standard assignment boss vs. high-HP final exam raid boss) while keeping creation logic decoupled from controllers.


3.3. Layered Architecture Responsibilities 

  • Presentation Layer (Flask Blueprints + Jinja2/JS): Renders dynamic HTML templates using Jinja2 engine, handles HTTP routes via modular Flask Blueprints, and updates client-side components asynchronously using AJAX (such as real-time Pomodoro visual countdowns, interactive Boss health bar reductions, and immediate notification toasts).


  • Business/Service Layer (Python Logic): Enforces core domain rules, calculates progressive level/XP threshold formulas, executes combat algorithms for Boss damage calculations based on submission timeliness, processes daily streak decay logic, and performs security authorization checks before execution.


  • Data Access Layer (SQLAlchemy ORM): Manages relational database persistence, defines Object-Relational Mapping (ORM) data models, handles safe database transactions (commits and rollbacks), executes optimized queries, and encapsulates raw SQL operations behind pythonic repository interfaces.




  1. ARCHITECTURE + DB 


4.1 Flask Application Structure & Directory Hierarchy 


For this project, the system uses the Flask Application Factory Pattern combined with a modular Blueprint architecture. Instead of putting all backend logic into a single monolithic script, the system is separated into logical packages to isolate responsibilities, support scalable development, and ensure maintainable code. 


studylms/

├── app/

│   ├── __init__.py           # Application Factory initialization & Blueprint registration

│   ├── config.py             # App configurations (DB URIs, Secret Keys, XP constants)

│   ├── models/               # SQLAlchemy ORM models (Data Access Layer)

│   │   ├── user.py           # User & Auth models

│   │   ├── course.py         # Modules & Assignment schemas

│   │   ├── gamification.py   # Boss, XP, and Streak models

│   │   └── pomodoro.py       # Focus timer logs

│   ├── services/             # Core Business Logic Layer

│   │   ├── xp_service.py    # XP & Leveling algorithms

│   │   ├── boss_service.py   # Combat mechanics & dynamic HP calculation

│   │   └── streak_service.py # Daily login validation logic

│   ├── routes/               # Presentation Layer (Flask Blueprints)

│   │   ├── auth.py           # Login, Register, Logout endpoints

│   │   ├── student.py        # Student dashboard, submission routes

│   │   ├── instructor.py     # Course administration & Boss creation

│   │   └── api.py            # AJAX endpoints for timers and HP updates

│   ├── static/               # CSS styles, JavaScript assets, UI sounds

│   └── templates/            # HTML views (Jinja2 templates)

├── tests/                    # PyTest integration and unit tests

└── run.py                    # Entry point script to launch WSGI server


4.2. Data Dictionary & Database Schemas 


Table 4.2.1. Data dictionary for User Entity 

Column Name

Data Type

Constraints

Description

id

integer

Primary key, auto increment

Unique user ID

email

string(120)

Unique, not null

User login email

password_hash

string(256)

Not null

Hashed password string

role

string(20)

Not null

Student, instructor, admin

level

integer

Default:1

Current Character level

Current xp

integer

Default: 0

Current accumulated xp

streak_count

integer

Default: 0

Active consecutive login days

last_active

date

Nullable

Date of last recorded activity


Table 4.2.2. Data dictionary for Course Boss Entity 

Column Name

Data Type

Constraints

Description

id

integer

Primary key, auto increment

Unique user ID

Course id

integer

Foreign key (course.id)

User login email

name

string(80)

Not null

Hashed password string

max_hp

integer

Not null

Student, instructor, admin

current_hp

integer

Not null

Remaining Health Points 

is_defeated

boolean

Default: False

Boss defeat state flag 


Table 4.2.3. Data dictionary for the Focus Session/Pomodoro Entity

Column Name

Data Type

Constraints

Description

id

integer

Primary key, auto increment

Session Unique ID 

user_id

integer

Foreign key (user.id)

Student executing timer 

duration

integer

Not null

Duration in minutes 

completed

boolean

Default: False

Successful completion state 

created_at

datetime

Not Null 

Timestamp session initiated 



4.3. Security & Role-Based Access Control (RBAC) 

To guarantee system integrity and protect sensitive student performance data, the application enforces a defense-in-depth security model across authentication, session management, and route access control.

  • Role-Based Access Control (RBAC): Authorization is managed dynamically using custom Flask route decorators (e.g., @roles_required('Instructor')). These decorators intercept incoming requests before controller execution, validating user permissions against session claims and aborting with HTTP 403 status codes if privileges are insufficient.

  • Password Hashing & Storage: Student and instructor credentials are never stored in plain text. Passwords are securely hashed using Werkzeug's implementation of standard Bcrypt/Argon2 algorithms with unique salt generation, ensuring resilience against dictionary attacks and pre-computed rainbow table compromises.

  • Session Security & Token Management: User authentication states are maintained via encrypted session cookies configured with strict security flags (HttpOnly to block client-side JavaScript inspection and prevent XSS token theft, SameSite=Lax/Strict to mitigate Cross-Site Request Forgery, and Secure to enforce transmission strictly over HTTPS).


Figure 4.3. Entity Relationship Diagram (ERD)



  1. Method and Timeline


5.1. Development Methodology & Sprint Roadmap


Figure 5.1. Timeline summarization of Sprint Roadmap


[Sprint 1: Weeks 1-2] Database & Authentication Core 

  • Define SQLAlchemy models 

  • Implement RBAC login/registration authentication routes 

  • Set up Flask Application Factory 


[Sprint 2: Weeks 3-4] Core LMS & Gamification Engine 

  • Build assignment submission workflows

  • Implement XP algorithm & leveling service logic 

  • Build Pomodoro tracking API endpoints 


[Sprint 3: Weeks 5-6] Boss Raid Combat, UI & Testing 

  • Create Boss HP sync logic & battle event logs 

  • Build Jinja templates & JS dashboard rendering 

  • System integration, unit testing, final documentation 


5.2. Team Roles & Responsibility Matrix 


Table 5.2. Team Roles Distribution and Responsibility

Role

Primary Responsibilities 

Deliverables 

Backend Lead

Flask architecture, REST API design, RBAC decorators 

Authentication system, Core Flask Services 

Database Architect

Schema design, migrations, ORM optimization 

Database ERD, SQLAlchemy Models, Seeder scripts 

Front-end Engineer 

Dashboard UI, AJAX dynamic calls, CSS layout 

Responsive Templates, Boss Arena UI, Timers 

QA/Tester

Test cases, edge case verification, system docs 

PyTest suite, Technical Specification doc 


5.3. Risk Assessment & Expected Outputs 


Table 5.3. Risk Assessment Matrix 

Risk Management

Risk Description

Severity

Strategy

Time Anti-Cheat Exploit

High

Validate start/stop timestamps 

Boss Health Concurrency Issues

Medium

Wrap damage execution in atomic DB transactions

Unbalanced XP Scaling

Low

Isolate gamification metrics inside an external configuration table for tuning

Expected Outputs:

  • Functional Flask web application for a complete web-based student management system featuring source codebase with complete test suite coverage.

  • Structured database with executable SQL schema migrations script for creating, updating, showcasing table and relationship between entities. 

  • Documentation describing the system architecture, database structure, components, data flow, and relationships between system modules.

  • Functional focus timer that allows students to conduct and record study sessions while monitoring their focused study time and session completion.

  • Operative integrated gamification function that supports XP accumulation, level progression, achievements, rewards, daily streaks and leaderboard rankings to encourage student engagement. 


Reference

Lecturer’s notes 



OOPllMidTermSlide.pdf
PDF ឯកសារ
ទាញយក អាន
ចែករំលែក
រក្សាទុក
ការផ្សព្វផ្សាយ
ការផ្សព្វផ្សាយ
មតិយោបល់ 0
ចូលគណនី ដើម្បីបញ្ចេញមតិ