Skip to main content

Academic Timetable Generation System - A comprehensive solution for generating and managing academic schedules

Project description

Timetable Builder

PyPI Version Version Python License

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

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:

  1. Clone the repository:

    git clone https://github.com/sujith-eag/timetable-builder.git
    cd timetable-builder
    
  2. Install in development mode:

    pip install -e .
    
  3. 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 parameters
  • facultyBasic.json - Faculty roster
  • subjects*.json - Subject definitions
  • studentGroups.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 parameters
  • facultyBasic.json - Faculty roster with basic information
  • subjects1CoreBasic.json - Semester 1 core subject definitions
  • subjects3CoreBasic.json - Semester 3 core subject definitions
  • subjects3ElectBasic.json - Semester 3 elective subjects
  • studentGroups.json - Student group and section definitions
  • roomPreferences.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 components
  • faculty2Full.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 assignments
  • teachingAssignments_sem3.json - Semester 3 assignments
  • statistics.json - Assignment statistics and summaries
  • reports/ - 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 timetable
  • schedule_analysis_report.md - Conflict analysis
  • views/ - 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

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/your-feature
  3. Make your changes with tests
  4. Run the test suite: pytest
  5. 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 ruff checks

License

This project is licensed under the MIT License - see the LICENSE file for details.

Support

For questions, issues, or contributions:


Timetable Builder System - Transforming academic data into optimized schedules through intelligent automation.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

timetable_builder-0.1.0.tar.gz (113.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

timetable_builder-0.1.0-py3-none-any.whl (171.1 kB view details)

Uploaded Python 3

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

Hashes for timetable_builder-0.1.0.tar.gz
Algorithm Hash digest
SHA256 333790b14b4a2a0c9730ed169d85352903eeca4b9ac69f98146938f6a751b00f
MD5 5c97f1474c8d38a73e3bfab68144a2e9
BLAKE2b-256 052409d4a95ea2f937a153b13b24975c779af5c5ee401b0901a0114f12e01fb8

See more details on using hashes here.

File details

Details for the file timetable_builder-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for timetable_builder-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9d8cee6b12b9ec634fb6cfde5656e6fe497aa38e9d5abdfbf3cd9b5349364614
MD5 bf172bd63188a6f0a6b297b7589457e5
BLAKE2b-256 b552cb3d6ea809c75181e5035a285f5096ab583d9adae51017a660e39615b302

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page