Part 1: Feasibility
Background
We've been tasked with designing a Learning Management System (LMS) to manage high school student information and courses.
Core Features:
- Account creation and authentication
- Course subscription system based on grade and subject
Non-Functional Requirements:
- Secure, scalable, and maintainable infrastructure
Team
- Faceman Peck (Front-end developer)
- Hannibal Smith (Back-end developer #1)
- B.A. Baracus (Back-end developer #1)
- Murdock (Junior Full-stack developer)
Feasibility Assessment
- Timeline Expectations (if only 1-2 days):
Completing a barebones user interface with little to some functionality in 1-2 days is possible, but completing an MVP (Minimum Viable Product) in 1-2 days may be unrealistic. The plan below assumes that I could successfully twist the CEO's arm for another day, so our appetite for this project is 3 days.
- Shape the Work
(Inspired by Shape Up)
Solution to be built:
- A single page for login/signup
- A course dashboard with clickable subscription actions
- An API to retrieve and manage course enrollments
Work Sequence:
- Build and integrate authentication
- Create a single end-to-end flow for subscribing to one course
- Expand to cover all predefined courses
Mitigate risks of not meeting timeline:
- Predefine course categories and a simple UI for subscription, no dynamic course creation
- Use an established library for authentication to eliminate rabbit holes
- Solve Unknowns First: Finalize decisions on framework selection, authentication library and database schemas
Part 2: Scope Creep
Your CEO just came across Siyavula and realised that its algorithmic practice is perfect in every single way and must be added to the LMS for the project to be successful, he also muttered something about unicorns and hockey sticks. Luckily, Siyavula provides an API to integrate their practice experience into third-party applications.
Go to Part 3: Design
Part 3: Design
The back-end architecture design is detailed below.
Requirements
- Basic account management (account creation and authentication).
- Users can be assigned to a course.
- User account integration with Siyavula accounts via the API.
- Siyavula activity integration specifically practice:
Design
Stack
- Framework: Flask
- Authentication: Flask-Login
- Data Validation: Pydantic
- ORM: SQLAlchemy
- API Communication: httpx
- Dependency Management: uv
Architecture
Database Design
Tables:
-
Users
idemail: Unique, for authenticationnamesurnamepassword_hashgradecountrycurriculumsiyavula_account_id: To link to Siyavula accountrole: Either "Learner" or "Teacher".created_at: Timestamp
-
Courses
idname: 'maths', 'science', 'physics' or 'chemistry'created_at: Timestamp
-
UserCourses
id:user_idcourse_idassigned_at: Timestamp
Flask Blueprint Structure
- users: user authentication and account creation.
- courses: course assignments
- siyavula: Siyavula API integration
API Workflow
-
Account Management:
/userPOSTandGETendpoints- Flask + SQLAlchemy + Flask-Login
-
Course Management:
- List Courses for User:
/assignment(GET) - Assign Users to Courses:
/assignment(POST)
- List Courses for User:
-
Siyavula Integration:
- Activity Creation:
GET/siyavula/activity- Siyavula API
- Answer Submission:
POST/siyavula/activity/answer- Siyavula API
- Next Question:
GET/siyavula/activity/question- Siyavula API
- Retry Question:
GET/siyavula/activity/retry- Siyavula API
- Activity Creation:
Future-Proofing:
- Scalability: Use an SQL database (e.g., PostgreSQL)
- Cost-Effectiveness: Host on a minimal AWS/GCP/Fly.io instance
- Strict Pydantic models for API payloads
Example Pydantic Model:
from pydantic import BaseModel
class SiyavulaUser(BaseModel):
external_user_id: str
uuid: str
role: str
name: str
surname: str
grade: int
country: str
curriculum: str
email: str
dialling_code: Optional[str]
telephone: Optional[str]
created_at: str
updated_at: str
Part 4: Implementation
See "How do I run this?" on github.com/dvdl16/ed4all-lms
Evaluation Criteria
- ⬜ Basic requirements have been met.
- ⬜ The code is Pythonic, clean, well-considered and extensible.
- ⬜ Creativity and pragmatism.