Data Model
Table of contents
Database Schema
UML Use Case Diagrams
Simplified UML Use Case Diagram showing the main system interactions.
Complete UML Use Case Diagram with detailed system architecture and relationships.
…
User
class User(db.Model, UserMixin):
id = db.Column(db.Integer, primary_key=True)
email = db.Column(db.String(150), unique=True)
password = db.Column(db.String(150))
first_name = db.Column(db.String(150))
role = db.Column(db.String(50)) # 'teacher' or 'student'
learning_points = db.Column(db.Integer, default=0)
selected_avatar = db.Column(db.String(100), default=None)
unlocked_avatars = db.Column(db.Text, default='')
Relationships:
classrooms_created: One-to-many with Classroom (teacher’s classrooms)joined_classrooms: Many-to-many with Classroom (student’s joined classrooms)quiz_attempts: One-to-many with StudentQuizAttempt
Classroom
class Classroom(db.Model):
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(100), nullable=False)
teacher_id = db.Column(db.Integer, db.ForeignKey('user.id'), nullable=False)
join_code = db.Column(db.String(8), unique=True, nullable=False)
Relationships:
teacher: Many-to-one with Userstudents: Many-to-many with Userquizzes: Many-to-many with Quizquiz_attempts: One-to-many with StudentQuizAttempt
Quiz
class Quiz(db.Model):
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(150), nullable=False)
teacher_id = db.Column(db.Integer, db.ForeignKey('user.id'), nullable=False)
is_published = db.Column(db.Boolean, default=False, nullable=False)
Relationships:
teacher: Many-to-one with Userquestions: One-to-many with Questionclassrooms_assigned_to: Many-to-many with Classroom
Question
class Question(db.Model):
id = db.Column(db.Integer, primary_key=True)
quiz_id = db.Column(db.Integer, db.ForeignKey('quiz.id'), nullable=False)
text = db.Column(db.Text, nullable=False)
learning_points = db.Column(db.Integer, nullable=False, default=1)
Relationships:
quiz: Many-to-one with Quizanswers: One-to-many with Answer
Answer
class Answer(db.Model):
id = db.Column(db.Integer, primary_key=True)
question_id = db.Column(db.Integer, db.ForeignKey('question.id'), nullable=False)
text = db.Column(db.String(255), nullable=False)
is_correct = db.Column(db.Boolean, default=False, nullable=False)
Relationships:
question: Many-to-one with Question
StudentQuizAttempt
class StudentQuizAttempt(db.Model):
id = db.Column(db.Integer, primary_key=True)
student_id = db.Column(db.Integer, db.ForeignKey('user.id'), nullable=False)
quiz_id = db.Column(db.Integer, db.ForeignKey('quiz.id'), nullable=False)
classroom_id = db.Column(db.Integer, db.ForeignKey('classroom.id'), nullable=False)
score = db.Column(db.Integer, default=0)
Relationships:
student: Many-to-one with Userquiz: Many-to-one with Quizclassroom: Many-to-one with Classroom
Association Tables
classroom_members
Many-to-many relationship between students and classrooms:
classroom_members = db.Table('classroom_members',
db.Column('user_id', db.Integer, db.ForeignKey('user.id'), primary_key=True),
db.Column('classroom_id', db.Integer, db.ForeignKey('classroom.id'), primary_key=True)
)
classroom_quizzes
Many-to-many relationship between classrooms and quizzes:
classroom_quizzes = db.Table('classroom_quizzes',
db.Column('classroom_id', db.Integer, db.ForeignKey('classroom.id'), primary_key=True),
db.Column('quiz_id', db.Integer, db.ForeignKey('quiz.id'), primary_key=True)
)
…
Quiz Flow
- Teachers create quizzes with multiple-choice questions in their classrooms
- Each question can have multiple correct answers and earns learning points (LP)
- Students join classrooms using unique join codes
- Students take quizzes and earn LP based on correct answers
- LP can be used to purchase items from the shop
- Teachers can review quiz results and student performance
Student Progress
- Students accumulate LP by completing quizzes correctly
- LP can be spent in the shop for cosmetic items
- Students can track their progress in each classroom’s leaderboard
- Quiz attempts are recorded to prevent retaking the same quiz
Authentication & User Management
User login interface with email and password authentication.
Registration form for new users to create accounts.
Confirmation screen after successful user authentication.
Student profile displaying learning points, level, and personal statistics.
Classroom Management
Overview of all classrooms a student has joined.
Interface for students to join classrooms using unique codes.
Individual classroom view showing assigned quizzes and class information.
Quiz System
List of quizzes available for students to take in their classrooms.
Quiz interface where students answer questions and earn learning points.
Gamification Features
Shop system where students can purchase cosmetic skins using earned points.
System Architecture
Overall dashboard wireframe showing the complete application structure.