# Consolidated Thesis Collection

## 1. Lesson SQLite Database Implementation

Source file: Lesson_ SQLite Database Implementation.html
Slide 1 of 12
Upgrading to Database Storage
DT/ICT: SQLite Database Implementation
Digital Technologies / Information Communication Technologies

From CSV to SQLite Database

Taking your Telegram Scheduler Bot to the next level

## Classroom Guidelines

### How Points Are Earned:

+2 Points - You attended class

+1 Point - You listened quietly during instruction

+1 Point - You attempted all assigned work

+1 Point - You completed all assigned work

Maximum: 5 points per class session

## Learning Outcomes

By the end of this lesson, you will be able to:

1. Understand the difference between CSV and database storage
2. Implement SQLite database in an existing Python application
3. Create and manage database tables with proper schema design
4. Implement CRUD operations (Create, Read, Update, Delete) in Python
5. Upgrade an existing Telegram bot from CSV to SQLite database

CRUD Operations: The four basic functions of persistent storage:

- Create - Add new data
- Read - Retrieve data
- Update - Modify existing data
- Delete - Remove data

## Why This Matters

Real-world Database Applications:

- Every modern website uses databases (Facebook, Amazon, Google)
- Mobile apps store user data, preferences, and content
- Business systems track inventory, orders, and customers
- Gaming platforms save player progress and achievements

Career Relevance:

Database skills are required for:

- Backend Developer
- Full Stack Developer
- Data Analyst
- Software Engineer
- DevOps Engineer

Industry Demand: Database management is consistently ranked among the top technical skills employers seek.

## Project Overview: What We're Building

Feature | Current v2 (CSV) | New v3 (SQLite)
--- | --- | ---
Data Storage | schedule_template RS.csv file | schedule.db database file
Data Access | Read-only from CSV | Read/Write via database
Persistence | Manual file editing required | Automatic, persists between runs
New Features | None | Interactive /add command
Scalability | Limited by CSV format | Supports complex queries

### Required Files for This Lesson:

- `telegram_scheduler_v2.py` - Your existing working bot
- `telegram_scheduler_v3.py` - New version we'll create
- `schedule_template RS.csv` - Original schedule data
- `schedule.db` - Will be created automatically

## Step-by-Step Complete Setup Guide

Check your Python installation before starting

Open PowerShell:

Press `Windows + R`, type `powershell`, press `Enter`

Check Python Version:

python --version # Should show: Python 3.x.x # If that doesn't work, try: python3 --version # Or on some systems: py --version

Required Python Libraries:

- `python-telegram-bot` - For Telegram bot functionality
- `sqlite3` - Comes built-in with Python
- `pandas` - For CSV reading (optional for v3)

## Create Your Project Folder

Organize your files properly from the start

Open PowerShell or Command Prompt:

Make sure you're not in the Python shell (should see `C:\>` or `PS C:\>`)

Navigate to Desktop or Documents:

Let's create a folder on your Desktop for easy access:

# Go to Desktop (Windows) cd Desktop # Create a new folder for your project mkdir telegram_scheduler_db # Go into your new folder cd telegram_scheduler_db # Copy your existing files here: # 1. telegram_scheduler_v2.py # 2. schedule_template RS.csv # 3. Any other related files

Expected Folder Structure:

telegram_scheduler_db/ ├── telegram_scheduler_v2.py # Your working bot ├── telegram_scheduler_v3.py # We'll create this ├── schedule_template RS.csv # Your schedule data ├── requirements.txt # Dependencies └── venv/ # Virtual environment

## Set Up Virtual Environment (venv)

Isolate project dependencies for clean development

Why Virtual Environment?

- Keeps project dependencies separate
- Avoids version conflicts between projects
- Makes sharing and deployment easier

Create Virtual Environment:

Make sure you're in your `telegram_scheduler_db` folder, then run:

# Create virtual environment named 'venv' python -m venv venv # Check if venv folder was created dir # You should see a 'venv' folder in the list

Activate Virtual Environment:

Windows PowerShell:

venv\Scripts\Activate.ps1 # If you get an error about execution policy, run this first: Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser venv\Scripts\Activate.ps1

Success Indicator: You should see `(venv)` at the start of your command line.

## Install Required Libraries

Get the Python packages needed for this project

First, activate your venv:

Make sure you see `(venv)` before the prompt.

Install required packages:

# Install the Telegram bot library pip install python-telegram-bot # Install pandas for CSV handling (optional for v3) pip install pandas # Verify installations pip show python-telegram-bot pip show pandas

Create Requirements File:

pip freeze > requirements.txt # View the requirements file type requirements.txt # (Mac/Linux: use 'cat requirements.txt' instead of 'type')

Why requirements.txt matters:

- Anyone can install exact same versions with `pip install -r requirements.txt`
- Ensures your project works the same on different computers
- Essential for collaboration and deployment

## Today's Lesson Structure

Phase 1: Database Concepts (15 minutes)

- Understanding CSV vs Database storage
- Introduction to SQLite
- Database schema design
- CRUD operations explained

Phase 2: Code Implementation (30 minutes)

- Creating v3 file from v2 template
- Adding SQLite database functions
- Implementing /add command with conversation flow
- Updating existing commands to use database

Phase 3: Testing & Practice (15 minutes)

- Testing database creation
- Adding new classes via /add command
- Verifying data persistence
- Troubleshooting common issues

Key Files We'll Create:

- `telegram_scheduler_v3.py` - Main database implementation
- `schedule.db` - SQLite database file (auto-created)
- `database_operations.py` - Optional helper module

## What You'll Achieve Today

By the end of this lesson, you will have:

- ✅ Created a working v3 Telegram bot with SQLite database
- ✅ Implemented database CRUD operations in Python
- ✅ Added interactive /add command to your bot
- ✅ Converted CSV-based application to database-driven
- ✅ Gained practical experience with real database implementation

Key Technical Skills You'll Develop:

- SQLite database setup and management
- Database schema design principles
- Python database programming with sqlite3
- Telegram bot conversation handling
- Data persistence and state management

Ready to upgrade your bot from v2 to v3?

# Next Steps

After this introductory presentation:

1. Follow along with the detailed implementation guide
2. Create your `telegram_scheduler_v3.py` file
3. Implement the SQLite database functions
4. Test your upgraded bot thoroughly
5. Show your working bot to receive credit

Support & Resources:

- Detailed code examples in the implementation guide
- Step-by-step instructions for each function
- Troubleshooting tips for common issues
- Ask questions anytime during the implementation

Digital Technologies / ICT
Database Implementation Project

Let's begin the implementation!

## 2. Presentaion School Schedule Assistant Bot Student Project

Source file: Presentaion_School Schedule Assistant Bot _ Student Project.html

# School Schedule Assistant Bot

A Telegram-based Solution for Student Organization

Student Thesis Project
Supervisor: Bob Santos
Student Developer: Gregory
Academic Year 2025-2026

# Project Overview

A digital assistant for modern student life

### Project Description

A friendly digital assistant that provides instant class schedule information through Telegram. Designed to help students stay organized and never miss classes.

### Key Features

1
Always Available - Accessible 24/7 through Telegram messenger on any device
2
Accurate Information - Provides up-to-date schedule information with real-time updates
3
Teacher-Friendly - Teachers can update schedules without technical knowledge using familiar spreadsheet tools

## How Students Use It

Simple text commands anyone can understand

### Basic Commands

Students ask questions using simple commands starting with "/".

Example 1: Find current class

Student: /whereami
Bot: "You should be in Math class, Room 201"

Example 2: See today's schedule

Student: /schedule
Bot: "Today: 9:00 Math, 10:00 Science..."

Example 3: Prepare for tomorrow

Student: /tomorrow
Bot: "Tomorrow: 9:00 English, 10:00 Physics..."

## Technology Made Simple

Easy for everyone - students, teachers, administrators

### For Students

• No new app to download - uses Telegram

• Simple text commands

• Available 24/7 from any smartphone

### For Teachers

• No programming knowledge needed

• Use Excel or Google Sheets

• Edit spreadsheet → Save → Bot updates automatically

## Better Storage and Testing

Improving reliability and user experience

### Better Storage System

• Moving from spreadsheets to reliable database

• Faster responses with many users

• More secure information storage

### Real Student Testing

• Test with real students before school-wide launch

• Collect feedback for improvements

• Ensure it works for all user types

# Future Possibilities

This bot could be extended in several interesting ways:

### Expansion Opportunities

👥
Multiple User Support Allow different students to have personalized schedules
👨‍🏫
Teacher Information Include which teacher is teaching each class and their contact information
🗺️
Classroom Maps Add links to maps showing where classrooms are located
📚
Homework Integration Connect to homework assignment systems
🔔
Mobile Notifications Send push notifications before class starts
📅
Special Schedules Handle exam weeks, holidays, and special event days
📊
Statistics Tracking Track which commands are used most often to improve the bot

Scalability: These enhancements would make the bot even more valuable for students and faculty.

Each addition builds on the solid foundation already established.

## 3. Professional Thesis Scheduler Bot

Source file: Professional_Thesis_Scheduler_Bot.html

# Thesis: Development and Analysis of a Telegram-Based Joke Bot

Bridging Simplicity with Digital Humor Delivery
Student Developer
December 2024

## Abstract

This document presents the design, implementation, and analysis of a minimalistic Telegram chatbot created for automated joke delivery. Developed using Python and the python-telegram-bot framework, this project serves as a case study in creating lightweight, functional digital companions. The bot demonstrates how simple code can produce meaningful user engagement while exploring the role of humor in digital communication.

## Introduction

In today's digital landscape, chatbots have become increasingly common across messaging platforms, serving various purposes from customer service to entertainment. This project focuses on creating a Telegram bot with a singular, joyful purpose: telling jokes. By emphasizing simplicity and narrow scope, this bot illustrates how minimal programming can generate tangible user satisfaction and engagement. This work contributes to discussions about accessible AI tools, human-computer interaction, and humor's role in technology.

## System Architecture

The bot employs a straightforward, event-driven architecture built on several key components:

### Core Framework

Utilizes the python-telegram-bot library (version 20+), providing an asynchronous interface for Telegram's Bot API. This choice enables efficient message handling without complex setup.

### Command Structure

The bot implements two primary commands:

- /start: Initializes user interaction with welcome instructions
- /joke: Triggers random selection and delivery of pre-defined jokes

### Data Management

Uses a static Python list (JOKE_LIST) as a lightweight database containing three curated, family-friendly jokes with emoji embellishments for enhanced engagement.

### Execution Method

The bot operates via long polling (app.run_polling()), maintaining persistent connection to Telegram's servers to listen for user commands continuously.

## Code Implementation

The complete implementation comprises fewer than 30 functional lines of code:

from telegram import Update from telegram.ext import Application, CommandHandler, ContextTypes import random JOKE_LIST = [ "Why did the robot go to school? To recharge his brain! 🔋", "Knock knock!\nWho's there?\nLettuce!\nLettuce who?\nLettuce in!", "Why don't eggs tell jokes? They'd crack each other up! 🥚" ] async def start(update: Update, context: ContextTypes.DEFAULT_TYPE): await update.message.reply_text("Hi! Type /joke for a funny joke! 😄") async def send_joke(update: Update, context: ContextTypes.DEFAULT_TYPE): joke = random.choice(JOKE_LIST) await update.message.reply_text(joke) def main(): BOT_TOKEN = "7864875699:AAEWf6ff1DYNzPvW6Dbn7D2W5aavg9KPhgY" app = Application.builder().token(BOT_TOKEN).build() app.add_handler(CommandHandler("start", start)) app.add_handler(CommandHandler("joke", send_joke)) print("Bot is running... Press Ctrl+C to stop.") app.run_polling() if __name__ == "__main__": main()

### Design Philosophy

The implementation embodies a "less is more" approach with:

- Minimal Dependencies: Only essential libraries
- Stateless Design: No user data persistence required
- Simple Error Handling: Leverages framework defaults

## Joke Content Analysis

The bot's humor collection demonstrates thoughtful content strategy:

Sample Joke 1: "Why did the robot go to school? To recharge his brain! 🔋"
Analysis: Combines technology theme with educational context, using battery emoji for visual enhancement.
Sample Joke 2: Knock-knock format with "Lettuce" pun
Analysis: Uses classic joke structure familiar to most users, incorporating wordplay.
Sample Joke 3: "Why don't eggs tell jokes? They'd crack each other up! 🥚"
Analysis: Food-based humor with visual egg emoji, employing double meaning of "crack up."

## Educational Value

This project demonstrates several important programming concepts for learners:

### Core Concepts Illustrated

- API Integration: Connecting to external services (Telegram)
- Event-Driven Programming: Responding to user commands
- Randomization: Using Python's random module for content selection
- Asynchronous Operations: Handling multiple potential users
- Modular Design: Separating concerns into functions

### Learning Pathway

From this foundation, students can expand to:

- Database integration for storing jokes
- User preference tracking
- Natural language processing for understanding free-form requests
- Integration with external APIs for dynamic content

## Conclusion

The Telegram joke bot, despite its apparent simplicity, serves as a compelling artifact in human-computer interaction studies. It demonstrates that minimal code—when focused on a clear, joyful purpose—can generate meaningful engagement. The project highlights that technology need not be complex to be effective; sometimes, a few lines of code and well-chosen humor can connect with users on a human level. As conversational AI evolves, this bot stands as a reminder of foundational principles in digital design: clarity of purpose, user-centered thinking, and the power of simplicity.

This project proves that programming isn't solely about technical complexity but about creating solutions that address human needs—in this case, the universal need for laughter and connection. It serves as an excellent starting point for aspiring developers to understand real-world application of coding principles while creating something genuinely enjoyable.

1

## 4. Scheduler Bot Telegram & CSV Database

Source file: Scheduler Bot_ Telegram & CSV Database.html
Slide 3 of 8

# Scheduler Bot Upgrade: CSV to SQLite

From CSV Files to Database Management

Transform your CSV-based scheduler into a dynamic database system

## CSV vs SQLite: What's Changing

### Current System (CSV)

- Reads from `schedule_template RS.csv`
- Uses pandas library
- Static file that you edit manually
- Schedule loads at bot startup
- No way to add classes via bot

### New System (SQLite)

- Stores data in `schedule.db` database
- Uses built-in sqlite3 module
- Dynamic - you can add classes via bot
- Real-time data access
- Users can add their own schedule entries

What we're replacing:

- `pandas` → `sqlite3` (built-in, no install needed!)
- `CSV file` → `SQLite database`
- `Static loading` → `Dynamic database operations`

## Step-by-Step Upgrade - Part 1

1
Remove pandas import

At the top of your file, FIND and DELETE these lines:

try: import pandas as pd except ImportError: print("❌ Error: pandas library not found!") print("Please install required packages using:") print("pip install -r requirements.txt") exit(1)
2
Add sqlite3 import

At the VERY TOP (after other imports), ADD this line:

import sqlite3

Your imports should now look like:

import datetime from telegram import Update from telegram.ext import Application, CommandHandler, ContextTypes import sqlite3 # ← ADDED THIS LINE
3
Add MessageHandler import

Change this import line:

from telegram.ext import Application, CommandHandler, ContextTypes

To this:

from telegram.ext import Application, CommandHandler, ContextTypes, MessageHandler, filters # ← ADDED MessageHandler and filters

## Step-by-Step Upgrade - Part 2

4
Add database configuration

After your `BOT_TOKEN` line, ADD these lines:

# Database setup DATABASE_NAME = "schedule.db" # User states for tracking conversations user_states = {} # Stores user conversation state
5
Remove old schedule loading

FIND and DELETE the entire `load_schedule()` function:

def load_schedule(): """ Load schedule from CSV file using pandas Returns a dictionary with day-wise schedule """ try: # Read CSV file - Updated to use the provided file name df = pd.read_csv('schedule_template RS.csv') schedule = {} # Process each row (each day) for _, row in df.iterrows(): day = row['Day'] schedule[day] = [] # Process each period column... # ... (all the CSV processing code) ... return schedule except FileNotFoundError: print("❌ Error: schedule_template RS.csv file not found!") print("Please make sure schedule_template RS.csv is in the same folder") return {} except Exception as e: print(f"❌ Error loading schedule: {e}") return {}

Also DELETE this line that loads the schedule:

# Load schedule at startup SCHEDULE = load_schedule()

## Step-by-Step Upgrade - Part 3

6
Add new database functions

Where the old `load_schedule()` function was, ADD these new functions:

def init_db(): """Initialize the SQLite database and create tables if they don't exist.""" conn = sqlite3.connect(DATABASE_NAME) cursor = conn.cursor() # Create table for schedule entries cursor.execute(''' CREATE TABLE IF NOT EXISTS schedule ( id INTEGER PRIMARY KEY AUTOINCREMENT, day TEXT NOT NULL, period INTEGER NOT NULL, subject TEXT NOT NULL, class_name TEXT NOT NULL, room TEXT NOT NULL, UNIQUE(day, period) ) ''') conn.commit() conn.close() def add_schedule_entry(day, period, subject, class_name, room): """Add a new schedule entry to the database.""" conn = sqlite3.connect(DATABASE_NAME) cursor = conn.cursor() try: cursor.execute(''' INSERT OR REPLACE INTO schedule (day, period, subject, class_name, room) VALUES (?, ?, ?, ?, ?) ''', (day, period, subject, class_name, room)) conn.commit() conn.close() return True except sqlite3.Error as e: print(f"Database error: {e}") conn.close() return False def load_schedule_from_db(): """Load schedule from the SQLite database.""" conn = sqlite3.connect(DATABASE_NAME) cursor = conn.cursor() cursor.execute("SELECT day, period, subject, class_name, room FROM schedule ORDER BY day, period") rows = cursor.fetchall() conn.close() # Group by day schedule = {} for day, period, subject, class_name, room in rows: if day not in schedule: schedule[day] = [] class_info = f"Subject: {subject} Class: {class_name} Room: {room}" schedule[day].append((str(period), class_info)) return schedule
7
Initialize the database

After the new functions, ADD this line:

# Initialize the database init_db()

## Step-by-Step Upgrade - Part 4

8
Update all command functions

In EACH of these functions: `where_am_i()`, `schedule()`, and `tomorrow()`:

FIND this check at the beginning:

if not SCHEDULE: await update.message.reply_text("❌ Schedule not loaded. Check schedule_template RS.csv file.") return

REPLACE it with:

# Reload schedule from DB to ensure latest data schedule = load_schedule_from_db() if not schedule: await update.message.reply_text("❌ Schedule not loaded from database.") return
9
Change all SCHEDULE references

In each function, CHANGE every `SCHEDULE` to just `schedule` (lowercase):

# OLD: if current_day not in SCHEDULE: # NEW: if current_day not in schedule: # OLD: for period_num, class_info in SCHEDULE[current_day]: # NEW: for period_num, class_info in schedule[current_day]: # OLD: schedule_text = f"*{day}'s Schedule:*\n" # OLD: if day in SCHEDULE and SCHEDULE[day]: # NEW: schedule_text = f"*{day}'s Schedule:*\n" if day in schedule and schedule[day]:

## Step-by-Step Upgrade - Part 5

10
Add the new /add command function

After your `tomorrow()` function, ADD this new function:

async def add(update: Update, context: ContextTypes.DEFAULT_TYPE): """Start the process of adding a new schedule entry.""" user_id = update.effective_user.id user_states[user_id] = {"step": "waiting_day"} await update.message.reply_text( "📅 Adding a new class to the schedule.\n" "Please enter the day of the week (e.g., Monday, Tuesday, etc.):" )
11
Add the message handler function

After the `add()` function, ADD this function:

async def handle_message(update: Update, context: ContextTypes.DEFAULT_TYPE): """Handle user messages during the add process.""" user_id = update.effective_user.id if user_id not in user_states: # Not in a conversation, ignore return state_info = user_states[user_id] message_text = update.message.text.strip() if state_info["step"] == "waiting_day": # Validate day input valid_days = ["monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday"] if message_text.lower() not in valid_days: await update.message.reply_text( f"'{message_text}' is not a valid day of the week.\n" "Please enter a valid day (e.g., Monday, Tuesday, etc.):" ) return state_info["day"] = message_text.capitalize() state_info["step"] = "waiting_period" await update.message.reply_text( f"Got it! Day: {state_info['day']}\n" "Now please enter the period number (1-13):" ) elif state_info["step"] == "waiting_period": try: period = int(message_text) if period < 1 or period > 13: raise ValueError("Period must be between 1 and 13") state_info["period"] = period state_info["step"] = "waiting_subject" await update.message.reply_text( f"Got it! Period: {period}\n" "Now please enter the subject name:" ) except ValueError: await update.message.reply_text( f"'{message_text}' is not a valid period number.\n" "Please enter a number between 1 and 13:" ) # ... continue with subject, class, and room steps ... elif state_info["step"] == "waiting_room": state_info["room"] = message_text # Add to database success = add_schedule_entry( state_info["day"], state_info["period"], state_info["subject"], state_info["class_name"], message_text ) if success: await update.message.reply_text( f"✅ Successfully added to schedule!\n\n" f"Day: {state_info['day']}\n" f"Period: {state_info['period']}\n" f"Subject: {state_info['subject']}\n" f"Class: {state_info['class_name']}\n" f"Room: {state_info['room']}" ) else: await update.message.reply_text( f"❌ Failed to add to schedule. Please try again." ) # Clean up user state del user_states[user_id]

## Step-by-Step Upgrade - Part 6

12
Update the main() function

In your `main()` function:

DELETE these lines:

if not SCHEDULE: print("❌ Failed to load schedule. Please check schedule_template RS.csv file.") print("Make sure schedule_template RS.csv exists in the same folder") return

In the handler section, ADD these two lines:

# Add command handlers application.add_handler(CommandHandler("start", start)) application.add_handler(CommandHandler("whereami", where_am_i)) application.add_handler(CommandHandler("schedule", schedule)) application.add_handler(CommandHandler("tomorrow", tomorrow)) application.add_handler(CommandHandler("add", add)) # ← ADD THIS LINE application.add_handler(CommandHandler("help", help_command)) # Add message handler for conversation flow application.add_handler(MessageHandler(filters.TEXT & ~filters.COMMAND, handle_message)) # ← ADD THIS LINE
13
Update the start message

In your `start()` function, update the message to include the /add command:

await update.message.reply_text( "🤖 Hello! I'm your enhanced class scheduler bot with database support!\n" "Use /whereami to find your current class\n" "Use /schedule to see today's full schedule\n" "Use /tomorrow to see tomorrow's schedule\n" "Use /add to add a new class to the schedule\n" # ← ADDED THIS LINE "Use /help for all commands" )
14
Update the help command

In your `help_command()` function, add /add to the list:

await update.message.reply_text( "Available commands:\n" "/start - Start the bot\n" "/whereami - Find your current class\n" "/schedule - Show today's full schedule\n" "/tomorrow - Show tomorrow's schedule\n" "/add - Add a new class to the schedule\n" # ← ADDED THIS LINE "/help - Show this help message" )

## 5. Student Database Search System Beginner's Guide

Source file: Student Database Search System _ Beginner's Guide.html

# Student Database Search System

From Excel to Database - A Beginner's Journey

Goal: Build a working search system in 1 hour

Prerequisites: No database experience needed!

# What Is a Relational Database?

Beginner's Guide to Understanding Database Fundamentals

### You'll Learn:

1
What tables, fields, records, and keys are
2
How relationships connect data across tables
3
Why primary keys and foreign keys are critical
4
The role of SQL (Structured Query Language)
5
Real-world examples in banks, hospitals, and apps
Think of it like this:

A relational database is like a digital filing cabinet with labeled folders (tables) that are connected to each other.

Each folder contains specific information that can be linked to other folders.

## Let's Watch and Learn

Take 10 minutes to understand relational databases

### What Is a Relational Database? | Beginner's Guide

By Knewget (30.3K subscribers)

▶ Watch Video on YouTube

This video explains everything you need to know about databases in plain English. Perfect for beginners!

### Key Takeaways:

✓
Tables = Excel sheets with rows and columns
✓
Rows = Individual records (like a student)
✓
Columns = Fields of information (name, grade, etc.)
✓
Primary Key = Unique ID for each row
✓
Foreign Key = Link to another table

## Our 1-Hour MVP Project

Simple Python program to search student schedules

Current Problem:

School data is in messy Excel sheets that are hard to search.

We need to find information quickly!

### Search Examples We'll Build:

1
Find homeroom teacher:
"Who is the homeroom teacher for student Alex?"
2
Find students in a subject:
"Show me all students in Math class 4A"
3
Simple database search:
"Search for any information across all sheets"

## Step 1: Setup (5 minutes)

# 1. Create a new file called "school_search.py" # 2. Open it in any text editor # 3. Start with this basic setup: import pandas as pd def main(): # Main function - everything starts here print("=== School Search System ===") # Load our Excel file file_path = "school_data.xlsx" try: # Read the Excel file excel_file = pd.ExcelFile(file_path) print(f"Success! Found {len(excel_file.sheet_names)} sheets") return excel_file except Exception as e: print(f"Error: {e}") return None if __name__ == "__main__": main()

### To Install Required Libraries:

# Open Command Prompt or Terminal and type: pip install pandas

That's it! Pandas will help us read Excel files easily.

## Step 2: Create Search Function (15 minutes)

# Add this function to your file (under the imports) def simple_search(excel_file, search_term): """Search for any term across all sheets""" results = [] for sheet_name in excel_file.sheet_names: # Read each sheet df = pd.read_excel(excel_file, sheet_name=sheet_name) # Search in all cells for row_idx, row in df.iterrows(): for col_name, cell_value in row.items(): if pd.notna(cell_value): if search_term.lower() in str(cell_value).lower(): results.append({ 'sheet': sheet_name, 'row': row_idx + 2, # Excel row number 'column': col_name, 'value': str(cell_value) }) return results

### Update Your Main Function:

def main(): print("=== School Search System ===") # Load data data = pd.ExcelFile("school_data.xlsx") # Test search print("\nSearching for 'Math'...") math_results = simple_search(data, "Math") for result in math_results[:5]: # Show first 5 results print(f"Found in {result['sheet']}, row {result['row']}: {result['value']}") print(f"\nTotal found: {len(math_results)} results")

## Step 3: Add Specific Searches (15 minutes)

# Function to find homeroom teacher def find_teacher(excel_file, student_name): """Find homeroom teacher for a student""" for sheet_name in excel_file.sheet_names: df = pd.read_excel(excel_file, sheet_name=sheet_name) # Look for student name for idx, row in df.iterrows(): for cell_value in row.values: if pd.notna(cell_value) and student_name in str(cell_value): # Check if teacher info is in same row for col in df.columns: if "teacher" in str(col).lower() or "преподаватель" in str(col).lower(): if pd.notna(row[col]): return row[col] return "Teacher not found"
# Function to find students by class def find_students_in_class(excel_file, class_name): """Find all students in a specific class (like 4A)""" students = [] for sheet_name in excel_file.sheet_names: df = pd.read_excel(excel_file, sheet_name=sheet_name) for idx, row in df.iterrows(): for cell_value in row.values: if pd.notna(cell_value) and class_name in str(cell_value): # Look for student names in this row for col in df.columns: if "name" in str(col).lower() or "фио" in str(col).lower(): if pd.notna(row[col]): students.append(row[col]) return list(set(students)) # Remove duplicates

## Step 4: Complete Program (10 minutes)

# school_search.py - COMPLETE PROGRAM import pandas as pd # [PASTE ALL FUNCTIONS FROM PREVIOUS SLIDES HERE] # 1. simple_search() function # 2. find_teacher() function # 3. find_students_in_class() function def main(): # 1. Load the data print("=== Student Database Search ===") try: # Change this to your actual file name data = pd.ExcelFile("Распределение по группам Технолицей 2025_2026 - 4.xlsx") print(f"✓ Loaded: {len(data.sheet_names)} sheets") except: print("✗ Error: Make sure the Excel file is in the same folder!") return # 2. Example searches print("\n--- Example 1: Find Teacher ---") teacher = find_teacher(data, "Арефьев") print(f"Homeroom teacher: {teacher}") print("\n--- Example 2: Find Students ---") students = find_students_in_class(data, "4A") print(f"Students in 4A: {len(students)} found") for student in students[:3]: # Show first 3 print(f" • {student}") print("\n--- Example 3: General Search ---") results = simple_search(data, "Math") print(f"Found 'Math' {len(results)} times") print("\n=== Search Complete ===") if __name__ == "__main__": main()

### How to Run:

1
Save all code in "school_search.py"
2
Put your Excel file in same folder
3
Open terminal in that folder
4
Type: `python school_search.py`

## Next Step: Real Database

Moving from Excel to SQLite database

# Simple SQLite database setup (future enhancement) import sqlite3 def create_database(): # Connect to database (creates if doesn't exist) conn = sqlite3.connect('school.db') cursor = conn.cursor() # Create tables (like in the video!) cursor.execute('''CREATE TABLE IF NOT EXISTS students ( id INTEGER PRIMARY KEY, name TEXT NOT NULL, grade TEXT, class TEXT, homeroom_teacher_id INTEGER )''') cursor.execute('''CREATE TABLE IF NOT EXISTS teachers ( id INTEGER PRIMARY KEY, name TEXT NOT NULL, subject TEXT )''') conn.commit() conn.close() print("Database created successfully!")
Database vs Excel:

Excel: Good for viewing, bad for searching

Database: Fast searching, relationships, scalable

### Your 1-Hour MVP is Complete!

You've built a working search system that can:

• Search across all Excel sheets

• Find teachers for students

• List students in classes

• Be extended to a real database

## 6. Thesis Intelligent School Schedule Management System 23 Jan 2026

Source file: Thesis_ Intelligent School Schedule Management System_23_Jan_2026.html

This project evolved from a simple chat assistant into a comprehensive school schedule management system. It began as a Telegram bot that tells students what class they have and when, and has grown to handle complex school scheduling with multiple layers of data organization.

### The Evolution

What started as a friendly robot in your phone that knows your class schedule has transformed into a sophisticated database system capable of managing complex school timetables with multiple tracks, groups, and modules.

## What It Does

The system now serves as a complete personal assistant for complex school timetables. Here are all the things it can do:

/start
Introduces the system and explains its capabilities
/whereami
Checks current time and tells which class or activity a student should be attending
/schedule
Displays all classes and activities for today in chronological order
/tomorrow
Shows tomorrow's complete schedule for advance preparation
/add
Allows administrators to add new schedule entries dynamically
Database Queries
Advanced queries for student groups, teacher schedules, and room allocations

## Data Analysis: Understanding Complex School Schedules

After analyzing real school schedule spreadsheets, we discovered that school timetables are far more complex than simple period-by-period schedules. Here's what we found:

### Key Insights from School Schedule Data:

Complex Groupings: Students belong to multiple overlapping group systems simultaneously:
• Whole class activities (entire 4A, 4B, 4C together)
• Split groups (Group 1, Group 2 for specialized subjects)
• English level groups (E1-E6 based on proficiency)
• Special tracks (Design & Creativity, Culinary, Industrial, etc.)
• Olympiad and competition groups
• Speaking clubs and extracurricular activities
Temporal Structure: Two modules (terms) with potentially different schedules and groupings
Multiple Dimensions: Each student has multiple simultaneous affiliations:
• Primary class (4A, 4B, 4C)
• English group (E1-E6)
• Technology track group
• Olympiad participation
• Speaking club assignment
Teacher Assignments: Different teachers for different subjects, with some handling multiple groups
Room Management: Specific rooms for specific activities, some shared across groups

## Recommended Database Schema

To handle this complexity, we designed a comprehensive database structure with 11 interconnected tables:

students
Student personal information and class assignments
teachers
Teacher information and department assignments
subjects
All subjects and tracks offered by the school
classes
Class information and homeroom teacher assignments
rooms
Room availability and capacity information
timeslots
Day and period time definitions
schedule_entries
Main scheduling table connecting all elements
student_subjects
Which students take which subjects
student_groups
Student assignments to specific activity groups
tech_tracks
Technological track specialization assignments
special_groups
Olympiad, programming, and special interest groups

### Core Database Structure:

Entity-Relationship Diagram
┌─────────────────────────────────────────────────────────────────────────────┐ │ CORE SCHEDULING STRUCTURE │ ├─────────────────────────────────────────────────────────────────────────────┤ │ │ │ students (1) ────────────────────────────────────────────────┐ │ │ teachers (1) ────────────────────────────────────────────────┤ │ │ subjects (1) ────────────────────────────────────────────────┼──────┐ │ │ rooms (1) ──────────────────────────────────────────────────┤ │ │ │ classes (1) ─────────────────────────────────────────────────┤ │ │ │ timeslots (1) ────────────────────────────────────────────────┘ │ │ │ │ │ │ │ ▼ ▼ ▼ │ │ schedule_entries (many) │ │ │ ├─────────────────────────────────────────────────────────────────────────────┤ │ STUDENT SPECIALIZATION STRUCTURE │ ├─────────────────────────────────────────────────────────────────────────────┤ │ │ │ students (1) ────── student_subjects (many) ────── subjects (1) │ │ │ │ students (1) ────── student_groups (many) ─────── groups (1) │ │ │ │ students (1) ────── tech_tracks (many) ────────── tracks (1) │ │ │ └─────────────────────────────────────────────────────────────────────────────┘
Entity (Database Table)
Relationship (Junction Table)
Cardinality (1:1, 1:many, many:1)

This normalized structure allows for efficient querying of complex relationships while maintaining data integrity and avoiding duplication. The core schedule_entries table connects all major entities, while specialized tables handle the complex group assignments that characterize modern school schedules.

## How It Works (System Architecture)

The entire system is designed to be scalable and maintainable. Here's how it all comes together:

1

### Data Import and Storage

The system imports complex school schedules from multiple Excel sheets into a structured SQLite database. Each spreadsheet (representing different grades or modules) is parsed and stored in the appropriate tables with proper relationships.

2

### Intelligent Query Processing

When a student asks "Where am I?", the system checks multiple dimensions: current time, day, the student's class, their English group, their technology track, and any special group assignments to determine their exact location.

3

### Multi-Dimensional Scheduling

The system understands that students have multiple simultaneous schedules: core class schedule, English group schedule, track activities, and extracurricular activities. It combines these to give a complete picture.

4

### Dynamic Updates and Management

Administrators can update schedules in real-time. The system handles changes gracefully, updating all related records while maintaining data consistency across all tables.

## The Innovation

This project demonstrates how a simple concept can evolve into a sophisticated system through careful analysis of real-world data. We discovered that school scheduling is not just about "period 1, period 2" but involves complex overlapping group systems, multiple modules, and specialized tracks.

The key innovation is in recognizing and modeling these complex relationships in a way that's both efficient for the database and intuitive for users. The system doesn't just tell students "you have math now" - it understands that Student A from 4A in English group E3 doing the Design & Creativity track should be in Room 204 with Teacher Smith for their specialized session.

### Future Directions

This foundation opens up numerous possibilities:

- Advanced Analytics: Track room utilization, teacher workload, and student participation patterns
- Conflict Detection: Automatically identify scheduling conflicts before they occur
- Parent Portal: Allow parents to view their children's schedules and receive updates
- Mobile Integration: Push notifications for schedule changes and reminders
- AI Optimization: Use machine learning to optimize schedules based on historical data

This project shows that even the most complex real-world systems can be modeled effectively with careful database design and thoughtful user interfaces.

## 7. Thesis AI7 Building A Scheduler Bot A Student Project

Source file: Thesis_AI7_Building_A_ Scheduler_Bot_A Student Project.html
Supervisor: Bob Santos
Developer: Березуцкий Григорий

## Introduction

This project created an advanced version of a class schedule helper bot for Telegram. The bot helps students by providing detailed schedule information through a messaging app. Unlike simple bots, this version can handle weekly schedules, multiple commands, and loads schedule data from an external file that can be easily updated by teachers or administrators.

## Aim

The goal was to create a more sophisticated scheduling tool that could:

- Load schedule data from a CSV file that's easy to edit without changing code
- Handle full weekly schedules with different classes each day
- Provide multiple helpful commands for students
- Show both current class information and full daily schedules
- Work with real class timings for a complete school day
- Make schedule updates simple for teachers and administrators

## Method

The development followed these key steps:

1

### Design Schedule Structure

Created a CSV file format that teachers can easily edit using programs like Excel or Google Sheets. The file includes days of the week and multiple class periods.

2

### Build File Loading System

Used the pandas library to read and process the CSV file, converting it into a schedule that the bot can understand and use.

3

### Create Multiple Commands

Built different functions for each command: /start, /whereami, /schedule, /tomorrow, and /help to provide a complete scheduling assistant.

4

### Implement Time Logic

Created a system that understands both the current day of the week and the exact time, matching them with the appropriate class period.

## Results

The project successfully created a feature-rich scheduling bot:

📂 File-Based Schedule

Schedule stored in CSV file that can be edited without touching the code. Teachers can update using familiar spreadsheet software.

🗓️ Weekly Scheduling

Handles different schedules for each day of the week (Monday-Friday), with up to 7 class periods per day.

🔍 Multiple Commands

Five useful commands: /start, /whereami, /schedule, /tomorrow, and /help to meet different student needs.

⏰ Real Class Times

Accurate timing system with proper start and end times for each period throughout the school day.

### Bot Commands in Action

- /start: Welcomes users and explains available commands
- /whereami: Tells students exactly which class they should be in right now, considering both day and time
- /schedule: Shows the complete schedule for today, with all class periods and times
- /tomorrow: Shows what classes are scheduled for tomorrow, helping students prepare
- /help: Lists all available commands with descriptions

## Conclusion

This advanced scheduler bot project demonstrates how programming can create practical tools that solve real-world problems. By moving from a simple hard-coded schedule to a file-based system, the bot became much more useful and maintainable. The student learned important programming concepts including file handling, data processing, time management, and creating user-friendly interfaces. The project shows that even school projects can evolve into sophisticated applications that could be used by real schools.

## Future Possibilities

This bot could be extended in several interesting ways:

- Multiple user support: Allow different students to have personalized schedules
- Teacher information: Include which teacher is teaching each class and their contact information
- Classroom maps: Add links to maps showing where classrooms are located
- Homework integration: Connect to homework assignment systems
- Mobile notifications: Send push notifications before class starts
- Special schedules: Handle exam weeks, holidays, and special event days
- Statistics tracking: Track which commands are used most often to improve the bot

## Addendum: Complete Bot Code

Here is the complete Python code for the Advanced Telegram Scheduler Bot:

Note: For security reasons, the actual bot token has been removed. When using this code, you should replace "YOUR_BOT_TOKEN_HERE" with your actual bot token from @BotFather.
import pandas as pd import datetime from telegram import Update from telegram.ext import Application, CommandHandler, ContextTypes # 🔑 REPLACE THIS with your bot token from @BotFather BOT_TOKEN = "YOUR_BOT_TOKEN_HERE" def load_schedule(): """ Load schedule from CSV file using pandas Returns a dictionary with day-wise schedule """ try: # Read CSV file df = pd.read_csv('schedule.csv') schedule = {} # Process each row (each day) for _, row in df.iterrows(): day = row['Day'] schedule[day] = [] # Process each time slot column time_slots = ['Period_1', 'Period_2', 'Period_3', 'Period_4', 'Period_5', 'Period_6', 'Period_7'] for slot in time_slots: # Check if class exists for this time slot if pd.notna(row[slot]) and str(row[slot]).strip(): class_info = str(row[slot]) schedule[day].append((slot, class_info)) return schedule except FileNotFoundError: print("❌ Error: schedule.csv file not found!") print("Please create schedule.csv in the same folder") return {} except Exception as e: print(f"❌ Error loading schedule: {e}") return {} # Load schedule at startup SCHEDULE = load_schedule() # Time mapping for periods PERIOD_TIMES = { 'Period_1': ('09:00', '09:40'), 'Period_2': ('10:00', '10:40'), 'Period_3': ('11:00', '11:40'), 'Period_4': ('11:50', '12:30'), 'Period_5': ('12:40', '13:20'), 'Period_6': ('13:30', '14:10'), 'Period_7': ('10:00', '10:40'), } async def start(update: Update, context: ContextTypes.DEFAULT_TYPE): """Send welcome message when command /start is issued.""" await update.message.reply_text( "🤖 Hello! I'm your enhanced class scheduler bot!\n" "Use /whereami to find your current class\n" "Use /schedule to see today's full schedule\n" "Use /tomorrow to see tomorrow's schedule\n" "Use /help for all commands" ) async def where_am_i(update: Update, context: ContextTypes.DEFAULT_TYPE): """Tell user where they should be right now.""" if not SCHEDULE: await update.message.reply_text("❌ Schedule not loaded. Check schedule.csv file.") return now = datetime.datetime.now() current_time = now.strftime("%H:%M") current_day = now.strftime("%A") await update.message.reply_text(f"📅 Today is {current_day}") await update.message.reply_text(f"⏰ Current time: {current_time}") # Check if we have schedule for today if current_day not in SCHEDULE: await update.message.reply_text("😊 No classes scheduled for today!") return # Find current class found_class = False for period, class_info in SCHEDULE[current_day]: start_time, end_time = PERIOD_TIMES[period] if start_time <= current_time <= end_time: await update.message.reply_text(f"🎯 You should be in: {class_info}") found_class = True break if not found_class: await update.message.reply_text("😊 No class right now! Free period.") async def schedule(update: Update, context: ContextTypes.DEFAULT_TYPE): """Show today's full schedule.""" if not SCHEDULE: await update.message.reply_text("❌ Schedule not loaded. Check schedule.csv file.") return current_day = datetime.datetime.now().strftime("%A") if current_day not in SCHEDULE or not SCHEDULE[current_day]: await update.message.reply_text("😊 No classes scheduled for today!") return schedule_text = f"📚 {current_day}'s Schedule:\n\n" for period, class_info in SCHEDULE[current_day]: start, end = PERIOD_TIMES[period] schedule_text += f"⏰ {start}-{end}: {class_info}\n" await update.message.reply_text(schedule_text) async def tomorrow(update: Update, context: ContextTypes.DEFAULT_TYPE): """Show tomorrow's schedule.""" if not SCHEDULE: await update.message.reply_text("❌ Schedule not loaded. Check schedule.csv file.") return tomorrow_date = datetime.datetime.now() + datetime.timedelta(days=1) tomorrow_day = tomorrow_date.strftime("%A") if tomorrow_day not in SCHEDULE or not SCHEDULE[tomorrow_day]: await update.message.reply_text(f"😊 No classes scheduled for {tomorrow_day}!") return schedule_text = f"📚 {tomorrow_day}'s Schedule:\n\n" for period, class_info in SCHEDULE[tomorrow_day]: start, end = PERIOD_TIMES[period] schedule_text += f"⏰ {start}-{end}: {class_info}\n" await update.message.reply_text(schedule_text) async def help_command(update: Update, context: ContextTypes.DEFAULT_TYPE): """Send help message with all commands.""" await update.message.reply_text( "Available commands:\n" "/start - Start the bot\n" "/whereami - Find your current class\n" "/schedule - Show today's schedule\n" "/tomorrow - Show tomorrow's schedule\n" "/help - Show this help message" ) def main(): """Start the bot.""" if not SCHEDULE: print("❌ Failed to load schedule. Please check schedule.csv file.") print("Make sure schedule.csv exists in the same folder") return # Create the Application application = Application.builder().token(BOT_TOKEN).build() # Add command handlers application.add_handler(CommandHandler("start", start)) application.add_handler(CommandHandler("whereami", where_am_i)) application.add_handler(CommandHandler("schedule", schedule)) application.add_handler(CommandHandler("tomorrow", tomorrow)) application.add_handler(CommandHandler("help", help_command)) # Start the Bot print("🤖 Enhanced scheduler bot is running...") print("📊 Schedule loaded successfully!") print("📅 Available days:", list(SCHEDULE.keys())) print("Press Ctrl+C to stop the bot") application.run_polling() if __name__ == "__main__": main()

Key features of this advanced code:

1. CSV File Loading: Uses pandas library to read schedule data from an external file
2. Flexible Schedule Structure: Supports different schedules for each day of the week
3. Multiple Periods: Handles up to 7 class periods per day with accurate timing
4. Error Handling: Includes error messages if the schedule file is missing or has problems
5. User-Friendly Commands: Five different commands to help students in different ways
6. Professional Structure: Well-organized code with clear functions and documentation