# aman3054/elective_bucket_selection architecture

> Architecture diagram of the GitHub repository aman3054/elective_bucket_selection, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-06). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/aman3054/elective_bucket_selection
- Repository: https://github.com/aman3054/elective_bucket_selection

## Overview

##### Main Components
- Web Application Frontend:
– User Interface built with HTML, CSS, Bootstrap, JavaScript, and React.
– Provides a responsive portal for students to select electives.
- Web Application Backend:
– PHP server logic that processes elective choices, handles business logic, and interacts with the database.
– SQL database for storing elective selections and related data.
- Facial Recognition Subsystem:
– Python-based modules (main.py, face_recognition.py, train.py, Student.py, attendance.py) that likely handle student image processing.
– XML files (classifier.xml, haarcascade_frontalface_alt2.xml, haarcascade_frontalface_default.xml) as training/classification data for face detection.
– This subsystem can be viewed as a microservice or separate module that authenticates students (or registers attendance) using computer vision.

##### Relationships and Interactions
- The Frontend communicates with the Backend to process elective selections.
- The Backend handles business logic and triggers database operations (SQL).
- The Facial Recognition Subsystem operates alongside this stack—either as a standalone service or an integrated module that the web backend can call for verifying students before they make selections.
- Data flows:
– User inputs from the browser → sent to Backend (PHP) → database updates.
– Image processing workflow: A student’s image is captured and passed to the Python service where face_recognition.py and train.py work together using the provided XML cascade classifiers. The results (e.g., student identity, attendance confirmation) are then fed back to the main system.

##### Architectural Patterns and Design Principles
- Separation of Concerns:
– Clearly isolate the frontend, backend, and the facial recognition subsystem.
– Each component focuses on its specific task – UI, business logic & persistence, and biometric processing.
- Microservices / Modular Architecture:
– The facial recognition module can be thought of as a specialized service that interacts with the main application.
- Dependency and Integration Points:
– Mark how the PHP backend would interact (e.g., via API calls or an intermediary service) with the Python-based image processing component.

##### Relevant Technologies
- Frontend: HTML, CSS, Bootstrap, JavaScript, React.
- Backend: PHP.
- Database: SQL.
- Facial Recognition: Python, OpenCV (implied by the use of Haar cascades), and custom modules for training and recognition.

## Diagram (Mermaid)

```mermaid
graph TD
    %% Client Layer
    subgraph "Client Layer"
        FE["Frontend (React/HTML/CSS/JS)"]:::frontend
    end

    %% Application Layer
    subgraph "Application Layer"
        BE["Backend (PHP)"]:::backend
        FR["Facial Recognition Service (Python)"]:::service
        subgraph "Face Recognition Subcomponents"
            main["main.py"]:::python
            face_recog["face_recognition.py"]:::python
            train["train.py"]:::python
            Student["Student.py"]:::python
            attendance["attendance.py"]:::python
            subgraph "Cascade Classifiers"
                classifier["classifier.xml"]:::xml
                haar_alt["haarcascade_frontalface_alt2.xml"]:::xml
                haar_def["haarcascade_frontalface_default.xml"]:::xml
            end
        end
    end

    %% Persistence Layer
    subgraph "Persistence Layer"
        DB["Database (SQL)"]:::database
    end

    %% Data Flow
    FE -->|"sendsRequest"| BE
    BE -->|"queriesUpdates"| DB
    BE -->|"triggersVerification"| FR
    FR -->|"returnsResult"| BE

    %% Click Events
    click FE "https://github.com/aman3054/elective_bucket_selection/blob/main/README.md"
    click main "https://github.com/aman3054/elective_bucket_selection/blob/main/main.py"
    click face_recog "https://github.com/aman3054/elective_bucket_selection/blob/main/face_recognition.py"
    click train "https://github.com/aman3054/elective_bucket_selection/blob/main/train.py"
    click Student "https://github.com/aman3054/elective_bucket_selection/blob/main/Student.py"
    click attendance "https://github.com/aman3054/elective_bucket_selection/blob/main/attendance.py"
    click classifier "https://github.com/aman3054/elective_bucket_selection/blob/main/classifier.xml"
    click haar_alt "https://github.com/aman3054/elective_bucket_selection/blob/main/haarcascade_frontalface_alt2.xml"
    click haar_def "https://github.com/aman3054/elective_bucket_selection/blob/main/haarcascade_frontalface_default.xml"

    %% Styles
    classDef frontend fill:#ffebcd,stroke:#000,stroke-width:2px;
    classDef backend fill:#add8e6,stroke:#000,stroke-width:2px;
    classDef service fill:#90ee90,stroke:#000,stroke-width:2px;
    classDef database fill:#f4a460,stroke:#000,stroke-width:2px;
    classDef python fill:#87cefa,stroke:#000,stroke-width:2px;
    classDef xml fill:#ffe4b5,stroke:#000,stroke-width:2px;
```
