Bus Management System - Final
Bus Management System - Final
INTRODUCTION
As cities grow, public transportation systems, especially buses, are finding it hard to
keep up with the increasing demand. Traditional bus management methods often lead to
problems like overcrowding, delays, and inefficient use of buses. These issues can frustrate
both passengers and operators.
By using crowdsourced data, bus management systems can be more flexible and
responsive, ensuring buses run when and where they are needed most. This system also
allows passengers to report problems directly, helping operators fix issues quickly. Overall,
crowdsourcing can make bus systems more efficient, reduce waiting times, and provide better
service for everyone.
CHAPTER-2
SYSTEM ANALYSIS
2.1.1Demerits:
1.Data Reliability:
Crowdsourced data depends on passengers sharing accurate information. If
the data is incorrect or incomplete, it can lead to poor decisions in managing the bus system.
2.Privacy Concerns:
Collecting personal data from passengers, such as their location or travel
patterns, can raise privacy issues. People may be concerned about how their information is
used and stored.
3.Technology Dependence:
The system relies on mobile apps or other technology, which may not be
accessible to all passengers, especially older adults or those without smartphones
2.1.2 Merits:
Crowdsourcing allows for real-time input from passengers, providing accurate and
timely information about bus locations, traffic conditions, delays, and passenger counts.
2. Cost-Effectiveness:
Crowdsourced data can help identify patterns in bus usage, pinpoint inefficiencies, and
optimize routes and schedules.
This may result in improved service, shorter wait times, and better coverage of
underserved areas.
Crowdsourced apps or platforms often include features like live bus tracking,
notifications of delays, or availability of seats, which enhance the commuter experience.
HARDWARE REQUIREMENTS:
1) Computer/Laptop
2) Mobile phone
SOFTWARE REQUIREMENTS:
1) Python IDLE
CHAPTER 4
PROJECT DESCRIPTION
4.1Modules:
CHAPTER-5
RESULT DISCUSSION
4.1.1.User/Passenger Module:
App = Flask(__name__)
Conn = get_db()
Cur = conn.cursor()
Cur.execute(“INSERT INTO users (username, password) VALUES (?, ?)”, (username,
hashed_password))
Conn.commit()
Conn.close()
Return redirect(url_for(‘login’))
Return render_template(‘register.html’)
Conn = get_db()
Cur = conn.cursor()
Cur.execute(“SELECT * FROM users WHERE username = ?”, (username,))
User = cur.fetchone()
Return render_template(‘login.html’)
If __name__ == ‘__main__’:
App.run(debug=True)
4.1.2.Admin Module:
Conn = get_db()
Cur = conn.cursor()
Cur.execute(“INSERT INTO routes (route_name, start_point, end_point, schedule)
VALUES (?, ?, ?, ?)”,
(route_name, start_point, end_point, schedule))
Conn.commit()
Conn.close()
Return redirect(url_for(‘admin_dashboard’))
Return render_template(‘add_route.html’)
# Admin dashboard
@app.route(‘/admin_dashboard’)
Def admin_dashboard():
Conn = get_db()
Cur = conn.cursor()
Cur.execute(“SELECT * FROM routes”)
Routes = cur.fetchall()
Conn.close()
Return render_template(‘admin_dashboard.html’, routes=routes)
Conn = get_db()
Cur = conn.cursor()
Cur.execute(“INSERT INTO bookings (route_id, passenger_name, seat_number, fare)
VALUES (?, ?, ?, ?)”,
(route_id, passenger_name, seat_number, fare))
Conn.commit()
Conn.close()
Return redirect(url_for(‘payment’, fare=fare))
Return render_template(‘book_ticket.html’)
# Payment route
@app.route(‘/payment’)
Def payment():
Fare = request.args.get(‘fare’)
Return f”Proceed with the payment of {fare}”
class bus:
Def __init__(self, bus_id, capacity):
Self.bus_id = bus_id
Self.capacity = capacity
Self.booked_seats = 0
Def book_seat(self):
If self.booked_seats self.booked_seats += 1
Print(f”Seat booked successfully on Bus {self.bus_id}.”)
Else:
Print(f”Bus {self.bus_id} is fully booked.”)
Def get_available_seats(self):
Return self.capacity – self.booked_seats
Class Route:
Def __init__(self, route_id, start_point, end_point):
Self.route_id = route_id
Self.start_point = start_point
Self.end_point = end_point
Def display_route(self):
Print(f”Route {self.route_id}: {self.start_point} to {self.end_point}”)
Class Schedule:
Def __init__(self, bus, route, departure_time):
Self.bus = bus
Self.route = route
Self.departure_time = departure_time
Def display_schedule(self):
Print(f”Bus {self.bus.bus_id} is scheduled on Route {self.route.route_id} from
{self.route.start_point} to {self.route.end_point} at {self.departure_time}.”)
Class BusManagementSystem:
Def __init__(self):
Self.buses = []
Self.routes = []
Self.schedules = []
Def display_routes(self):
Print(“Routes:”)
For route in self.routes:
Route.display_route()
Def display_schedules(self):
Print(“Schedules:”)
For schedule in self.schedules:
Schedule.display_schedule()
If __name__ == “__main__”:
System = BusManagementSystem()
System.add_bus(“B101”, 40)
System.add_bus(“B102”, 30)
System.add_route(“R1”, “City A”, “City B”)
System.add_route(“R2”, “City B”, “City C”)
System.create_schedule(“B101”, “R1”, “2024-12-10 08:00”)
System.create_schedule(“B102”, “R2”, “2024-12-10 09:00”)
System.display_
System.display_routes()
System.display_schedules()
System.book_ticket(“B101”)
System.book_ticket(“B101”)
System.book_ticket(“B102”)
System.display_buses()
5.2.SCREENSHOT
CHAPTER 7
BIBLIOGRAPHY