Skip to content

πŸŽ“ AI-Powered Timetable Generation System for Educational Institutions | Genetic Algorithms | React + Node.js + MongoDB | Real-time Analytics | Gemini AI Chatbot

License

Notifications You must be signed in to change notification settings

Harjotraith04/Time_Table_Generation_AI_Tool

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

67 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸŽ“ AlmanacAI - AI-Powered Timetable Generation System

AlmanacAI Banner Live Demo License: MIT

A Revolutionary AI-Powered Timetable Scheduling Platform for Educational Institutions

Features β€’ Demo β€’ Installation β€’ Documentation β€’ Tech Stack


πŸ“– About

AlmanacAI is a sophisticated full-stack timetable generation system that leverages Genetic Algorithms and advanced optimization techniques to automatically create conflict-free, optimal class schedules for educational institutions. Built with modern web technologies, it provides real-time generation tracking, intelligent conflict resolution, and comprehensive analytics.

This project implements a sophisticated timetable generation system using genetic algorithms and other optimization techniques. It provides a comprehensive solution for educational institutions to automatically generate optimal class schedules while considering multiple constraints and preferences.

🎯 Key Highlights

  • 🧬 Advanced Genetic Algorithm: Evolutionary optimization for superior timetable quality
  • πŸ€– AI-Powered Assistant: Gemini AI chatbot for instant query resolution
  • οΏ½ Real-time Analytics: Comprehensive dashboards for admins, faculty, and students
  • πŸ”„ Live Progress Tracking: Watch the generation process in real-time with WebSocket updates
  • πŸ“§ Automated Notifications: Email system for timetable updates and announcements
  • πŸ“± Responsive Design: Modern UI built with React and Tailwind CSS
  • 🌐 Production Ready: Deployed on Vercel (frontend) and Render (backend)

🌟 Features

πŸŽ“ For Educational Institutions

πŸŽ“ For Educational Institutions

πŸ”„ Timetable Generation

  • Advanced Genetic Algorithm: Sophisticated evolutionary algorithm for optimal timetable generation
  • Multiple Algorithm Support: Genetic Algorithm, Backtracking, and Simulated Annealing
  • Real-time Progress Tracking: Live updates during generation with WebSocket connections
  • Batch Processing: Handle 100+ teachers, 200+ classrooms, 500+ courses simultaneously
  • Smart Conflict Detection: Intelligent detection and automatic resolution of scheduling conflicts
  • Data Validation: Comprehensive validation of input data before generation
  • Export Capabilities: Export timetables in PDF, Excel, and CSV formats

πŸ‘₯ User Management

  • Role-Based Access Control: Separate dashboards for Admin, Faculty, and Students
  • Secure Authentication: JWT-based authentication with bcrypt password hashing
  • CSV Bulk Import: Import teachers and students via CSV files
  • Profile Management: Update availability, preferences, and contact information

πŸ€– AI-Powered Features

  • Gemini AI Chatbot: Intelligent assistant for answering queries about timetables
  • Query Resolution System: Students and faculty can ask questions and get instant answers
  • Natural Language Processing: Understand and respond to complex scheduling queries
  • Context-Aware Responses: AI understands user role and provides relevant information

πŸ“Š Analytics & Insights

  • Resource Utilization: Track classroom and teacher usage statistics
  • Workload Analysis: Monitor teacher workload distribution
  • Conflict Reports: Detailed reports on scheduling conflicts and resolutions
  • Performance Metrics: Generation time, success rates, and optimization scores

πŸ“§ Communication System

  • Email Notifications: Automated emails for timetable updates
  • SMTP Integration: Configurable email service (Gmail, Outlook, custom SMTP)
  • Bulk Messaging: Send announcements to all users or specific roles
  • Query Notifications: Alert users when their queries are answered

βš™οΈ Constraint Management

Hard Constraints (Must be satisfied):

  • Teacher conflicts (no teacher in multiple classes simultaneously)

  • Classroom conflicts (no room double-booking)

  • Student group conflicts (no overlapping classes for same group)

  • Room capacity limits

  • Mandatory break enforcement

  • Soft Constraints (Optimized but not mandatory):

    • Teacher availability preferences
    • Workload balance among teachers
    • Consecutive hours limits
    • Room type matching
    • Day distribution optimization

πŸš€ Live Demo

Frontend: https://timetable-frontend-psi.vercel.app
Backend API: https://timetable-backend-2h6m.onrender.com/api/health

Demo Credentials

  • Admin: admin@example.com / admin123
  • Faculty: faculty@example.com / faculty123
  • Student: student@example.com / student123

πŸ› οΈ Tech Stack

Frontend (Client)

Technology Purpose
React 18 UI framework with modern hooks and state management
Vite Lightning-fast build tool and dev server
Tailwind CSS Utility-first CSS framework for responsive design
Material-UI (MUI) Pre-built React components for enterprise UI
React Router v6 Client-side routing and navigation
Axios Promise-based HTTP client for API calls
Lucide React Beautiful icon library
Recharts Charting library for analytics visualization
Three.js + OGL 3D graphics for interactive landing page

Backend (Server)

Technology Purpose
Node.js JavaScript runtime for server-side logic
Express.js Web framework for RESTful API
MongoDB NoSQL database for flexible data storage
Mongoose ODM for MongoDB with schema validation
Socket.io WebSocket for real-time progress updates
JWT JSON Web Tokens for secure authentication
Bcrypt Password hashing and security
Nodemailer Email service for notifications
Google Gemini AI AI chatbot integration for query resolution
Winston Logging framework for debugging
Helmet Security middleware for Express

DevOps & Deployment

Tool Purpose
Vercel Frontend hosting with automatic deployments
Render Backend hosting with health checks
MongoDB Atlas Cloud-hosted MongoDB database
GitHub Version control and CI/CD trigger
Git Source code management

πŸ“‚ Project Structure

Time_Table_Generation_AI_Tool/
β”‚
β”œβ”€β”€ πŸ“ client/                          # React Frontend
β”‚   β”œβ”€β”€ πŸ“ public/                      # Static assets
β”‚   β”‚   └── logo.png
β”‚   β”œβ”€β”€ πŸ“ src/
β”‚   β”‚   β”œβ”€β”€ πŸ“ components/              # Reusable UI components
β”‚   β”‚   β”‚   β”œβ”€β”€ AdminDashboard.jsx      # Admin control panel
β”‚   β”‚   β”‚   β”œβ”€β”€ StudentDashboard.jsx    # Student interface
β”‚   β”‚   β”‚   β”œβ”€β”€ TeacherDashboard.jsx    # Faculty interface
β”‚   β”‚   β”‚   β”œβ”€β”€ Auth.jsx                # Login/Register forms
β”‚   β”‚   β”‚   β”œβ”€β”€ ChatbotInterface.jsx    # AI chatbot UI
β”‚   β”‚   β”‚   β”œβ”€β”€ Landing.jsx             # Landing page with 3D graphics
β”‚   β”‚   β”‚   β”œβ”€β”€ Navbar.jsx              # Navigation bar
β”‚   β”‚   β”‚   └── Sidebar.jsx             # Dashboard sidebar
β”‚   β”‚   β”œβ”€β”€ πŸ“ services/                # API integration
β”‚   β”‚   β”‚   └── api.js                  # Axios instance & API calls
β”‚   β”‚   β”œβ”€β”€ πŸ“ assets/                  # Images, fonts, etc.
β”‚   β”‚   β”œβ”€β”€ App.jsx                     # Main app component with routing
β”‚   β”‚   β”œβ”€β”€ index.jsx                   # React entry point
β”‚   β”‚   └── index.css                   # Global styles
β”‚   β”œβ”€β”€ .env.example                    # Environment variables template
β”‚   β”œβ”€β”€ vercel.json                     # Vercel deployment config
β”‚   β”œβ”€β”€ package.json                    # Dependencies & scripts
β”‚   β”œβ”€β”€ vite.config.js                  # Vite configuration
β”‚   β”œβ”€β”€ tailwind.config.js              # Tailwind CSS config
β”‚   └── postcss.config.js               # PostCSS config
β”‚
β”œβ”€β”€ πŸ“ server/                          # Node.js Backend
β”‚   β”œβ”€β”€ πŸ“ routes/                      # API endpoints
β”‚   β”‚   β”œβ”€β”€ auth.js                     # Authentication routes
β”‚   β”‚   β”œβ”€β”€ data.js                     # CRUD for teachers, rooms, courses
β”‚   β”‚   β”œβ”€β”€ timetables.js               # Timetable generation & management
β”‚   β”‚   β”œβ”€β”€ algorithms.js               # Algorithm selection endpoints
β”‚   β”‚   β”œβ”€β”€ queries.js                  # Query resolution system
β”‚   β”‚   └── chatbot.js                  # AI chatbot endpoints
β”‚   β”œβ”€β”€ πŸ“ models/                      # Mongoose schemas
β”‚   β”‚   β”œβ”€β”€ User.js                     # User model (admin, faculty, student)
β”‚   β”‚   β”œβ”€β”€ Teacher.js                  # Teacher details & availability
β”‚   β”‚   β”œβ”€β”€ Classroom.js                # Classroom/room information
β”‚   β”‚   β”œβ”€β”€ Course.js                   # Course/subject details
β”‚   β”‚   β”œβ”€β”€ Timetable.js                # Generated timetables
β”‚   β”‚   β”œβ”€β”€ Query.js                    # User queries
β”‚   β”‚   └── Student.js                  # Student information
β”‚   β”œβ”€β”€ πŸ“ algorithms/                  # Optimization algorithms
β”‚   β”‚   β”œβ”€β”€ genetic.js                  # Genetic Algorithm implementation
β”‚   β”‚   β”œβ”€β”€ backtracking.js             # Backtracking algorithm
β”‚   β”‚   └── simulated_annealing.js      # Simulated Annealing
β”‚   β”œβ”€β”€ πŸ“ middleware/                  # Express middleware
β”‚   β”‚   β”œβ”€β”€ auth.js                     # JWT verification
β”‚   β”‚   └── errorHandler.js             # Global error handling
β”‚   β”œβ”€β”€ πŸ“ utils/                       # Utility functions
β”‚   β”‚   β”œβ”€β”€ emailService.js             # Email sending logic
β”‚   β”‚   β”œβ”€β”€ validator.js                # Data validation helpers
β”‚   β”‚   └── logger.js                   # Winston logger config
β”‚   β”œβ”€β”€ πŸ“ scripts/                     # Utility scripts
β”‚   β”‚   β”œβ”€β”€ create_admin.js             # Create admin user
β”‚   β”‚   β”œβ”€β”€ setup_mailing.js            # Configure email service
β”‚   β”‚   └── populate_test_data.js       # Seed database
β”‚   β”œβ”€β”€ .env.example                    # Environment variables template
β”‚   β”œβ”€β”€ server.js                       # Express server entry point
β”‚   β”œβ”€β”€ package.json                    # Dependencies & scripts
β”‚   └── README.md                       # Backend documentation
β”‚
β”œβ”€β”€ πŸ“„ DEPLOYMENT.md                    # Deployment guide
β”œβ”€β”€ πŸ“„ GEMINI_AI_INTEGRATION.md         # AI chatbot setup
β”œβ”€β”€ πŸ“„ MAILING_SYSTEM_GUIDE.md          # Email system docs
β”œβ”€β”€ πŸ“„ QUERY_RESOLUTION_SYSTEM.md       # Query system docs
β”œβ”€β”€ πŸ“„ STUDENT_MANAGEMENT_GUIDE.md      # Student module docs
β”œβ”€β”€ πŸ“„ README.md                        # This file
β”œβ”€β”€ πŸ“„ vercel.json                      # Root Vercel config
└── πŸ“„ .gitignore                       # Git ignore rules

πŸ› οΈ Installation & Setup

Prerequisites

Before you begin, ensure you have the following installed:

πŸ”§ Local Development Setup

1️⃣ Clone the Repository

git clone https://github.com/Harjotraith04/Time_Table_Generation_AI_Tool.git
cd Time_Table_Generation_AI_Tool

2️⃣ Backend Setup

# Navigate to server directory
cd server

# Install dependencies
npm install

# Create environment file
cp .env.example .env

# Edit .env with your configuration
# Required variables:
# - MONGODB_URI (MongoDB connection string)
# - JWT_SECRET (Random secret key)
# - GEMINI_API_KEY (Google Gemini AI key)
# - SMTP credentials (for email service)

Sample .env file:

# Database
MONGODB_URI=mongodb://localhost:27017/timetable_generator
# OR for MongoDB Atlas:
# MONGODB_URI=mongodb+srv://username:password@cluster.mongodb.net/timetable_generator

# Server
PORT=8000
NODE_ENV=development

# Authentication
JWT_SECRET=your-super-secret-jwt-key-change-this-in-production

# Client URL (for CORS)
CLIENT_URL=http://localhost:5173

# Google Gemini AI
GEMINI_API_KEY=your-gemini-api-key-here

# Email Service
EMAIL_ENABLED=true
SMTP_HOST=smtp.gmail.com
SMTP_PORT=587
SMTP_USER=your-email@gmail.com
SMTP_PASS=your-app-specific-password
EMAIL_FROM=AlmanacAI <noreply@almanacai.com>
# Create admin user (optional)
npm run create-admin

# Start development server
npm run dev

Server will run on http://localhost:8000

3️⃣ Frontend Setup

# Navigate to client directory (from root)
cd client

# Install dependencies
npm install

# Create environment file
cp .env.example .env.local

# Edit .env.local
# VITE_API_URL=http://localhost:8000/api

Sample .env.local file:

# Backend API URL
VITE_API_URL=http://localhost:8000/api
# Start development server
npm run dev

Frontend will run on http://localhost:5173

4️⃣ Access the Application

Open your browser and navigate to:


🌐 Production Deployment

Deploy to Vercel (Frontend)

  1. Push code to GitHub
  2. Import project in Vercel Dashboard
  3. Configure settings:
    • Root Directory: client
    • Build Command: npm run build
    • Output Directory: dist
  4. Add environment variable:
    • VITE_API_URL=https://your-backend-url.onrender.com/api
  5. Deploy - Vercel will auto-deploy on git push

Deploy to Render (Backend)

  1. Create Web Service in Render Dashboard
  2. Connect GitHub repository
  3. Configure settings:
    • Root Directory: server
    • Build Command: npm install
    • Start Command: npm run start
  4. Add environment variables (all from .env.example)
  5. Deploy - Render will auto-deploy on git push

πŸ“– Full deployment guide: DEPLOYMENT.md


πŸ“š Documentation

Quick Start Guides

Feature Guides

Developer Guides


🧬 Genetic Algorithm Implementation

The genetic algorithm is the core of this timetable generation system. It uses evolutionary principles to find optimal solutions.

Algorithm Flow

1. Initialize Population (100+ random timetables)
   ↓
2. Evaluate Fitness (check constraints & conflicts)
   ↓
3. Selection (tournament selection)
   ↓
4. Crossover (combine parent solutions)
   ↓
5. Mutation (random changes for diversity)
   ↓
6. Elitism (preserve best solutions)
   ↓
7. Repeat until convergence or max generations

Key Parameters

Parameter Value Description
Population Size 100-200 Number of candidate solutions
Generations 500-1000 Maximum iterations
Crossover Rate 0.8 (80%) Probability of combining parents
Mutation Rate 0.1 (10%) Probability of random changes
Elite Size 10% Best solutions preserved
Tournament Size 5 Selection pool size

Performance Metrics

  • βœ… Handles: 100+ teachers, 200+ classrooms, 500+ courses
  • ⚑ Generation Time: 2-5 minutes for complex timetables
  • 🎯 Constraint Satisfaction: 95%+ hard constraints met
  • πŸ“ˆ Optimization: Maximizes resource utilization and teacher preferences

Fitness Function

Fitness = (Hard Constraint Score Γ— 10) + (Soft Constraint Score Γ— 1)

Hard Constraints (0 or 1):
- No teacher conflicts
- No classroom conflicts  
- No student group conflicts
- Room capacity respected
- Break enforcement

Soft Constraints (0 to 1):
- Teacher availability preferences
- Workload balance
- Consecutive hours limits
- Room type matching
- Day distribution

🎯 Usage Guide

For Administrators

  1. Login with admin credentials
  2. Add Data:
    • Upload teachers via CSV or add manually
    • Add classrooms with capacity and type
    • Create courses with duration and requirements
  3. Generate Timetable:
    • Select algorithm (Genetic recommended)
    • Set parameters (optional)
    • Click "Generate"
    • Watch real-time progress
  4. Review & Export:
    • Check for conflicts
    • Review analytics
    • Export to PDF/Excel/CSV
  5. Manage Users:
    • Add/edit students and faculty
    • Assign roles and permissions
    • Monitor system usage

For Faculty

  1. Login with faculty credentials
  2. View Schedule: See your teaching timetable
  3. Update Availability: Set preferred working hours
  4. Ask Questions: Use AI chatbot for queries
  5. Download: Export your personal timetable

For Students

  1. Login with student credentials
  2. View Timetable: See your class schedule
  3. Download: Export to PDF or add to calendar
  4. Ask Questions: Query the AI about class timings
  5. Check Conflicts: Verify no scheduling issues

πŸ”Œ API Endpoints

Authentication

POST   /api/auth/register       # Register new user
POST   /api/auth/login          # Login user
POST   /api/auth/logout         # Logout user
GET    /api/auth/me             # Get current user

Timetable Management

POST   /api/timetables/generate              # Generate new timetable
GET    /api/timetables                       # Get all timetables
GET    /api/timetables/:id                   # Get specific timetable
PUT    /api/timetables/:id                   # Update timetable
DELETE /api/timetables/:id                   # Delete timetable
GET    /api/timetables/:id/conflicts         # Check conflicts
POST   /api/timetables/:id/export            # Export timetable
GET    /api/timetables/:id/progress          # Get generation progress (WebSocket)

Data Management

GET    /api/teachers            # Get all teachers
POST   /api/teachers            # Create teacher
PUT    /api/teachers/:id        # Update teacher
DELETE /api/teachers/:id        # Delete teacher
POST   /api/teachers/import     # Import teachers from CSV

GET    /api/classrooms          # Get all classrooms
POST   /api/classrooms          # Create classroom
PUT    /api/classrooms/:id      # Update classroom
DELETE /api/classrooms/:id      # Delete classroom

GET    /api/courses             # Get all courses
POST   /api/courses             # Create course
PUT    /api/courses/:id         # Update course
DELETE /api/courses/:id         # Delete course

GET    /api/students            # Get all students
POST   /api/students            # Create student
POST   /api/students/import     # Import students from CSV

Query & Chatbot

POST   /api/queries             # Submit new query
GET    /api/queries             # Get user's queries
POST   /api/chatbot/message     # Send message to AI chatbot
GET    /api/chatbot/history     # Get chat history

Analytics

GET    /api/analytics/dashboard         # Dashboard summary
GET    /api/analytics/utilization       # Resource utilization
GET    /api/analytics/conflicts         # Conflict statistics
GET    /api/analytics/teacher-workload  # Teacher workload distribution

βš™οΈ Configuration

Client Environment Variables

# .env.local in client/
VITE_API_URL=http://localhost:8000/api

Server Environment Variables

# .env in server/

# Database
MONGODB_URI=mongodb://localhost:27017/timetable_generator

# Server
PORT=8000
NODE_ENV=development

# JWT
JWT_SECRET=your-secret-key-here
JWT_EXPIRE=7d

# CORS
CLIENT_URL=http://localhost:5173

# Google Gemini AI
GEMINI_API_KEY=your-api-key-here

# Email (Gmail example)
EMAIL_ENABLED=true
SMTP_HOST=smtp.gmail.com
SMTP_PORT=587
SMTP_SECURE=false
SMTP_USER=your-email@gmail.com
SMTP_PASS=your-app-password
EMAIL_FROM=AlmanacAI <noreply@almanacai.com>

# Algorithm Parameters (optional)
GA_POPULATION_SIZE=100
GA_MAX_GENERATIONS=1000
GA_CROSSOVER_RATE=0.8
GA_MUTATION_RATE=0.1

πŸ§ͺ Testing

Backend Tests

cd server
npm test

Frontend Tests

cd client
npm test

Manual Testing

  1. Health Check: Visit http://localhost:8000/api/health
  2. API Testing: Use Postman or cURL
  3. Frontend: Navigate through all pages
  4. Generation: Create test data and generate timetable

🀝 Contributing

We welcome contributions! Please follow these steps:

  1. Fork the repository
  2. Create a branch: git checkout -b feature/amazing-feature
  3. Make changes and test thoroughly
  4. Commit: git commit -m 'Add amazing feature'
  5. Push: git push origin feature/amazing-feature
  6. Open a Pull Request

Contribution Guidelines

  • Follow existing code style
  • Write clear commit messages
  • Add tests for new features
  • Update documentation
  • Keep PRs focused on single features

πŸ“ License

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


πŸ‘₯ Authors


πŸ™ Acknowledgments

  • Google Gemini AI for chatbot capabilities
  • MongoDB for flexible data storage
  • Vercel & Render for seamless deployment
  • React & Vite teams for excellent developer experience
  • Open source community for amazing libraries

πŸ“ž Support

For support, questions, or feedback:


⭐ Star this repository if you find it helpful!

Made with ❀️ by AlmanacAI Team

About

πŸŽ“ AI-Powered Timetable Generation System for Educational Institutions | Genetic Algorithms | React + Node.js + MongoDB | Real-time Analytics | Gemini AI Chatbot

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages