# prasanthcoder/seating-arrangement-and-invigilator-scheduling architecture

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

- Interactive diagram: https://gitdiagram.com/prasanthcoder/seating-arrangement-and-invigilator-scheduling
- Repository: https://github.com/prasanthcoder/seating-arrangement-and-invigilator-scheduling

## Overview

##### Main Components
- Web Server/Django Application: Represent the umbrella system with its Django project under the “epics” directory (for settings, URLs, WSGI, ASGI) and two Django apps (“facsch” and “seating”).
- Frontend/UI Layer: Include the templates (HTML files such as admindash.html, faculty.html, etc.) and static assets (CSS under “static”) that define the user interfaces for admin, faculty, and possibly students.
- Database: Mark PostgreSQL as the central data store for user data, exam seating, invigilator schedules, ticket records, and any other persistent data.
- Background Task Processing: Illustrate the Celery worker (configured in epics/celery.py), which handles asynchronous tasks such as scheduled email notifications via SMTP.
- External Messaging/AMQP: Include a connection to the CloudAMQP server (as indicated in the README) that’s tied to Celery.
- Email Service (SMTP): Show the email service used to dispatch notifications for exam schedules and invigilator reminders.

##### Relationships and Interactions
- Frontend (browser clients) interacts with the Django server for login, form submissions (faculty ticket raising, seating or scheduling info upload).
- The Django server talks directly to the PostgreSQL database for CRUD operations across the different modules.
- Upon receiving input (such as excel uploads or scheduling form submissions), the Django apps (seating and facsch) process the information according to business rules (like seating constraints or invigilator work hour constraints).
- For actions that require asynchronous processing (email notifications, scheduling computations), Django enqueues tasks to Celery.
- Celery workers grab tasks from the AMQP message queue (CloudAMQP) and execute these jobs.
- After processing, results (e.g., generated seating arrangement Excel) are sent back to the client via a HTTP response or made available for download.

##### Architectural Patterns and Principles
- The project is organized as a typical Django MVC (Model-View-Controller) pattern.
- There is a clear separation between concerns: Data management (Django models within seating and facsch), presentation (templates), request routing (urls.py in multiple apps), and asynchronous processing (Celery).
- Integration of external systems (SMTP, CloudAMQP, Excel file inputs/outputs) which form peripheral but vital components in the overall architecture.

##### Relevant Technologies and Their Roles
- Django: Core web framework managing web requests, rendering UI, and model logic.
- Celery + CloudAMQP: Handling asynchronous tasks (ex. sending emails as per schedule).
- PostgreSQL: Primary database for persistent storage.
- SMTP: Used for sending email notifications.
- Excel Files: Both as input (data ingestion) and output (result generation).

## Diagram (Mermaid)

```mermaid
graph TD
    %% Frontend/UI Layer
    subgraph "Frontend/UI"
        T("Templates (HTML)"):::frontend
        S("Static Assets (CSS)"):::frontend
    end
    Browser("Browser/Client"):::client

    %% Backend/Django Application
    subgraph "Backend/Django Application"
        D("Django Web Server"):::django
        F("Faculty Scheduling App"):::django
        E("Seating Arrangement App"):::django
    end

    %% Background Processing
    subgraph "Background Processing"
        C("Celery Worker"):::celery
        A("CloudAMQP Server"):::external
        M("SMTP Email Service"):::external
    end

    %% External Services
    subgraph "External Services"
        DB("PostgreSQL Database"):::database
    end

    %% External Data Files
    subgraph "External Data Files"
        EX1("Seating.xlsx"):::file
        EX2("StudentInput.xlsx"):::file
        EX3("SubjectInfo.xlsx"):::file
        EX4("registations.xlsx"):::file
    end

    %% Connections between layers
    Browser -->|"HTTP_request"| D
    
    D -->|"includes"| F
    D -->|"includes"| E
    D -->|"CRUD_operations"| DB
    F -->|"CRUD_operations"| DB
    E -->|"CRUD_operations"| DB

    EX1 --->|"upload_data"| D
    EX2 --->|"upload_data"| D
    EX3 --->|"upload_data"| D
    EX4 --->|"upload_data"| D

    D -->|"enqueue_task"| C
    A -.->|"AMQP_messages"| C
    C -->|"send_email"| M

    %% Styles
    classDef frontend fill:#ffdead,stroke:#8b6914,stroke-width:2px;
    classDef client fill:#ffe4e1,stroke:#ff1493,stroke-width:2px;
    classDef django fill:#add8e6,stroke:#00008b,stroke-width:2px;
    classDef celery fill:#98fb98,stroke:#008000,stroke-width:2px;
    classDef external fill:#ffb6c1,stroke:#ff69b4,stroke-width:2px;
    classDef database fill:#e0ffff,stroke:#20b2aa,stroke-width:2px;
    classDef file fill:#fafad2,stroke:#ffd700,stroke-width:2px;

    %% Click Events
    click D "https://github.com/prasanthcoder/seating-arrangement-and-invigilator-scheduling/tree/main/epics/"
    click F "https://github.com/prasanthcoder/seating-arrangement-and-invigilator-scheduling/tree/main/facsch/"
    click E "https://github.com/prasanthcoder/seating-arrangement-and-invigilator-scheduling/tree/main/seating/"
    click T "https://github.com/prasanthcoder/seating-arrangement-and-invigilator-scheduling/tree/main/templates/"
    click S "https://github.com/prasanthcoder/seating-arrangement-and-invigilator-scheduling/tree/main/static/"
    click C "https://github.com/prasanthcoder/seating-arrangement-and-invigilator-scheduling/blob/main/epics/celery.py"
    click EX1 "https://github.com/prasanthcoder/seating-arrangement-and-invigilator-scheduling/blob/main/Seating.xlsx"
    click EX2 "https://github.com/prasanthcoder/seating-arrangement-and-invigilator-scheduling/blob/main/StudentInput.xlsx"
    click EX3 "https://github.com/prasanthcoder/seating-arrangement-and-invigilator-scheduling/blob/main/SubjectInfo.xlsx"
    click EX4 "https://github.com/prasanthcoder/seating-arrangement-and-invigilator-scheduling/blob/main/registations.xlsx"
```
