# raj-ai-ml/adroit_scheduler_timetable_generator architecture

> Architecture diagram of the GitHub repository raj-ai-ml/adroit_scheduler_timetable_generator, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-06-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/raj-ai-ml/adroit_scheduler_timetable_generator
- Repository: https://github.com/raj-ai-ml/adroit_scheduler_timetable_generator

## Overview

1. **Repository shape**
   - This is a **single Django monolith** with one project package, `M1`, and one main app, `mm1`.
   - The architecture is centered on a **timetable-generation workflow** exposed through Django views and rendered with HTML templates.

2. **Runtime and framework**
   - The app runs on **Python 3.6+** and **Django 2+**.
   - `manage.py` is the entry point, `M1/settings.py` configures the project, `M1/urls.py` wires top-level routing, and `M1/wsgi.py` is the deployment entry point.

3. **Core functional subsystem: timetable generation**
   - The main business capability is an **intelligent university timetable generator** using a **Genetic Algorithm**.
   - The README identifies both **hard constraints** and **soft constraints**, so the scheduler is not just a CRUD app; it is an optimization engine that must satisfy room capacity, teacher uniqueness, no room clashes, and weekly distribution rules.

4. **Domain/data model boundary**
   - The app’s persistent domain is likely represented by the models in `mm1/models.py`, with migrations showing at least a `section`-related change and a `class_in_week`-type attribute.
   - Based on the template names, the core entities are:
     - departments
     - instructors/teachers
     - courses
     - rooms
     - sections
   - These are the inputs to the scheduling engine and the source of truth for generated timetables.

5. **CRUD and configuration UI**
   - `mm1/forms.py` and `mm1/admin.py` indicate two management paths:
     - custom forms/pages for app users
     - Django admin for internal data maintenance
   - The templates `addep.html`, `addmt.html`, `adcrs.html`, `addsec.html`, `adins.html`, and `addrm.html` support creating and editing the master data used by the scheduler.

6. **Scheduling orchestration layer**
   - `mm1/views.py` is the likely orchestration boundary where user actions trigger data loading, timetable generation, and result rendering.
   - `mm1/urls.py` maps the app’s routes, including the timetable generation entry point referenced in the README (`/timetable_generation/`).

7. **Presentation layer**
   - The UI is template-driven, not a client-side SPA.
   - `templates/base.html` provides shared layout, while pages like `index.html`, `crslist.html`, `deptlist.html`, `instlist.html`, `mtlist.html`, `rmlist.html`, and `seclist.html` present the domain lists.
   - `templates/timetable.html` and `templates/timetable(1).html` are the output views for generated schedules.

8. **Persistence layer**
   - Data is stored in **SQLite** (`db.sqlite3`) through Django’s ORM.
   - This makes the architecture self-contained: no separate database service is present in the repo tree.

9. **Static and styling boundary**
   - Front-end assets are minimal and server-rendered.
   - `static/CSS/style.css` appears to be the app-specific stylesheet, while `assets/admin/...` is Django’s bundled admin static assets.
   - There is no evidence of a separate front-end build pipeline; styling is handled directly from static files.

10. **Data flow through the system**
   - Typical flow is:
     - user enters or edits master scheduling data
     - Django persists that data in SQLite
     - the genetic algorithm consumes the saved entities and constraints
     - a timetable is produced
     - results are rendered back to HTML templates for viewing
   - This is a classic **input-data → optimization engine → rendered schedule** pipeline.

11. **Important architectural boundary**
   - The repository does **not** show external services, message queues, or background workers.
   - That suggests the timetable optimization is executed inside the Django request/response application boundary, rather than in a separate service.

12. **What to show in an architecture diagram**
   - Draw four main blocks:
     - **Browser/UI templates**
     - **Django app layer (`mm1`)**
     - **Genetic algorithm scheduling logic**
     - **SQLite persistence**
   - Connect the CRUD pages and admin interface to the ORM, then connect the scheduling views to the domain data and the timetable output pages.

Main entry points: [`mm1/views.py`](https://github.com/raj-ai-ml/adroit_scheduler_timetable_generator/blob/main/mm1/views.py) (Views), [`M1/settings.py`](https://github.com/raj-ai-ml/adroit_scheduler_timetable_generator/blob/main/M1/settings.py) (Settings), [`mm1/models.py`](https://github.com/raj-ai-ml/adroit_scheduler_timetable_generator/blob/main/mm1/models.py) (Models), [`mm1/admin.py`](https://github.com/raj-ai-ml/adroit_scheduler_timetable_generator/blob/main/mm1/admin.py) (Admin)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_g1["Django project"]
  node_n1["manage.py<br/>entrypoint<br/>[manage.py]"]
  node_n2["Settings<br/>config<br/>[settings.py]"]
  node_n3["Root URLs<br/>router<br/>[urls.py]"]
  node_n4["WSGI<br/>deploy entry<br/>[wsgi.py]"]
end

subgraph group_g2["Timetable app"]
  node_n5[("Models<br/>domain schema<br/>[models.py]")]
  node_n6["Forms<br/>[forms.py]"]
  node_n7["Admin<br/>[admin.py]"]
  node_n8["App URLs<br/>router<br/>[urls.py]"]
  node_n9["Views<br/>request handlers<br/>[views.py]"]
  node_n10{{"Scheduler<br/>genetic algorithm"}}
end

subgraph group_g3["Templates"]
  node_n11["Base layout<br/>template layout<br/>[base.html]"]
  node_n12["Master data pages<br/>templates"]
  node_n13["Timetable views<br/>templates"]
  node_n14["Index<br/>home page<br/>[index.html]"]
end

subgraph group_g4["Static assets"]
  node_n15["Style CSS<br/>stylesheet<br/>[style.css]"]
  node_n16["Admin assets<br/>static bundle"]
end

subgraph group_g5["Data store"]
  node_n17[("SQLite DB<br/>database<br/>[db.sqlite3]")]
end

node_n1 -->|"loads config"| node_n2
node_n2 -->|"wires routes"| node_n3
node_n2 -->|"enables admin"| node_n7
node_n3 -->|"includes"| node_n8
node_n8 -->|"dispatches"| node_n9
node_n9 -->|"reads/writes"| node_n5
node_n6 -->|"submits data"| node_n9
node_n7 -->|"administers"| node_n5
node_n9 -->|"invokes"| node_n10
node_n10 -->|"consumes"| node_n5
node_n10 -->|"reads/writes"| node_n17
node_n5 -->|"persists to"| node_n17
node_n9 -->|"renders"| node_n11
node_n9 -->|"renders"| node_n12
node_n9 -->|"renders"| node_n13
node_n14 -->|"extends"| node_n11
node_n11 -->|"styles with"| node_n15
node_n7 -->|"uses"| node_n16
node_n4 -->|"starts app"| node_n2

click node_n1 "https://github.com/raj-ai-ml/adroit_scheduler_timetable_generator/blob/main/manage.py"
click node_n2 "https://github.com/raj-ai-ml/adroit_scheduler_timetable_generator/blob/main/M1/settings.py"
click node_n3 "https://github.com/raj-ai-ml/adroit_scheduler_timetable_generator/blob/main/M1/urls.py"
click node_n4 "https://github.com/raj-ai-ml/adroit_scheduler_timetable_generator/blob/main/M1/wsgi.py"
click node_n5 "https://github.com/raj-ai-ml/adroit_scheduler_timetable_generator/blob/main/mm1/models.py"
click node_n6 "https://github.com/raj-ai-ml/adroit_scheduler_timetable_generator/blob/main/mm1/forms.py"
click node_n7 "https://github.com/raj-ai-ml/adroit_scheduler_timetable_generator/blob/main/mm1/admin.py"
click node_n8 "https://github.com/raj-ai-ml/adroit_scheduler_timetable_generator/blob/main/mm1/urls.py"
click node_n9 "https://github.com/raj-ai-ml/adroit_scheduler_timetable_generator/blob/main/mm1/views.py"
click node_n11 "https://github.com/raj-ai-ml/adroit_scheduler_timetable_generator/blob/main/templates/base.html"
click node_n14 "https://github.com/raj-ai-ml/adroit_scheduler_timetable_generator/blob/main/templates/index.html"
click node_n15 "https://github.com/raj-ai-ml/adroit_scheduler_timetable_generator/blob/main/static/CSS/style.css"
click node_n16 "https://github.com/raj-ai-ml/adroit_scheduler_timetable_generator/tree/main/assets/admin"
click node_n17 "https://github.com/raj-ai-ml/adroit_scheduler_timetable_generator/blob/main/db.sqlite3"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_n1,node_n2,node_n3,node_n4 toneBlue
class node_n5,node_n6,node_n7,node_n8,node_n9,node_n10 toneAmber
class node_n11,node_n12,node_n13,node_n14 toneMint
class node_n15,node_n16 toneRose
class node_n17 toneIndigo
```

## Components

### Django project

Framework entry and configuration

- [manage.py](https://github.com/raj-ai-ml/adroit_scheduler_timetable_generator/blob/main/manage.py): entrypoint · Django command entry point · `manage.py`
- [Settings](https://github.com/raj-ai-ml/adroit_scheduler_timetable_generator/blob/main/M1/settings.py): config · Project configuration and installed apps · `M1/settings.py`
- [Root URLs](https://github.com/raj-ai-ml/adroit_scheduler_timetable_generator/blob/main/M1/urls.py): router · Top-level URL routing · `M1/urls.py`
- [WSGI](https://github.com/raj-ai-ml/adroit_scheduler_timetable_generator/blob/main/M1/wsgi.py): deploy entry · Deployment interface for Django · `M1/wsgi.py`

### Timetable app

Domain models, forms, views, and routing

- [Models](https://github.com/raj-ai-ml/adroit_scheduler_timetable_generator/blob/main/mm1/models.py): domain schema · Departments, instructors, courses, rooms, sections · `mm1/models.py`
- [Forms](https://github.com/raj-ai-ml/adroit_scheduler_timetable_generator/blob/main/mm1/forms.py): ui forms · Custom data entry and editing forms · `mm1/forms.py`
- [Admin](https://github.com/raj-ai-ml/adroit_scheduler_timetable_generator/blob/main/mm1/admin.py): admin config · Django admin registrations · `mm1/admin.py`
- [App URLs](https://github.com/raj-ai-ml/adroit_scheduler_timetable_generator/blob/main/mm1/urls.py): router · App-level route mapping · `mm1/urls.py`
- [Views](https://github.com/raj-ai-ml/adroit_scheduler_timetable_generator/blob/main/mm1/views.py): request handlers · Orchestrates CRUD and timetable generation · `mm1/views.py`
- **Scheduler**: genetic algorithm · Optimization engine for timetable generation

### Templates

Server-rendered UI pages

- [Base layout](https://github.com/raj-ai-ml/adroit_scheduler_timetable_generator/blob/main/templates/base.html): template layout · Shared page shell · `templates/base.html`
- **Master data pages**: templates · Department, instructor, course, room, and section pages
- **Timetable views**: templates · Generated schedule output pages
- [Index](https://github.com/raj-ai-ml/adroit_scheduler_timetable_generator/blob/main/templates/index.html): home page · Landing page · `templates/index.html`

### Static assets

Styles and bundled admin assets

- [Style CSS](https://github.com/raj-ai-ml/adroit_scheduler_timetable_generator/blob/main/static/CSS/style.css): stylesheet · App-specific styling · `static/CSS/style.css`
- [Admin assets](https://github.com/raj-ai-ml/adroit_scheduler_timetable_generator/tree/main/assets/admin): static bundle · Bundled Django admin CSS/JS/fonts · `assets/admin`

### Data store

SQLite persistence

- [SQLite DB](https://github.com/raj-ai-ml/adroit_scheduler_timetable_generator/blob/main/db.sqlite3): database · Local persistent storage · `db.sqlite3`

## Connections

- manage.py → Settings: loads config · Manage commands use project settings
- Settings → Root URLs: wires routes · Settings include the project URL configuration
- Settings → Admin: enables admin · Admin is registered through Django settings and app config
- Root URLs → App URLs: includes · Top-level routing delegates to app routes
- App URLs → Views: dispatches · App routes map requests to handlers
- Views → Models: reads/writes · Views persist and query master data
- Forms → Views: submits data · Forms feed request handlers for create/edit flows
- Admin → Models: administers · Django admin manages the same domain entities
- Views → Scheduler: invokes · Timetable generation is triggered from request handling
- Scheduler → Models: consumes · Optimization uses courses, rooms, instructors, sections, and departments
- Scheduler → SQLite DB: reads/writes · Generated schedules and source data are stored in SQLite
- Models → SQLite DB: persists to · ORM-backed domain storage
- Views → Base layout: renders · Views compose pages through the shared layout
- Views → Master data pages: renders · CRUD screens display master data lists and editors
- Views → Timetable views: renders · Views return the generated timetable pages
- Index → Base layout: extends · Home page uses the shared base template
- Base layout → Style CSS: styles with · Shared UI styling comes from the app stylesheet
- Admin → Admin assets: uses · Admin UI depends on bundled static assets
- WSGI → Settings: starts app · WSGI boots Django with project settings
