├── .github ├── ISSUE_TEMPLATE │ ├── feature-request.md │ └── good-first-issue.md └── workflows │ ├── ci-cd.yml │ ├── ci.yml │ ├── python-app.yml │ └── python-package.yml ├── .gitignore ├── ARCHITECTURE.md ├── Activity Workflow Modeling.md ├── Assignment 14 ├── Getting Started.md ├── Reflection.md ├── contributing.md ├── issues.JPG ├── labeled_issues.md ├── license.md └── roadmap.md ├── Attendance Marking Workflow.png ├── Attendance Verification Workflow.png ├── Attendance-marking.png ├── Attendance-record.png ├── Branch Protection screenshot.md ├── Changelog.md ├── ChangelogAssigment 12.md ├── Class Diagram.md ├── Course Management Workflow.png ├── Design-Decisions.md ├── Domain model description.md ├── Getting Started.md ├── Integration Tests.md ├── Integration.md ├── Justification.md ├── Kanban Board.md ├── Notification System Workflow.png ├── Object State Modeling.md ├── PROTECTION.md ├── Product Backlog.md ├── README.md ├── Reflection Assignment 9.md ├── Reflection-Assigment7.md ├── Reflection_Assigment_8.md ├── Report Generation Workflow.png ├── SPECIFICATION.md ├── Sprint Plan.md ├── Stakeholder Analysis.md ├── Stakeholder, Functional and Non-Functional Requrements.md ├── Student Graduation Workflow.png ├── Student Registration Workflow.png ├── Swagger UI for Student Attendance.md ├── Swagger UI.JPG ├── Swagger2.JPG ├── Swagger3.JPG ├── System Requirements.md ├── Teacher Resignation Workflow.png ├── Test Case.md ├── Test Cover.md ├── USERCASE.png ├── Unit Tests Report.md ├── Unit tests.JPG ├── Use Case Diagram.md ├── Use Case Specifications.md ├── User Stories Table.md ├── api ├── __init__.py ├── __pycache__ │ ├── __init__.cpython-313.pyc │ ├── attendance_api.cpython-313.pyc │ ├── course_api.cpython-313.pyc │ └── student_api.cpython-313.pyc ├── attendance_api.py ├── course_api.py └── student_api.py ├── app.py ├── class-diagram.png ├── config.py ├── contributing.md ├── creational_patterns directory └── main.py ├── diagram-Admin.png ├── diagram-Attendance.png ├── diagram-Course.png ├── diagram-Notification.png ├── diagram-Report.png ├── diagram-Session.png ├── diagram-Student.png ├── diagram-Teacher.png ├── docs ├── openapi.json └── openapi.yaml ├── integration_tests_report.JPG ├── issues.JPG ├── kanban_explanation.md ├── labeled_issues.md ├── license.md ├── requirements.txt ├── roadmap.md ├── rule1.JPG ├── rule2.JPG ├── services ├── __init__.py ├── __pycache__ │ ├── __init__.cpython-313.pyc │ ├── attendance_service.cpython-313.pyc │ ├── course_service.cpython-313.pyc │ └── student_service.cpython-313.pyc ├── attendance_service.py ├── course_service.py └── student_service.py ├── src directory └── main.py ├── static └── css │ └── style.css ├── template_analysis.md ├── templates ├── admin_dashboard.html ├── edit_user.html ├── generate_report.html ├── index.html ├── layout.html ├── login.html ├── manage_attendance.html ├── mark_attendance.html ├── my_attendance.html ├── register.html ├── student_dashboard.html ├── teacher_dashboard.html ├── user_management.html └── view_report.html └── tests directory └── test_creational_patterns.py /.github/ISSUE_TEMPLATE/feature-request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature Request 3 | about: Suggest a new feature for the attendance system 4 | title: '' 5 | labels: ['feature-request'] 6 | assignees: '' 7 | --- 8 | 9 | ## User Story 10 | As a [type of user], I want to [perform some action] so that [I can achieve some goal]. 11 | 12 | ## Description 13 | [Detailed description of the feature] 14 | 15 | ## Component 16 | - [ ] Frontend 17 | - [ ] Backend 18 | - [ ] Mobile 19 | - [ ] Analytics 20 | - [ ] Database 21 | - [ ] Other: ___________ 22 | 23 | ## Priority 24 | - [ ] Low 25 | - [ ] Medium 26 | - [ ] High 27 | 28 | ## Acceptance Criteria 29 | - [ ] [Specific requirement 1] 30 | - [ ] [Specific requirement 2] 31 | - [ ] [Specific requirement 3] 32 | 33 | ## Design Considerations 34 | - [Technical considerations] 35 | - [UI/UX considerations] 36 | - [Performance considerations] 37 | 38 | ## Dependencies 39 | - [List any dependencies on other issues or external factors] 40 | 41 | ## Additional Context 42 | [Add any other context or screenshots about the feature request here] 43 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/good-first-issue.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Good First Issue 3 | about: Template for beginner-friendly issues 4 | title: '' 5 | labels: ['good-first-issue'] 6 | assignees: '' 7 | --- 8 | 9 | ## Description 10 | [Clear, concise description of the task] 11 | 12 | ## Component 13 | - [ ] Frontend 14 | - [ ] Backend 15 | - [ ] Documentation 16 | - [ ] Testing 17 | - [ ] Other: ___________ 18 | 19 | ## Estimated Time 20 | [1-4 hours] 21 | 22 | ## Acceptance Criteria 23 | - [ ] [Specific requirement 1] 24 | - [ ] [Specific requirement 2] 25 | - [ ] [Specific requirement 3] 26 | 27 | ## Resources 28 | - [Link to relevant documentation] 29 | - [Link to related code files] 30 | 31 | ## Getting Started 32 | 1. Comment on this issue to let others know you're working on it 33 | 2. Fork the repository 34 | 3. Create a new branch for your changes 35 | 4. Make your changes and test them 36 | 5. Submit a pull request 37 | -------------------------------------------------------------------------------- /.github/workflows/ci-cd.yml: -------------------------------------------------------------------------------- 1 | name: CI/CD Pipeline 2 | 3 | on: [push, pull_request] 4 | 5 | jobs: 6 | build-and-test: 7 | runs-on: ubuntu-latest 8 | 9 | steps: 10 | - name: Checkout Code 11 | uses: actions/checkout@v3 12 | 13 | - name: Set up Node.js 14 | uses: actions/setup-node@v3 15 | with: 16 | node-version: 18 17 | 18 | - name: Install Dependencies 19 | run: npm install 20 | 21 | - name: Run Tests 22 | run: npm test 23 | -------------------------------------------------------------------------------- /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | name: CI 2 | 3 | on: 4 | push: 5 | branches: [ main ] 6 | pull_request: 7 | branches: [ main ] 8 | 9 | jobs: 10 | build-and-test: 11 | runs-on: ubuntu-latest 12 | 13 | steps: 14 | - name: Checkout code 15 | uses: actions/checkout@v3 16 | 17 | - name: Set up Python 18 | uses: actions/setup-python@v4 19 | with: 20 | python-version: '3.11' 21 | 22 | - name: Install dependencies 23 | run: | 24 | python -m pip install --upgrade pip 25 | pip install -r requirements.txt 26 | 27 | - name: Run tests 28 | run: | 29 | pytest 30 | -------------------------------------------------------------------------------- /.github/workflows/python-app.yml: -------------------------------------------------------------------------------- 1 | # This workflow will install Python dependencies, run tests and lint with a single version of Python 2 | # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python 3 | 4 | name: Python application 5 | 6 | on: 7 | push: 8 | branches: [ "main" ] 9 | pull_request: 10 | branches: [ "main" ] 11 | 12 | permissions: 13 | contents: read 14 | 15 | jobs: 16 | build: 17 | 18 | runs-on: ubuntu-latest 19 | 20 | steps: 21 | - uses: actions/checkout@v4 22 | - name: Set up Python 3.10 23 | uses: actions/setup-python@v3 24 | with: 25 | python-version: "3.10" 26 | - name: Install dependencies 27 | run: | 28 | python -m pip install --upgrade pip 29 | pip install flake8 pytest 30 | if [ -f requirements.txt ]; then pip install -r requirements.txt; fi 31 | - name: Lint with flake8 32 | run: | 33 | # stop the build if there are Python syntax errors or undefined names 34 | flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics 35 | # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide 36 | flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics 37 | - name: Test with pytest 38 | run: | 39 | pytest 40 | -------------------------------------------------------------------------------- /.github/workflows/python-package.yml: -------------------------------------------------------------------------------- 1 | # This workflow will install Python dependencies, run tests and lint with a variety of Python versions 2 | # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python 3 | 4 | name: Python package 5 | 6 | on: 7 | push: 8 | branches: [ "main" ] 9 | pull_request: 10 | branches: [ "main" ] 11 | 12 | jobs: 13 | build: 14 | 15 | runs-on: ubuntu-latest 16 | strategy: 17 | fail-fast: false 18 | matrix: 19 | python-version: ["3.9", "3.10", "3.11"] 20 | 21 | steps: 22 | - uses: actions/checkout@v4 23 | - name: Set up Python ${{ matrix.python-version }} 24 | uses: actions/setup-python@v3 25 | with: 26 | python-version: ${{ matrix.python-version }} 27 | - name: Install dependencies 28 | run: | 29 | python -m pip install --upgrade pip 30 | python -m pip install flake8 pytest 31 | if [ -f requirements.txt ]; then pip install -r requirements.txt; fi 32 | - name: Lint with flake8 33 | run: | 34 | # stop the build if there are Python syntax errors or undefined names 35 | flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics 36 | # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide 37 | flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics 38 | - name: Test with pytest 39 | run: | 40 | pytest 41 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | venv/ 2 | __pycache__/ 3 | *.py[cod] 4 | *.class 5 | *.so 6 | .Python 7 | instance/ 8 | .env 9 | *.db 10 | *.sqlite 11 | *.sqlite3 12 | -------------------------------------------------------------------------------- /ARCHITECTURE.md: -------------------------------------------------------------------------------- 1 | ## C1: Context Diagram 2 | ### Student Attendance Management System 3 | 4 | ```mermaid 5 | graph TD; 6 | subgraph External Users 7 | Student[Student] -->|Marks Attendance| AttendanceSystem 8 | Teacher[Teacher] -->|Verifies Attendance| AttendanceSystem 9 | Admin[Admin] -->|Manages System| AttendanceSystem 10 | end 11 | 12 | subgraph External Services 13 | EmailService[Email Notification Service] -->|Sends Notifications| AttendanceSystem 14 | end 15 | 16 | AttendanceSystem[Student Attendance System] -->|Stores Data| Database[(Database)] 17 | ``` 18 | 19 | ### Explanation: 20 | - **Users:** 21 | - **Students** mark their attendance. 22 | - **Teachers** verify student attendance. 23 | - **Admins** manage users and system configurations. 24 | - **External Services:** 25 | - **Email Service** sends attendance reports. 26 | - **System Interactions:** 27 | - The **Attendance System** stores and retrieves attendance records from the **database**. 28 | 29 | --- 30 | 31 | ## C2: Container Diagram 32 | ### System Components 33 | 34 | ```mermaid 35 | graph TD; 36 | subgraph AttendanceSystem 37 | WebApp[Web Application] -->|Requests| Backend[Backend API] 38 | Backend -->|Reads/Writes| Database[(Database)] 39 | Backend -->|Sends Notifications| EmailService[Email Service] 40 | end 41 | 42 | Student[Student] -->|Uses| WebApp 43 | Teacher[Teacher] -->|Manages| WebApp 44 | Admin[Admin] -->|Configures| WebApp 45 | ``` 46 | 47 | ### Explanation: 48 | - **Web Application:** Interface for users to interact with the system. 49 | - **Backend API:** Handles logic and data processing. 50 | - **Database:** Stores student attendance records. 51 | - **Email Service:** Sends attendance reports. 52 | 53 | --- 54 | 55 | ## C3: Component Diagram 56 | ### Backend API Breakdown 57 | 58 | ```mermaid 59 | graph TD; 60 | subgraph Backend API 61 | AuthService[Authentication Service] -->|Manages| UserDB[(User Database)] 62 | AttendanceService[Attendance Management] -->|Tracks| AttendanceDB[(Attendance Database)] 63 | ReportService[Report Generation] -->|Generates| ReportDB[(Report Database)] 64 | end 65 | ``` 66 | 67 | ### Explanation: 68 | - **Authentication Service:** Manages user login and registration. 69 | - **Attendance Management:** Handles marking and verifying attendance. 70 | - **Report Generation:** Creates attendance reports for students and teachers. 71 | 72 | --- 73 | 74 | ## C4: Code Diagram 75 | ### Class Diagram Example 76 | 77 | ```mermaid 78 | classDiagram 79 | class User { 80 | +String id 81 | +String name 82 | +String role 83 | } 84 | 85 | class Attendance { 86 | +String studentId 87 | +Date date 88 | +Boolean status 89 | } 90 | 91 | class Report { 92 | +String teacherId 93 | +Date generatedDate 94 | +List attendanceRecords 95 | } 96 | 97 | User --> Attendance : "marks" 98 | User --> Report : "generates" 99 | Attendance --> Report : "is included in" 100 | ``` 101 | 102 | ### Explanation: 103 | - **User Class:** Represents students, teachers, and admins. 104 | - **Attendance Class:** Stores attendance records. 105 | - **Report Class:** Generates attendance reports. 106 | -------------------------------------------------------------------------------- /Activity Workflow Modeling.md: -------------------------------------------------------------------------------- 1 | # Activity Workflow Modeling with Activity Diagrams 2 | 3 | --- 4 | 5 | ## 1. Student Registration Workflow 6 | 7 | ![Student Registration Workflow](Student%20Registration%20Workflow.png) 8 | 9 | ### Key Highlights: 10 | - **Addresses Stakeholder Concerns**: Ensures a structured registration process with clear approval and rejection criteria. 11 | - **Scalability**: The workflow allows the admin to efficiently manage multiple student applications. 12 | - **Transparency**: Students receive clear communication regarding their registration status. 13 | 14 | --- 15 | 16 | ## 2. Attendance Marking Workflow 17 | 18 | ![Attendance Marking Workflow](Attendance%20Marking%20Workflow.png) 19 | 20 | ### Key Highlights: 21 | - **Addresses Stakeholder Concerns**: Ensures accurate attendance tracking, which is essential for monitoring student presence. 22 | - **Real-Time Updates**: Alerts parents instantly when a student is absent. 23 | - **Multiple Methods**: Supports both manual and biometric attendance, ensuring flexibility for institutions. 24 | 25 | --- 26 | 27 | ## 3. Attendance Verification Workflow 28 | 29 | ![Attendance Verification Workflow](Attendance%20Verification%20Workflow.png) 30 | 31 | ### Key Highlights: 32 | - **Addresses Stakeholder Concerns**: Prevents attendance discrepancies and ensures accountability. 33 | - **Accuracy & Validation**: Admin can review and correct any errors before finalizing attendance records. 34 | 35 | --- 36 | 37 | ## 4. Course Management Workflow 38 | 39 | ![Course Management Workflow](Course%20Management%20Workflow.png) 40 | 41 | ### Key Highlights: 42 | - **Addresses Stakeholder Concerns**: Helps manage course enrollment efficiently. 43 | - **Scalability**: Automatically restricts enrollment based on available slots, preventing overbooking. 44 | 45 | --- 46 | 47 | ## 5. Notification System Workflow 48 | 49 | ![Notification System Workflow](Notification%20System%20Workflow.png) 50 | 51 | ### Key Highlights: 52 | - **Addresses Stakeholder Concerns**: Keeps parents informed about student absences. 53 | - **Automation**: Eliminates manual tracking by teachers and admins. 54 | - **Accountability**: Ensures parents acknowledge receipt of absence notifications. 55 | 56 | --- 57 | 58 | ## 6. Report Generation Workflow 59 | 60 | ![Report Generation Workflow](Report%20Generation%20Workflow.png) 61 | 62 | ### Key Highlights: 63 | - **Addresses Stakeholder Concerns**: Provides a detailed view of attendance records for decision-making. 64 | - **Error Handling**: Admins can validate reports and request corrections before approval. 65 | - **Record Keeping**: Ensures data is stored securely for future reference. 66 | 67 | --- 68 | 69 | ## 7. Teacher Resignation Workflow 70 | 71 | ![Teacher Resignation Workflow](Teacher%20Resignation%20Workflow.png) 72 | 73 | ### Key Highlights: 74 | - **Addresses Stakeholder Concerns**: Ensures a smooth exit process for teachers. 75 | - **Transparency**: Teachers receive formal notifications regarding the status of their resignation. 76 | - **Administrative Control**: Admins can assess and approve resignations based on institutional requirements. 77 | 78 | --- 79 | 80 | ## 8. Student Graduation Workflow 81 | 82 | ![Student Graduation Workflow](Student%20Graduation%20Workflow.png) 83 | 84 | ### Key Highlights: 85 | - **Addresses Stakeholder Concerns**: Streamlines the graduation process, ensuring students meet eligibility criteria. 86 | - **Automation**: Automatically generates certificates upon approval. 87 | - **Student Communication**: Notifies students about their graduation status efficiently. 88 | -------------------------------------------------------------------------------- /Assignment 14/Getting Started.md: -------------------------------------------------------------------------------- 1 | # Getting Started 2 | 3 | A comprehensive system for tracking and managing student attendance across educational institutions. 4 | 5 | ## Features 6 | 7 | - **User Authentication & Authorization**: Role-based access for students, teachers, and administrators 8 | - **Attendance Tracking**: Mark attendance for multiple classes and courses 9 | - **Reporting**: Generate detailed attendance reports with customizable parameters 10 | - **Student Management**: Add, update, and manage student profiles 11 | - **Course Management**: Create and manage courses and class schedules 12 | - **Notifications**: Alert system for absent students and attendance updates 13 | 14 | ## Getting Started 15 | 16 | These instructions will help you set up the project on your local machine for development and testing purposes. 17 | 18 | ### Prerequisites 19 | 20 | - Python 3.8+ 21 | - MySQL or PostgreSQL 22 | - Git 23 | 24 | ### Installation 25 | 26 | 1. **Clone the repository** 27 | ```bash 28 | git clone https://github.com/Ndelelo/student-attendance-system.git 29 | cd student-attendance-system 30 | ``` 31 | 32 | 2. **Set up a virtual environment** 33 | ```bash 34 | python -m venv venv 35 | 36 | # On Windows 37 | venv\Scripts\activate 38 | 39 | # On macOS/Linux 40 | source venv/bin/activate 41 | ``` 42 | 43 | 3. **Install dependencies** 44 | ```bash 45 | pip install -r requirements.txt 46 | ``` 47 | 48 | 4. **Configure environment variables** 49 | ```bash 50 | cp .env.example .env 51 | # Edit .env file with your database credentials and settings 52 | ``` 53 | 54 | 5. **Run migrations** 55 | ```bash 56 | python manage.py migrate 57 | ``` 58 | 59 | 6. **Create a superuser** 60 | ```bash 61 | python manage.py createsuperuser 62 | ``` 63 | 64 | 7. **Start the development server** 65 | ```bash 66 | python manage.py runserver 67 | ``` 68 | 69 | 8. **Access the application** 70 | Open your browser and navigate to http://127.0.0.1:8000 71 | 72 | ## Features for Contribution 73 | 74 | Below are some key areas where contributions are welcome: 75 | 76 | | Feature | Description | Difficulty | Labels | 77 | |---------|-------------|------------|--------| 78 | | QR Code Attendance | Implement QR code generation and scanning for quick attendance | Medium | `feature-request` | 79 | | Mobile Responsiveness | Optimize UI components for mobile devices | Easy | `good-first-issue` | 80 | | Export to PDF | Add functionality to export attendance reports as PDF | Easy | `good-first-issue` | 81 | | Email Notifications | Set up automated email alerts for attendance events | Medium | `feature-request` | 82 | | Data Visualization | Create charts and graphs for attendance statistics | Medium | `good-first-issue` | 83 | | Bulk Import | Allow importing student data from CSV/Excel files | Easy | `good-first-issue` | 84 | | API Development | Create RESTful endpoints for system integration | Hard | `feature-request` | 85 | | Facial Recognition | Optional AI-based attendance verification | Hard | `feature-request` | 86 | | Offline Mode | Enable system functionality without internet connection | Medium | `good-first-issue` | 87 | | Calendar Integration | Sync with Google/Microsoft calendars | Medium | `good-first-issue` | 88 | 89 | ## Documentation 90 | 91 | - [Contributing Guidelines](./CONTRIBUTING.md) 92 | - [Roadmap](./ROADMAP.md) 93 | - [API Documentation](./docs/api.md) (coming soon) 94 | 95 | ## Testing 96 | 97 | Run the test suite: 98 | 99 | ```bash 100 | pytest 101 | ``` 102 | 103 | ## Built With 104 | 105 | - [Django](https://www.djangoproject.com/) - The web framework 106 | - [Django REST Framework](https://www.django-rest-framework.org/) - For API endpoints 107 | - [Bootstrap](https://getbootstrap.com/) - Frontend components 108 | - [Chart.js](https://www.chartjs.org/) - For data visualization 109 | 110 | ## License 111 | 112 | This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details. 113 | 114 | ## Acknowledgments 115 | 116 | - All contributors who participate in this project 117 | - Educational institutions that provided feedback during development 118 | -------------------------------------------------------------------------------- /Assignment 14/Reflection.md: -------------------------------------------------------------------------------- 1 | # 📝 Reflection 2 | 3 | Improving the Student Attendance Management System repository based on peer feedback was an insightful process that enhanced both the technical quality and collaborative potential of the project. Initially, the repository lacked contributor-focused resources and had minimal issue labeling or documentation. After receiving peer feedback, I identified and addressed several improvement areas including better onboarding documentation, clearer contribution guidelines, and labeling issues for community participation. 4 | 5 | One significant improvement was the inclusion of structured documentation. I created a `Getting Started.md` to guide newcomers through environment setup and the project’s basic structure. I also added a `CONTRIBUTING.md` to clarify the expected workflow (fork, branch, pull request), coding conventions, and testing instructions. These were complemented by a `ROADMAP.md` outlining future features like biometric integration and mobile app support. Furthermore, based on suggestions, I updated the `README.md` to centralize links to all key documents and added visual aids like labeled issue screenshots to improve accessibility. Labeling beginner-friendly issues (`good first issue`) and distinguishing feature requests made the repository much more navigable for contributors. 6 | 7 | Despite these improvements, onboarding contributors came with several challenges. The most prominent issue was the lack of familiarity among new contributors with the backend stack, particularly the integration between FastAPI and persistent storage layers. Many contributors also found it difficult to set up a consistent development environment. To address this, I included more descriptive setup instructions and sample seed data to mimic real-world use cases. Another challenge was maintaining code quality across contributions; differences in style, missing tests, or undocumented code required careful review and sometimes follow-up communication. This highlighted the need for an automated CI workflow to enforce testing and linting, which I plan to implement next. 8 | 9 | The experience offered several important lessons about open-source collaboration. First, clarity is crucial — a contributor’s ability to help relies heavily on clear documentation and well-scoped issues. I learned that ambiguity in tasks or setup steps leads to confusion and delays. Secondly, creating a welcoming and structured issue tracker helps contributors select work they’re confident in handling. Labeling issues like `good first issue`, `feature request`, allowed new contributors to filter tasks aligned with their skill levels. Lastly, collaboration is not just about writing code — it’s about community. Prompt responses to pull requests, positive feedback, and open discussions around implementation details were vital in retaining contributor interest and trust. 10 | 11 | In conclusion, peer feedback played a critical role in shaping the repository into a more inclusive and collaborative space. The changes made — from documentation improvements to issue labeling — not only increased transparency but also helped me better understand the ecosystem of open-source software development. Although there are still areas for growth, particularly in automation and contributor retention, I now appreciate the value of building software *with* others, not just *for* others. This reflection serves as both a checkpoint and a springboard for continued improvement. 12 | -------------------------------------------------------------------------------- /Assignment 14/contributing.md: -------------------------------------------------------------------------------- 1 | # Contributing to Student Attendance System 2 | 3 | Thank you for considering contributing to the Student Attendance System! This document outlines the process for contributing to this project and helps you get started as a contributor. 4 | 5 | ## Table of Contents 6 | - [Prerequisites](#prerequisites) 7 | - [Installation Instructions](#installation-instructions) 8 | - [Development Workflow](#development-workflow) 9 | - [Coding Standards](#coding-standards) 10 | - [Testing Guidelines](#testing-guidelines) 11 | - [Issue Selection Process](#issue-selection-process) 12 | - [Pull Request Process](#pull-request-process) 13 | - [Communication](#communication) 14 | 15 | ## Prerequisites 16 | 17 | Before you begin, ensure you have the following installed: 18 | - Python 3.8 or higher 19 | - pip (Python package manager) 20 | - Git 21 | - A code editor (VS Code, PyCharm, etc.) 22 | - MySQL or PostgreSQL (depending on project configuration) 23 | 24 | ## Installation Instructions 25 | 26 | 1. **Fork the repository** 27 | 28 | Start by forking the repository to your GitHub account. 29 | 30 | 2. **Clone your fork** 31 | ```bash 32 | git clone https://github.com/Ndelelo/Student-Attendance-Management-System.git 33 | cd student-attendance-system 34 | ``` 35 | 36 | 3. **Set up a virtual environment** 37 | ```bash 38 | python -m venv venv 39 | 40 | # On Windows 41 | venv\Scripts\activate 42 | 43 | # On macOS/Linux 44 | source venv/bin/activate 45 | ``` 46 | 47 | 4. **Install dependencies** 48 | ```bash 49 | pip install -r requirements.txt 50 | pip install -r requirements-dev.txt # Development dependencies 51 | ``` 52 | 53 | 5. **Set up the database** 54 | ```bash 55 | # Configure your database connection in .env file (use .env.example as template) 56 | cp .env.example .env 57 | 58 | # Run migrations 59 | python manage.py migrate 60 | ``` 61 | 62 | 6. **Run the development server** 63 | ```bash 64 | python manage.py runserver 65 | ``` 66 | 67 | ## Development Workflow 68 | 69 | 1. **Create a new branch** 70 | ```bash 71 | git checkout -b feature/your-feature-name 72 | ``` 73 | 74 | 2. **Make your changes** 75 | - Write code that implements the feature or fixes the bug 76 | - Add or update tests as necessary 77 | - Update documentation if needed 78 | 79 | 3. **Commit your changes** 80 | ```bash 81 | git add . 82 | git commit -m "Description of changes" 83 | ``` 84 | 85 | 4. **Push to your fork** 86 | ```bash 87 | git push origin feature/your-feature-name 88 | ``` 89 | 90 | 5. **Create a Pull Request** 91 | - Go to the original repository 92 | - Click "New Pull Request" 93 | - Select your fork and branch 94 | - Fill out the PR template with details of your changes 95 | 96 | ## Coding Standards 97 | 98 | We follow PEP 8 style guidelines for Python code. Additionally: 99 | 100 | - Use 4 spaces for indentation (not tabs) 101 | - Maximum line length of 88 characters (we use Black formatter) 102 | - Write descriptive variable and function names 103 | - Include docstrings for all functions, classes, and modules 104 | - Use type hints where appropriate 105 | 106 | ### Linting 107 | 108 | We use the following tools to ensure code quality: 109 | 110 | - **Black**: For code formatting 111 | ```bash 112 | black . 113 | ``` 114 | 115 | - **Flake8**: For style guide enforcement 116 | ```bash 117 | flake8 118 | ``` 119 | 120 | - **isort**: For import sorting 121 | ```bash 122 | isort . 123 | ``` 124 | 125 | ## Testing Guidelines 126 | 127 | - Write tests for all new features and bug fixes 128 | - Maintain or improve test coverage with your changes 129 | - Run tests locally before submitting a PR 130 | 131 | ```bash 132 | # Run tests 133 | pytest 134 | 135 | # Run tests with coverage 136 | pytest --cov=. 137 | ``` 138 | 139 | ## Issue Selection Process 140 | 141 | 1. **Find an issue** 142 | - Check the [issues tab](https://github.com/OWNER/student-attendance-system/issues) 143 | - Look for issues labeled `good-first-issue` if you're new to the project 144 | - Issues labeled `feature-request` are for new enhancements 145 | 146 | 2. **Comment on the issue** 147 | - Express your interest in working on the issue 148 | - Ask any questions you might have about the requirements 149 | - Wait for a maintainer to assign the issue to you 150 | 151 | 3. **Work on the issue** 152 | - Once assigned, follow the development workflow to implement your solution 153 | - If you're stuck, ask for help in the issue comment thread 154 | 155 | ## Pull Request Process 156 | 157 | 1. **Ensure your PR addresses a specific issue** 158 | - Reference the issue number in your PR description using #issue-number 159 | 160 | 2. **Fill out the PR template** 161 | - Describe what your changes do 162 | - Explain how you've tested your changes 163 | - List any dependencies that were added or removed 164 | 165 | 3. **Pass all checks** 166 | - Your PR must pass all automated tests and checks 167 | - Address any review comments from maintainers 168 | 169 | 4. **Code review** 170 | - A maintainer will review your code 171 | - You may need to make additional changes based on feedback 172 | 173 | 5. **Merge** 174 | - Once approved, a maintainer will merge your PR 175 | - Celebrate your contribution! 🎉 176 | 177 | ## Communication 178 | 179 | - For quick questions, use the project's discussion board 180 | - For bug reports or feature requests, create an issue 181 | - Be respectful and considerate in all communications 182 | 183 | Thank you for contributing to the Student Attendance System! 184 | -------------------------------------------------------------------------------- /Assignment 14/issues.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ndelelo/Student-Attendance-Management-System/af0ce317c8f19fe74b84847fa5a29462694c94be/Assignment 14/issues.JPG -------------------------------------------------------------------------------- /Assignment 14/labeled_issues.md: -------------------------------------------------------------------------------- 1 | # Labeled Issues 2 | 3 | ![issues](issues.jpg) 4 | - **Advanced reporting system** (feature-request) 5 | - **Mobile app for attendance tracking** (feature-request) 6 | - **Add loading indicators** (good-first-issue) 7 | - **Create sample data seeder** (good-first-issue) 8 | - **Add unit tests for date utility functions** (good-first-issue) 9 | - **Improve button styling consistency** (good-first-issue) 10 | - **Implement attendance analytics dashboard** (feature-request) 11 | - **Add input validation messages** (good-first-issue) 12 | - **Fix typos in documentation** (good-first-issue) 13 | -------------------------------------------------------------------------------- /Assignment 14/license.md: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2025 Student Attendance System Contributors 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /Assignment 14/roadmap.md: -------------------------------------------------------------------------------- 1 | # Student Attendance System Roadmap 2 | 3 | This document outlines the planned development roadmap for the Student Attendance System. It provides visibility into our priorities and upcoming features. 4 | 5 | ## Current Version (1.0) 6 | 7 | The current version includes: 8 | - Basic user authentication and role management 9 | - Manual attendance recording 10 | - Simple reporting for teachers and administrators 11 | - Student profile management 12 | - Course and class management 13 | 14 | ## Short-term Goals (Next 3 Months) 15 | 16 | ### Version 1.1 17 | - **Mobile Responsiveness** 18 | - Optimize UI for mobile devices 19 | - Improve teacher experience on tablets 20 | - Priority: High 21 | 22 | - **Enhanced Reports** 23 | - Add visual graphs and charts for attendance trends 24 | - Export reports in multiple formats (PDF, Excel, CSV) 25 | - Priority: Medium 26 | 27 | - **Integrate Redis Caching** 28 | - Improve system performance 29 | - Reduce database load 30 | - Priority: Medium 31 | 32 | - **Automated Email Notifications** 33 | - Send alerts to parents for absent students 34 | - Weekly attendance summaries 35 | - Priority: High 36 | 37 | ### Version 1.2 38 | - **QR Code Attendance** 39 | - Generate unique QR codes for classes 40 | - Allow students to scan for quick check-in 41 | - Priority: Medium 42 | 43 | - **API Development** 44 | - Create RESTful API endpoints 45 | - Enable third-party integrations 46 | - Priority: Low 47 | 48 | ## Mid-term Goals (6-12 Months) 49 | 50 | ### Version 2.0 51 | - **Facial Recognition Attendance (Optional)** 52 | - Implement AI-based attendance verification 53 | - Privacy-focused approach with opt-in functionality 54 | - Priority: Low 55 | 56 | - **Learning Management System (LMS) Integration** 57 | - Connect with popular LMS platforms 58 | - Sync course schedules and enrollment data 59 | - Priority: Medium 60 | 61 | - **Advanced Analytics Dashboard** 62 | - Predictive analytics for attendance patterns 63 | - Identify at-risk students 64 | - Priority: High 65 | 66 | - **Multi-tenancy Support** 67 | - Allow multiple schools/institutions on single instance 68 | - Customizable branding per institution 69 | - Priority: Medium 70 | 71 | ## Long-term Vision (Beyond 12 Months) 72 | 73 | ### Version 3.0 74 | - **Blockchain Attendance Verification** 75 | - Immutable attendance records 76 | - Digital credentials for perfect attendance 77 | - Priority: Low 78 | 79 | - **Offline Mode** 80 | - Full functionality without internet connection 81 | - Background sync when connection restored 82 | - Priority: Medium 83 | 84 | - **AI Attendance Assistant** 85 | - Smart suggestions for teachers 86 | - Automated follow-ups for chronic absenteeism 87 | - Priority: Medium 88 | 89 | - **Integration with Student Information Systems** 90 | - Bidirectional data exchange with major SIS platforms 91 | - Automated roster updates 92 | - Priority: High 93 | 94 | ## How We Prioritize 95 | 96 | Features are prioritized based on: 97 | 1. User impact and feedback 98 | 2. Technical feasibility 99 | 3. Strategic alignment with project goals 100 | 4. Resource availability 101 | 102 | ## Contributing to the Roadmap 103 | 104 | We welcome community input on our roadmap! If you have suggestions for features or want to help implement items on this roadmap: 105 | 106 | 1. Check the [Issues](https://github.com/OWNER/student-attendance-system/issues) page for related discussions 107 | 2. Submit a new feature request with the `feature-request` label 108 | 3. Reference this roadmap in your feature discussions 109 | 110 | The roadmap is a living document and will be updated regularly based on project progress and community feedback. 111 | -------------------------------------------------------------------------------- /Attendance Marking Workflow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ndelelo/Student-Attendance-Management-System/af0ce317c8f19fe74b84847fa5a29462694c94be/Attendance Marking Workflow.png -------------------------------------------------------------------------------- /Attendance Verification Workflow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ndelelo/Student-Attendance-Management-System/af0ce317c8f19fe74b84847fa5a29462694c94be/Attendance Verification Workflow.png -------------------------------------------------------------------------------- /Attendance-marking.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ndelelo/Student-Attendance-Management-System/af0ce317c8f19fe74b84847fa5a29462694c94be/Attendance-marking.png -------------------------------------------------------------------------------- /Attendance-record.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ndelelo/Student-Attendance-Management-System/af0ce317c8f19fe74b84847fa5a29462694c94be/Attendance-record.png -------------------------------------------------------------------------------- /Branch Protection screenshot.md: -------------------------------------------------------------------------------- 1 | # Branch Protection Rules 2 | 3 | This repository uses GitHub's **branch protection rules** to maintain a stable and secure `main` branch. 4 | 5 | --- 6 | 7 | ## 🔒 Rules Configured for `main` 8 | 9 | ### ✅ Require Pull Request Reviews 10 | - At least **1 approval** is required before merging. 11 | - Promotes peer review and reduces the chance of bugs. 12 | 13 | ### ✅ No Direct Pushes 14 | - All changes must go through a **Pull Request (PR)**. 15 | - Prevents accidental or unauthorized commits. 16 | 17 | ### ✅ Optional: Status Checks (CI) 18 | - If CI is configured, PRs must pass before merging. 19 | - Ensures code builds and tests run cleanly. 20 | 21 | --- 22 | 23 | ## 🖼️ Screenshots 24 | 25 | ### 🧩 Rule 1: Require Pull Request Review 26 | 27 | ![Branch Protection Rule 1](rule1.JPG) 28 | 29 | --- 30 | 31 | ### 🚫 Rule 2: Disable Direct Pushes 32 | 33 | ![Branch Protection Rule 2](rule2.JPG) 34 | 35 | --- 36 | 37 | ## 📌 Why These Rules Matter 38 | 39 | - **Code Quality**: PRs allow reviews, improving code correctness and maintainability. 40 | - **Security**: Protects the `main` branch from unauthorized or unsafe changes. 41 | - **Stability**: Prevents broken code from being merged accidentally. 42 | - **Transparency**: PRs create a clear record of all code changes and discussions. 43 | 44 | --- 45 | 46 | By enforcing these rules, we ensure a consistent, collaborative, and secure development workflow. 47 | 48 | -------------------------------------------------------------------------------- /Changelog.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | All notable changes to this project are documented in this file. 4 | 5 | 6 | ### Added 7 | - Implemented all six creational design patterns: 8 | - Singleton 9 | - Factory Method 10 | - Abstract Factory 11 | - Builder 12 | - Prototype 13 | - Object Pool 14 | 15 | ### Fixed 16 | - Fix #15: Made Singleton thread-safe for multithreaded use 17 | - Corrected return values in Abstract Factory for better clarity 18 | - Improved error handling in Builder and Object Pool patterns 19 | 20 | ### Changed 21 | - Refactored Factory pattern to be more modular 22 | - Enhanced Prototype pattern with deep copy logic 23 | - Optimized Object Pool initialization and resource reuse 24 | 25 | ### Tests 26 | - Achieved 98% test coverage in `test_creational_patterns.py` 27 | - Added test cases for edge cases and exception handling in `main.py` 28 | 29 | ### Documentation 30 | - Created detailed docstrings and inline comments for each pattern 31 | - Linked relevant issues to commits (Improvement: Increase test coverage for main.py) 32 | - Added this `CHANGELOG.md` for tracking project changes 33 | 34 | --- -------------------------------------------------------------------------------- /ChangelogAssigment 12.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | ## [Unreleased] 4 | ### Added 5 | - Initial release of the API for managing student attendance records. 6 | 7 | ### Features 8 | - **Student Management API** 9 | - `POST /students`: Create a new student record. 10 | - `GET /students`: Fetch all student records. 11 | - `GET /students/{id}`: Retrieve student details by ID. 12 | - `PUT /students/{id}`: Update student information by ID. 13 | - `DELETE /students/{id}`: Delete student record by ID. 14 | 15 | - **Course Management API** 16 | - `POST /courses`: Create a new course. 17 | - `GET /courses`: Fetch all courses. 18 | - `GET /courses/{id}`: Retrieve course details by ID. 19 | - `PUT /courses/{id}`: Update course details by ID. 20 | - `DELETE /courses/{id}`: Delete a course by ID. 21 | 22 | - **Attendance Management API** 23 | - `POST /attendance`: Record attendance for a student and a course. 24 | - `GET /attendance`: Fetch all attendance records. 25 | - `GET /attendance/{id}`: Retrieve attendance record by ID. 26 | - `GET /attendance/filter`: Filter attendance records by student, course, or date. 27 | 28 | ### Fixes 29 | - Fixed issue with filtering attendance by date, which previously returned incorrect results. 30 | - Fixed issue where creating a new student with an existing email would throw a server error instead of a validation error. 31 | 32 | ### Added 33 | - **Basic API Structure** 34 | - Endpoints for adding, updating, and deleting students, courses, and attendance records. 35 | - Authentication endpoints (JWT-based) for securing API requests. 36 | 37 | ### Changed 38 | - Updated the `POST /attendance` endpoint to ensure that attendance cannot be marked for a non-existent student or course. 39 | - Refined the error messages for failed requests to improve clarity. 40 | 41 | ### Fixes 42 | - Fixed incorrect HTTP status codes for `GET /students` when no records were found (previously returned 500, now returns 404). 43 | - Fixed bug in the `PUT /students/{id}` endpoint where blank fields were not being handled correctly. 44 | 45 | ### Added 46 | - Initial endpoints for managing student records: 47 | - `POST /students`: Create student. 48 | - `GET /students/{id}`: Get student by ID. 49 | 50 | ### Fixed 51 | - Fixed `POST /students` endpoint validation to ensure the email is unique. 52 | -------------------------------------------------------------------------------- /Class Diagram.md: -------------------------------------------------------------------------------- 1 | # Class Diagram Overview 2 | 3 | ![Class Diagram](class-diagram.png) 4 | 5 | --- 6 | 7 | ### 1. Separation of Concerns via Entities 8 | - **Why:** Each entity represents a distinct real-world concept such as `Student`, `Course`, and `Teacher`. 9 | - **Benefit:** Promotes modularity and simplifies maintenance, allowing different parts of the system to evolve independently. 10 | 11 | 12 | 13 | ### 2. Use of `AttendanceRecord` as an Independent Entity 14 | - **Why:** Attendance needs to be recorded per student, per course, per date. 15 | - **Benefit:** Allows flexible tracking, querying, and reporting without duplication or data loss. 16 | 17 | 18 | 19 | ### 3. Many-to-Many Relationship Between Students and Courses 20 | - **Why:** Students can enroll in multiple courses and each course has multiple students. 21 | - **Benefit:** Reflects real-world enrollment scenarios; implemented using a join table if stored in a relational database. 22 | 23 | 24 | 25 | ### 4. Teacher Assigned Only to Their Courses 26 | - **Why:** Ensures data integrity—only the responsible teacher can manage course-specific attendance. 27 | - **Benefit:** Supports role-based access control and reduces errors in attendance handling. 28 | 29 | 30 | 31 | ### 5. Use of `Schedule` as a Separate Entity 32 | - **Why:** Scheduling varies per course and needs to be maintained independently for flexibility. 33 | - **Benefit:** Makes it easier to manage class times, avoid overlaps, and validate attendance dates. 34 | 35 | 36 | 37 | ### 6. Composition Between `Student` and `AttendanceRecord` 38 | - **Why:** An attendance record has no meaning if the student is deleted. 39 | - **Benefit:** Reflects lifecycle dependency; deleting a student should also delete their attendance records. 40 | 41 | 42 | ### 7. Aggregation Between `Course` and `Schedule` 43 | - **Why:** A course depends on a schedule, but a schedule can exist independently. 44 | - **Benefit:** Improves reusability and separation in scheduling logic. 45 | 46 | 47 | 48 | ### 8. `Department` as a Container for Core Entities 49 | - **Why:** Academic institutions group people and courses by departments. 50 | - **Benefit:** Enables better reporting, filtering, and organization based on academic structure. 51 | 52 | 53 | 54 | ### 9. `Attendance Status` as an Enum 55 | - **Why:** Ensures consistent recording using predefined values (e.g., Present, Absent). 56 | - **Benefit:** Simplifies logic for reports, statistics, and UI elements like color-coding. 57 | 58 | 59 | 60 | ### 10. Business Rules Enforced at Logical Level 61 | - **Why:** Rules like 75% attendance requirement are business-driven and can change. 62 | - **Benefit:** Keeps core model flexible while supporting rules at service or application level. 63 | -------------------------------------------------------------------------------- /Course Management Workflow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ndelelo/Student-Attendance-Management-System/af0ce317c8f19fe74b84847fa5a29462694c94be/Course Management Workflow.png -------------------------------------------------------------------------------- /Design-Decisions.md: -------------------------------------------------------------------------------- 1 | # Language Choice & Design Decisions 2 | 3 | ## Why Python? 4 | - Clean and readable syntax 5 | - Strong OOP support (class-based architecture) 6 | - Fast prototyping and easy to test 7 | - Widely used in education and development 8 | 9 | ## Key Design Principles 10 | - **Encapsulation** using private attributes 11 | - **Composition and Association** modeled from UML 12 | - **Separation of Concerns**: Each class handles its own logic 13 | - **Scalability**: Easy to extend with GUI or database later 14 | -------------------------------------------------------------------------------- /Domain model description.md: -------------------------------------------------------------------------------- 1 | # Domain model description 2 | 3 | --- 4 | 5 | # Key Domain Entities 6 | 7 | ## 1. Student 8 | 9 | **Attributes:** 10 | - `studentId` (String) 11 | - `name` (String) 12 | - `email` (String) 13 | - `rollNumber` (String) 14 | - `department` (String) 15 | 16 | **Responsibilities:** 17 | - View attendance 18 | - Update profile 19 | 20 | **Relationships:** 21 | - Enrolled in one or more **Courses** 22 | - Has many **AttendanceRecords** 23 | 24 | --- 25 | 26 | ## 2. Course 27 | 28 | **Attributes:** 29 | - `courseId` (String) 30 | - `courseName` (String) 31 | - `department` (String) 32 | - `teacherId` (String) 33 | 34 | **Responsibilities:** 35 | - Maintain course schedule 36 | - Generate course-wise attendance report 37 | 38 | **Relationships:** 39 | - Taught by a **Teacher** 40 | - Has many **Students** 41 | - Linked to many **AttendanceRecords** 42 | 43 | --- 44 | 45 | ## 3. Teacher 46 | 47 | **Attributes:** 48 | - `teacherId` (String) 49 | - `name` (String) 50 | - `email` (String) 51 | - `department` (String) 52 | 53 | **Responsibilities:** 54 | - Record attendance 55 | - View and generate attendance reports 56 | 57 | **Relationships:** 58 | - Teaches multiple **Courses** 59 | 60 | --- 61 | 62 | ## 4. AttendanceRecord 63 | 64 | **Attributes:** 65 | - `recordId` (String) 66 | - `date` (Date) 67 | - `studentId` (String) 68 | - `courseId` (String) 69 | - `status` (Enum: Present, Absent, Late, Excused) 70 | 71 | **Responsibilities:** 72 | - Log and update attendance 73 | - Track attendance status for a student in a course on a specific date 74 | 75 | **Relationships:** 76 | - Associated with a specific **Student** and **Course** 77 | 78 | --- 79 | 80 | ## 5. Schedule 81 | 82 | **Attributes:** 83 | - `scheduleId` (String) 84 | - `courseId` (String) 85 | - `dayOfWeek` (String) 86 | - `startTime` (Time) 87 | - `endTime` (Time) 88 | 89 | **Responsibilities:** 90 | - Maintain when and where a class meets 91 | 92 | **Relationships:** 93 | - Linked to a single **Course** 94 | 95 | --- 96 | 97 | ## 6. Department 98 | 99 | **Attributes:** 100 | - `departmentId` (String) 101 | - `departmentName` (String) 102 | 103 | **Responsibilities:** 104 | - Manage course and student associations 105 | 106 | **Relationships:** 107 | - Has many **Students**, **Teachers**, and **Courses** 108 | -------------------------------------------------------------------------------- /Getting Started.md: -------------------------------------------------------------------------------- 1 | # Getting Started 2 | 3 | A comprehensive system for tracking and managing student attendance across educational institutions. 4 | 5 | ## Features 6 | 7 | - **User Authentication & Authorization**: Role-based access for students, teachers, and administrators 8 | - **Attendance Tracking**: Mark attendance for multiple classes and courses 9 | - **Reporting**: Generate detailed attendance reports with customizable parameters 10 | - **Student Management**: Add, update, and manage student profiles 11 | - **Course Management**: Create and manage courses and class schedules 12 | - **Notifications**: Alert system for absent students and attendance updates 13 | 14 | ## Getting Started 15 | 16 | These instructions will help you set up the project on your local machine for development and testing purposes. 17 | 18 | ### Prerequisites 19 | 20 | - Python 3.8+ 21 | - MySQL or PostgreSQL 22 | - Git 23 | 24 | ### Installation 25 | 26 | 1. **Clone the repository** 27 | ```bash 28 | git clone https://github.com/Ndelelo/student-attendance-system.git 29 | cd student-attendance-system 30 | ``` 31 | 32 | 2. **Set up a virtual environment** 33 | ```bash 34 | python -m venv venv 35 | 36 | # On Windows 37 | venv\Scripts\activate 38 | 39 | # On macOS/Linux 40 | source venv/bin/activate 41 | ``` 42 | 43 | 3. **Install dependencies** 44 | ```bash 45 | pip install -r requirements.txt 46 | ``` 47 | 48 | 4. **Configure environment variables** 49 | ```bash 50 | cp .env.example .env 51 | # Edit .env file with your database credentials and settings 52 | ``` 53 | 54 | 5. **Run migrations** 55 | ```bash 56 | python manage.py migrate 57 | ``` 58 | 59 | 6. **Create a superuser** 60 | ```bash 61 | python manage.py createsuperuser 62 | ``` 63 | 64 | 7. **Start the development server** 65 | ```bash 66 | python manage.py runserver 67 | ``` 68 | 69 | 8. **Access the application** 70 | Open your browser and navigate to http://127.0.0.1:8000 71 | 72 | ## Features for Contribution 73 | 74 | Below are some key areas where contributions are welcome: 75 | 76 | | Feature | Description | Difficulty | Labels | 77 | |---------|-------------|------------|--------| 78 | | QR Code Attendance | Implement QR code generation and scanning for quick attendance | Medium | `feature-request` | 79 | | Mobile Responsiveness | Optimize UI components for mobile devices | Easy | `good-first-issue` | 80 | | Export to PDF | Add functionality to export attendance reports as PDF | Easy | `good-first-issue` | 81 | | Email Notifications | Set up automated email alerts for attendance events | Medium | `feature-request` | 82 | | Data Visualization | Create charts and graphs for attendance statistics | Medium | `good-first-issue` | 83 | | Bulk Import | Allow importing student data from CSV/Excel files | Easy | `good-first-issue` | 84 | | API Development | Create RESTful endpoints for system integration | Hard | `feature-request` | 85 | | Facial Recognition | Optional AI-based attendance verification | Hard | `feature-request` | 86 | | Offline Mode | Enable system functionality without internet connection | Medium | `good-first-issue` | 87 | | Calendar Integration | Sync with Google/Microsoft calendars | Medium | `good-first-issue` | 88 | 89 | ## Documentation 90 | 91 | - [Contributing Guidelines](./contributing.md) 92 | - [Roadmap](./roadmap.md) 93 | - [API Documentation](./docs/api.md) (coming soon) 94 | 95 | ## Testing 96 | 97 | Run the test suite: 98 | 99 | ```bash 100 | pytest 101 | ``` 102 | 103 | ## Built With 104 | 105 | - [Django](https://www.djangoproject.com/) - The web framework 106 | - [Django REST Framework](https://www.django-rest-framework.org/) - For API endpoints 107 | - [Bootstrap](https://getbootstrap.com/) - Frontend components 108 | - [Chart.js](https://www.chartjs.org/) - For data visualization 109 | 110 | ## License 111 | 112 | This project is licensed under the MIT License - see the [LICENSE](license.md) file for details. 113 | 114 | ## Acknowledgments 115 | 116 | - All contributors who participate in this project 117 | - Educational institutions that provided feedback during development 118 | -------------------------------------------------------------------------------- /Integration Tests.md: -------------------------------------------------------------------------------- 1 | # Integration Tests for Student Attendance System 2 | 3 | ## Overview 4 | 5 | This Student Attendance System is designed to help institutions efficiently manage student attendance records across different courses. The system allows the following functionalities: 6 | 7 | - **Students**: Manage student records and information. 8 | - **Courses**: Manage course details and schedules. 9 | - **Attendance**: Record and track student attendance. 10 | 11 | The following integration tests validate the interaction between these components and ensure the system works as expected. 12 | 13 | ## System Features 14 | 15 | ### Students 16 | Manage student records and information. 17 | 18 | - **Student ID**: A unique identifier for each student. 19 | - **Name**: The name of the student. 20 | - **Email**: The contact email of the student. 21 | 22 | ### Courses 23 | Manage course details and schedules. 24 | 25 | - **Course ID**: A unique identifier for each course. 26 | - **Course Name**: The name of the course. 27 | - **Course Code**: The code assigned to the course. 28 | - **Course Description**: A brief description of the course. 29 | 30 | ### Attendance 31 | Record and track student attendance. 32 | 33 | - **Attendance ID**: A unique identifier for each attendance record. 34 | - **Course**: The course associated with the attendance record. 35 | - **Student**: The student associated with the attendance record. 36 | - **Date**: The date of the class. 37 | - **Status**: Whether the student was present or absent. 38 | 39 | ## Home Page 40 | 41 | The home page provides an overview of the system and easy access to student and course management. 42 | 43 | ### Students Section 44 | 45 | #### Student Management 46 | | ID | Name | Student ID | Email | Actions | 47 | | --- | ----------- | ---------- | -------------------- | ------- | 48 | | 1 | John Doe | ST001 | john@example.com | Edit/Delete | 49 | | 2 | Jane Smith | ST002 | jane@example.com | Edit/Delete | 50 | | 3 | Bob Johnson | ST003 | bob@example.com | Edit/Delete | 51 | 52 | ### Courses Section 53 | 54 | #### Course Management 55 | | ID | Name | Code | Description | Actions | 56 | | --- | ----------- | ---- | -------------------- | ------- | 57 | | No courses found | | | | | 58 | 59 | ### Attendance Section 60 | 61 | #### Attendance Management 62 | | ID | Student | Course | Date | Status | Actions | 63 | | --- | ------------ | --------- | ---------- | -------- | ------- | 64 | | No attendance records found | | | | | 65 | 66 | ## Integration Test Results 67 | 68 | These integration tests ensure that the components of the system (students, courses, and attendance) are interacting correctly. 69 | 70 | ### Test Summary 71 | 72 | - **Total Tests**: 25 73 | - **Passed**: 25 74 | - **Failed**: 0 75 | - **Skipped**: 0 76 | - **Duration**: 50 ms 77 | 78 | ### Test Scenarios 79 | 80 | 1. **Create Student** 81 | - Verify that a student can be created and saved in the system. 82 | 83 | 2. **Create Course** 84 | - Verify that a course can be created with unique codes and details. 85 | 86 | 3. **Record Attendance** 87 | - Verify that attendance can be recorded for a student and a course. 88 | 89 | 4. **Filter Attendance Records** 90 | - Ensure that attendance records can be filtered by student, course, and date. 91 | 92 | 5. **Update Student Information** 93 | - Test updating the student’s information, such as name or email. 94 | 95 | 6. **Update Course Information** 96 | - Test updating course details such as name or description. 97 | 98 | 7. **Delete Student** 99 | - Test the deletion of student records from the system. 100 | 101 | 8. **Delete Course** 102 | - Test the deletion of a course and ensure attendance records related to that course are handled correctly. 103 | 104 | ### Test Results 105 | 106 | | Test Name | Result | Duration | 107 | | ------------------------------------ | ------ | -------- | 108 | | `test_create_student_success` | Passed | 2 ms | 109 | | `test_create_course_success` | Passed | 3 ms | 110 | | `test_record_attendance_success` | Passed | 4 ms | 111 | | `test_filter_attendance_records` | Passed | 2 ms | 112 | | `test_update_student_success` | Passed | 2 ms | 113 | | `test_update_course_success` | Passed | 2 ms | 114 | | `test_delete_student_success` | Passed | 3 ms | 115 | | `test_delete_course_success` | Passed | 3 ms | 116 | | ... | ... | ... | 117 | 118 | ## Visual Reports 119 | 120 | ![Integration Tests Report](integration_tests_report.JPG) 121 | 122 | ## Conclusion 123 | 124 | All integration tests have passed successfully, indicating that the Student Attendance System is working as intended. The system is able to manage student records, course information, and attendance efficiently. 125 | 126 | --- 127 | 128 | **Report Generated on**: 03-May-2025 129 | -------------------------------------------------------------------------------- /Integration.md: -------------------------------------------------------------------------------- 1 | # Integration 2 | 3 | ## 1. Functional Requirements (FR) 4 | 5 | These represent the main features of the system: 6 | 7 | - **FR1**: Student Registration 8 | - **FR2**: Attendance Marking 9 | - **FR3**: Attendance Verification 10 | - **FR4**: Course Management 11 | - **FR5**: Notifications 12 | - **FR6**: Report Generation 13 | - **FR7**: Teacher Resignation 14 | - **FR8**: Student Graduation 15 | 16 | --- 17 | 18 | ## 2. Workflows 19 | 20 | Each functional requirement is linked to a workflow that describes how it operates. Example mappings: 21 | 22 | - **FR1** → *Student Registration Workflow* 23 | - **FR2** → *Attendance Marking Workflow* 24 | - **FR5** → *Notification System Workflow* 25 | - *(Additional workflows exist for FR3–FR8 and follow the same structure.)* 26 | 27 | --- 28 | 29 | ## 3. User Stories (US) 30 | 31 | These describe what different types of users want from the system: 32 | 33 | - **US1**: *As a Student, I want to submit my registration form online.* 34 | - **US2**: *As a Teacher, I want to mark attendance for my class.* 35 | - **US3**: *As an Admin, I want to verify attendance records.* 36 | - **US5**: *As a Parent, I want to receive absence notifications.* 37 | 38 | --- 39 | 40 | ## 4. Sprint Tasks (ST) 41 | 42 | Development tasks to implement the user stories: 43 | 44 | - **ST1**: Design and develop student registration UI. 45 | - **ST2**: Create database schema for attendance records. 46 | - **ST3**: Implement attendance verification system. 47 | - **ST5**: Set up notification system for absences. 48 | 49 | --- 50 | 51 | ## 5. Flow and Relationships 52 | 53 | The following diagram (or logical flow) connects functional requirements to workflows, user stories, and sprint tasks, illustrating how each piece of the system fits together: 54 | 55 | ### Example: FR2 - Attendance Marking 56 | 57 | -------------------------------------------------------------------------------- /Justification.md: -------------------------------------------------------------------------------- 1 | # Student Attendance Management System 2 | 3 | ## Justification 4 | 5 | ### Language Choice: Python 6 | 7 | Python was selected for developing the **Student Attendance Management System** because of its: 8 | 9 | - **Ease of use and readability** – ideal for implementing and understanding design patterns. 10 | - **Object-oriented structure** – aligns well with the system’s entity-based model (e.g., `Student`, `Teacher`, `Course`). 11 | - **Quick prototyping ability** – perfect for building and demonstrating core system logic with minimal setup. 12 | 13 | --- 14 | 15 | ### Design Decisions: Creational Patterns 16 | 17 | To ensure clean, maintainable, and scalable architecture, all six **creational design patterns** were implemented with direct relevance to the Student Management Attendance System: 18 | 19 | | Pattern | Real-World Application | Reason for Use | 20 | |---------------------|------------------------------------------------------------|----------------| 21 | | **Singleton** | `Logger` - Used to log all attendance actions across the system. | Guarantees a single shared instance of logging, avoiding duplicates or inconsistencies. | 22 | | **Factory Method** | `NotificationFactory` - Sends email/SMS alerts when attendance is marked. | Abstracts notification creation, allowing easy extension (e.g., add push notifications). | 23 | | **Abstract Factory** | `GUIFactory` - Produces themed UI components (e.g., buttons for light/dark mode). | Prepares for future GUI support with consistent UI generation logic. | 24 | | **Builder** | `ReportBuilder` - Generates detailed attendance reports for teachers/admins. | Handles step-by-step report construction, supporting flexible formatting and customization. | 25 | | **Prototype** | `CourseTemplate` - Allows quick duplication of existing course structures. | Enables efficient reuse of course definitions with minimal manual setup. | 26 | | **Object Pool** | `ConnectionPool` - Manages reusable DB connections (simulated). | Demonstrates how resource pooling would reduce overhead in real-world database scenarios. | 27 | 28 | -------------------------------------------------------------------------------- /Kanban Board.md: -------------------------------------------------------------------------------- 1 | # Kanban Board Overview 2 | 3 | ![Kanban Board](KanbanBoard.jpg) 4 | 5 | 6 | ![Kanban Board - Testing](Kanban.jpg) 7 | 8 | ### **Testing Column** 9 | 10 | - **Testing** guarantees in Agile development that features satisfy quality criteria before they are labelled as Done. 11 | - Including a testing column enables an organized review and feedback loop; quality checks prior to release; bug or performance issues identification. 12 | 13 | #### **How Does Automation Work** 14 | - After a **Pull Request (PR)** is accepted, move to "Testing". 15 | - After testing is finished and integrated, move to "Done". 16 | 17 | --- 18 | 19 | ### **Blocked Column** 20 | 21 | The **Blocked Column** was added to the Kanban board for managing task dependencies that prevent further progress. 22 | 23 | #### **Blocking Stage** 24 | - A Blocked column helps identify dependencies and stops flow congestion in your system. 25 | - This stage is helpful when outside dependencies prevent a job from starting. 26 | - Stopping progress calls for a waiting time, and a major issue (such as a bug or delayed approval) calls for this as well. 27 | 28 | #### **How Does Automation Work** 29 | - Change to Blocked when a **PR** or **issue** gains a **blocked label**. 30 | - When the label is taken off, return to **In Progress**. 31 | 32 | --- -------------------------------------------------------------------------------- /Notification System Workflow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ndelelo/Student-Attendance-Management-System/af0ce317c8f19fe74b84847fa5a29462694c94be/Notification System Workflow.png -------------------------------------------------------------------------------- /Object State Modeling.md: -------------------------------------------------------------------------------- 1 | # Object State Modeling with State Transition Diagrams 2 | 3 | ## 1. Attendance Record 4 | 5 | **Key States:** 6 | Initialized → Marked → Verified 7 | 8 | **Diagram:** 9 | ![Attendance Record State Diagram](Attendance-record.png) 10 | 11 | **Transitions:** 12 | - `Initialize()` → Initialized 13 | - `MarkAttendance()` → Marked 14 | - `VerifyAttendance()` → Verified 15 | 16 | **Mapping to Functional Requirements:** 17 | - **FR1:** The Marked state ensures that teachers can manually or automatically mark attendance. 18 | - **FR3:** The Verified state enables administrators to confirm attendance records before report generation. 19 | 20 | 21 | ## 2. Student 22 | 23 | **Key States:** 24 | Registered → Active → (Graduated / Dropped) 25 | 26 | **Diagram:** 27 | ![Student State Diagram](diagram-Student.png) 28 | 29 | **Transitions:** 30 | - `Register()` → Registered 31 | - `Enroll()` → Active 32 | - `Graduate()` → Graduated 33 | - `DropOut()` → Dropped 34 | 35 | **Mapping to Functional Requirements:** 36 | - **FR2:** The Active state allows students to view their attendance records. 37 | - **FR4:** If a student is Dropped or absent for a session, the system can trigger alerts for parents. 38 | 39 | --- 40 | 41 | ## 3. Course 42 | 43 | **Key States:** 44 | Created → Active → (Completed / Cancelled) 45 | 46 | **Diagram:** 47 | ![Course State Diagram](diagram-Course.png) 48 | 49 | **Transitions:** 50 | - `CreateCourse()` → Created 51 | - `StartCourse()` → Active 52 | - `FinishCourse()` → Completed 53 | - `CancelCourse()` → Cancelled 54 | 55 | **Mapping to Functional Requirements:** 56 | - **FR3:** Courses that reach the Completed state contribute to attendance report generation. 57 | - **FR5:** The Created state ensures courses are registered in the institution’s database. 58 | 59 | --- 60 | 61 | ## 4. Session 62 | 63 | **Key States:** 64 | Scheduled → Ongoing → Completed 65 | 66 | **Diagram:** 67 | ![Session State Diagram](diagram-Session.png) 68 | 69 | **Transitions:** 70 | - `ScheduleSession()` → Scheduled 71 | - `StartSession()` → Ongoing 72 | - `EndSession()` → Completed 73 | 74 | **Mapping to Functional Requirements:** 75 | - **FR1:** The Ongoing state enables real-time attendance tracking. 76 | - **FR3:** The Completed state allows attendance data to be included in reports. 77 | 78 | --- 79 | 80 | ## 5. Teacher 81 | 82 | **Key States:** 83 | Hired → Active → (Resigned / Retired) 84 | 85 | **Diagram:** 86 | ![Teacher State Diagram](diagram-Teacher.png) 87 | 88 | **Transitions:** 89 | - `HireTeacher()` → Hired 90 | - `AssignCourse()` → Active 91 | - `ResignTeacher()` → Resigned 92 | - `RetireTeacher()` → Retired 93 | 94 | **Mapping to Functional Requirements:** 95 | - **FR1:** The Active state ensures teachers can mark attendance. 96 | - **FR6:** The Hired state links to authentication and access control. 97 | 98 | --- 99 | 100 | ## 6. Admin 101 | 102 | **Key States:** 103 | Created → Active → (Suspended / Removed) 104 | 105 | **Diagram:** 106 | ![Admin State Diagram](diagram-Admin.png) 107 | 108 | **Transitions:** 109 | - `CreateAdminAccount()` → Created 110 | - `ActivateAccount()` → Active 111 | - `SuspendAccount()` → Suspended 112 | - `RemoveAccount()` → Removed 113 | 114 | **Mapping to Functional Requirements:** 115 | - **FR3:** The Active state ensures administrators can generate reports. 116 | - **FR6:** The system supports multiple authentication methods for administrators. 117 | 118 | --- 119 | 120 | ## 7. Notification 121 | 122 | **Key States:** 123 | Generated → Sent → Read 124 | 125 | **Diagram:** 126 | ![Notification State Diagram](diagram-Notification.png) 127 | 128 | **Transitions:** 129 | - `GenerateNotification()` → Generated 130 | - `SendNotification()` → Sent 131 | - `ReadNotification()` → Read 132 | 133 | **Mapping to Functional Requirements:** 134 | - **FR4:** Notifications in the Sent state ensure parents receive alerts for absences. 135 | 136 | --- 137 | 138 | ## 8. Report 139 | 140 | **Key States:** 141 | Created → Reviewed → (Approved / Rejected) 142 | 143 | **Diagram:** 144 | ![Report State Diagram](diagram-Report.png) 145 | 146 | **Transitions:** 147 | - `GenerateReport()` → Created 148 | - `ReviewReport()` → Reviewed 149 | - `ApproveReport()` → Approved 150 | - `RejectReport()` → Rejected 151 | 152 | **Mapping to Functional Requirements:** 153 | - **FR3:** The Approved state confirms valid attendance reports. 154 | - **FR5:** Integration with the institution’s database ensures reports are stored properly. 155 | -------------------------------------------------------------------------------- /PROTECTION.md: -------------------------------------------------------------------------------- 1 | # Branch Protection Rules 2 | 3 | ## Summary 4 | 5 | This repository uses **branch protection rules** for the `main` branch to ensure code quality, collaboration, and stability. 6 | 7 | ## Rules in Place 8 | 9 | - ✅ **Pull Request Reviews Required** 10 | At least one team member must approve changes before they can be merged into `main`. 11 | 12 | - ✅ **Status Checks Required** 13 | All commits must pass our CI checks (builds, tests, etc.) before being eligible for merge. 14 | 15 | - ✅ **No Direct Pushes Allowed** 16 | Direct pushes to the `main` branch are disabled. All changes must go through a pull request (PR). 17 | 18 | ## Why These Rules Matter 19 | 20 | 1. **Code Quality** 21 | Reviews catch bugs early and ensure adherence to best practices. 22 | 23 | 2. **Collaboration** 24 | Encourages team discussion and knowledge sharing around changes. 25 | 26 | 3. **Stability** 27 | Prevents broken or untested code from reaching production. 28 | 29 | 4. **Auditability** 30 | Every change is logged with an associated PR and review history. 31 | 32 | 5. **Security** 33 | Reduces risk of accidental or unauthorized changes. 34 | -------------------------------------------------------------------------------- /Product Backlog.md: -------------------------------------------------------------------------------- 1 | # Product Backlog 2 | 3 | **Prioritized product backlog using MoSCoW prioritization and effort estimates:** 4 | 5 | ## 1. Backlog Items 6 | 7 | | Story ID | User Story | Priority (MoSCoW) | Effort Estimate (1-5) | Dependencies | 8 | |----------|------------|-------------------|----------------------|--------------| 9 | | US001 | As a student, I want to log in securely so that I can access my data safely. | Must-have | 3 | None | 10 | | US002 | As a teacher, I want to mark student attendance manually so that I can keep records for each session. | Must-have | 2 | US001 | 11 | | US003 | As a student, I want to check in using an RFID card so that my attendance is recorded automatically. | Must-have | 4 | US001 | 12 | | US004 | As an admin, I want to generate attendance reports so that I can analyze student attendance trends. | Must-have | 3 | US002, US003 | 13 | | US005 | As a parent, I want to receive notifications when my child is absent so that I can follow up on attendance issues. | Must-have | 3 | US004 | 14 | | US006 | As a school administrator, I want attendance reports to show patterns so that I can make data-driven decisions. | Should-have | 4 | US004 | 15 | | US007 | As a student, I want to apply for leave online so that I can request absences conveniently. | Should-have | 2 | US001 | 16 | | US008 | As a teacher, I want to approve or reject leave requests so that I can manage class attendance records accurately. | Should-have | 3 | US007 | 17 | | US009 | As a student, I want to access my attendance records so that I can track my presence in class. | Could-have | 2 | US002 | 18 | | US010 | As a system administrator, I want all student data to be encrypted with AES-256 so that security compliance is maintained. | Must-have | 5 | None | 19 | | US011 | As an admin, I want to configure attendance policies so that I can set rules for different institutions. | Could-have | 3 | US004 | 20 | | US012 | As a student, I want to access the system on my phone so that I can check my attendance status on the go. | Should-have | 4 | US009 | 21 | 22 | --- 23 | 24 | ## 2. Justification for Prioritization 25 | 26 | 1. **Must-Have** stories are essential for system functionality and security. 27 | - Without authentication (**US001**), the system cannot operate. 28 | - Attendance tracking (**US002, US003**) and reporting (**US004**) are core features. 29 | - Security (**US010**) ensures compliance. 30 | 31 | 2. **Should-Have** stories improve usability but are not immediately critical. 32 | - Features like leave requests (**US007, US008**) and advanced analytics (**US006**) enhance user experience but do not block core operations. 33 | 34 | 3. **Could-Have** stories are nice additions but can be deferred. 35 | - Mobile access (**US012**) and attendance history (**US009**) add convenience but do not impact the system’s main functionality. 36 | 37 | 4. **Won’t-Have** stories (if applicable) are either out of scope or unnecessary for the current release. 38 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Student-Attendance-Management-System 2 | 3 | ## Introduction 4 | 5 | The Student Attendance Management System is a software application designed to automate the process of tracking student attendance in schools, colleges, and universities. This system eliminates the need for manual attendance registers, reducing paperwork and errors while improving efficiency and accuracy. 6 | 7 | **Project Description** 8 | 9 | The project aims to provide an intuitive and user-friendly interface for teachers and administrators to mark and manage attendance records efficiently. The system will store attendance data, generate reports, and provide insights into student participation. It can be integrated with biometric systems, RFID cards, or manual input for flexibility. 10 | # Project Documentation 11 | - [CONTRIBUTING](./contributing.md) 12 | - [ROADMAP](./roadmap.md) 13 | - [LICENSE](./license.md) 14 | 15 | ## Links to Other Documents 16 | - [Getting Started](./Getting%20Started.md) 17 | - [Specification](./SPECIFICATION.md) 18 | - [Architecture](./ARCHITECTURE.md) 19 | - [Design Decisions and Language Choice](Design-Decisions.md) 20 | - [Creational_patterns](Justification.md) 21 | - ![Tests](https://img.shields.io/badge/tests-passing-brightgreen) 22 | 23 | -------------------------------------------------------------------------------- /Reflection Assignment 9.md: -------------------------------------------------------------------------------- 1 | # Reflection: Designing the Domain Model and Class Diagram 2 | 3 | The process of making the domain model and class diagram for the **Student Attendance Management System** was both exciting and demanding. It required a deep understanding of object-oriented design principles, the unique challenges of academic environments, and finding the right balance between abstraction and detail. 4 | 5 | --- 6 | 7 | ## 1. Domain Model and Class Diagram Design Challenges 8 | 9 | - **Abstraction Level:** 10 | It was challenging to choose what to model. While modeling real-world details like student year levels, vacations, and course credits was tempting, I had to stay focused on core **attendance functionality** rather than building a full academic administration system. 11 | 12 | - **Entity Relationships:** 13 | Defining relationships, especially the **many-to-many** link between Students and Courses, was complex. I realized that attendance records should not be embedded but instead modeled as a separate `AttendanceRecord` entity that links a Student, Course, and Date. This helped preserve clean, object-oriented design. 14 | 15 | - **Method Design (Responsibilities):** 16 | Determining what actions each class should handle (e.g., recording vs. viewing attendance) helped me avoid violating the **Single Responsibility Principle**. Delegating responsibilities wisely improved cohesion. 17 | 18 | --- 19 | 20 | ## 2. Alignment with Previous Assignments (Use Cases, State Diagrams, Requirements) 21 | 22 | - **Use Cases:** 23 | Use cases like *“Mark Attendance”* influenced my class interactions. The flow of an Instructor selecting a Course, then a Student, and recording attendance shaped method logic and associations. 24 | 25 | - **State Diagrams:** 26 | Modeling the lifecycle of `AttendanceRecord` (e.g., Created → Updated → Finalized) highlighted the need for update methods and validation logic. 27 | 28 | - **Requirements:** 29 | System requirements emphasized **security and access control**, validating design decisions like limiting attendance editing to assigned instructors. 30 | 31 | --- 32 | 33 | ## 3. Trade-Offs and Design Decisions 34 | 35 | - **Avoiding Inheritance for Roles:** 36 | Although creating a `User` superclass with `Student` and `Teacher` subclasses seemed logical, their limited shared attributes made this impractical. I opted for **independent entities** to reduce tight coupling. 37 | 38 | - **Composition vs. Aggregation:** 39 | - Used **composition** between `Student` and `AttendanceRecord`—since attendance makes no sense without a student. 40 | - Used **aggregation** between `Course` and `Schedule`—allowing schedule reuse and independent updates. 41 | 42 | --- 43 | 44 | ## 4. Lessons Learned About Object-Oriented Design 45 | 46 | This exercise improved my grasp of key OOP concepts: 47 | 48 | - ✅ **Cohesion and Responsibility:** 49 | Every class must serve a single, clear purpose. 50 | 51 | - ✅ **Encapsulation:** 52 | Grouping attributes and behaviors logically supports maintainability. 53 | 54 | - ✅ **Loose Coupling:** 55 | Design should support changes in one area without affecting others. 56 | 57 | - ✅ **Reusability & Extensibility:** 58 | Flexible design eases future updates and integration. 59 | 60 | > 📌 **Final Insight:** 61 | > Modeling is not about capturing *everything* - it's about capturing the *right things*. A clear, clean domain model simplifies everything from database design to implementation and testing. 62 | 63 | -------------------------------------------------------------------------------- /Reflection-Assigment7.md: -------------------------------------------------------------------------------- 1 | ## Reflection 2 | 3 | ### Challenges in Agile Development Management 4 | - **Template Selection**: Choosing the right template for Agile development required careful evaluation. The goal was to ensure efficient task tracking, sprint planning, and workflow visualization. 5 | - **Customization**: Balancing simplicity with necessary features was crucial. Essential functionalities like user roles, task dependencies, and workflow automation needed to be incorporated. 6 | - **Integration with Issues**: Planning was necessary to ensure a seamless connection between Kanban tasks and GitHub Issues. The integration should support real-time updates, maintain data consistency, and minimize manual effort. 7 | 8 | After selecting the Kanban template, the Automated Kanban template was not available by default due to GitHub's recent update to its Projects system. Instead, GitHub now provides a more flexible custom board setup, requiring manual setup of automated Kanban workflows. 9 | 10 | ### Steps to Automate Task Movements using GitHub Actions 11 | #### Install GitHub Command Line 12 | - Since the workflow uses GitHub CLI (`gh project item update`), the `gh` CLI must be installed on my machine. 13 | 14 | #### Authenticate GitHub CLI with a Personal Access Token (PAT) 15 | - Since GitHub Actions runs in a CI/CD environment, it needs a GitHub Token with proper permissions. 16 | 17 | #### Generate a Personal Access Token (PAT) 18 | - Used for Continuous Integration/Deployment and pipelines to authenticate and perform automated deployments. 19 | 20 | ### Comparison of GitHub Projects, Trello, and Jira 21 | | Feature | GitHub Projects | Trello | Jira | 22 | |-------------------|---------------|--------|------| 23 | | **Agile Support** | Yes, supports Kanban and customizable workflows | Basic Agile support via Kanban boards | Advanced support for Scrum, Kanban, and SAFe | 24 | | **Automation** | Built-in automation via GitHub Actions and project rules | Limited (Power-Ups required for automation) | Extensive automation with customizable rules and integrations | 25 | | **Issue Tracking** | Fully integrated with GitHub Issues | Separate (requires third-party tools for issue tracking) | Advanced issue tracking with backlog management, sprints, and reporting | 26 | | **Customization** | Moderate (Limited board customization, but flexible labels and fields) | Highly customizable (Power-Ups, labels, workflows) | Highly customizable (Custom workflows, reports, dashboards) | 27 | | **Collaboration** | Best for Dev Teams (Direct GitHub repo integration) | Great for General Teams (Easy to use, integrates with many apps) | Best for Large Teams (Comprehensive collaboration features) | 28 | | **Best For** | Developers & GitHub Users managing code-related tasks | Small teams & simple task management | Large organizations with structured Agile workflows | 29 | | **Cost** | Free for basic use (Paid plans available) | Free for individuals (Paid features via Power-Ups) | Paid (Limited free plan, full features require subscription) | 30 | -------------------------------------------------------------------------------- /Reflection_Assigment_8.md: -------------------------------------------------------------------------------- 1 | # Reflection 2 | 3 | --- 4 | 5 | ## 1. Challenges in Choosing Granularity for States and Actions 6 | 7 | Finding the appropriate level of detail is a major challenge when designing Activity Diagrams (ADs) and State Transition Diagrams (STDs). 8 | 9 | ### Key Challenges: 10 | - **Too Elaborate**: Diagrams become cluttered and hard to interpret, leading to maintenance issues. 11 | - **Too Abstract**: Critical system behavior may be overlooked, reducing accuracy. 12 | 13 | ### Example: 14 | - **Modeling Student State**: 15 | Should there be just one "Enrolled" state, or should we distinguish between "Registered", "Verified", and "Active"? 16 | - **Attendance Marking**: 17 | Should every teacher action be collapsed into a single "Mark Attendance" node, or broken down into multiple steps? 18 | 19 | ### Best Practices: 20 | - Use **high-level states** for clarity. 21 | - Employ **nested states** or **sub-diagrams** when more detail is necessary. 22 | - Model from the **user’s perspective**—developers might prefer technical details, but simplicity aids usability. 23 | 24 | --- 25 | 26 | ## 2. Aligning Agile User Stories with Diagrams 27 | 28 | Agile development focuses on **user-centric**, incremental builds, while UML diagrams often attempt to model the entire system upfront. 29 | 30 | ### Challenges: 31 | - **Rigid structure** of diagrams doesn't always align with Agile's **flexibility**. 32 | - **Traceability** becomes complex when one user story affects multiple diagrams or flows. 33 | 34 | ### Example: 35 | - **User Story**: "As a Teacher, I want to mark attendance for my class." 36 | - **Activity Diagram**: Login → Select Class → Mark Present/Absent → Submit 37 | - **State Diagram**: 38 | - *Student*: Present ↔ Absent 39 | - *System*: Draft → Submitted 40 | - Agile iteration may later add "Bulk Marking" or "AI-based Attendance", requiring diagram updates. 41 | 42 | ### Perfect Practice: 43 | - Use **lightweight diagrams** that are easy to evolve with Agile sprints. 44 | - Prefer **modular diagrams** over monolithic ones. 45 | - Focus on **core workflows** first—perfect coverage can come later. 46 | 47 | --- 48 | 49 | ## 3. Comparing State Diagrams vs. Activity Diagrams 50 | 51 | | **Aspect** | **State Transition Diagram (STD)** | **Activity Diagram (AD)** | 52 | |------------------|--------------------------------------------------------------------|-------------------------------------------------------------| 53 | | **Focus** | Object behavior over time | Process and workflow execution | 54 | | **Use Case** | Lifecycle of objects (e.g., a student from registration to grad) | Task sequences (e.g., a teacher marking attendance) | 55 | | **Example** | Student: Unregistered → Registered → Verified → Graduated | Login → Select Class → Mark → Submit | 56 | | **Best for** | Modeling constraints (e.g., avoid duplicate attendance) | Understanding user flow and decision points | 57 | | **Challenges** | Choosing meaningful states, concurrency | Managing complexity when multiple actors are involved | 58 | 59 | --- 60 | 61 | ## Lessons Learned: Reflection on System Modeling 62 | 63 | ### Granularity in Diagrams: 64 | - Balance between **detail and abstraction** is key. 65 | - Use **nested states** where deeper clarity is needed. 66 | - Always model with the **end user** in mind. 67 | 68 | ### Agile Compatibility: 69 | - Traditional UML may be out of sync with Agile flow. 70 | - Diagrams can become obsolete as user stories change. 71 | - Use **modular, updatable, lightweight diagrams** to support agile iterations. 72 | 73 | ### Combining Diagram Types: 74 | - **STDs** model system rules and object states. 75 | - **ADs** highlight user interactions and task flows. 76 | - Combining both gives a **complete view** of the system from both behavioral and functional perspectives. 77 | -------------------------------------------------------------------------------- /Report Generation Workflow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ndelelo/Student-Attendance-Management-System/af0ce317c8f19fe74b84847fa5a29462694c94be/Report Generation Workflow.png -------------------------------------------------------------------------------- /SPECIFICATION.md: -------------------------------------------------------------------------------- 1 | ## Introduction 2 | 3 | ### Project: Student Attendance Management System 4 | 5 | ### Domain: Education Technology 6 | - This project focus on educational technology category, specifically in the direction of academic administration and student management systems. The tool will improving teaching and learning experience, and also improving administrative work within educational institutions is the meaning of educational technology. 7 | - The main goal is to replace manually attendance tracking systems with an automated, trustworthy digital counterpart, the Student Attendance Management System is a vital crossroads of information technology and academic administration. The system will utilize advanced technologies to monitor an elementary administrative process with an emphasis on institutional compliance, resource utilization, and monitoring of academic achievement. 8 | 9 | ### Problem Statement: 10 | Globally Educational institutions face significant challenges with traditional attendance management methods, which mostly rely on paper-based systems . This digital Student Attendance Management System automates will reduce paperwork, improving accuracy, and enabling real-time reporting for students, teachers, and administrators. 11 | **These conventional approaches present several critical issues:** 12 | 1. **Inefficiency and Time Consumption**:Manual attendance registration destabilize valuable classroom time from teaching activities. 13 | 2. **Delayed Analysis and Reporting**:Manual compilation of attendance records delays the findings of attendance patterns and at-risk students. 14 | 3. **Communication Gaps**:Traditional systems lack immediate notification capabilities for administrators and teachers regarding attendance issues. 15 | 4. **Limited Accessibility**:Physical attendance records are difficult to access remotely and across departments. 16 | 17 | ### Individual Scope: 18 | As an individual contributor, I will develop a simplified version of the **Student Attendance Management System** focusing on: 19 | - **User Authentication** (Students & Teachers login/register) 20 | - **Attendance Marking** (Students mark attendance; Teachers verify it) 21 | - **Attendance Records Management** (View attendance history, generate reports) 22 | 23 | #### C4 Diagrams Representation: 24 | - **C1: Context Diagram** (Overall system interactions) 25 | - **C2: Container Diagram** (Frontend, Backend, Database separation) 26 | - **C3: Component Diagram** (Key services like Authentication, Attendance Management) 27 | - **C4: Code Diagram** (Class structure for main components) 28 | -------------------------------------------------------------------------------- /Sprint Plan.md: -------------------------------------------------------------------------------- 1 | # Sprint Planning 2 | 3 | ## Sprint Goal 4 | The goal of this sprint is to implement core authentication, attendance tracking, and reporting features to establish the foundation of the system. 5 | This sprint focuses on user authentication, manual attendance tracking, and basic reporting, ensuring that stakeholders can securely log in, record attendance, and access reports—critical functionalities for the Minimum Viable Product (MVP). 6 | 7 | 8 | --- 9 | 10 | ## Sprint Backlog Table 11 | 12 | | Task ID | Task Description | Assigned To | Estimated Hours | Status | 13 | |---------|-----------------|-------------|----------------|--------| 14 | | T-001 | Develop user authentication (login/logout) API | Backend Dev | 8 | To Do | 15 | | T-002 | Implement role-based access control | Backend Dev | 6 | To Do | 16 | | T-003 | Design and develop login UI | Frontend Dev | 6 | To Do | 17 | | T-004 | Develop manual attendance marking interface | Frontend Dev | 6 | To Do | 18 | | T-005 | Implement attendance data storage and retrieval | Backend Dev | 8 | To Do | 19 | | T-006 | Create an API to generate attendance reports | Backend Dev | 6 | To Do | 20 | | T-007 | Implement AES-256 encryption for sensitive data | Security Engineer | 10 | To Do | 21 | | T-008 | Write unit tests for authentication and attendance features | QA Team | 5 | To Do | 22 | 23 | --- 24 | 25 | ## Sprint Goal Justification 26 | This sprint lays the foundation for secure authentication, attendance tracking, and reporting, ensuring that students, teachers, and admins can access and use core system functionalities safely. 27 | These features are essential for the MVP, enabling early testing and feedback before expanding functionality. 28 | -------------------------------------------------------------------------------- /Stakeholder Analysis.md: -------------------------------------------------------------------------------- 1 | ## Stakeholder Analysis Table 2 | --- 3 | | Stakeholder | Role & Responsibilities | Key Concerns | Pain Points | Success Metrics | 4 | |------------------------|-----------------------------------------------|-----------------------------------------------|--------------------------------------------------|------------------------------------------------| 5 | | **Students** | Primary users of the system | Accurate attendance, easy access, fairness | Manual tracking, lack of real-time data | 95%+ accuracy, real-time access, clear rules | 6 | | **Teachers** | Tracking and monitoring attendance | Fast attendance marking, reporting | Time-consuming, inconsistent methods | 80% reduction in marking time, instant reports | 7 | | **Administrators** | System managers, strategic planners | Compliance, student tracking, resource planning | Fragmented systems, manual compilation | Digital tracking, predictive analytics | 8 | | **Parents** | Monitoring student progress | Real-time visibility, early warnings | Limited transparency, delayed notifications | Instant alerts, detailed monthly reports | 9 | | **IT Department** | Technical implementation, maintenance | Security, scalability, integration | High maintenance, legacy system issues | 99.9% uptime, seamless integration | 10 | | **Policy Makers** | Policy development, standardization | Data-driven decisions, benchmarking | Lack of insights, complex data aggregation | Faster policy cycle, data-backed policies | 11 | | **External Auditors** | Quality assurance, compliance enforcement | Verifiable records, compliance, integrity | Manual verification, inconsistent documentation | Tamper-proof records, instant audit trails | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /Student Graduation Workflow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ndelelo/Student-Attendance-Management-System/af0ce317c8f19fe74b84847fa5a29462694c94be/Student Graduation Workflow.png -------------------------------------------------------------------------------- /Student Registration Workflow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ndelelo/Student-Attendance-Management-System/af0ce317c8f19fe74b84847fa5a29462694c94be/Student Registration Workflow.png -------------------------------------------------------------------------------- /Swagger UI for Student Attendance.md: -------------------------------------------------------------------------------- 1 | # Swagger UI for Student Attendance System 2 | 3 | FastAPI automatically provides **interactive API documentation** using Swagger UI. 4 | 5 | --- 6 | 7 | ## 🔗 Accessing Swagger UI 8 | 9 | Once the app is running (via `uvicorn main:app --reload`), open your browser and visit: 10 | 11 | **Swagger UI**: [http://localhost:8000/docs](http://localhost:8000/docs) 12 | 13 | --- 14 | 15 | ## 📷 Swagger UI Screenshots 16 | 17 | ### 1. Overview Page 18 | ![Swagger UI](Swagger%20UI.JPG) 19 | 20 | --- 21 | 22 | ### 2. Student API Example 23 | ![Student Endpoint - Swagger](Swagger2.JPG) 24 | 25 | --- 26 | 27 | ### 3. Attendance API Example 28 | ![Attendance Endpoint - Swagger](Swagger3.JPG) 29 | 30 | --- 31 | 32 | ## 🧾 What You Can Do in Swagger UI 33 | 34 | - Test endpoints live (`GET`, `POST`, `PUT`, `DELETE`) 35 | - View detailed request/response formats 36 | - Inspect models, validations, and schemas 37 | - Download the full `openapi.json` 38 | 39 | --- 40 | 41 | -------------------------------------------------------------------------------- /Swagger UI.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ndelelo/Student-Attendance-Management-System/af0ce317c8f19fe74b84847fa5a29462694c94be/Swagger UI.JPG -------------------------------------------------------------------------------- /Swagger2.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ndelelo/Student-Attendance-Management-System/af0ce317c8f19fe74b84847fa5a29462694c94be/Swagger2.JPG -------------------------------------------------------------------------------- /Swagger3.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ndelelo/Student-Attendance-Management-System/af0ce317c8f19fe74b84847fa5a29462694c94be/Swagger3.JPG -------------------------------------------------------------------------------- /System Requirements.md: -------------------------------------------------------------------------------- 1 | ## Functional Requirements 2 | 3 | | ID | Requirement Description | Stakeholder(s) | 4 | |----|--------------------------|---------------| 5 | | **FR1** | The system shall allow teachers to mark attendance manually or through automated methods (biometric, RFID). | Teachers, Administrators | 6 | | **FR2** | The system shall provide students access to view their attendance records. | Students | 7 | | **FR3** | The system shall allow administrators to generate attendance reports for analysis. | Administrators | 8 | | **FR4** | The system shall send automated alerts to parents if a student is absent. | Parents, Administrators | 9 | | **FR5** | The system shall integrate with the institution's existing database. | IT Department | 10 | | **FR6** | The system shall support multiple authentication methods (e.g., username/password, biometric). | Students, Teachers, Administrators | 11 | 12 | ## Non-Functional Requirements 13 | 14 | | ID | Requirement Description | Priority | 15 | |----|-------------------------|----------| 16 | | **NFR1** | The system shall be available 99.5% of the time to ensure continuous operation. | High | 17 | | **NFR2** | The system shall process attendance data in real-time with a response time of less than 2 seconds. | High | 18 | | **NFR3** | The system shall comply with data security regulations (e.g., GDPR, FERPA). | High | 19 | | **NFR4** | The system shall support at least 500 concurrent users. | Medium | 20 | | **NFR5** | The system shall provide a user-friendly interface accessible on desktop and mobile devices. | High | 21 | 22 | ## Traceability Matrix 23 | 24 | | Requirement ID | Related Stakeholder Need | 25 | |---------------|-------------------------| 26 | | **FR1** | Teachers need an easy way to mark attendance | 27 | | **FR2** | Students need to check their attendance records | 28 | | **FR3** | Administrators need to generate attendance reports | 29 | | **FR4** | Parents need alerts about student absences | 30 | | **FR5** | IT Department needs system integration | 31 | | **FR6** | Security is required for authentication | 32 | | **NFR1** | Continuous system operation is required | 33 | | **NFR2** | The system must provide real-time attendance tracking | 34 | | **NFR3** | The system must comply with data security regulations | 35 | | **NFR4** | The system should handle high user traffic | 36 | | **NFR5** | The system should provide a user-friendly interface | 37 | -------------------------------------------------------------------------------- /Teacher Resignation Workflow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ndelelo/Student-Attendance-Management-System/af0ce317c8f19fe74b84847fa5a29462694c94be/Teacher Resignation Workflow.png -------------------------------------------------------------------------------- /Test Case.md: -------------------------------------------------------------------------------- 1 | # Test Case Development 2 | 3 | ## Functional Requirements 4 | 5 | ### Test Case Table 6 | 7 | | **Test Case ID** | **Requirement ID** | **Description** | **Steps** | **Expected Result** | **Actual Result** | **Status (Pass/Fail)** | 8 | |---------------|---------------|--------------------|--------|-------------------|----------------|----------------| 9 | | TC-001 | FR-001 | User Authentication | 1. Enter valid credentials. 2. Click "Login". | User should be successfully logged in based on role. | Successfully logged | Pass | 10 | | TC-002 | FR-001 | Login Lockout after 3 Failed Attempts | 1. Enter incorrect credentials 3 times. 2. Try to log in again. | User should be locked out and prompted with recovery options. | Unsuccessfully locked out | Fail | 11 | | TC-003 | FR-002 | Manual Attendance Input | 1. Teacher enters student attendance manually. 2. Click "Submit". | Attendance should be successfully marked with timestamp and saved. | Successfully submitted | Pass | 12 | | TC-004 | FR-002 | RFID Card Support for Attendance | 1. Student scans RFID card. 2. Check attendance status. | Attendance should be automatically marked and timestamped. | Not yet active | Fail | 13 | | TC-005 | FR-003 | Generate Individual Student Attendance Report | 1. Teacher/admin selects a student. 2. Generate report for daily, weekly, monthly. | Report is generated showing presence, absences, and late entries. | Can be able to select student | Fail | 14 | | TC-006 | FR-004 | Automatic Alerts for Low Attendance | 1. Student attendance falls below threshold. 2. Check alert. | Alert should be automatically triggered and sent via email/SMS. | Successfully generate Alert | Pass | 15 | | TC-007 | FR-006 | Generate Monthly Attendance Analytics | 1. Admin generates monthly attendance report. 2. Analyze trends. | Report should show monthly attendance trends with statistical analysis. | Able to generate report | Pass | 16 | | TC-008 | FR-007 | Mobile Accessibility | 1. Open system on mobile app (iOS/Android). 2. Perform actions like attendance marking. | UI should be responsive, and functions should work smoothly on mobile. | Not yet implemented | Fail | 17 | 18 | 19 | 20 | ## Data Backup and Recovery 21 | 22 | ### Test Case Table 23 | 24 | | **Test Case ID** | **Requirement ID** | **Description** | **Steps** | **Expected Result** | **Actual Result** | **Status (Pass/Fail)** | 25 | |---------------|---------------|--------------------|--------|-------------------|----------------|----------------| 26 | | TC-013 | FR-009 | Automatic Data Backup | 1. Schedule automatic backups. 2. Verify backup completion after the scheduled time. | Backup should complete successfully and be verified for integrity. | Can’t be tested now | N/A | 27 | | TC-014 | FR-009 | Data Recovery Process | 1. Simulate data loss. 2. Initiate recovery process using backup data. | Data should be restored to the state it was at the time of backup. | Can’t be tested now | N/A | 28 | 29 | 30 | 31 | ## Integration with External Systems 32 | 33 | ### Test Case Table 34 | 35 | | **Test Case ID** | **Requirement ID** | **Description** | **Steps** | **Expected Result** | **Actual Result** | **Status (Pass/Fail)** | 36 | |---------------|---------------|--------------------|--------|-------------------|----------------|----------------| 37 | | TC-015 | FR-010 | API Integration with LMS | 1. Initiate integration between the attendance system and LMS. 2. Verify synchronization of attendance data. | Attendance data should be synchronized between the systems without discrepancies. | It can relate to other system now | N/A | 38 | | TC-016 | FR-010 | Data Synchronization with SIS | 1. Update attendance in the system. 2. Verify that the updated data appears in the SIS. | Attendance data should automatically update and synchronize in the SIS. | It can relate to other system for now | N/A | 39 | 40 | --- 41 | 42 | ## Non-Functional Requirements 43 | 44 | ### Performance Testing 45 | 46 | | **Test Case ID** | **Requirement ID** | **Description** | **Steps** | **Expected Result** | **Actual Result** | **Status (Pass/Fail)** | 47 | |---------------|---------------|--------------------|--------|-------------------|----------------|----------------| 48 | | TC-009 | NFR-001 | Load Testing with 1000 Concurrent Users | 1. Simulate 1000 concurrent users. 2. Perform typical actions (e.g., logging in, attendance input). | System should perform all actions within 3 seconds per operation. | Unable to perform the task | Fail | 49 | | TC-010 | NFR-001 | Peak Usage Performance | 1. Simulate peak usage between 8:00–9:00 AM. 2. Record system response time for 95% of attendance records. | Response time for 95% of operations should be ≤ 2 seconds. | Test can be done for now | Fail | 50 | 51 | 52 | 53 | ### Security Testing 54 | 55 | | **Test Case ID** | **Requirement ID** | **Description** | **Steps** | **Expected Result** | **Actual Result** | **Status (Pass/Fail)** | 56 | |---------------|---------------|--------------------|--------|-------------------|----------------|----------------| 57 | | TC-011 | NFR-002 | Test TLS 1.3 Encryption | 1. Simulate data exchange between client and server. 2. Inspect data transmission. | TLS 1.3 encryption with strong cipher suites should be used. | Cannot be done on system current state | Fail | 58 | | TC-012 | NFR-002 | Role-Based Access Control | 1. Log in as student, teacher, admin with different credentials. 2. Try accessing restricted data. | Each user role should only have access to relevant data based on permissions. | Student successfully logged in and unable to access restricted data | Pass | 59 | 60 | 61 | 62 | 63 | 64 | 65 | ----- 66 | 67 | # Reflection 68 | 69 | Translating requirements into tests for a **Student Attendance Management System** was challenging due to several factors. Some key challenges include: 70 | 71 | ## 1. Features Yet to be Implemented 72 | Multiple test cases, such as **RFID card support, mobile accessibility, and API integration**, either failed or could not be assessed due to the features not being active or implemented at this time. 73 | 74 | **Challenge:** The alignment of test cases with the development progress necessitates regular updates. 75 | 76 | ## 2. Insufficient Requirements 77 | Several test cases, such as **TC-002 related to login lockout**, did not pass because the requirements regarding the expected behavior were not clearly defined. For instance, the system failed to lock the user out as intended. 78 | 79 | **Challenge:** It is essential for requirements to outline specific expected behaviors to prevent inconsistencies in test outcomes. 80 | 81 | ## 3. Limitations of Performance Testing 82 | The **load testing (TC-009) and peak usage performance (TC-010)** failed as the system was unable to manage a significant volume of concurrent users effectively. 83 | 84 | **Challenge:** The evaluation of performance necessitates the use of simulation tools and infrastructure that can accommodate extensive testing scenarios. 85 | 86 | ## 4. Limitations in Security Testing 87 | The **testing for TLS 1.3 encryption (TC-011)** was not able to be conducted because of limitations within the system. 88 | 89 | **Challenge:** The process of security testing necessitates the use of specialized tools and configurations, which may not be accessible in the initial stages of development. 90 | 91 | ## 5. Challenges in Integration 92 | The testing of **API integration with Learning Management Systems (LMS) and Student Information Systems (SIS) (TC-015 & TC-016)** was not possible due to the incomplete status of the integration. 93 | 94 | **Challenge:** Coordination with third-party systems is essential due to external system dependencies and the need for data synchronization. 95 | 96 | ## 6. Issues Related to Data Backup and Recovery Testing 97 | The execution of test cases for **automatic backup and data recovery (TC-013 & TC-014)** was not possible. 98 | 99 | **Challenge:** Simulating data loss and assessing the effectiveness of recovery processes necessitates a carefully managed test environment. 100 | 101 | ## 7. User Experience and Mobile Compatibility 102 | The **mobile accessibility testing (TC-008)** did not pass because the system has not been configured for mobile usage. 103 | 104 | **Challenge:** Achieving cross-platform usability necessitates thorough **UI/UX testing** across various devices. 105 | 106 | -------------------------------------------------------------------------------- /Test Cover.md: -------------------------------------------------------------------------------- 1 | ## Test Coverage 2 | 3 | | Test Case | Status | 4 | |------------------------------------------|--------| 5 | | test_abstract_factory_dark_button | ✅ ok | 6 | | test_abstract_factory_light_button | ✅ ok | 7 | | test_builder_report | ✅ ok | 8 | | test_factory_email_notification | ✅ ok | 9 | | test_factory_invalid_method | ✅ ok | 10 | | test_factory_sms_notification | ✅ ok | 11 | | test_object_pool_connection_reuse | ✅ ok | 12 | | test_object_pool_exhaustion | ✅ ok | 13 | | test_prototype_course_clone | ✅ ok | 14 | | test_singleton_logger | ✅ ok | 15 | 16 | ## ✅ Test Summary 17 | 18 | - ✅ **10 tests** were discovered and run 19 | - ✅ **Every creational pattern was covered:** 20 | - **Singleton:** Logger 21 | - **Factory Method:** Email & SMS notification creation 22 | - **Abstract Factory:** UI themes 23 | - **Builder:** Attendance report 24 | - **Prototype:** Course template cloning 25 | - **Object Pool:** Simulated DB connection reuse and exhaustion 26 | 27 | --- 28 | 29 | ## 📊 Coverage Breakdown 30 | 31 | | File | Coverage | Notes | 32 | |----------------------------|----------|------------------------------------------------------------------------| 33 | | `main.py` | 72% | Some logic still untested — could be edge cases, error handling, or branches. | 34 | | `test_creational_patterns.py` | 98% | Excellent — nearly all test code is executed. | 35 | | **Total** | **81%** | Above average. | 36 | -------------------------------------------------------------------------------- /USERCASE.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ndelelo/Student-Attendance-Management-System/af0ce317c8f19fe74b84847fa5a29462694c94be/USERCASE.png -------------------------------------------------------------------------------- /Unit Tests Report.md: -------------------------------------------------------------------------------- 1 | # Unit Tests Report 2 | 3 | ## Overview 4 | 5 | This report summarizes the results of the unit tests for the business logic of the Student Attendance Management System. The tests were conducted using `pytest` on 03-May-2025 at 23:35:37, and the report was generated with `pytest-html` v4.1.1. 6 | 7 | ## Environment 8 | 9 | - **Python**: 3.13.1 10 | - **Platform**: Windows-10-10.0.19045-SP0 11 | - **Packages**: 12 | - `pytest`: 8.3.5 13 | - `pluggy`: 1.5.0 14 | - **Plugins**: 15 | - `anyio`: 4.9.0 16 | - `html`: 4.1.1 17 | - `metadata`: 3.1.1 18 | 19 | ## Test Summary 20 | 21 | - **Total tests**: 29 22 | - **Duration**: 14 ms 23 | - **Results**: 24 | - **Passed**: 29 25 | - **Failed**: 0 26 | - **Skipped**: 0 27 | - **Expected Failures**: 0 28 | - **Unexpected Passes**: 0 29 | - **Errors**: 0 30 | - **Reruns**: 0 31 | 32 | ## Detailed Results 33 | 34 | | Test | Result | Duration | 35 | |------|--------|----------| 36 | | `tests/test_attendance_service.py::TestAttendanceService::test_get_attendance_by_student_and_course` | Passed | 1 ms | 37 | | `tests/test_attendance_service.py::TestAttendanceService::test_mark_attendance_duplicate` | Passed | 1 ms | 38 | | `tests/test_attendance_service.py::TestAttendanceService::test_mark_attendance_success` | Passed | 1 ms | 39 | | `tests/test_course_service.py::TestCourseService::test_create_course_duplicate_code` | Passed | 1 ms | 40 | | `tests/test_course_service.py::TestCourseService::test_create_course_success` | Passed | 1 ms | 41 | | `tests/test_course_service.py::TestCourseService::test_delete_course` | Passed | 1 ms | 42 | | `tests/test_course_service.py::TestCourseService::test_delete_course_not_found` | Passed | 1 ms | 43 | | `tests/test_course_service.py::TestCourseService::test_get_all_courses` | Passed | 0 ms | 44 | | `tests/test_course_service.py::TestCourseService::test_get_course_by_code` | Passed | 0 ms | 45 | | `tests/test_course_service.py::TestCourseService::test_get_course_by_code_not_found` | Passed | 0 ms | 46 | | `tests/test_course_service.py::TestCourseService::test_get_course_by_id` | Passed | 0 ms | 47 | | `tests/test_course_service.py::TestCourseService::test_get_course_not_found` | Passed | 0 ms | 48 | | `tests/test_course_service.py::TestCourseService::test_search_courses_by_name` | Passed | 0 ms | 49 | | `tests/test_course_service.py::TestCourseService::test_update_course` | Passed | 0 ms | 50 | | `tests/test_course_service.py::TestCourseService::test_update_course_duplicate_code` | Passed | 0 ms | 51 | | `tests/test_course_service.py::TestCourseService::test_update_course_not_found` | Passed | 1 ms | 52 | | `tests/test_student_service.py::TestStudentService::test_create_student_duplicate_email` | Passed | 1 ms | 53 | | `tests/test_student_service.py::TestStudentService::test_create_student_duplicate_id` | Passed | 0 ms | 54 | | `tests/test_student_service.py::TestStudentService::test_create_student_success` | Passed | 0 ms | 55 | | `tests/test_student_service.py::TestStudentService::test_delete_student` | Passed | 0 ms | 56 | | `tests/test_student_service.py::TestStudentService::test_delete_student_not_found` | Passed | 0 ms | 57 | | `tests/test_student_service.py::TestStudentService::test_get_all_students` | Passed | 0 ms | 58 | | `tests/test_student_service.py::TestStudentService::test_get_student_by_id` | Passed | 0 ms | 59 | | `tests/test_student_service.py::TestStudentService::test_get_student_by_student_id` | Passed | 0 ms | 60 | | `tests/test_student_service.py::TestStudentService::test_get_student_by_student_id_not_found` | Passed | 0 ms | 61 | | `tests/test_student_service.py::TestStudentService::test_get_student_not_found` | Passed | 1 ms | 62 | | `tests/test_student_service.py::TestStudentService::test_update_student` | Passed | 0 ms | 63 | | `tests/test_student_service.py::TestStudentService::test_update_student_duplicate_email` | Passed | 0 ms | 64 | | `tests/test_student_service.py::TestStudentService::test_update_student_not_found` | Passed | 0 ms | 65 | 66 | ## Visual Report 67 | 68 | ![Unit Tests Report](Unit%20tests.JPG) 69 | 70 | ## Conclusion 71 | 72 | All 29 unit tests have passed successfully, indicating that the business logic of the Student Attendance Management System is functioning as expected. 73 | -------------------------------------------------------------------------------- /Unit tests.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ndelelo/Student-Attendance-Management-System/af0ce317c8f19fe74b84847fa5a29462694c94be/Unit tests.JPG -------------------------------------------------------------------------------- /Use Case Diagram.md: -------------------------------------------------------------------------------- 1 | ## Use Case Diagram 2 | 3 | ![Use Case Diagram](USERCASE.png) 4 | 5 | ## Key Actors and Their Roles 6 | 7 | ### **1. Student** 8 | - Marks their attendance. 9 | - Requests leave for absence (approved/rejected by teacher). 10 | - Verifies attendance records and reports discrepancies. 11 | - Ensures accuracy in attendance tracking. 12 | 13 | ### **2. Teacher** 14 | - Takes and updates attendance records. 15 | - Views attendance data. 16 | - Approves or rejects student leave requests. 17 | - Modifies attendance records for errors. 18 | - Ensures accurate attendance tracking. 19 | 20 | ### **3. Administrator** 21 | - Manages the overall system. 22 | - Generates attendance reports and monitors trends. 23 | - Ensures compliance with attendance policies. 24 | - Works with teachers for attendance correction and reporting. 25 | - Addresses system issues and updates. 26 | 27 | ### **4. Parent** 28 | - Monitors student attendance records. 29 | - Communicates with teachers for attendance concerns. 30 | - Helps improve student discipline and punctuality. 31 | - Submits leave requests on behalf of the student. 32 | 33 | ### **5. IT Department** 34 | - Manages technical aspects of the system. 35 | - Maintains system security. 36 | - Handles data backups and recovery. 37 | - Works with administrators for system configurations. 38 | - Integrates with learning management systems. 39 | 40 | ### **6. External Auditors** 41 | - Verify accuracy of attendance records. 42 | - Ensure compliance with regulations. 43 | - Access tamper-proof attendance logs. 44 | - Generate compliance reports for legal and academic review. 45 | 46 | ### **7. Academic Policymakers** 47 | - Define institutional attendance policies. 48 | - Evaluate attendance impact on academic performance. 49 | - Enforce regulations based on auditor reports. 50 | - Ensure universities/colleges follow attendance regulations. 51 | -------------------------------------------------------------------------------- /Use Case Specifications.md: -------------------------------------------------------------------------------- 1 | ## Use Case Specifications 2 | 3 | ### **Use Case: Mark Attendance** 4 | **Actor:** Teacher 5 | **Precondition:** 6 | - Teacher is logged into the system. 7 | - The class session is scheduled, and the list of students is available. 8 | - The system is operational, and the student attendance records are accessible. 9 | **Postcondition:** 10 | - Attendance is recorded successfully for each student. 11 | - Attendance data is saved in the system for future reference and reporting. 12 | **Basic Flow:** 13 | 1. The teacher logs into the system. 14 | 2. The teacher selects the class session for which they need to mark attendance. 15 | 3. The system displays the list of registered students for that session. 16 | 4. The teacher marks each student's attendance as present or absent. 17 | 5. The teacher submits the attendance record. 18 | 6. The system saves the attendance data and confirms the successful recording of attendance. 19 | 20 | --- 21 | 22 | ### **Use Case: View Attendance Record** 23 | **Actor:** Parent/Teacher 24 | **Precondition:** 25 | - The user is logged into the system. 26 | - The user has the necessary permissions to view attendance records. 27 | **Postcondition:** 28 | - Attendance history is displayed for the selected student. 29 | **Basic Flow:** 30 | 1. The user logs into the system. 31 | 2. The user navigates to the Attendance section. 32 | 3. The system displays a list of available records (student, class, or date range). 33 | 4. The user selects the desired student or date range. 34 | 5. The system displays the detailed attendance record. 35 | 6. The user can view or print the attendance history. 36 | 37 | --- 38 | 39 | ### **Use Case: Apply for Leave** 40 | **Actor:** Student 41 | **Precondition:** 42 | - The student or parent is logged into the system. 43 | - The student is enrolled in the class for which they wish to apply for leave. 44 | - The leave request has a valid reason such as illness or personal matters. 45 | **Postcondition:** 46 | - The leave request is successfully submitted for approval. 47 | - The system updates the student's leave status to "pending" until reviewed. 48 | **Basic Flow:** 49 | 1. The student or parent logs into the system. 50 | 2. The student navigates to the "Leave Request" section. 51 | 3. The student selects the class and dates for the leave. 52 | 4. The student enters a reason for the leave. 53 | 5. The student submits the request. 54 | 6. The system stores the leave request and notifies the teacher or admin for approval. 55 | 56 | --- 57 | 58 | ### **Use Case: Approve Leave Requests** 59 | **Actor:** Teacher 60 | **Precondition:** 61 | - The teacher or admin is logged into the system. 62 | - There is at least one pending leave request for review. 63 | - The teacher or admin has the necessary permissions to approve or deny leave requests. 64 | **Postcondition:** 65 | - The leave request is either approved or denied. 66 | - The student’s attendance status is updated accordingly. 67 | **Basic Flow:** 68 | 1. The teacher or admin logs into the system. 69 | 2. The teacher navigates to the "Leave Requests" section. 70 | 3. The teacher reviews the list of pending requests. 71 | 4. The teacher decides whether to approve or deny the leave. 72 | 5. The system updates the leave status in the student’s attendance record. 73 | 74 | --- 75 | 76 | ### **Use Case: Generate Attendance Reports** 77 | **Actor:** Administrator 78 | **Precondition:** 79 | - The admin is logged into the system. 80 | - The system has stored sufficient attendance data. 81 | - The admin has the required permissions to generate reports. 82 | **Postcondition:** 83 | - The report is generated and saved in the system. 84 | - The report can be downloaded or viewed by the admin. 85 | **Basic Flow:** 86 | 1. The admin logs into the system. 87 | 2. The admin navigates to the "Reports" section. 88 | 3. The admin selects the report type and filters either by date range, class, or student. 89 | 4. The system generates the report based on the selected criteria. 90 | 5. The admin reviews the report or exports it for further use. 91 | 92 | --- 93 | 94 | ### **Use Case: Backup and Restore Data** 95 | **Actor:** IT Department 96 | **Precondition:** 97 | - The IT department has the necessary permissions to access the system’s data. 98 | - The system is operational, and data is available for backup. 99 | **Postcondition:** 100 | - The attendance data is backed up and securely stored. 101 | - In the case of data corruption or loss, the data can be restored from the backup. 102 | **Basic Flow:** 103 | 1. The IT department logs into the system. 104 | 2. The IT department navigates to the "Backup" section. 105 | 3. The IT department initiates the backup process. 106 | 4. The system creates a backup of the attendance records and confirms process completion. 107 | 108 | --- 109 | 110 | ### **Use Case: Ensure Compliance** 111 | **Actor:** External Auditors 112 | **Precondition:** 113 | - The external auditor has logged into the system. 114 | - The system contains a sufficient history of attendance records for review. 115 | - The auditor has permission to access and review attendance data. 116 | **Postcondition:** 117 | - The auditor verifies that the attendance records are accurate and compliant with policies and regulations. 118 | - If discrepancies are found, the auditor may raise issues for further review or correction. 119 | **Basic Flow:** 120 | 1. The auditor logs into the system. 121 | 2. The auditor navigates to the "Compliance" section. 122 | 3. The system displays all necessary records and compliance checks. 123 | 4. The auditor reviews the attendance records for the selected period and student group. 124 | 5. The auditor cross-checks the attendance records against institutional and regulatory policies. 125 | 6. If compliant, the auditor marks the audit as successful. 126 | 7. If non-compliant, the auditor generates a report highlighting discrepancies and potential issues. 127 | 128 | --- 129 | 130 | ### **Use Case: Define Attendance Policies** 131 | **Actor:** Academic Policymakers 132 | **Precondition:** 133 | - The academic policymaker is logged into the system with the appropriate permissions to modify attendance policies. 134 | - The system is operational and capable of saving and applying the policies. 135 | **Postcondition:** 136 | - The new or modified attendance policies are saved in the system. 137 | - The system updates any relevant processes, such as notifying students or applying restrictions based on the new policies. 138 | **Basic Flow:** 139 | 1. The policymaker logs into the system. 140 | 2. The policymaker navigates to the "Attendance Policies" section. 141 | 3. The system displays the current policies. 142 | 4. The policymaker modifies or defines new policies. 143 | 5. The policymaker saves the new or modified policy. 144 | 6. The system applies the policy across all relevant student and teacher records. 145 | -------------------------------------------------------------------------------- /User Stories Table.md: -------------------------------------------------------------------------------- 1 | 2 | # Student Attendance Management System - User Stories 3 | 4 | 5 | ## 1. User Story Table 6 | 7 | | Story ID | User Story | Acceptance Criteria | Priority | 8 | |----------|------------|---------------------|----------| 9 | | US001 | As a student, I want to log in securely so that I can access my data safely. | Users must authenticate using unique credentials, with role-based access control. After three failed attempts, the account is locked. | High | 10 | | US002 | As a teacher, I want to mark student attendance manually so that I can keep records for each session. | A user-friendly interface must allow teachers to mark attendance. The system saves records in real time. | High | 11 | | US003 | As a student, I want to check in using an RFID card so that my attendance is recorded automatically. | The system must support RFID-based check-in and record timestamps. | High | 12 | | US004 | As an admin, I want to generate attendance reports so that I can analyse student attendance trends. | Reports must be available for individual students and whole classes with various timeframes (daily, weekly, monthly, yearly). | High | 13 | | US005 | As a parent, I want to receive notifications when my child is absent so that I can follow up on attendance issues. | Parents receive automated notifications via email/SMS when a student is absent. | High | 14 | | US006 | As a school administrator, I want attendance reports to show patterns so that I can make data-driven decisions. | Reports should analyse trends, showing correlations between attendance and performance. | Medium | 15 | | US007 | As a student, I want to apply for leave online so that I can request absences conveniently. | The system must allow students to submit leave requests with reasons, and update status upon approval. | Medium | 16 | | US008 | As a teacher, I want to approve or reject leave requests so that I can manage class attendance records accurately. | Teachers must be able to approve/reject requests, updating the student's attendance status accordingly. | Medium | 17 | | US009 | As a student, I want to access my attendance records so that I can track my presence in class. | The system must display a student's attendance history in an easy-to-read format. | Low | 18 | | US010 | As a system administrator, I want all student data to be encrypted with AES-256 so that security compliance is maintained. | All personal data must be encrypted in transit (TLS 1.3) and at rest (AES-256). | High | 19 | | US011 | As an admin, I want to configure attendance policies so that I can set rules for different institutions. | Admins must be able to set attendance thresholds, auto-excuse rules, and class weightage. | Medium | 20 | | US012 | As a student, I want to access the system on my phone so that I can check my attendance status on the go. | The system must provide a responsive web design and native mobile apps for iOS and Android. | High | 21 | --- 22 | -------------------------------------------------------------------------------- /api/__init__.py: -------------------------------------------------------------------------------- 1 | # This file makes the api directory a Python package -------------------------------------------------------------------------------- /api/__pycache__/__init__.cpython-313.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ndelelo/Student-Attendance-Management-System/af0ce317c8f19fe74b84847fa5a29462694c94be/api/__pycache__/__init__.cpython-313.pyc -------------------------------------------------------------------------------- /api/__pycache__/attendance_api.cpython-313.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ndelelo/Student-Attendance-Management-System/af0ce317c8f19fe74b84847fa5a29462694c94be/api/__pycache__/attendance_api.cpython-313.pyc -------------------------------------------------------------------------------- /api/__pycache__/course_api.cpython-313.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ndelelo/Student-Attendance-Management-System/af0ce317c8f19fe74b84847fa5a29462694c94be/api/__pycache__/course_api.cpython-313.pyc -------------------------------------------------------------------------------- /api/__pycache__/student_api.cpython-313.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ndelelo/Student-Attendance-Management-System/af0ce317c8f19fe74b84847fa5a29462694c94be/api/__pycache__/student_api.cpython-313.pyc -------------------------------------------------------------------------------- /api/attendance_api.py: -------------------------------------------------------------------------------- 1 | from fastapi import APIRouter, HTTPException, Request 2 | from fastapi.responses import HTMLResponse 3 | from fastapi.templating import Jinja2Templates 4 | from pydantic import BaseModel 5 | from datetime import date 6 | 7 | from services.attendance_service import AttendanceService 8 | from domain.models.attendance import Attendance 9 | from repositories.inmemory.attendance_repository import InMemoryAttendanceRepository # ✅ Added 10 | 11 | # Initialize repository and service properly 12 | attendance_repository = InMemoryAttendanceRepository() 13 | attendance_service = AttendanceService(repository=attendance_repository) 14 | 15 | router = APIRouter() 16 | templates = Jinja2Templates(directory="templates") 17 | 18 | class AttendanceRequest(BaseModel): 19 | student_id: str 20 | course_id: str 21 | date: date 22 | 23 | @router.post("/") 24 | def mark_attendance(data: AttendanceRequest): 25 | if attendance_service.attendance_exists(data.student_id, data.course_id, data.date): 26 | raise HTTPException(status_code=400, detail="Attendance already marked") 27 | 28 | record = Attendance( 29 | student_id=data.student_id, 30 | course_id=data.course_id, 31 | date=data.date 32 | ) 33 | attendance_service.mark_attendance(record) 34 | return {"message": "Attendance recorded"} 35 | 36 | @router.get("/") 37 | def list_attendance(): 38 | return attendance_service.get_all_attendance() 39 | 40 | @router.get("/student/{student_id}") 41 | def get_attendance_by_student(student_id: str): 42 | return attendance_service.get_attendance_by_student(student_id) 43 | 44 | @router.get("/course/{course_id}") 45 | def get_attendance_by_course(course_id: str): 46 | return attendance_service.get_attendance_by_course(course_id) 47 | 48 | # ✅ HTML Endpoint 49 | @router.get("/html", response_class=HTMLResponse) 50 | def attendance_html(request: Request): 51 | records = attendance_service.get_all_attendance() 52 | return templates.TemplateResponse("attendance.html", {"request": request, "attendance": records}) 53 | -------------------------------------------------------------------------------- /api/course_api.py: -------------------------------------------------------------------------------- 1 | from fastapi import APIRouter, HTTPException, Query 2 | from pydantic import BaseModel 3 | from typing import List, Optional 4 | from datetime import date 5 | 6 | # Create router 7 | router = APIRouter() 8 | 9 | # Attendance model 10 | class AttendanceBase(BaseModel): 11 | student_id: int 12 | course_id: int 13 | date: date 14 | status: str # "present", "absent", "late" 15 | 16 | class AttendanceCreate(AttendanceBase): 17 | pass 18 | 19 | class Attendance(AttendanceBase): 20 | id: int 21 | 22 | class Config: 23 | orm_mode = True 24 | 25 | # In-memory attendance database for demo 26 | attendance_db = [ 27 | {"id": 1, "student_id": 1, "course_id": 1, "date": date(2023, 5, 1), "status": "present"}, 28 | {"id": 2, "student_id": 2, "course_id": 1, "date": date(2023, 5, 1), "status": "absent"}, 29 | {"id": 3, "student_id": 3, "course_id": 1, "date": date(2023, 5, 1), "status": "present"}, 30 | {"id": 4, "student_id": 1, "course_id": 2, "date": date(2023, 5, 2), "status": "present"}, 31 | {"id": 5, "student_id": 2, "course_id": 2, "date": date(2023, 5, 2), "status": "present"} 32 | ] 33 | 34 | # API endpoints 35 | @router.get("/", response_model=List[Attendance]) 36 | def get_attendance( 37 | student_id: Optional[int] = None, 38 | course_id: Optional[int] = None, 39 | start_date: Optional[date] = None, 40 | end_date: Optional[date] = None 41 | ): 42 | results = attendance_db 43 | 44 | if student_id: 45 | results = [a for a in results if a["student_id"] == student_id] 46 | if course_id: 47 | results = [a for a in results if a["course_id"] == course_id] 48 | if start_date: 49 | results = [a for a in results if a["date"] >= start_date] 50 | if end_date: 51 | results = [a for a in results if a["date"] <= end_date] 52 | 53 | return results 54 | 55 | @router.get("/{attendance_id}", response_model=Attendance) 56 | def get_attendance_by_id(attendance_id: int): 57 | for attendance in attendance_db: 58 | if attendance["id"] == attendance_id: 59 | return attendance 60 | raise HTTPException(status_code=404, detail="Attendance record not found") 61 | 62 | @router.post("/", response_model=Attendance) 63 | def create_attendance(attendance: AttendanceCreate): 64 | new_id = max(a["id"] for a in attendance_db) + 1 if attendance_db else 1 65 | new_attendance = {"id": new_id, **attendance.dict()} 66 | attendance_db.append(new_attendance) 67 | return new_attendance 68 | 69 | @router.put("/{attendance_id}", response_model=Attendance) 70 | def update_attendance(attendance_id: int, attendance: AttendanceBase): 71 | for i, a in enumerate(attendance_db): 72 | if a["id"] == attendance_id: 73 | attendance_db[i] = {**a, **attendance.dict()} 74 | return attendance_db[i] 75 | raise HTTPException(status_code=404, detail="Attendance record not found") 76 | 77 | @router.delete("/{attendance_id}") 78 | def delete_attendance(attendance_id: int): 79 | global attendance_db 80 | attendance_db = [a for a in attendance_db if a["id"] != attendance_id] 81 | return {"message": "Attendance record deleted successfully"} 82 | 83 | # Batch update attendance 84 | @router.post("/batch") 85 | def batch_create_attendance(attendances: List[AttendanceCreate]): 86 | global attendance_db 87 | results = [] 88 | 89 | for attendance in attendances: 90 | new_id = max(a["id"] for a in attendance_db) + 1 if attendance_db else 1 91 | new_attendance = {"id": new_id, **attendance.dict()} 92 | attendance_db.append(new_attendance) 93 | results.append(new_attendance) 94 | 95 | return {"message": f"Created {len(results)} attendance records", "records": results} -------------------------------------------------------------------------------- /api/student_api.py: -------------------------------------------------------------------------------- 1 | from fastapi import APIRouter, HTTPException, Depends 2 | from pydantic import BaseModel 3 | from typing import List, Optional 4 | 5 | # Create router 6 | router = APIRouter() 7 | 8 | # Student model 9 | class StudentBase(BaseModel): 10 | name: str 11 | email: str 12 | student_id: str 13 | 14 | class StudentCreate(StudentBase): 15 | pass 16 | 17 | class Student(StudentBase): 18 | id: int 19 | 20 | class Config: 21 | orm_mode = True 22 | 23 | # In-memory student database for demo 24 | students_db = [ 25 | {"id": 1, "name": "John Doe", "email": "john@example.com", "student_id": "ST001"}, 26 | {"id": 2, "name": "Jane Smith", "email": "jane@example.com", "student_id": "ST002"}, 27 | {"id": 3, "name": "Bob Johnson", "email": "bob@example.com", "student_id": "ST003"} 28 | ] 29 | 30 | # API endpoints 31 | @router.get("/", response_model=List[Student]) 32 | def get_students(): 33 | return students_db 34 | 35 | @router.get("/{student_id}", response_model=Student) 36 | def get_student(student_id: int): 37 | for student in students_db: 38 | if student["id"] == student_id: 39 | return student 40 | raise HTTPException(status_code=404, detail="Student not found") 41 | 42 | @router.post("/", response_model=Student) 43 | def create_student(student: StudentCreate): 44 | new_id = max(s["id"] for s in students_db) + 1 if students_db else 1 45 | new_student = {"id": new_id, **student.dict()} 46 | students_db.append(new_student) 47 | return new_student 48 | 49 | @router.put("/{student_id}", response_model=Student) 50 | def update_student(student_id: int, student: StudentBase): 51 | for i, s in enumerate(students_db): 52 | if s["id"] == student_id: 53 | students_db[i] = {**s, **student.dict()} 54 | return students_db[i] 55 | raise HTTPException(status_code=404, detail="Student not found") 56 | 57 | @router.delete("/{student_id}") 58 | def delete_student(student_id: int): 59 | global students_db 60 | students_db = [s for s in students_db if s["id"] != student_id] 61 | return {"message": "Student deleted successfully"} -------------------------------------------------------------------------------- /class-diagram.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ndelelo/Student-Attendance-Management-System/af0ce317c8f19fe74b84847fa5a29462694c94be/class-diagram.png -------------------------------------------------------------------------------- /config.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ndelelo/Student-Attendance-Management-System/af0ce317c8f19fe74b84847fa5a29462694c94be/config.py -------------------------------------------------------------------------------- /contributing.md: -------------------------------------------------------------------------------- 1 | # Contributing to Student Attendance System 2 | 3 | Thank you for considering contributing to the Student Attendance System! This document outlines the process for contributing to this project and helps you get started as a contributor. 4 | 5 | ## Table of Contents 6 | - [Prerequisites](#prerequisites) 7 | - [Installation Instructions](#installation-instructions) 8 | - [Development Workflow](#development-workflow) 9 | - [Coding Standards](#coding-standards) 10 | - [Testing Guidelines](#testing-guidelines) 11 | - [Issue Selection Process](#issue-selection-process) 12 | - [Pull Request Process](#pull-request-process) 13 | - [Communication](#communication) 14 | 15 | ## Prerequisites 16 | 17 | Before you begin, ensure you have the following installed: 18 | - Python 3.8 or higher 19 | - pip (Python package manager) 20 | - Git 21 | - A code editor (VS Code, PyCharm, etc.) 22 | - MySQL or PostgreSQL (depending on project configuration) 23 | 24 | ## Installation Instructions 25 | 26 | 1. **Fork the repository** 27 | 28 | Start by forking the repository to your GitHub account. 29 | 30 | 2. **Clone your fork** 31 | ```bash 32 | git clone https://github.com/Ndelelo/Student-Attendance-Management-System.git 33 | cd student-attendance-system 34 | ``` 35 | 36 | 3. **Set up a virtual environment** 37 | ```bash 38 | python -m venv venv 39 | 40 | # On Windows 41 | venv\Scripts\activate 42 | 43 | # On macOS/Linux 44 | source venv/bin/activate 45 | ``` 46 | 47 | 4. **Install dependencies** 48 | ```bash 49 | pip install -r requirements.txt 50 | pip install -r requirements-dev.txt # Development dependencies 51 | ``` 52 | 53 | 5. **Set up the database** 54 | ```bash 55 | # Configure your database connection in .env file (use .env.example as template) 56 | cp .env.example .env 57 | 58 | # Run migrations 59 | python manage.py migrate 60 | ``` 61 | 62 | 6. **Run the development server** 63 | ```bash 64 | python manage.py runserver 65 | ``` 66 | 67 | ## Development Workflow 68 | 69 | 1. **Create a new branch** 70 | ```bash 71 | git checkout -b feature/your-feature-name 72 | ``` 73 | 74 | 2. **Make your changes** 75 | - Write code that implements the feature or fixes the bug 76 | - Add or update tests as necessary 77 | - Update documentation if needed 78 | 79 | 3. **Commit your changes** 80 | ```bash 81 | git add . 82 | git commit -m "Description of changes" 83 | ``` 84 | 85 | 4. **Push to your fork** 86 | ```bash 87 | git push origin feature/your-feature-name 88 | ``` 89 | 90 | 5. **Create a Pull Request** 91 | - Go to the original repository 92 | - Click "New Pull Request" 93 | - Select your fork and branch 94 | - Fill out the PR template with details of your changes 95 | 96 | ## Coding Standards 97 | 98 | We follow PEP 8 style guidelines for Python code. Additionally: 99 | 100 | - Use 4 spaces for indentation (not tabs) 101 | - Maximum line length of 88 characters (we use Black formatter) 102 | - Write descriptive variable and function names 103 | - Include docstrings for all functions, classes, and modules 104 | - Use type hints where appropriate 105 | 106 | ### Linting 107 | 108 | We use the following tools to ensure code quality: 109 | 110 | - **Black**: For code formatting 111 | ```bash 112 | black . 113 | ``` 114 | 115 | - **Flake8**: For style guide enforcement 116 | ```bash 117 | flake8 118 | ``` 119 | 120 | - **isort**: For import sorting 121 | ```bash 122 | isort . 123 | ``` 124 | 125 | ## Testing Guidelines 126 | 127 | - Write tests for all new features and bug fixes 128 | - Maintain or improve test coverage with your changes 129 | - Run tests locally before submitting a PR 130 | 131 | ```bash 132 | # Run tests 133 | pytest 134 | 135 | # Run tests with coverage 136 | pytest --cov=. 137 | ``` 138 | 139 | ## Issue Selection Process 140 | 141 | 1. **Find an issue** 142 | - Check the [issues tab](https://github.com/OWNER/student-attendance-system/issues) 143 | - Look for issues labeled `good-first-issue` if you're new to the project 144 | - Issues labeled `feature-request` are for new enhancements 145 | 146 | 2. **Comment on the issue** 147 | - Express your interest in working on the issue 148 | - Ask any questions you might have about the requirements 149 | - Wait for a maintainer to assign the issue to you 150 | 151 | 3. **Work on the issue** 152 | - Once assigned, follow the development workflow to implement your solution 153 | - If you're stuck, ask for help in the issue comment thread 154 | 155 | ## Pull Request Process 156 | 157 | 1. **Ensure your PR addresses a specific issue** 158 | - Reference the issue number in your PR description using #issue-number 159 | 160 | 2. **Fill out the PR template** 161 | - Describe what your changes do 162 | - Explain how you've tested your changes 163 | - List any dependencies that were added or removed 164 | 165 | 3. **Pass all checks** 166 | - Your PR must pass all automated tests and checks 167 | - Address any review comments from maintainers 168 | 169 | 4. **Code review** 170 | - A maintainer will review your code 171 | - You may need to make additional changes based on feedback 172 | 173 | 5. **Merge** 174 | - Once approved, a maintainer will merge your PR 175 | - Celebrate your contribution! 🎉 176 | 177 | ## Communication 178 | 179 | - For quick questions, use the project's discussion board 180 | - For bug reports or feature requests, create an issue 181 | - Be respectful and considerate in all communications 182 | 183 | Thank you for contributing to the Student Attendance System! 184 | -------------------------------------------------------------------------------- /creational_patterns directory/main.py: -------------------------------------------------------------------------------- 1 | from abc import ABC, abstractmethod 2 | import copy 3 | 4 | # 1. Singleton - Logger 5 | class Logger: 6 | _instance = None 7 | 8 | def __new__(cls): 9 | if cls._instance is None: 10 | cls._instance = super(Logger, cls).__new__(cls) 11 | return cls._instance 12 | 13 | def log(self, message): 14 | print(f"[LOG]: {message}") 15 | 16 | 17 | # 2. Factory Method - Notification 18 | class Notification(ABC): 19 | @abstractmethod 20 | def send(self, message): pass 21 | 22 | class EmailNotification(Notification): 23 | def send(self, message): 24 | print(f"[EMAIL] {message}") 25 | 26 | class SMSNotification(Notification): 27 | def send(self, message): 28 | print(f"[SMS] {message}") 29 | 30 | class NotificationFactory: 31 | @staticmethod 32 | def create_notification(method): 33 | if method == "email": 34 | return EmailNotification() 35 | elif method == "sms": 36 | return SMSNotification() 37 | else: 38 | raise ValueError("Unsupported method") 39 | 40 | 41 | # 3. Abstract Factory - GUI Components 42 | class Button(ABC): 43 | @abstractmethod 44 | def draw(self): pass 45 | 46 | class LightButton(Button): 47 | def draw(self): print("Drawing Light Button") 48 | 49 | class DarkButton(Button): 50 | def draw(self): print("Drawing Dark Button") 51 | 52 | class GUIFactory(ABC): 53 | @abstractmethod 54 | def create_button(self): pass 55 | 56 | class LightThemeFactory(GUIFactory): 57 | def create_button(self): return LightButton() 58 | 59 | class DarkThemeFactory(GUIFactory): 60 | def create_button(self): return DarkButton() 61 | 62 | 63 | # 4. Builder - Attendance Report 64 | class Report: 65 | def __init__(self): 66 | self.parts = [] 67 | 68 | def add(self, part): 69 | self.parts.append(part) 70 | 71 | def display(self): 72 | return "\n".join(self.parts) 73 | 74 | class ReportBuilder: 75 | def __init__(self): 76 | self.report = Report() 77 | 78 | def add_header(self, title): 79 | self.report.add(f"==== {title} ====") 80 | return self 81 | 82 | def add_attendance_record(self, name, status): 83 | self.report.add(f"{name} - {status}") 84 | return self 85 | 86 | def add_footer(self): 87 | self.report.add("==== End of Report ====") 88 | return self 89 | 90 | def build(self): 91 | return self.report 92 | 93 | 94 | # 5. Prototype - Course Template 95 | class CourseTemplate: 96 | def __init__(self, title, teacher): 97 | self.title = title 98 | self.teacher = teacher 99 | self.materials = [] 100 | 101 | def add_material(self, material): 102 | self.materials.append(material) 103 | 104 | def clone(self): 105 | return copy.deepcopy(self) 106 | 107 | 108 | # 6. Object Pool - DB Connections 109 | class DBConnection: 110 | def __init__(self, id): 111 | self.id = id 112 | 113 | def query(self, sql): 114 | print(f"[DB {self.id}] Executing: {sql}") 115 | 116 | class ConnectionPool: 117 | def __init__(self, size): 118 | self.pool = [DBConnection(i) for i in range(size)] 119 | 120 | def get(self): 121 | return self.pool.pop() if self.pool else None 122 | 123 | def release(self, conn): 124 | self.pool.append(conn) 125 | 126 | 127 | # CLI Demo 128 | if __name__ == "__main__": 129 | print("--- Singleton Logger ---") 130 | Logger().log("System Initialized") 131 | 132 | print("\n--- Factory Method (Notification) ---") 133 | notifier = NotificationFactory.create_notification("email") 134 | notifier.send("Welcome to Attendance System") 135 | 136 | print("\n--- Abstract Factory (GUI Button) ---") 137 | theme = LightThemeFactory() 138 | btn = theme.create_button() 139 | btn.draw() 140 | 141 | print("\n--- Builder (Attendance Report) ---") 142 | builder = ReportBuilder().add_header("Attendance Report") 143 | builder.add_attendance_record("Alice", "Present").add_attendance_record("Bob", "Absent") 144 | report = builder.add_footer().build() 145 | print(report.display()) 146 | 147 | print("\n--- Prototype (Course Template) ---") 148 | course = CourseTemplate("Intro to Python", "Dr. A") 149 | course.add_material("Week 1") 150 | cloned = course.clone() 151 | cloned.title = "Advanced Python" 152 | print(f"Original: {course.title}, Clone: {cloned.title}") 153 | 154 | print("\n--- Object Pool (DB Connections) ---") 155 | pool = ConnectionPool(2) 156 | conn = pool.get() 157 | if conn: 158 | conn.query("SELECT * FROM attendance") 159 | pool.release(conn) 160 | else: 161 | print("No connections available") 162 | -------------------------------------------------------------------------------- /diagram-Admin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ndelelo/Student-Attendance-Management-System/af0ce317c8f19fe74b84847fa5a29462694c94be/diagram-Admin.png -------------------------------------------------------------------------------- /diagram-Attendance.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ndelelo/Student-Attendance-Management-System/af0ce317c8f19fe74b84847fa5a29462694c94be/diagram-Attendance.png -------------------------------------------------------------------------------- /diagram-Course.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ndelelo/Student-Attendance-Management-System/af0ce317c8f19fe74b84847fa5a29462694c94be/diagram-Course.png -------------------------------------------------------------------------------- /diagram-Notification.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ndelelo/Student-Attendance-Management-System/af0ce317c8f19fe74b84847fa5a29462694c94be/diagram-Notification.png -------------------------------------------------------------------------------- /diagram-Report.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ndelelo/Student-Attendance-Management-System/af0ce317c8f19fe74b84847fa5a29462694c94be/diagram-Report.png -------------------------------------------------------------------------------- /diagram-Session.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ndelelo/Student-Attendance-Management-System/af0ce317c8f19fe74b84847fa5a29462694c94be/diagram-Session.png -------------------------------------------------------------------------------- /diagram-Student.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ndelelo/Student-Attendance-Management-System/af0ce317c8f19fe74b84847fa5a29462694c94be/diagram-Student.png -------------------------------------------------------------------------------- /diagram-Teacher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ndelelo/Student-Attendance-Management-System/af0ce317c8f19fe74b84847fa5a29462694c94be/diagram-Teacher.png -------------------------------------------------------------------------------- /docs/openapi.yaml: -------------------------------------------------------------------------------- 1 | openapi: 3.1.0 2 | info: 3 | title: Student Attendance System 4 | description: API for managing students, courses, and attendance records. 5 | version: 1.0.0 6 | paths: 7 | /: 8 | get: 9 | summary: Read Home 10 | operationId: read_home__get 11 | responses: 12 | '200': 13 | description: Successful Response 14 | content: 15 | text/html: 16 | schema: 17 | type: string 18 | /students: 19 | get: 20 | summary: Read Students 21 | operationId: read_students_students_get 22 | responses: 23 | '200': 24 | description: Successful Response 25 | content: 26 | text/html: 27 | schema: 28 | type: string 29 | /courses: 30 | get: 31 | summary: Read Courses 32 | operationId: read_courses_courses_get 33 | responses: 34 | '200': 35 | description: Successful Response 36 | content: 37 | text/html: 38 | schema: 39 | type: string 40 | /attendance: 41 | get: 42 | summary: Read Attendance 43 | operationId: read_attendance_attendance_get 44 | responses: 45 | '200': 46 | description: Successful Response 47 | content: 48 | text/html: 49 | schema: 50 | type: string 51 | /api/students/: 52 | get: 53 | tags: 54 | - students 55 | summary: Get Students 56 | operationId: get_students_api_students__get 57 | responses: 58 | '200': 59 | description: Successful Response 60 | content: 61 | application/json: 62 | schema: 63 | items: 64 | $ref: '#/components/schemas/Student' 65 | type: array 66 | title: Response Get Students Api Students Get 67 | post: 68 | tags: 69 | - students 70 | summary: Create Student 71 | operationId: create_student_api_students__post 72 | requestBody: 73 | content: 74 | application/json: 75 | schema: 76 | $ref: '#/components/schemas/StudentCreate' 77 | required: true 78 | responses: 79 | '200': 80 | description: Successful Response 81 | content: 82 | application/json: 83 | schema: 84 | $ref: '#/components/schemas/Student' 85 | '422': 86 | description: Validation Error 87 | content: 88 | application/json: 89 | schema: 90 | $ref: '#/components/schemas/HTTPValidationError' 91 | /api/students/{student_id}: 92 | get: 93 | tags: 94 | - students 95 | summary: Get Student 96 | operationId: get_student_api_students__student_id__get 97 | parameters: 98 | - name: student_id 99 | in: path 100 | required: true 101 | schema: 102 | type: integer 103 | title: Student Id 104 | responses: 105 | '200': 106 | description: Successful Response 107 | content: 108 | application/json: 109 | schema: 110 | $ref: '#/components/schemas/Student' 111 | '422': 112 | description: Validation Error 113 | content: 114 | application/json: 115 | schema: 116 | $ref: '#/components/schemas/HTTPValidationError' 117 | put: 118 | tags: 119 | - students 120 | summary: Update Student 121 | operationId: update_student_api_students__student_id__put 122 | parameters: 123 | - name: student_id 124 | in: path 125 | required: true 126 | schema: 127 | type: integer 128 | title: Student Id 129 | requestBody: 130 | required: true 131 | content: 132 | application/json: 133 | schema: 134 | $ref: '#/components/schemas/StudentBase' 135 | responses: 136 | '200': 137 | description: Successful Response 138 | content: 139 | application/json: 140 | schema: 141 | $ref: '#/components/schemas/Student' 142 | '422': 143 | description: Validation Error 144 | content: 145 | application/json: 146 | schema: 147 | $ref: '#/components/schemas/HTTPValidationError' 148 | delete: 149 | tags: 150 | - students 151 | summary: Delete Student 152 | operationId: delete_student_api_students__student_id__delete 153 | parameters: 154 | - name: student_id 155 | in: path 156 | required: true 157 | schema: 158 | type: integer 159 | title: Student Id 160 | responses: 161 | '200': 162 | description: Successful Response 163 | content: 164 | application/json: 165 | schema: {} 166 | '422': 167 | description: Validation Error 168 | content: 169 | application/json: 170 | schema: 171 | $ref: '#/components/schemas/HTTPValidationError' 172 | /api/courses/: 173 | get: 174 | tags: 175 | - courses 176 | summary: Get Attendance 177 | operationId: get_attendance_api_courses__get 178 | parameters: 179 | - name: student_id 180 | in: query 181 | required: false 182 | schema: 183 | anyOf: 184 | - type: integer 185 | - type: 'null' 186 | title: Student Id 187 | - name: course_id 188 | in: query 189 | required: false 190 | schema: 191 | anyOf: 192 | - type: integer 193 | - type: 'null' 194 | title: Course Id 195 | - name: start_date 196 | in: query 197 | required: false 198 | schema: 199 | anyOf: 200 | - type: string 201 | format: date 202 | - type: 'null' 203 | title: Start Date 204 | - name: end_date 205 | in: query 206 | required: false 207 | schema: 208 | anyOf: 209 | - type: string 210 | format: date 211 | - type: 'null' 212 | title: End Date 213 | responses: 214 | '200': 215 | description: Successful Response 216 | content: 217 | application/json: 218 | schema: 219 | type: array 220 | items: 221 | $ref: '#/components/schemas/Attendance' 222 | title: Response Get Attendance Api Courses Get 223 | '422': 224 | description: Validation Error 225 | content: 226 | application/json: 227 | schema: 228 | $ref: '#/components/schemas/HTTPValidationError' 229 | post: 230 | tags: 231 | - courses 232 | summary: Create Attendance 233 | operationId: create_attendance_api_courses__post 234 | requestBody: 235 | required: true 236 | content: 237 | application/json: 238 | schema: 239 | $ref: '#/components/schemas/AttendanceCreate' 240 | responses: 241 | '200': 242 | description: Successful Response 243 | content: 244 | application/json: 245 | schema: 246 | $ref: '#/components/schemas/Attendance' 247 | '422': 248 | description: Validation Error 249 | content: 250 | application/json: 251 | schema: 252 | $ref: '#/components/schemas/HTTPValidationError' 253 | /api/courses/{attendance_id}: 254 | get: 255 | tags: 256 | - courses 257 | summary: Get Attendance By Id 258 | operationId: get_attendance_by_id_api_courses__attendance_id__get 259 | parameters: 260 | - name: attendance_id 261 | in: path 262 | required: true 263 | schema: 264 | type: integer 265 | title: Attendance Id 266 | responses: 267 | '200': 268 | description: Successful Response 269 | content: 270 | application/json: 271 | schema: 272 | $ref: '#/components/schemas/Attendance' 273 | '422': 274 | description: Validation Error 275 | content: 276 | application/json: 277 | schema: 278 | $ref: '#/components/schemas/HTTPValidationError' 279 | put: 280 | tags: 281 | - courses 282 | summary: Update Attendance 283 | operationId: update_attendance_api_courses__attendance_id__put 284 | parameters: 285 | - name: attendance_id 286 | in: path 287 | required: true 288 | schema: 289 | type: integer 290 | title: Attendance Id 291 | requestBody: 292 | required: true 293 | content: 294 | application/json: 295 | schema: 296 | $ref: '#/components/schemas/AttendanceBase' 297 | responses: 298 | '200': 299 | description: Successful Response 300 | content: 301 | application/json: 302 | schema: 303 | $ref: '#/components/schemas/Attendance' 304 | '422': 305 | description: Validation Error 306 | content: 307 | application/json: 308 | schema: 309 | $ref: '#/components/schemas/HTTPValidationError' 310 | delete: 311 | tags: 312 | - courses 313 | summary: Delete Attendance 314 | operationId: delete_attendance_api_courses__attendance_id__delete 315 | parameters: 316 | - name: attendance_id 317 | in: path 318 | required: true 319 | schema: 320 | type: integer 321 | title: Attendance Id 322 | responses: 323 | '200': 324 | description: Successful Response 325 | content: 326 | application/json: 327 | schema: {} 328 | '422': 329 | description: Validation Error 330 | content: 331 | application/json: 332 | schema: 333 | $ref: '#/components/schemas/HTTPValidationError' 334 | /api/courses/batch: 335 | post: 336 | tags: 337 | - courses 338 | summary: Batch Create Attendance 339 | operationId: batch_create_attendance_api_courses_batch_post 340 | requestBody: 341 | content: 342 | application/json: 343 | schema: 344 | items: 345 | $ref: '#/components/schemas/AttendanceCreate' 346 | type: array 347 | title: Attendances 348 | required: true 349 | responses: 350 | '200': 351 | description: Successful Response 352 | content: 353 | application/json: 354 | schema: {} 355 | '422': 356 | description: Validation Error 357 | content: 358 | application/json: 359 | schema: 360 | $ref: '#/components/schemas/HTTPValidationError' 361 | components: 362 | schemas: 363 | Attendance: 364 | properties: 365 | student_id: 366 | type: integer 367 | title: Student Id 368 | course_id: 369 | type: integer 370 | title: Course Id 371 | date: 372 | type: string 373 | format: date 374 | title: Date 375 | status: 376 | type: string 377 | title: Status 378 | id: 379 | type: integer 380 | title: Id 381 | type: object 382 | required: 383 | - student_id 384 | - course_id 385 | - date 386 | - status 387 | - id 388 | title: Attendance 389 | AttendanceBase: 390 | properties: 391 | student_id: 392 | type: integer 393 | title: Student Id 394 | course_id: 395 | type: integer 396 | title: Course Id 397 | date: 398 | type: string 399 | format: date 400 | title: Date 401 | status: 402 | type: string 403 | title: Status 404 | type: object 405 | required: 406 | - student_id 407 | - course_id 408 | - date 409 | - status 410 | title: AttendanceBase 411 | AttendanceCreate: 412 | properties: 413 | student_id: 414 | type: integer 415 | title: Student Id 416 | course_id: 417 | type: integer 418 | title: Course Id 419 | date: 420 | type: string 421 | format: date 422 | title: Date 423 | status: 424 | type: string 425 | title: Status 426 | type: object 427 | required: 428 | - student_id 429 | - course_id 430 | - date 431 | - status 432 | title: AttendanceCreate 433 | HTTPValidationError: 434 | properties: 435 | detail: 436 | items: 437 | $ref: '#/components/schemas/ValidationError' 438 | type: array 439 | title: Detail 440 | type: object 441 | title: HTTPValidationError 442 | Student: 443 | properties: 444 | name: 445 | type: string 446 | title: Name 447 | email: 448 | type: string 449 | title: Email 450 | student_id: 451 | type: string 452 | title: Student Id 453 | id: 454 | type: integer 455 | title: Id 456 | type: object 457 | required: 458 | - name 459 | - email 460 | - student_id 461 | - id 462 | title: Student 463 | StudentBase: 464 | properties: 465 | name: 466 | type: string 467 | title: Name 468 | email: 469 | type: string 470 | title: Email 471 | student_id: 472 | type: string 473 | title: Student Id 474 | type: object 475 | required: 476 | - name 477 | - email 478 | - student_id 479 | title: StudentBase 480 | StudentCreate: 481 | properties: 482 | name: 483 | type: string 484 | title: Name 485 | email: 486 | type: string 487 | title: Email 488 | student_id: 489 | type: string 490 | title: Student Id 491 | type: object 492 | required: 493 | - name 494 | - email 495 | - student_id 496 | title: StudentCreate 497 | ValidationError: 498 | properties: 499 | loc: 500 | items: 501 | anyOf: 502 | - type: string 503 | - type: integer 504 | type: array 505 | title: Location 506 | msg: 507 | type: string 508 | title: Message 509 | type: 510 | type: string 511 | title: Error Type 512 | type: object 513 | required: 514 | - loc 515 | - msg 516 | - type 517 | title: ValidationError 518 | -------------------------------------------------------------------------------- /integration_tests_report.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ndelelo/Student-Attendance-Management-System/af0ce317c8f19fe74b84847fa5a29462694c94be/integration_tests_report.JPG -------------------------------------------------------------------------------- /issues.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ndelelo/Student-Attendance-Management-System/af0ce317c8f19fe74b84847fa5a29462694c94be/issues.JPG -------------------------------------------------------------------------------- /kanban_explanation.md: -------------------------------------------------------------------------------- 1 | ## Kanban Board Explanation 2 | 3 | A **Kanban board** is a visual tool for workflow management, enabling teams to monitor activities throughout several phases of completion. Through visible task progress, it offers a methodical approach to view work, prioritize management, and increase productivity. Columns representing different phases of a process make up the board, allowing teams to identify bottlenecks, balance workloads, and continuously enhance efficiency. 4 | 5 | ### How Kanban Board Works 6 | 7 | #### 1. Virtualizing Workflow 8 | My Kanban board is structured with columns that represent different stages of tasks. Tasks move from left to right across the board as progress is made: 9 | 10 | - **To Do** - Tasks planned but not yet started. 11 | - **In Progress** - Tasks currently being worked on. 12 | - **Review** - Tasks waiting for code review. 13 | - **Testing** - Tasks undergoing functional testing. 14 | - **Blocked** - Tasks stuck due to dependencies or issues. 15 | - **Done** - Completed tasks. 16 | 17 | #### 2. Limiting Work-in-Progress (WIP) 18 | My board features **WIP restrictions**, ensuring that only a limited number of tasks are in progress at any moment. This preserves efficiency and prevents congestion. The limits are as follows: 19 | 20 | - **In Progress** column allows a maximum of three tasks. 21 | - **Review** and **Testing** columns allow a maximum of two tasks at a time. 22 | 23 | Enforcing these restrictions ensures that team members do not overload themselves with tasks, reducing multitasking and improving focus. If a column reaches its limit, no additional tasks can be added until existing ones are completed, promoting teamwork to clear obstacles before starting new tasks. 24 | 25 | #### 3. Supporting Agile Principles 26 | By aligning with Agile values, my Kanban board promotes: 27 | 28 | - **Regular updates and faster job delivery**, as tasks move smoothly through the system. 29 | - **Flexibility and adaptability**, allowing new projects to be added or reprioritized based on business needs without disrupting workflow. 30 | - **Transparency and teamwork**, ensuring every team member clearly sees workloads, responsibilities, and priorities. 31 | 32 | Regularly reviewing the board enhances productivity and guides decision-making based on real-time data, ultimately leading to improved team performance. 33 | -------------------------------------------------------------------------------- /labeled_issues.md: -------------------------------------------------------------------------------- 1 | # Labeled Issues 2 | 3 | ![issues](issues.jpg) 4 | - **Advanced reporting system** (feature-request) 5 | - **Mobile app for attendance tracking** (feature-request) 6 | - **Add loading indicators** (good-first-issue) 7 | - **Create sample data seeder** (good-first-issue) 8 | - **Add unit tests for date utility functions** (good-first-issue) 9 | - **Improve button styling consistency** (good-first-issue) 10 | - **Implement attendance analytics dashboard** (feature-request) 11 | - **Add input validation messages** (good-first-issue) 12 | - **Fix typos in documentation** (good-first-issue) 13 | -------------------------------------------------------------------------------- /license.md: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2025 Student Attendance System Contributors 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | flask==2.2.3 2 | flask-sqlalchemy==3.0.3 3 | flask-bcrypt==1.0.1 4 | -------------------------------------------------------------------------------- /roadmap.md: -------------------------------------------------------------------------------- 1 | # Student Attendance System Roadmap 2 | 3 | This document outlines the planned development roadmap for the Student Attendance System. It provides visibility into our priorities and upcoming features. 4 | 5 | ## Current Version (1.0) 6 | 7 | The current version includes: 8 | - Basic user authentication and role management 9 | - Manual attendance recording 10 | - Simple reporting for teachers and administrators 11 | - Student profile management 12 | - Course and class management 13 | 14 | ## Short-term Goals (Next 3 Months) 15 | 16 | ### Version 1.1 17 | - **Mobile Responsiveness** 18 | - Optimize UI for mobile devices 19 | - Improve teacher experience on tablets 20 | - Priority: High 21 | 22 | - **Enhanced Reports** 23 | - Add visual graphs and charts for attendance trends 24 | - Export reports in multiple formats (PDF, Excel, CSV) 25 | - Priority: Medium 26 | 27 | - **Integrate Redis Caching** 28 | - Improve system performance 29 | - Reduce database load 30 | - Priority: Medium 31 | 32 | - **Automated Email Notifications** 33 | - Send alerts to parents for absent students 34 | - Weekly attendance summaries 35 | - Priority: High 36 | 37 | ### Version 1.2 38 | - **QR Code Attendance** 39 | - Generate unique QR codes for classes 40 | - Allow students to scan for quick check-in 41 | - Priority: Medium 42 | 43 | - **API Development** 44 | - Create RESTful API endpoints 45 | - Enable third-party integrations 46 | - Priority: Low 47 | 48 | ## Mid-term Goals (6-12 Months) 49 | 50 | ### Version 2.0 51 | - **Facial Recognition Attendance (Optional)** 52 | - Implement AI-based attendance verification 53 | - Privacy-focused approach with opt-in functionality 54 | - Priority: Low 55 | 56 | - **Learning Management System (LMS) Integration** 57 | - Connect with popular LMS platforms 58 | - Sync course schedules and enrollment data 59 | - Priority: Medium 60 | 61 | - **Advanced Analytics Dashboard** 62 | - Predictive analytics for attendance patterns 63 | - Identify at-risk students 64 | - Priority: High 65 | 66 | - **Multi-tenancy Support** 67 | - Allow multiple schools/institutions on single instance 68 | - Customizable branding per institution 69 | - Priority: Medium 70 | 71 | ## Long-term Vision (Beyond 12 Months) 72 | 73 | ### Version 3.0 74 | - **Blockchain Attendance Verification** 75 | - Immutable attendance records 76 | - Digital credentials for perfect attendance 77 | - Priority: Low 78 | 79 | - **Offline Mode** 80 | - Full functionality without internet connection 81 | - Background sync when connection restored 82 | - Priority: Medium 83 | 84 | - **AI Attendance Assistant** 85 | - Smart suggestions for teachers 86 | - Automated follow-ups for chronic absenteeism 87 | - Priority: Medium 88 | 89 | - **Integration with Student Information Systems** 90 | - Bidirectional data exchange with major SIS platforms 91 | - Automated roster updates 92 | - Priority: High 93 | 94 | ## How We Prioritize 95 | 96 | Features are prioritized based on: 97 | 1. User impact and feedback 98 | 2. Technical feasibility 99 | 3. Strategic alignment with project goals 100 | 4. Resource availability 101 | 102 | ## Contributing to the Roadmap 103 | 104 | We welcome community input on our roadmap! If you have suggestions for features or want to help implement items on this roadmap: 105 | 106 | 1. Check the [Issues](https://github.com/OWNER/student-attendance-system/issues) page for related discussions 107 | 2. Submit a new feature request with the `feature-request` label 108 | 3. Reference this roadmap in your feature discussions 109 | 110 | The roadmap is a living document and will be updated regularly based on project progress and community feedback. 111 | -------------------------------------------------------------------------------- /rule1.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ndelelo/Student-Attendance-Management-System/af0ce317c8f19fe74b84847fa5a29462694c94be/rule1.JPG -------------------------------------------------------------------------------- /rule2.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ndelelo/Student-Attendance-Management-System/af0ce317c8f19fe74b84847fa5a29462694c94be/rule2.JPG -------------------------------------------------------------------------------- /services/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ndelelo/Student-Attendance-Management-System/af0ce317c8f19fe74b84847fa5a29462694c94be/services/__init__.py -------------------------------------------------------------------------------- /services/__pycache__/__init__.cpython-313.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ndelelo/Student-Attendance-Management-System/af0ce317c8f19fe74b84847fa5a29462694c94be/services/__pycache__/__init__.cpython-313.pyc -------------------------------------------------------------------------------- /services/__pycache__/attendance_service.cpython-313.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ndelelo/Student-Attendance-Management-System/af0ce317c8f19fe74b84847fa5a29462694c94be/services/__pycache__/attendance_service.cpython-313.pyc -------------------------------------------------------------------------------- /services/__pycache__/course_service.cpython-313.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ndelelo/Student-Attendance-Management-System/af0ce317c8f19fe74b84847fa5a29462694c94be/services/__pycache__/course_service.cpython-313.pyc -------------------------------------------------------------------------------- /services/__pycache__/student_service.cpython-313.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ndelelo/Student-Attendance-Management-System/af0ce317c8f19fe74b84847fa5a29462694c94be/services/__pycache__/student_service.cpython-313.pyc -------------------------------------------------------------------------------- /services/attendance_service.py: -------------------------------------------------------------------------------- 1 | from fastapi import APIRouter, Depends, HTTPException, status 2 | from typing import List, Optional 3 | from datetime import date 4 | 5 | # Import your schemas (assuming you have these) 6 | from domain.schemas.attendance import AttendanceCreate, AttendanceResponse, AttendanceUpdate 7 | 8 | # Import your service and repository 9 | from services.attendance_service import AttendanceService 10 | from repositories.attendance_repository import AttendanceRepository 11 | from database.database import get_db 12 | from sqlalchemy.orm import Session 13 | 14 | router = APIRouter(prefix="/attendances", tags=["attendances"]) 15 | 16 | # Dependency to get the repository and service 17 | def get_attendance_repository(db: Session = Depends(get_db)): 18 | return AttendanceRepository(db) 19 | 20 | def get_attendance_service(attendance_repository: AttendanceRepository = Depends(get_attendance_repository)): 21 | # Fixed: Using the correct parameter name 'attendance_repository' instead of 'repository' 22 | return AttendanceService(attendance_repository) 23 | 24 | @router.post("/", response_model=AttendanceResponse, status_code=status.HTTP_201_CREATED) 25 | def create_attendance( 26 | attendance: AttendanceCreate, 27 | service: AttendanceService = Depends(get_attendance_service) 28 | ): 29 | try: 30 | return service.mark_attendance( 31 | student_id=attendance.student_id, 32 | course_id=attendance.course_id, 33 | date=attendance.date, 34 | status=attendance.status 35 | ) 36 | except ValueError as e: 37 | raise HTTPException(status_code=status.HTTP_400_BAD_REQUEST, detail=str(e)) 38 | 39 | @router.get("/", response_model=List[AttendanceResponse]) 40 | def get_attendance( 41 | student_id: Optional[int] = None, 42 | course_id: Optional[int] = None, 43 | date: Optional[date] = None, 44 | status: Optional[str] = None, 45 | service: AttendanceService = Depends(get_attendance_service) 46 | ): 47 | return service.get_attendance( 48 | student_id=student_id, 49 | course_id=course_id, 50 | date=date, 51 | status=status 52 | ) 53 | 54 | @router.get("/{attendance_id}", response_model=AttendanceResponse) 55 | def get_attendance_by_id( 56 | attendance_id: int, 57 | service: AttendanceService = Depends(get_attendance_service) 58 | ): 59 | attendance = service.attendance_repository.find_by_id(attendance_id) 60 | if not attendance: 61 | raise HTTPException( 62 | status_code=status.HTTP_404_NOT_FOUND, 63 | detail=f"Attendance record with ID {attendance_id} not found" 64 | ) 65 | return attendance 66 | 67 | @router.put("/{attendance_id}", response_model=AttendanceResponse) 68 | def update_attendance( 69 | attendance_id: int, 70 | attendance: AttendanceUpdate, 71 | service: AttendanceService = Depends(get_attendance_service) 72 | ): 73 | try: 74 | return service.update_attendance( 75 | attendance_id=attendance_id, 76 | student_id=attendance.student_id, 77 | course_id=attendance.course_id, 78 | date=attendance.date, 79 | status=attendance.status 80 | ) 81 | except ValueError as e: 82 | raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail=str(e)) 83 | 84 | @router.delete("/{attendance_id}", status_code=status.HTTP_204_NO_CONTENT) 85 | def delete_attendance( 86 | attendance_id: int, 87 | service: AttendanceService = Depends(get_attendance_service) 88 | ): 89 | try: 90 | service.delete_attendance(attendance_id) 91 | return None 92 | except ValueError as e: 93 | raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail=str(e)) -------------------------------------------------------------------------------- /services/course_service.py: -------------------------------------------------------------------------------- 1 | # File: services/course_service.py 2 | from domain.models.course import Course 3 | 4 | class CourseService: 5 | def __init__(self, course_repository): 6 | """ 7 | Initialize the course service 8 | 9 | Args: 10 | course_repository: Repository for course data 11 | """ 12 | self.course_repository = course_repository 13 | 14 | def create_course(self, code, name, description=None, instructor=None): 15 | """ 16 | Create a new course 17 | 18 | Args: 19 | code: Course code (e.g., "CS101") 20 | name: Name of the course 21 | description: Description of the course (optional) 22 | instructor: Name of the course instructor (optional) 23 | 24 | Returns: 25 | The created course record 26 | 27 | Raises: 28 | ValueError: If a course with the given code already exists 29 | """ 30 | # Check if course code already exists 31 | existing = self.course_repository.find_by_code(code) 32 | if existing: 33 | raise ValueError(f"Course with code {code} already exists") 34 | 35 | # Create new course 36 | course = Course( 37 | id=None, # Repository will assign ID 38 | code=code, 39 | name=name, 40 | description=description, 41 | instructor=instructor 42 | ) 43 | 44 | # Save and return 45 | return self.course_repository.save(course) 46 | 47 | def get_course(self, course_id): 48 | """ 49 | Get a course by ID 50 | 51 | Args: 52 | course_id: The ID of the course 53 | 54 | Returns: 55 | The course record if found 56 | 57 | Raises: 58 | ValueError: If the course does not exist 59 | """ 60 | course = self.course_repository.find_by_id(course_id) 61 | if not course: 62 | raise ValueError(f"Course with ID {course_id} not found") 63 | 64 | return course 65 | 66 | def get_course_by_code(self, code): 67 | """ 68 | Get a course by course code 69 | 70 | Args: 71 | code: The course code (e.g., "CS101") 72 | 73 | Returns: 74 | The course record if found 75 | 76 | Raises: 77 | ValueError: If the course does not exist 78 | """ 79 | course = self.course_repository.find_by_code(code) 80 | if not course: 81 | raise ValueError(f"Course with code {code} not found") 82 | 83 | return course 84 | 85 | def search_courses_by_name(self, name): 86 | """ 87 | Search for courses by name 88 | 89 | Args: 90 | name: The name to search for 91 | 92 | Returns: 93 | List of course records with names containing the search term 94 | """ 95 | return self.course_repository.find_by_name(name) 96 | 97 | def get_all_courses(self): 98 | """ 99 | Get all courses 100 | 101 | Returns: 102 | List of all course records 103 | """ 104 | return self.course_repository.find_all() 105 | 106 | def update_course(self, course_id, code=None, name=None, description=None, instructor=None): 107 | """ 108 | Update an existing course 109 | 110 | Args: 111 | course_id: The ID of the course to update 112 | code: New course code (optional) 113 | name: New name (optional) 114 | description: New description (optional) 115 | instructor: New instructor (optional) 116 | 117 | Returns: 118 | The updated course record 119 | 120 | Raises: 121 | ValueError: If the course does not exist or if the code is already used by another course 122 | """ 123 | # Get existing course 124 | course = self.course_repository.find_by_id(course_id) 125 | if not course: 126 | raise ValueError(f"Course with ID {course_id} not found") 127 | 128 | # Check if code already exists (if provided and changed) 129 | if code and code != course.code: 130 | existing = self.course_repository.find_by_code(code) 131 | if existing and existing.id != course_id: 132 | raise ValueError(f"Course with code {code} already exists") 133 | 134 | # Update values if provided 135 | if code: 136 | course.code = code 137 | if name: 138 | course.name = name 139 | if description is not None: # Allow empty description 140 | course.description = description 141 | if instructor is not None: # Allow empty instructor 142 | course.instructor = instructor 143 | 144 | # Save and return 145 | return self.course_repository.save(course) 146 | 147 | def delete_course(self, course_id): 148 | """ 149 | Delete a course 150 | 151 | Args: 152 | course_id: The ID of the course to delete 153 | 154 | Returns: 155 | True if deletion was successful 156 | 157 | Raises: 158 | ValueError: If the course does not exist 159 | """ 160 | course = self.course_repository.find_by_id(course_id) 161 | if not course: 162 | raise ValueError(f"Course with ID {course_id} not found") 163 | 164 | return self.course_repository.delete(course_id) 165 | -------------------------------------------------------------------------------- /services/student_service.py: -------------------------------------------------------------------------------- 1 | # File: services/student_service.py 2 | from domain.models.student import Student 3 | 4 | class StudentService: 5 | def __init__(self, student_repository): 6 | """ 7 | Initialize the student service 8 | 9 | Args: 10 | student_repository: Repository for student data 11 | """ 12 | self.student_repository = student_repository 13 | 14 | def create_student(self, student_id, name, email=None, phone=None): 15 | """ 16 | Create a new student 17 | 18 | Args: 19 | student_id: Student ID number (e.g., "S001") 20 | name: Full name of the student 21 | email: Email address of the student (optional) 22 | phone: Phone number of the student (optional) 23 | 24 | Returns: 25 | The created student record 26 | 27 | Raises: 28 | ValueError: If a student with the given student ID or email already exists 29 | """ 30 | # Check if student ID already exists 31 | existing = self.student_repository.find_by_student_id(student_id) 32 | if existing: 33 | raise ValueError(f"Student with ID {student_id} already exists") 34 | 35 | # Check if email already exists (if provided) 36 | if email: 37 | existing = self.student_repository.find_by_email(email) 38 | if existing: 39 | raise ValueError(f"Student with email {email} already exists") 40 | 41 | # Create new student 42 | student = Student( 43 | id=None, # Repository will assign ID 44 | student_id=student_id, 45 | name=name, 46 | email=email, 47 | phone=phone 48 | ) 49 | 50 | # Save and return 51 | return self.student_repository.save(student) 52 | 53 | def get_student(self, student_id): 54 | """ 55 | Get a student by ID 56 | 57 | Args: 58 | student_id: The ID of the student 59 | 60 | Returns: 61 | The student record if found 62 | 63 | Raises: 64 | ValueError: If the student does not exist 65 | """ 66 | student = self.student_repository.find_by_id(student_id) 67 | if not student: 68 | raise ValueError(f"Student with ID {student_id} not found") 69 | 70 | return student 71 | 72 | def get_student_by_student_id(self, external_student_id): 73 | """ 74 | Get a student by external student ID (e.g., "S001") 75 | 76 | Args: 77 | external_student_id: The external student ID 78 | 79 | Returns: 80 | The student record if found 81 | 82 | Raises: 83 | ValueError: If the student does not exist 84 | """ 85 | student = self.student_repository.find_by_student_id(external_student_id) 86 | if not student: 87 | raise ValueError(f"Student with student ID {external_student_id} not found") 88 | 89 | return student 90 | 91 | def get_all_students(self): 92 | """ 93 | Get all students 94 | 95 | Returns: 96 | List of all student records 97 | """ 98 | return self.student_repository.find_all() 99 | 100 | def update_student(self, student_id, name=None, email=None, phone=None): 101 | """ 102 | Update an existing student 103 | 104 | Args: 105 | student_id: The ID of the student to update 106 | name: New name (optional) 107 | email: New email (optional) 108 | phone: New phone (optional) 109 | 110 | Returns: 111 | The updated student record 112 | 113 | Raises: 114 | ValueError: If the student does not exist or if the email is already used by another student 115 | """ 116 | # Get existing student 117 | student = self.student_repository.find_by_id(student_id) 118 | if not student: 119 | raise ValueError(f"Student with ID {student_id} not found") 120 | 121 | # Check if email already exists (if provided and changed) 122 | if email and email != student.email: 123 | existing = self.student_repository.find_by_email(email) 124 | if existing and existing.id != student_id: 125 | raise ValueError(f"Student with email {email} already exists") 126 | 127 | # Update values if provided 128 | if name: 129 | student.name = name 130 | if email: 131 | student.email = email 132 | if phone: 133 | student.phone = phone 134 | 135 | # Save and return 136 | return self.student_repository.save(student) 137 | 138 | def delete_student(self, student_id): 139 | """ 140 | Delete a student 141 | 142 | Args: 143 | student_id: The ID of the student to delete 144 | 145 | Returns: 146 | True if deletion was successful 147 | 148 | Raises: 149 | ValueError: If the student does not exist 150 | """ 151 | student = self.student_repository.find_by_id(student_id) 152 | if not student: 153 | raise ValueError(f"Student with ID {student_id} not found") 154 | 155 | return self.student_repository.delete(student_id) 156 | -------------------------------------------------------------------------------- /src directory/main.py: -------------------------------------------------------------------------------- 1 | class Department: 2 | def __init__(self, department_id, department_name): 3 | self._department_id = department_id 4 | self._department_name = department_name 5 | self._courses = [] 6 | self._members = [] 7 | 8 | def manage_courses(self): 9 | pass 10 | 11 | def manage_members(self): 12 | pass 13 | 14 | 15 | class Student: 16 | def __init__(self, student_id, name, email, roll_number, department): 17 | self._student_id = student_id 18 | self._name = name 19 | self._email = email 20 | self._roll_number = roll_number 21 | self._department = department 22 | self._courses = [] 23 | self._attendance_records = [] 24 | 25 | def view_attendance(self): 26 | return self._attendance_records 27 | 28 | def update_profile(self, name=None, email=None): 29 | if name: 30 | self._name = name 31 | if email: 32 | self._email = email 33 | 34 | 35 | class Teacher: 36 | def __init__(self, teacher_id, name, email, department): 37 | self._teacher_id = teacher_id 38 | self._name = name 39 | self._email = email 40 | self._department = department 41 | self._courses = [] 42 | 43 | def record_attendance(self, course, student, date, status): 44 | if course in self._courses: 45 | record = AttendanceRecord(course, student, date, status) 46 | student._attendance_records.append(record) 47 | 48 | def view_reports(self): 49 | pass 50 | 51 | 52 | class Course: 53 | def __init__(self, course_id, course_name, department, teacher): 54 | self._course_id = course_id 55 | self._course_name = course_name 56 | self._department = department 57 | self._teacher = teacher 58 | self._students = [] 59 | self._schedule = [] 60 | 61 | def generate_attendance_report(self): 62 | pass 63 | 64 | 65 | class Schedule: 66 | def __init__(self, schedule_id, day_of_week, start_time, end_time): 67 | self._schedule_id = schedule_id 68 | self._day_of_week = day_of_week 69 | self._start_time = start_time 70 | self._end_time = end_time 71 | 72 | def get_schedule(self): 73 | return { 74 | "day": self._day_of_week, 75 | "start": self._start_time, 76 | "end": self._end_time 77 | } 78 | 79 | 80 | class AttendanceRecord: 81 | def __init__(self, course, student, date, status): 82 | self._record_id = f"{student._student_id}_{course._course_id}_{date}" 83 | self._date = date 84 | self._status = status 85 | self._student = student 86 | self._course = course 87 | 88 | def log_attendance(self): 89 | pass 90 | 91 | def update_attendance(self, status): 92 | self._status = status 93 | 94 | 95 | if __name__ == "__main__": 96 | dept = Department("D001", "Computer Science") 97 | teacher = Teacher("T001", "Dr. Smith", "smith@example.com", dept) 98 | student = Student("S001", "Alice", "alice@example.com", "R123", dept) 99 | course = Course("C001", "OOP", dept, teacher) 100 | 101 | teacher._courses.append(course) 102 | course._students.append(student) 103 | student._courses.append(course) 104 | 105 | teacher.record_attendance(course, student, "2025-04-15", "Present") 106 | 107 | for record in student.view_attendance(): 108 | print(f"Date: {record._date}, Status: {record._status}") 109 | -------------------------------------------------------------------------------- /static/css/style.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ndelelo/Student-Attendance-Management-System/af0ce317c8f19fe74b84847fa5a29462694c94be/static/css/style.css -------------------------------------------------------------------------------- /template_analysis.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ndelelo/Student-Attendance-Management-System/af0ce317c8f19fe74b84847fa5a29462694c94be/template_analysis.md -------------------------------------------------------------------------------- /templates/admin_dashboard.html: -------------------------------------------------------------------------------- 1 | {% extends 'layout.html' %} 2 | 3 | {% block title %}Admin Dashboard - Attendance System{% endblock %} 4 | 5 | {% block content %} 6 |
7 |

Admin Dashboard

8 | 9 |
10 |
11 |

Total Users

12 |

42

13 |
14 |
15 |

Students

16 |

30

17 |
18 |
19 |

Teachers

20 |

10

21 |
22 |
23 |

Admins

24 |

2

25 |
26 |
27 | 28 |
29 |

Quick Actions

30 |
31 | Manage Users 32 |
33 |
34 |
35 | {% endblock %} 36 | -------------------------------------------------------------------------------- /templates/edit_user.html: -------------------------------------------------------------------------------- 1 | {% extends 'layout.html' %} 2 | 3 | {% block title %}Edit User - Attendance System{% endblock %} 4 | 5 | {% block content %} 6 |
7 |

Edit User

8 | 9 |
10 |
11 | 12 | 13 |
14 |
15 | 16 | 17 |
18 |
19 | 20 | 25 |
26 |
27 | 28 | 29 |
30 | 31 | Cancel 32 |
33 |
34 | {% endblock %} 35 | -------------------------------------------------------------------------------- /templates/generate_report.html: -------------------------------------------------------------------------------- 1 | {% extends 'layout.html' %} 2 | 3 | {% block title %}Generate Report - Attendance System{% endblock %} 4 | 5 | {% block content %} 6 |
7 |

Generate Attendance Report

8 | 9 |
10 |
11 |
12 | 13 | 18 |
19 | 20 |
21 | 22 | 28 |
29 |
30 | 31 |
32 |
33 | 34 | 35 |
36 | 37 |
38 | 39 | 40 |
41 |
42 | 43 |
44 | 45 | 50 |
51 | 52 | 53 |
54 | 55 |
56 |

Saved Report Templates

57 |
    58 |
  • 59 | Monthly Attendance Overview 60 | 61 |
  • 62 |
  • 63 | Student Absence Report 64 | 65 |
  • 66 |
  • 67 | Class Attendance Summary 68 | 69 |
  • 70 |
71 |
72 |
73 | 74 | 96 | {% endblock %} 97 | -------------------------------------------------------------------------------- /templates/index.html: -------------------------------------------------------------------------------- 1 | {% extends 'layout.html' %} 2 | 3 | {% block title %}Home - Attendance System{% endblock %} 4 | 5 | {% block content %} 6 |
7 |
8 |

Student Attendance Management System

9 |

A simple and effective way to manage attendance for educational institutions.

10 |
11 | Login 12 | Register 13 |
14 |
15 | 16 |
17 |
18 |
19 |

For Students

20 |

Track your attendance and view your attendance records.

21 |
22 |
23 |

For Teachers

24 |

Mark and manage attendance, generate reports.

25 |
26 |
27 |

For Administrators

28 |

Manage users and system settings.

29 |
30 |
31 |
32 |
33 | {% endblock %} 34 | -------------------------------------------------------------------------------- /templates/layout.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | {% block title %}Attendance System{% endblock %} 7 | 8 | 9 | 10 |
11 | 35 |
36 | 37 |
38 | {% with messages = get_flashed_messages() %} 39 | {% if messages %} 40 |
41 | {% for message in messages %} 42 |
{{ message }}
43 | {% endfor %} 44 |
45 | {% endif %} 46 | {% endwith %} 47 | 48 | {% block content %}{% endblock %} 49 |
50 | 51 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /templates/login.html: -------------------------------------------------------------------------------- 1 | {% extends 'layout.html' %} 2 | 3 | {% block title %}Login - Attendance System{% endblock %} 4 | 5 | {% block content %} 6 |
7 |
8 |

Login

9 |
10 |
11 | 12 | 13 |
14 |
15 | 16 | 17 |
18 | 19 |
20 |

Don't have an account? Register here

21 |
22 |
23 | {% endblock %} 24 | -------------------------------------------------------------------------------- /templates/manage_attendance.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ndelelo/Student-Attendance-Management-System/af0ce317c8f19fe74b84847fa5a29462694c94be/templates/manage_attendance.html -------------------------------------------------------------------------------- /templates/mark_attendance.html: -------------------------------------------------------------------------------- 1 | {% extends 'layout.html' %} 2 | 3 | {% block title %}Mark Attendance - Attendance System{% endblock %} 4 | 5 | {% block content %} 6 |
7 |

Mark Attendance

8 | 9 |
10 |
11 | 12 | 13 |
14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | {% for student in students %} 24 | 25 | 26 | 33 | 34 | {% else %} 35 | 36 | 37 | 38 | {% endfor %} 39 | 40 |
StudentStatus
{{ student.username }} 27 | 32 |
No students found.
41 | 42 | 43 |
44 |
45 | {% endblock %} 46 | -------------------------------------------------------------------------------- /templates/my_attendance.html: -------------------------------------------------------------------------------- 1 | {% extends 'layout.html' %} 2 | 3 | {% block title %}My Attendance - Attendance System{% endblock %} 4 | 5 | {% block content %} 6 |
7 |

My Attendance

8 | 9 |
10 | 11 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | {% for attendance in attendances %} 29 | 30 | 31 | 32 | 33 | 34 | {% else %} 35 | 36 | 37 | 38 | {% endfor %} 39 | 40 |
DateStatusMarked By
{{ attendance.date.strftime('%Y-%m-%d') }}{{ attendance.status }}{{ attendance.teacher.username }}
No attendance records found.
41 |
42 | {% endblock %} 43 | -------------------------------------------------------------------------------- /templates/register.html: -------------------------------------------------------------------------------- 1 | {% extends 'layout.html' %} 2 | 3 | {% block title %}Register - Attendance System{% endblock %} 4 | 5 | {% block content %} 6 |
7 |
8 |

Register

9 |
10 |
11 | 12 | 13 |
14 |
15 | 16 | 17 |
18 |
19 | 20 | 21 |
22 |
23 | 24 | 28 |
29 | 30 |
31 |

Already have an account? Login here

32 |
33 |
34 | {% endblock %} -------------------------------------------------------------------------------- /templates/student_dashboard.html: -------------------------------------------------------------------------------- 1 | {% extends 'layout.html' %} 2 | 3 | {% block title %}Student Dashboard - Attendance System{% endblock %} 4 | 5 | {% block content %} 6 |
7 |

Student Dashboard

8 |
9 |
10 |

Attendance Rate

11 |

85%

12 |
13 |
14 |

Present Days

15 |

17

16 |
17 |
18 |

Absent Days

19 |

3

20 |
21 |
22 | 23 |
24 |

Quick Actions

25 |
26 | View My Attendance 27 |
28 |
29 |
30 | {% endblock %} 31 | -------------------------------------------------------------------------------- /templates/teacher_dashboard.html: -------------------------------------------------------------------------------- 1 | {% extends 'layout.html' %} 2 | 3 | {% block title %}Teacher Dashboard - Attendance System{% endblock %} 4 | 5 | {% block content %} 6 |
7 |

Teacher Dashboard

8 | 9 |
10 |

Quick Actions

11 | 16 |
17 | 18 |
19 |

Recent Activity

20 |
    21 |
  • Attendance marked for Class A on Feb 25, 2025
  • 22 |
  • Attendance marked for Class B on Feb 24, 2025
  • 23 |
  • Report generated on Feb 23, 2025
  • 24 |
25 |
26 |
27 | {% endblock %} 28 | -------------------------------------------------------------------------------- /templates/user_management.html: -------------------------------------------------------------------------------- 1 | {% extends 'layout.html' %} 2 | 3 | {% block title %}User Management - Attendance System{% endblock %} 4 | 5 | {% block content %} 6 |
7 |

User Management

8 | 9 |
10 | 11 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | {% for user in users %} 31 | 32 | 33 | 34 | 35 | 36 | 40 | 41 | {% else %} 42 | 43 | 44 | 45 | {% endfor %} 46 | 47 |
IDUsernameEmailRoleActions
{{ user.id }}{{ user.username }}{{ user.email }}{{ user.role }} 37 | Edit 38 | 39 |
No users found.
48 |
49 | {% endblock %} 50 | -------------------------------------------------------------------------------- /templates/view_report.html: -------------------------------------------------------------------------------- 1 | {% extends 'layout.html' %} 2 | 3 | {% block title %}View Report - Attendance System{% endblock %} 4 | 5 | {% block content %} 6 |
7 |

{{ report_title }}

8 | 9 |
10 |

Period: {{ start_date }} to {{ end_date }}

11 |

Generated on: {{ generation_date }}

12 | {% if student %} 13 |

Student: {{ student.username }}

14 | {% endif %} 15 |
16 | 17 |
18 | 19 | 20 | 21 | 22 |
23 | 24 |
25 |

Summary

26 |
27 |
28 |

Total Days

29 |

{{ total_days }}

30 |
31 |
32 |

Present

33 |

{{ present_days }} ({{ present_percentage }}%)

34 |
35 |
36 |

Absent

37 |

{{ absent_days }} ({{ absent_percentage }}%)

38 |
39 |
40 |

Late

41 |

{{ late_days }} ({{ late_percentage }}%)

42 |
43 |
44 |
45 | 46 |
47 |

Attendance Visualization

48 |
49 | 50 |
51 |
52 | Present 53 |
54 |
55 | Absent 56 |
57 |
58 | Late 59 |
60 |
61 |
62 |
63 | 64 |
65 |

Detailed Records

66 | 67 | 68 | 69 | 70 | {% if report_type != 'student' %} 71 | 72 | {% endif %} 73 | 74 | 75 | 76 | 77 | 78 | {% for record in attendance_records %} 79 | 80 | 81 | {% if report_type != 'student' %} 82 | 83 | {% endif %} 84 | 85 | 86 | 87 | {% else %} 88 | 89 | 90 | 91 | {% endfor %} 92 | 93 |
DateStudentStatusMarked By
{{ record.date.strftime('%Y-%m-%d') }}{{ record.student.username }}{{ record.status }}{{ record.teacher.username }}
No attendance records found.
94 |
95 | 96 | 97 | 114 |
115 | 116 | 145 | {% endblock %} 146 | -------------------------------------------------------------------------------- /tests directory/test_creational_patterns.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | from main import ( 3 | Logger, NotificationFactory, EmailNotification, SMSNotification, 4 | LightThemeFactory, DarkThemeFactory, ReportBuilder, 5 | CourseTemplate, ConnectionPool 6 | ) 7 | 8 | class TestCreationalPatterns(unittest.TestCase): 9 | 10 | def test_singleton_logger(self): 11 | logger1 = Logger() 12 | logger2 = Logger() 13 | self.assertIs(logger1, logger2) 14 | 15 | def test_factory_email_notification(self): 16 | notifier = NotificationFactory.create_notification("email") 17 | self.assertIsInstance(notifier, EmailNotification) 18 | 19 | def test_factory_sms_notification(self): 20 | notifier = NotificationFactory.create_notification("sms") 21 | self.assertIsInstance(notifier, SMSNotification) 22 | 23 | def test_factory_invalid_method(self): 24 | with self.assertRaises(ValueError): 25 | NotificationFactory.create_notification("fax") 26 | 27 | def test_abstract_factory_light_button(self): 28 | factory = LightThemeFactory() 29 | button = factory.create_button() 30 | self.assertEqual(button.__class__.__name__, "LightButton") 31 | 32 | def test_abstract_factory_dark_button(self): 33 | factory = DarkThemeFactory() 34 | button = factory.create_button() 35 | self.assertEqual(button.__class__.__name__, "DarkButton") 36 | 37 | def test_builder_report(self): 38 | builder = ReportBuilder() 39 | report = (builder.add_header("Test Report") 40 | .add_attendance_record("John", "Present") 41 | .add_footer() 42 | .build()) 43 | self.assertIn("==== Test Report ====", report.display()) 44 | self.assertIn("John - Present", report.display()) 45 | self.assertIn("==== End of Report ====", report.display()) 46 | 47 | def test_prototype_course_clone(self): 48 | original = CourseTemplate("Math", "Dr. Mukwevho") 49 | original.add_material("Chapter 1") 50 | clone = original.clone() 51 | self.assertNotEqual(id(original), id(clone)) 52 | self.assertEqual(clone.title, "Math") 53 | self.assertEqual(clone.teacher, "Dr. Mukwevho") 54 | self.assertIn("Chapter 1", clone.materials) 55 | 56 | def test_object_pool_connection_reuse(self): 57 | pool = ConnectionPool(2) 58 | conn1 = pool.get() 59 | conn2 = pool.get() 60 | self.assertIsNotNone(conn1) 61 | self.assertIsNotNone(conn2) 62 | pool.release(conn1) 63 | pool.release(conn2) 64 | conn3 = pool.get() 65 | self.assertIsNotNone(conn3) 66 | 67 | def test_object_pool_exhaustion(self): 68 | pool = ConnectionPool(1) 69 | conn1 = pool.get() 70 | conn2 = pool.get() # Should return None as pool is empty 71 | self.assertIsNotNone(conn1) 72 | self.assertIsNone(conn2) 73 | 74 | if __name__ == '__main__': 75 | unittest.main() 76 | --------------------------------------------------------------------------------