ARSHIQUE ALAM
Mrs. Rojalini Parija (PGT Comp Sc.)
SESSION : 2025-26
Arshique
ARSHIQUE Alam
ALAM
This is to certify that …………………………………… of
Class-XII, Science Stream, of St. Arnold’s
School, Jhartarang, Rourkela has successfully
completed this investigatory project
School
SCHOOLBus BUSOptimizer
OPTIMIZER
“………………………………………………………….…” in the
Computer Laboratory of the school in the
academic session 2025-26 under my supervision.
He/ she has taken a keen interest and has shown
utmost sincerity in completing this project.
I certify that this project is up to my
expectation & as per the guidelines issued by
CBSE, NEW DELHI.
Mrs. Rojalini Parija
( Internal Examiner ) External Examiner
DECLARATION
I hereby declare that the project work entitled
“……………………………..…………..……………………………..” ,
submitted to Department of Computer Science, St.
Arnold’s School, Jhartarang, Rourkela under the guidance
of [Link] Parija, PGT (Comp. Sc) is prepared by me
for the session 2025-26. All the coding is result of my
personal efforts and original work .
I further declare that this project record or any part of this
has not been submitted elsewhere for any other class .
Name : ……………………………………………
Date : …………………………… AISSCE Roll No- ……………………………
CONTENT
SL No TOPIC Pg No
1 ACKNOWLEDGEMENT
2 OBJECTIVE OF THE PROJECT
HARDWARE & SOFTWARE
3
REQUIREMENTS
4 PROGRAMMING CODE
5 OUTPUT PRESENTATION
6 BIBLIOGRAPHY
7 CONCLUSION
ACKNOWLEDGEMENT
I would like to express my gratitude and
appreciation to all those who gave me the possibility
to complete this project. Special thanks are due to
my project guide Mrs. Rojalini Parija (PGT, Comp
Sc) whose help, stimulating suggestions and
encouragement helped me in all time of fabrication
process and in writing this report.
I would also like to acknowledge with much
appreciation the crucial role of my principal, friends
and family for their kind co-operation and constant
motivation.
Sign : ………………………………..
Roll no : ……………………………
OBJECTIVE OF THE PROJECT
The primary objective of the School Bus Optimiser project is to design
and develop an intelligent, user-friendly system that streamlines the
management and optimization of school bus routes. This project aims to
reduce the manual effort involved in assigning buses, managing routes,
and monitoring stops, while ensuring efficiency, safety, and convenience
for both school administrators and drivers.
The system provides an integrated graphical user interface (GUI) built
using Python’s Tkinter library, which allows administrators to manage
various entities such as students, drivers, buses, routes, and stops
through a single dashboard. The project is also connected to a MySQL
database, ensuring secure and structured data storage for all records.
Each operation, including adding, editing, or deleting entries, is directly
reflected in the database, maintaining data consistency and reliability.
A key feature of this project is the Route Optimization functionality,
which uses location coordinates (latitude and longitude) of stops to
generate an optimized travel path between the school and all designated
stops. By implementing a nearest-neighbour-based optimization logic,
the system determines the most efficient route, thereby minimizing
travel time and fuel consumption. The optimized route is visualized on a
map using the Folium library, making it easy to interpret and use in real-
world scenarios.
Overall, the objective of this project is to combine technology, logic, and
data visualization to create a smart school transportation management
system. It aims to enhance operational efficiency, improve route
planning accuracy, and provide an interactive, modern solution for
schools to manage their transportation network effectively.
MINIMUM HARDWARE & SOFTWARE
REQUIREMENTS
Minimum Hardware Requirements:
Computer or Laptop: You will need a computer or laptop to write, run, and test your Python code.
Processor and RAM: A modern processor (e.g., Intel Core i3 or equivalent) and at least 4GB of
RAM are recommended for smooth coding and running Python programs.
Storage: Adequate storage space (at least 128GB SSD or 500GB HDD) for storing your Python code
files, project data, and any necessary libraries.
Display: A display with a resolution of at least 1366x768 pixels for comfortable coding and viewing.
Input Devices: A keyboard and mouse or a touchpad for input.
Minimum Software Requirements:
The Python Interpreter: You'll need to have Python installed on your computer. You can
download latest version of Python from the official website ([Link]
Choose Python 3.x as Python 2 is no longer supported.
Integrated Development Environment (IDE): While you can write Python code in a simple
text editor like Notepad, using a Python-specific IDE can greatly improve your coding experience.
Some popular options include:
Visual Studio Code: A free and versatile code editor with Python support.
PyCharm: A dedicated Python IDE with many features.
Jupyter Notebook: A great choice for data science and interactive coding.
Libraries: Depending on your project, you may need to install Python libraries or packages.
Common libraries used in Python projects include NumPy, pandas, matplotlib, and more. You can
install these libraries using the Python package manager, pip, by running commands like pip install
NumPy.
MySQL: A free and open-source DBMS widely used for educational purposes and small to medium-
sized projects.
Microsoft SQL Server: A robust DBMS from Microsoft. You may have access to this software if
your school or institution has a license.
SQL Client Tool: You will need a tool to write and execute SQL queries against the database. Most
DBMS software includes a command-line interface for this purpose, but you may also consider using
graphical SQL clients for a more user-friendly experience.
Documentation Software: You may need word processing software like Microsoft
Word or Google Docs to create documentation explaining your project's
database design, SQL queries, and results.
PROGRAMMING CODE
[Link]
import tkinter as tk
from tkinter import ttk, messagebox
import [Link]
import folium
import webbrowser
import math
# ---------- Database Connection ----------
def get_connection():
return [Link](
host="localhost",
user="root",
password="Bff=n&s<3",
database="RouteDb"
)
# ---------- Functions ----------
def distance(a, b):
lat1, lon1 = float(a[1]), float(a[2])
lat2, lon2 = float(b[1]), float(b[2])
return [Link]((lat1 - lat2) ** 2 + (lon1 -
lon2) ** 2)
def optimize_route(stops, school):
route, rem, cur = [school], [Link](), school
while rem:
nxt = min(rem, key=lambda s: distance(cur,
s))
[Link](nxt)
[Link](nxt)
cur = nxt
[Link](school)
return route
def logintodb(user, passw):
if not user or not passw:
[Link]("Input Error", "Please
enter both username and password")
return
db = get_connection()
if not db:
[Link]("Connection Error",
"Failed to connect to the database")
return
try:
cursor = [Link]()
query = "select * from Admin Where
Adm_username=%s AND Adm_passw=%s"
[Link](query, (user, passw))
result = [Link]()
if result:
[Link]("Login Successful",
f"Welcome, {user}!")
return True
else:
[Link]("Login Failed",
"Invalid username or password")
return False
except [Link] as err:
[Link]("Query Error",
f"Database query failed:\n{err}")
finally:
[Link]()
[Link]()
def submitact(Username, password):
user = [Link]()
passw = [Link]()
if logintodb(user, passw):
adm_dashboard(user)
def show_tables(table_name):
db = get_connection()
if not db:
print("Failed to connect to the database")
return
try:
right_buttons_dict = {
"Admin": ["Add Admin", "Edit Admin",
"Delete Admin", "Exit"],
"Student": ["Add Student", "Edit
Student", "Delete Student", "Exit"],
"Driver": ["Add Driver", "Edit Driver",
"Remove Driver", "Exit"],
"Bus": ["Add Bus", "Edit Bus", "Assign
Route", "Delete Bus", "Exit"],
"Route": ["Add Route", "Edit Route",
"Optimize Route", "Delete Route", "Exit"],
"Stop": ["Add Stop", "Edit Stop", "Remove
Stop", "Exit"]
}
cursor = [Link]()
[Link](f"DESCRIBE {table_name}")
columns = [col[0] for col in
[Link]()]
[Link](f"SELECT * FROM {table_name}")
rows = [Link]()
for widget in frame2.winfo_children():
[Link]()
table_frame = [Link](frame2, bg="#ffffff")
table_frame.pack(fill="both", expand=True)
tree = [Link](table_frame,
columns=columns, show='headings')
[Link](side="left", fill='both',
expand=True)
for col in columns:
[Link](col, text=col)
[Link](col, width=len(col) * 20,
anchor='center')
for row in rows:
[Link]('', 'end', values=row)
for widget in right_frame.winfo_children():
[Link]()
vsb = [Link](table_frame,
orient="vertical", command=[Link])
[Link](side='right', fill='y')
buttons_to_add =
right_buttons_dict.get(table_name, [])
for btn_text in buttons_to_add:
btn = [Link](right_frame,
text=btn_text, bg="#3a7ca5", fg="white",
width=20, command=lambda
t=btn_text: handle_action(t, tree, table_name,
columns))
[Link](pady=5, fill="x")
style = [Link]()
style.theme_use('clam')
# Light theme styling
[Link]("Treeview",
background="#ffffff",
foreground="#202020",
fieldbackground="#ffffff",
font=("Segoe UI", 12))
[Link]("Treeview",
background=[('selected',
'#cce5ff')],
foreground=[('selected',
'#000000')])
[Link]("[Link]",
background="#3a7ca5",
foreground="white",
font=("Segoe UI", 12,
"bold"))
[Link]("[Link]",
background=[('active', '#357ABD')])
[Link](style="Treeview",
yscrollcommand=[Link])
except [Link] as err:
print(f"Database query failed: {err}")
finally:
[Link]()
[Link]()
def start_inline_edit(tree, rowid, col_index,
table_name, columns, next_column=False):
if col_index >= len(columns):
return
if col_index == 0:
if next_column:
return start_inline_edit(tree, rowid, 1,
table_name, columns, next_column=True)
return
col_id = f"#{col_index + 1}"
bbox = [Link](rowid, col_id)
if not bbox:
return
x, y, width, height = bbox
old_value = [Link](rowid, "values")[col_index]
entry = [Link](tree, font=("Segoe UI", 12))
[Link](x=x, y=y, width=width, height=height)
[Link](0, old_value)
[Link]()
def save_edit(event=None):
new_value = [Link]()
values = list([Link](rowid, "values"))
values[col_index] = new_value
[Link](rowid, values=values)
[Link]()
pk_col = columns[0]
pk_val = values[0]
try:
db = get_connection()
cursor = [Link]()
update_col = columns[col_index]
[Link](f"UPDATE {table_name} SET
{update_col}=%s WHERE {pk_col}=%s", (new_value,
pk_val))
[Link]()
[Link]()
[Link]()
except Exception as e:
print("DB update failed:", e)
if next_column and col_index + 1 <
len(columns):
[Link](50, lambda:
start_inline_edit(tree, rowid, col_index + 1,
table_name, columns, True))
[Link]("<Return>", save_edit)
[Link]("<FocusOut>", save_edit)
def handle_action(action, tree, table_name, columns):
sel = [Link]()
if [Link]("Add"):
try:
db = get_connection()
cursor = [Link]()
[Link](f"DESCRIBE {table_name}")
col_info = [Link]()
insert_cols = []
insert_values = []
for field, ftype, null, key, default,
extra in col_info:
if "auto_increment" in [Link]():
continue
insert_cols.append(field)
# handle field defaults
if default is not None:
insert_values.append(default)
elif "enum" in [Link]():
first_enum =
ftype[[Link]("(") +
1:[Link](")")].split(",")[0].strip("'")
insert_values.append(first_enum)
elif null == "YES":
insert_values.append(None)
else:
insert_values.append("N/A") #
fallback placeholder
placeholders = ", ".join(["%s"] *
len(insert_values))
query = f"INSERT INTO {table_name} ({',
'.join(insert_cols)}) VALUES ({placeholders})"
[Link](query, insert_values)
[Link]()
[Link](f"SELECT * FROM
{table_name} ORDER BY {col_info[0][0]} DESC LIMIT 1")
new_row = [Link]()
[Link]()
[Link]()
new_id = [Link]('', 'end',
values=new_row)
start_inline_edit(tree, new_id, 1,
table_name, [c[0] for c in col_info],
next_column=True)
except Exception as e:
print("Add failed:", e)
elif [Link]("Edit"):
if sel:
row_id = sel[0]
start_inline_edit(tree, row_id, 1,
table_name, columns, next_column=True)
else:
[Link]("Select row",
"Please select a row to edit")
elif [Link]("Delete") or
[Link]("Remove"):
if sel:
values = [Link](sel[0], "values")
pk_val = values[0]
try:
db = get_connection()
cursor = [Link]()
query = f"DELETE FROM {table_name}
WHERE {columns[0]}=%s"
[Link](query, (pk_val,))
[Link]()
[Link]()
[Link]()
[Link](sel[0])
except Exception as e:
print("Delete failed:", e)
else:
[Link]("Select row",
"Please select a row to delete")
elif [Link]("Exit"):
for widget in frame2.winfo_children():
[Link]()
for widget in right_frame.winfo_children():
[Link]()
elif action == "Assign Route":
[Link]("Info", "Assign Route
functionality is not yet implemented.")
elif action == "Optimize Route":
try:
db = get_connection()
cursor = [Link]()
[Link]("Select Stp_name,
Latitude, Longitude from Stop")
rows = [Link]()
stops = []
for name, lat, lon in rows:
try:
[Link]((name, float(lat),
float(lon)))
except ValueError:
print(f"Skipping invalid
coordinates for stop: {name}")
school = ("[Link]'s School",
22.2187296, 84.7791764)
optimized = optimize_route(stops, school)
m = [Link](location=[school[1],
school[2]], zoom_start=13)
[Link]([(s[1], s[2]) for s in
optimized], color="blue", weight=3).add_to(m)
for s in optimized:
[Link]([s[1], s[2]],
tooltip=s[0]).add_to(m)
[Link]("optimized_route.html")
[Link]("optimized_route.html")
[Link]("Route Optimized",
"Check terminal for stop order!")
except Exception as e:
[Link]("Optimize Route
failed:", e)
# ---------- GUI Setup ----------
def main():
global root
root = [Link]()
[Link]("500x400")
[Link]("Login Page - Route Wizard v1.0")
[Link](bg="#ffffff")
[Link](False, False)
frame = [Link](root, bg="#ffffff")
[Link](relx=0.5, rely=0.5, anchor="center")
head = [Link](root, text="Login to Route
Wizard", fg="#3a7ca5", bg="#ffffff", font=("Segoe
UI", 20, "bold"))
[Link](relx=0.5, y=30, anchor="n")
lblfrstrow = [Link](frame, text="Username",
fg="#202020", bg="#ffffff", font=("Segoe UI", 14))
[Link](pady=(0, 5))
Username = [Link](frame, width=35,
bg="#f9f9f9", fg="#202020", justify="center",
relief="solid", bd=1)
[Link](pady=(0, 15), ipady=5, ipadx=10)
lblsecrow = [Link](frame, text="Password",
fg="#202020", bg="#ffffff", font=("Segoe UI", 14))
[Link](pady=(0, 5))
password = [Link](frame, width=35,
bg="#f9f9f9", fg="#202020", show="*",
justify="center", relief="solid", bd=1)
[Link](pady=(0, 15), ipady=5, ipadx=10)
submitbtn = [Link](frame, text="Login",
bg="#3a7ca5", font=("Segoe UI", 14), fg="white",
command=lambda:
submitact(Username, password))
[Link](pady=10, ipadx=10, ipady=2)
[Link]()
def adm_dashboard(user):
[Link]()
global frame2, right_frame
dashboard = [Link]()
[Link]("Admin Dashboard")
[Link]("1366x768")
[Link](bg="#ffffff")
head = [Link](dashboard, text=f"Welcome
{user}!!", fg="#3a7ca5", bg="#ffffff", font=("Segoe
UI", 20, "bold"))
[Link](pady=20)
frame = [Link](dashboard, bg="#ffffff")
[Link](pady=20)
button_frame = [Link](dashboard, bg="#ffffff")
button_frame.pack(pady=10)
buttons = [
"Admin Management",
"Student Management",
"Driver Management",
"Bus Management",
"Route Management",
"Stop Management"
]
for i, text in enumerate(buttons):
btn = [Link](button_frame, text=text,
bg="#3a7ca5", fg="white",
font=("Segoe UI", 14),
width=20, command=lambda t=text:
show_tables([Link]()[0]))
[Link](row=i // 3, column=i % 3, padx=50,
pady=20)
content_frame = [Link](dashboard, bg="#ffffff")
content_frame.pack(fill="both", expand=True,
padx=20, pady=20)
center_frame = [Link](content_frame,
bg="#f5f5f5", relief="solid", bd=1)
center_frame.pack()
frame2 = [Link](center_frame, bg="#ffffff",
width=700, height=400)
[Link](side="left", padx=(20, 20), pady=20)
right_frame = [Link](center_frame,
bg="#ffffff")
right_frame.pack(side="left", padx=(20, 20),
pady=20, anchor="n")
[Link]()
main()
[Link]
CREATE DATABASE IF NOT EXISTS RouteDb;
USE RouteDb;
CREATE TABLE IF NOT EXISTS Admin(
Adm_Id INT PRIMARY KEY AUTO_INCREMENT,
Adm_username VARCHAR(20) UNIQUE,
Adm_passw VARCHAR(25) NOT NULL,
Adm_role ENUM('Admin','Staff','Driver')
);
CREATE TABLE IF NOT EXISTS Student(
Std_id INT PRIMARY KEY AUTO_INCREMENT,
Std_name VARCHAR(30) NOT NULL,
class VARCHAR(3) NOT NULL,
Roll_no INT NOT NULL,
Std_addrs TEXT NOT NULL,
contact_num VARCHAR(10) UNIQUE NOT NULL
);
CREATE TABLE IF NOT EXISTS Driver(
Drv_id INT PRIMARY KEY AUTO_INCREMENT,
Drv_name VARCHAR(30) NOT NULL,
Drv_lic_no VARCHAR(15) UNIQUE NOT NULL,
contact_num VARCHAR(10) UNIQUE NOT NULL,
Adm_Id INT,
FOREIGN KEY (Adm_Id) REFERENCES Admin(Adm_Id) ON
DELETE CASCADE
);
CREATE TABLE IF NOT EXISTS Route(
Rte_id INT PRIMARY KEY AUTO_INCREMENT,
Rte_name VARCHAR(20) NOT NULL,
start_point VARCHAR(30) NOT NULL,
end_point VARCHAR(30) NOT NULL,
Total_distance FLOAT NOT NULL,
Est_time INT NOT NULL
);
CREATE TABLE IF NOT EXISTS Bus(
Bus_id INT PRIMARY KEY AUTO_INCREMENT,
Bus_no VARCHAR(10) UNIQUE NOT NULL,
capacity INT NOT NULL,
Drv_id INT,
Rte_id INT,
FOREIGN KEY (Drv_id) REFERENCES Driver(Drv_id) ON
DELETE CASCADE,
FOREIGN KEY (Rte_id) REFERENCES Route(Rte_id) ON
DELETE CASCADE
);
CREATE TABLE IF NOT EXISTS Stop(
Stp_id INT PRIMARY KEY AUTO_INCREMENT,
Stp_name VARCHAR(30) NOT NULL,
latitude DOUBLE NOT NULL,
longitude DOUBLE NOT NULL,
Rte_id INT,
FOREIGN KEY (Rte_id) REFERENCES Route(Rte_id) ON
DELETE CASCADE
);
OUTPUT PRESENTATION
LOGIN PAGE
DASHBOARD
FOLIUM MAP
BIBLIOGRAPHY
➢ Python Software Foundation. Python
Programming Language. Available at:
[Link]
➢ Tkinter Documentation. Tkinter – Python GUI
Library. Available at:
[Link]
➢ MySQL Connector/Python Developer Guide.
Available at: [Link]
python/en/
➢ Folium Documentation. Python Library for
Interactive Maps. Available at: [Link]
[Link]/folium/
➢ Stack Overflow Community. Programming Help
and Solutions. Available at:
[Link]
➢ GeeksforGeeks. Python GUI and Database
Tutorials. Available at:
[Link]
➢ Classroom Discussion and Interaction
CONCLUSION
The Route Wizard project successfully demonstrates the
integration of Python, Tkinter, MySQL, and Folium to create
a functional and interactive school transport management
system. Through this project, we were able to implement
features such as user authentication, database management
for students, drivers, buses, routes, and stops, and an
optimized route planning system using distance calculations.
The project provides a user-friendly interface that allows
administrators to manage data efficiently while visualizing bus
routes on an interactive map. The optimization algorithm
ensures that routes are planned efficiently, minimizing travel
distance and time.
Overall, the project highlights the practical application of
programming concepts, database management, and geospatial
visualization in solving real-world problems. This project not
only strengthens technical skills in Python and database
integration but also demonstrates the importance of automation
and optimization in transport logistics.