How adroit-abhik/adroit-scheduler works
1. What this repository is
- A single Django monolith for university timetable generation.
- The core idea is to collect academic resources and then produce a timetable using a genetic algorithm that balances hard and soft scheduling constraints.
2. Top-level application boundary
- M1/ is the Django project configuration layer: settings, root URL routing, and WSGI entrypoint.
- mm1/ is the main application containing the domain logic, data models, forms, view handlers, admin registration, and tests.
3. Persistence and runtime
- The project uses SQLite via db.sqlite3, so the architecture is self-contained and local-file backed.
- The runtime dependency profile is minimal: Python 3.6+ and Django 2+.
4. Domain model layer
- mm1/models.py and the migrations define the core scheduling entities.
- The file names and migration history indicate administrative entities such as departments, courses, instructors/mentors, rooms, and sections/classes.
- 0002_section_num_class_in_week.py shows that section-level weekly load is part of the schema, which matters for timetable generation constraints.
5. Schema evolution
- The mm1/migrations/ directory shows the data model is Django-ORM managed and has evolved at least twice.
- That means the timetable logic depends on persisted relational state, not on in-memory or file-based configuration.
6. User-facing CRUD workflow
- The templates addep.html, adcrs.html, adins.html, addrm.html, and addsec.html suggest separate create/edit screens for each scheduling entity.
- The list pages deptlist.html, crslist.html, instlist.html, rmlist.html, and seclist.html indicate a classic admin workflow: define resources first, then generate schedules from them.
7. Timetable generation flow
- The main output pages are timetable.html and timetable(1).html.
- The timetable generation is likely triggered from a dedicated route/view in mm1/views.py, which reads persisted entities, runs the optimization logic, and renders the schedule result into the template.
8. Optimization boundary
- The README is explicit that the timetable is generated by a genetic algorithm.
- This means the architectural boundary is between:
- deterministic data collection/storage in Django models, and
- heuristic optimization that assigns courses, rooms, teachers, and time slots while respecting constraints.
9. Constraint semantics
- Hard constraints listed in the README include unique class timing, room capacity, no double-booked rooms, unique teacher timing, and correct teacher-course assignment.
- Soft constraints include matching section requirements, department alignment, and even weekly distribution.
- These constraints are the core business rules that the optimization engine must satisfy or optimize against.
10. Presentation layer
- templates/base.html is the shared layout shell, and the remaining templates extend it for forms, lists, and timetable output.
- Styling is split between project-local CSS in static/CSS/style.css and the copied Django admin assets under assets/admin/, which suggests the project reuses standard admin UI resources.
11. Django admin and form handling
- mm1/admin.py exposes the domain entities to Django admin.
- mm1/forms.py likely provides structured input forms for the add/edit screens, separating validation from view rendering.
12. Routing and request flow
- M1/urls.py is the project-level router; mm1/urls.py holds application routes.
- The request path is therefore: browser → Django URL resolver → mm1.views → ORM/forms → template rendering → timetable or CRUD page.
13. What is not present
- There is no sign of a separate API service, background worker, message queue, or external database.
- The architecture is therefore a compact, single-process web app with all major logic inside the Django app.
14. Best diagram focus
- Show four main blocks: UI templates, Django views/forms, ORM + SQLite models, and genetic timetable optimizer.
- The optimizer should be drawn as consuming model data and producing a rendered timetable, with admin CRUD feeding the data store upstream.
Main entry points: views.py Scheduler · models.py Domain models · base.html Base layout · manage.py manage.py
Components 17
Django project
Project configuration and entrypoints
- manage.py · Django command entrypoint
manage.py - Settings · Project settings and Django configuration
M1/settings.py - Project routes · Root URL routing for the site
M1/urls.py - WSGI · Deployment entrypoint
M1/wsgi.py
Main app
Domain logic, persistence, and request handling
- App config · Application registration
mm1/apps.py - App routes · Application URL patterns
mm1/urls.py - Scheduler · CRUD handlers and timetable generation flow
mm1/views.py - Forms · Structured input and validation for entity screens
mm1/forms.py - Domain models · Departments, courses, instructors, rooms, sections, and timetable data
mm1/models.py - Admin · Model registration for Django admin
mm1/admin.py - Migrations · Managed database schema history
mm1/migrations/0001_initial.py
Presentation
Templates and static assets
- Base layout · Shared page shell
templates/base.html - CRUD pages · Department, course, instructor, room, and section forms/lists
templates/addep.html - Timetable pages · Rendered schedule output
templates/timetable.html - Home page · Landing page
templates/index.html - Styles · Project styling
static/CSS/style.css
Storage
Local SQLite database and schema evolution
- SQLite DB · Local file-backed persistence
db.sqlite3
Connections 18
- manage.py → WSGI: starts · Launches the Django application
- manage.py → Settings: loads · Uses project settings
- Project routes → App routes: includes · Routes requests into the app
- WSGI → Settings: configures · Reads Django configuration
- App routes → Scheduler: dispatches · Maps requests to handlers
- Scheduler → Forms: validates · Processes entity input through forms
- Scheduler → Domain models: reads/writes · Loads scheduling resources and saved timetable data
- Scheduler → Timetable pages: renders · Produces timetable output pages
- Scheduler → CRUD pages: renders · Serves create/list workflows
- CRUD pages → Base layout: extends · Shares the common layout
- Timetable pages → Base layout: extends · Uses the shared layout shell
- Home page → Base layout: extends · Uses the shared layout shell
- Base layout → Styles: styles · Applies site styling
- Admin → Domain models: registers · Exposes domain entities to admin
- Domain models → SQLite DB: persists to · Stores scheduler state in SQLite
- Migrations → Domain models: evolves · Tracks schema changes for the domain model
- Migrations → SQLite DB: applies to · Materializes schema in the database
- App config → Domain models: contains · App boundary for the main domain package