How masterprg/kakaoo works
Project Type and Purpose
• The project is a Django-based web application designed for scheduling university courses. It uses three specialized algorithms – a Graph Coloring algorithm, a Genetic Algorithm, and a Penalty Genetic Algorithm – to group lessons, arrange them throughout the week, and handle conflicts.
• This places the project in the full-stack web application category, with both a presentation layer (front end via HTML templates and static resources) and a business logic layer (scheduler algorithms and Django backend).
Analyzing the File Structure
• Top-Level Files and Directories:
• “app/”: Contains the Django project.
• “app/app/”: Contains the core Django configuration files such as settings.py, asgi.py, wsgi.py, and urls.py.
• “app/manage.py”: The management script to run commands like migrations and starting the server.
• “app/scheduler/”: The dedicated Django app for scheduling, holding models, views, URLs, admin definitions, and migrations.
• “app/scheduler/Graph.py”, “app/scheduler/genetic_algorithm.py”, etc.: These files house the scheduling algorithms (graph coloring, genetic, penalty genetic) that form the core business logic.
• “app/templates/” and “app/static/”: These directories contain the HTML templates and static assets (CSS, JS) used by the front end.
Key Architectural Components
a. Presentation Layer:
• Client/browser sends HTTP requests.
• Django views in the scheduler app render HTML using templates under “app/templates/”.
• Static files (CSS/JS) under “app/static/scheduler/” provide UI styling and interactions.
b. Application Layer (Backend):
• Django Core: Configured from “app/app/” with URL configurations directing to the scheduler app via “app/scheduler/urls.py”.
• Scheduler App: Contains routes, views, and models to handle user operations such as adding courses, professors, and linking them.
• Business Logic: Scheduler-specific algorithms (Graph.py, genetic_algorithm.py, etc.) manage the complex scheduling operations.
c. Data Layer:
• Django Models under “app/scheduler/models.py” define the database structure for courses, professors, and schedule relationships.
• Migrations in “app/scheduler/migrations/” ensure that the database schema stays in sync with the models.
Relationships and Interactions
• The browser communicates with the Django server, which uses its URL routing system to dispatch requests.
• Views use the scheduler’s models to retrieve/update data in the database.
• When a scheduling operation is triggered, the view calls the appropriate algorithm module (Graph Coloring, Genetic Algorithm, Penalty Genetic Algorithm) to determine optimal scheduling.
• The outcomes are passed back to views, which then render the schedule using templates.
• Admin interfaces (configured in “app/scheduler/admin.py”) allow management of courses and professors.
Important Architectural Patterns
• MVC (or MTV in Django terms): Templates (View), Models (Data), and Views (Controller in Django) are clearly separated.
• Layered Architecture: Distinct separation between presentation (templates, static files), business logic (views and algorithm modules), and data persistence (models and migrations).
• Algorithm Isolation: The scheduling logic is modularized into separate files, making it easier to maintain or replace.