How shreyavaidya2311/timetable-generator works
Project Type and Purpose
• This is a full-stack, single-page web application (“Time Table Generator”) that lets users enter course and scheduling constraints via a React frontend and generates a valid timetable by solving a Constraint Satisfaction Problem (CSP) in a Python/Flask backend.
File Structure
• Top-level folders:
• backend/ – Flask application (app.py), CSP solver (csp.py), data model (model.py), Python dependencies (requirements.txt)
• src/ – React application (components, pages, styles, tests)
• public/ – Static HTML, manifest, robots.txt
• Config files: package.json & package-lock.json for frontend, requirements.txt for backend
• No external database—data is passed in at runtime and processed in memory.
Key Insights from README
• Users supply courses, instructors, lecture counts, durations, working hours, and pairwise “non-consecutive” constraints.
• The backend models “variables” (timeslots), “domains” (subjects), and enforces constraints (no overlaps, teacher hours, etc.).
• Tech stack: React + Node for frontend; Python + Flask + python-constraint library for backend.
Main Architectural Components
a. Frontend (Browser)
• React SPA (src/) with components:
– AddCourses.jsx
– AddConstraints.jsx
– ViewTimeTable.jsx
– Dashboard.jsx
• Public assets (public/index.html)
b. API Layer (Flask app.py)
• HTTP endpoints for submitting course data, constraints, and requesting timetable
c. CSP Engine
• csp.py implements solver algorithms
• model.py defines data structures (Course, Instructor, TimeSlot)
d. Data Flow & User Interaction
• User → React UI → REST API → CSP Engine → Flask returns JSON → React renders timetable
Relationships and Interactions
• Directional HTTP calls from frontend to backend
• Internal calls: app.py imports model.py and csp.py to build and solve the CSP
• JSON payloads carry course definitions, constraint lists, and solution timetables
Architectural Patterns and Design Principles
• Separation of concerns: UI vs. API vs. business logic (CSP solver)
• Modularization: React components vs. Flask modules
• Stateless backend: no persistent store, each request reconstructs and solves the CSP
Technologies and Frameworks to Annotate
• React (UI)
• Axios or Fetch (HTTP client in React)
• Flask (REST API)
• python-constraint (solver library)
• Node/NPM (frontend build)
• pip (backend dependencies)