Academic Timetable Generation System - A comprehensive solution for generating and managing academic schedules
Project description
Timetable Builder
A comprehensive, modular data pipeline system for transforming academic configuration data into AI-ready scheduling inputs and enriched timetable outputs. The system implements a six-stage progressive data enrichment model with robust validation and type safety.
Table of Contents
- Overview
- Key Features
- System Architecture
- Installation
- Quick Start
- Project Structure
- CLI Reference
- Stage Descriptions
- API Usage
- Configuration
- Development
- Contributing
- License
Overview
The Timetable Builder System is designed to streamline the complex process of academic timetable generation. It transforms basic institutional dataโfaculty rosters, subject definitions, student groups, and scheduling constraintsโinto comprehensive, validated datasets suitable for AI-driven scheduling algorithms.
The system employs a modular, six-stage pipeline architecture that ensures data integrity, maintainability, and scalability. Each stage builds upon validated outputs from previous stages, creating a robust foundation for automated timetable generation.
Key Features
๐ง Modular Architecture
- Six-stage progressive data enrichment pipeline
- Independent, testable components
- Clear separation of concerns
โ Data Validation
- Pydantic model validation throughout the pipeline
- JSON Schema validation for data integrity
- Comprehensive error reporting and debugging
๐ CLI Interface
- Unified command-line interface for all operations
- Intuitive commands for building, validation, and data management
- Rich output with progress indicators and detailed reporting
๐ Comprehensive Reporting
- Human-readable reports and summaries
- Multiple export formats (CSV, JSON, Markdown)
- Detailed analytics and conflict detection
๐ Type Safety
- Full type annotations throughout the codebase
- Runtime validation with Pydantic models
- Compile-time type checking support
๐งช Testing Framework
- Comprehensive test suite (278+ tests)
- Unit and integration test coverage
- Automated validation and regression testing
System Architecture
Design Philosophy
The system implements a progressive data enrichment model where each stage transforms and enhances data from the previous stage. This approach ensures:
- Data Integrity: Each stage validates its inputs and outputs
- Modularity: Stages can be developed, tested, and modified independently
- Traceability: Clear data lineage from configuration to final output
- Maintainability: Isolated components reduce coupling and complexity
Data Flow Pipeline
Stage 1: Configuration Layer
โ (Validation + Enrichment)
Stage 2: Data Building
โ (Assignment Generation)
Stage 3: Teaching Assignments
โ (Consolidation)
Stage 4: AI Scheduling Input
โ (AI Processing)
Stage 5: AI Schedule Output
โ (Enrichment + Analysis)
Stage 6: Enriched Timetable
Core Components
- DataLoader: Centralized data access with automatic validation
- Pydantic Models: Type-safe data structures for all entities
- CLI Framework: Command-line interface built with Click
- Schema Validation: JSON Schema validation for data integrity
- Build System: Modular stage-specific build processors
Installation
Prerequisites
- Python 3.10 or higher
- pip package manager
PyPI Installation (Recommended)
Install the latest stable version from PyPI:
pip install timetable-builder
Development Installation
For development, testing, or the latest features:
-
Clone the repository:
git clone https://github.com/sujith-eag/timetable-builder.git cd timetable-builder
-
Install in development mode:
pip install -e .
-
Verify installation:
timetable --version
For development with all dependencies:
# Install with development dependencies
pip install -e ".[dev]"
# Run tests
pytest
# Run linting
ruff check .
Quick Start
1. Initialize a New Project
# Create a new timetable project
timetable init --data-dir ./my_timetable_project
# Navigate to the project directory
cd my_timetable_project
2. Configure Stage 1 Data
Edit the template files in stage_1/ with your institutional data:
config.json- Time slots, rooms, and scheduling parametersfacultyBasic.json- Faculty rostersubjects*.json- Subject definitionsstudentGroups.json- Student group configurations
3. Build and Validate
# Validate Stage 1 data
timetable validate --stage 1
# Build Stage 2 enriched data
timetable build stage2
# Validate Stage 2 data
timetable validate --stage 2
# Build complete pipeline
timetable build all
4. View Results
# Check pipeline status
timetable status
# View data summaries
timetable info all
# Export data
timetable export csv
Project Structure
timetable-builder/
โโโ src/timetable/ # Main package
โ โโโ cli/ # Command-line interface
โ โ โโโ __init__.py # CLI entry point
โ โ โโโ build.py # Build commands
โ โ โโโ validate.py # Validation commands
โ โ โโโ info.py # Information display
โ โ โโโ load.py # Data loading
โ โ โโโ export.py # Data export
โ โ โโโ schema.py # Schema validation
โ โโโ core/ # Core functionality
โ โ โโโ loader.py # DataLoader class
โ โ โโโ schema.py # Schema validation
โ โ โโโ exceptions.py # Custom exceptions
โ โโโ models/ # Pydantic data models
โ โ โโโ stage1.py # Stage 1 models
โ โ โโโ stage2.py # Stage 2 models
โ โ โโโ stage6.py # Stage 6 models
โ โโโ scripts/ # Stage-specific scripts
โ โ โโโ stage2/ # Stage 2 build scripts
โ โ โโโ stage3/ # Stage 3 build scripts
โ โ โโโ stage6/ # Stage 6 processing scripts
โ โโโ stages/ # Template data files
โ โโโ stage_1/ # Stage 1 templates
โโโ schemas/ # JSON schemas
โ โโโ stage1/ # Stage 1 schemas
โ โโโ stage2/ # Stage 2 schemas
โ โโโ stage6/ # Stage 6 schemas
โโโ tests/ # Test suite
โ โโโ unit/ # Unit tests
โ โโโ integration/ # Integration tests
โโโ docs/ # Documentation
โโโ pyproject.toml # Package configuration
CLI Reference
Core Commands
Project Management
timetable init --data-dir <path> # Initialize new project
timetable status # Show pipeline status
Data Validation
timetable validate --all # Validate all stages
timetable validate --stage <1-6> # Validate specific stage
timetable schema list # List available schemas
timetable schema validate <name> # Validate against schema
Build Pipeline
timetable build all # Build all stages
timetable build stage<N> # Build specific stage
timetable build check # Check build readiness
Data Inspection
timetable info all # Complete data summary
timetable info faculty # Faculty information
timetable info subjects # Subject information
timetable load faculty --stage 2 # Load and display data
Data Export
timetable export csv # Export to CSV
timetable export json # Export to JSON
timetable export markdown # Export reports
Command Groups
| Group | Commands | Purpose |
|---|---|---|
| build | all, stage2-6, check |
Build pipeline stages |
| validate | --all, --stage |
Data validation |
| info | all, faculty, subjects, etc. |
Data inspection |
| load | faculty, subjects, config |
Data loading |
| export | csv, json, markdown |
Data export |
| schema | list, validate |
Schema validation |
Stage Descriptions
Stage 1: Configuration Layer
Purpose: Define institutional constraints, resources, and scheduling rules.
Input Files:
config.json- Time slots, days, rooms, and scheduling parametersfacultyBasic.json- Faculty roster with basic informationsubjects1CoreBasic.json- Semester 1 core subject definitionssubjects3CoreBasic.json- Semester 3 core subject definitionssubjects3ElectBasic.json- Semester 3 elective subjectsstudentGroups.json- Student group and section definitionsroomPreferences.json- Room preferences and constraints
Validation: Pydantic models with JSON Schema validation.
Stage 2: Data Enrichment
Purpose: Transform basic Stage 1 data into enriched, component-level representations.
Processes:
- Expand subject credit patterns into detailed components
- Calculate faculty workload statistics
- Generate comprehensive subject and faculty profiles
Output Files:
subjects2Full.json- Subjects with expanded componentsfaculty2Full.json- Faculty with workload calculations- Build reports with human-readable summaries
Scripts: build_subjects_full.py, build_faculty_full.py, build_all.py
Stage 3: Teaching Assignment Generation
Purpose: Generate optimized teaching assignments based on institutional rules.
Processes:
- Assign faculty to subjects based on qualifications and availability
- Generate teaching assignments for all semesters
- Create constraint matrices and overlap analysis
Output Files:
teachingAssignments_sem1.json- Semester 1 assignmentsteachingAssignments_sem3.json- Semester 3 assignmentsstatistics.json- Assignment statistics and summariesreports/- Detailed Markdown reports
Scripts: assignment_generator.py, generate_statistics.py, build_all.py
Stage 4: AI Scheduling Input Consolidation
Purpose: Consolidate all data into a single, self-contained input for AI scheduling.
Process: Aggregate data from Stages 1-3 into a comprehensive scheduling input file.
Output File: schedulingInput.json - Complete AI scheduling input
Scripts: build_scheduling_input.py, view_scheduling_input.py
Stage 5: AI Schedule Output
Purpose: Store and validate AI-generated schedule outputs.
Input: AI solver output (typically ai_solved_schedule.json)
Validation: Schema validation against expected AI output format
Scripts: generate_schedule_template.py (utility for testing)
Stage 6: Enriched Timetable Generation
Purpose: Transform AI schedule into comprehensive, human-readable timetable.
Processes:
- Enrich schedule with detailed faculty, subject, and room information
- Generate conflict analysis and validation reports
- Create faculty and student schedule views
Output Files:
timetable_enriched.json- Complete enriched timetableschedule_analysis_report.md- Conflict analysisviews/- Individual faculty and student schedules
Scripts: enrich_schedule.py, analyze_schedule.py, generate_*_views.py
API Usage
DataLoader Class
The DataLoader provides type-safe data access with automatic validation:
from timetable.core import DataLoader
# Initialize loader
loader = DataLoader("/path/to/project")
# Load Stage 1 data
config = loader.load_config()
faculty = loader.load_faculty()
subjects = loader.load_subjects(semester=1)
# Load Stage 2 data
faculty_full = loader.load_faculty_full()
subjects_full = loader.load_subjects_full()
# Load Stage 3 data
assignments = loader.load_teaching_assignments(semester=1)
statistics = loader.load_statistics()
Pydantic Models
All data structures are defined as Pydantic models for type safety:
from timetable.models.stage1 import Faculty, Subject
from timetable.models.stage2 import FacultyFull, SubjectFull
# Models provide validation and type hints
faculty: Faculty = loader.load_faculty()[0]
# Type checking and validation automatic
Configuration
Environment Variables
# Project configuration
TIMETABLE_DATA_DIR=/path/to/project
TIMETABLE_LOG_LEVEL=INFO
TIMETABLE_STRICT_MODE=false
# Development settings
TIMETABLE_DEBUG=true
TIMETABLE_VERBOSE=true
Project Configuration
Each project contains a .env file with project-specific settings and a stage_1/config.json with scheduling parameters.
Development
Running Tests
# Run all tests
pytest
# Run with coverage
pytest --cov=timetable
# Run specific test categories
pytest tests/unit/
pytest tests/integration/
Code Quality
# Linting
ruff check .
# Formatting
ruff format .
# Type checking
mypy src/timetable/
Building Documentation
# Generate documentation
sphinx-build docs/ docs/_build/
# Serve documentation locally
sphinx-autobuild docs/ docs/_build/
Contributing
We welcome contributions to the Timetable Builder System! Please see our Contributing Guide for details.
Development Workflow
- Fork the repository
- Create a feature branch:
git checkout -b feature/your-feature - Make your changes with tests
- Run the test suite:
pytest - Submit a pull request
Code Standards
- Type Hints: All functions and methods must have type annotations
- Docstrings: Comprehensive docstrings for all public APIs
- Testing: Unit tests for all new functionality
- Linting: Code must pass
ruffchecks
License
This project is licensed under the MIT License - see the LICENSE file for details.
Support
For questions, issues, or contributions:
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Documentation: Full Documentation
Timetable Builder System - Transforming academic data into optimized schedules through intelligent automation.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file timetable_builder-0.1.0.tar.gz.
File metadata
- Download URL: timetable_builder-0.1.0.tar.gz
- Upload date:
- Size: 113.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
333790b14b4a2a0c9730ed169d85352903eeca4b9ac69f98146938f6a751b00f
|
|
| MD5 |
5c97f1474c8d38a73e3bfab68144a2e9
|
|
| BLAKE2b-256 |
052409d4a95ea2f937a153b13b24975c779af5c5ee401b0901a0114f12e01fb8
|
File details
Details for the file timetable_builder-0.1.0-py3-none-any.whl.
File metadata
- Download URL: timetable_builder-0.1.0-py3-none-any.whl
- Upload date:
- Size: 171.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9d8cee6b12b9ec634fb6cfde5656e6fe497aa38e9d5abdfbf3cd9b5349364614
|
|
| MD5 |
bf172bd63188a6f0a6b297b7589457e5
|
|
| BLAKE2b-256 |
b552cb3d6ea809c75181e5035a285f5096ab583d9adae51017a660e39615b302
|