This system predicts students' academic performance using AI and supports educators with smart insights. This version includes full object-oriented class models and implementations of six creational design patterns, backed by unit tests.
An AI-driven system designed to predict academic performance and assist educators with early intervention strategies. This project combines full object-oriented modeling, creational design patterns, repository persistence, Agile GitHub project management, and comprehensive documentation.
- Predict student performance using AI/ML models.
- Allow services to access, create, and update student data.
- Abstract persistence logic for future-proofed storage.
- Provide a RESTful API with clear documentation using Swagger.
Domain Layer: Contains entity models and core logic.Repository Layer: Abstracted data storage with in-memory implementation.Service Layer: Business logic handling prediction, CRUD operations.API Layer: FastAPI app exposing endpoints.Tests: Unit tests with Pytest.
Assignment 3: Domain modelsAssignment 4: Use casesAssignment 6: Interfaces and persistenceAssignment 10: Creational design patternsAssignment 11: Repository abstraction using Factory PatternAssignment 12: Service layer and FastAPI REST API
- Simple Factory
- Factory Method
- Abstract Factory
- Builder
- Prototype
- Singleton
StudentPerformanceAI/
β
βββ domain/ # Domain Layer
β βββ models/
β βββ student.py # Core domain model
β
βββ creational_patterns/ # Design Patterns (Assignment 4)
β βββ factory_method/
β βββ abstract_factory/
β βββ builder/
β βββ prototype/
β βββ singleton/
β
βββ repositories/ # Persistence Layer
β βββ interfaces/ # Generic & specific interfaces
β β βββ student_repository_interface.py
β βββ inmemory/ # In-memory implementations
β β βββ inmemory_student_repository.py
β βββ database/ # Placeholder for DB implementations
β
βββ factories/ # Factory for repository creation
β βββ repository_factory.py
β
βββ services/ # Service Layer (Assignment 12)
β βββ student_service.py
β
βββ api/ # FastAPI REST API (Assignment 12)
β βββ main.py
β
βββ tests/ # Unit Tests (Assignment 5+)
β βββ test_student_model.py
β βββ test_inmemory_student_repository.py
β βββ test_student_service.py
β
βββ .vscode/
β βββ settings.json # VS Code Python settings
β
βββ .env # Environment Variables (optional)
βββ run_example.py # Manual execution script
βββ requirements.txt # Python dependencies
βββ README.md # Project documentation
βββ CHANGELOG.md # Version log
βββ reflection.md # Personal reflection
---
## π Table of Contents
- [System Overview](#system-overview)
- [Setup Instructions](#setup-instructions)
- [Folder Structure](#folder-structure)
- [Assignments Breakdown](#assignments-breakdown)
- [Implemented Creational Patterns](#implemented-creational-patterns)
- [Repository Layer and Persistence](#repository-layer-and-persistence)
- [Running the Project](#running-the-project)
- [Challenges Faced](#challenges-faced)
- [Features](#features)
- [Author](#author)
---
## π System Overview
The system predicts student performance based on their academic records, stores student profiles, and generates reports. Built using Python, following SOLID principles and Agile methodology.
---
## π Setup Instructions
### 1. Clone the Repository
```bash
git clone https://github.com/your-username/StudentPerformanceAI.git
cd StudentPerformanceAIpython -m venv venv
venv\Scripts\activate # On Windows
source venv/bin/activate # On Mac/Linuxpip install pytest pytest-covSet your PYTHONPATH before running tests:
set PYTHONPATH=.To automate, create a .env file containing:
PYTHONPATH=.
| Assignment | Contribution |
|---|---|
| Assignment 3 | Defined the problem domain and objectives. |
| Assignment 4 | Identified stakeholders and functional requirements. |
| Assignment 5 | Created Use Case Diagram and actors. |
| Assignment 6 | Developed full Use Case Specifications. |
| Assignment 7 | Set up GitHub Agile Project Board with Issues and Milestones. |
| Assignment 8 | Modeled State and Activity Diagrams. |
| Assignment 9 | Created Domain Model Table and UML Class Diagram. |
| Assignment 10 | Implemented source code, applied creational design patterns, and wrote unit tests. |
| Assignment 11 | Designed Repository Persistence Layer and completed full system integration. |
| Pattern | Summary |
|---|---|
| Simple Factory | PredictionFactory creates AI models. |
| Factory Method | Exporters (PDF/CSV) for reports. |
| Abstract Factory | UIFactory generates platform-specific UI components. |
| Builder | Step-by-step construction of StudentProfile. |
| Prototype | Cloning AIModel instances. |
| Singleton | Single instance of DatabaseConnection ensured. |
- Base Repository Interface: Generic CRUD methods.
- In-Memory Repository: Quick storage for testing.
- Repository Factory: Selects between Memory or (future) Database implementation.
- Database Repository (Stub): Placeholder ready for SQL backend integration.
from factories.repository_factory import RepositoryFactory
student_repo = RepositoryFactory.get_student_repository("MEMORY")set PYTHONPATH=.
python run_example.pyset PYTHONPATH=.
pytest
β οΈ Important: Tests currently failing due to path import issues underpytest. Manual running works fine.
- ModuleNotFoundError: Python could not find
repositories/because VS Code didnβt automatically set PYTHONPATH. - pytest Import Error: Had to manually set
PYTHONPATH=.before running. - Test Failures: Despite correct manual running, pytest could not resolve imports without deep configuration.
- Environment Configuration: Required setting
.envand.vscode/settings.json.
β
Manual running (run_example.py) works perfectly.
β Full pytest automation pending due to time constraints.
- Predicts student performance with AI logic
- Generates academic performance reports
- Saves student data in an in-memory store
- Future-proof repository ready for SQL database
- Follows SOLID principles and Agile Methodology
Sisipho Mdaka
Postgraduate Diploma in ICT: Application Development
Cape Peninsula University of Technology
- Implemented full class diagram in code.
- Applied six major creational design patterns.
- Added Repository Persistence Layer.
- Integrated manual test cases.
- Detailed README.md and project documentation.
# Setup (Windows):
python -m venv venv
venv\Scripts\activate
pip install -r requirements.txt
pytest