Academic Year: 2021/2022 | 1st Semester | 1st Year
LyftIUL is a command-line application developed in Python that simulates a carpooling management platform for students at ISCTE-IUL. It allows users, acting as either Drivers or Riders, to manage their profiles, vehicles, and trips, facilitating ride-sharing between their homes and the university. The entire system is built on object-oriented principles.
The main goal of this project was to apply object-oriented programming concepts to develop a robust, class-based system in Python capable of:
- 👤 Managing user and vehicle registrations.
- 🗺️ Scheduling and managing individual trips.
- 🤝 Handling passenger sign-ups for available rides.
- 📊 Providing key system statistics and activity analysis.
This was an individual project developed for the Programação (Programming) course in the Licenciatura em Ciência de Dados (Bachelor Degree in Data Science) at ISCTE-IUL. The project was designed to demonstrate proficiency in Python programming, object-oriented design, and basic data structures, since it was the first time we programmed in this course.
The platform is built around four main classes that model the real-world concepts of the carpooling system:
👤 User
: Represents an ISCTE student. Key attributes include a unique student number, name, address, and contact information. A user can be a Driver or a Rider.🚗 Vehicle
: Represents a car owned by a Driver. Attributes include license plate, description, number of seats, and a counter for trips made.🗺️ Trip
: Represents a scheduled journey. It links aVehicle
to a specific date/time, route, number of available seats, and a list of registered passengers.⚙️ Manager
: The central class that orchestrates the entire system. It holds lists of all users, vehicles, and active trips, providing methods to manage the platform's operations.
This project was developed entirely in Python, using standard libraries and a few key packages for data analysis and visualization.
The project was structured into five main implementation tasks (T1
to T5
), each focusing on a specific aspect of the system:
-
Task 1: User and Vehicle Classes (
T1
)- Implemented the
Utilizador
(User) andViatura
(Vehicle) classes with all required attributes (e.g., student number, address, license plate) and methods (e.g., getters, setters,add_new_trip
). Ensured data integrity, such as making the student number immutable after creation.
- Implemented the
-
Task 2: Trip Class (
T2
)- Developed the
Viagem
(Trip) class to manage individual journeys. This included properties to check if a trip is still active (ativa
), calculate available seats (boleias_disponiveis
), and methods to add passengers, preventing overbooking.
- Developed the
-
Task 3: Manager Class (
T3
)- Created the central
Gestor
(Manager) class to act as the system's brain. This class is responsible for managing lists of users, vehicles, and trips, preventing duplicates (e.g., users with the same number), and providing core system functionalities like listing entities, adding new trips, and cleaning up completed trips by archiving them to a.csv
file.
- Created the central
-
Task 4: Main Program & CLI (
T4
)- Built a user-friendly, menu-driven command-line interface (CLI) to allow interaction with the system. The program runs in a loop, enabling users to perform operations like listing users, registering trips, and signing up for rides until they choose to exit.
-
Task 5: Statistical Analysis (
T5
)- Implemented a feature to analyze the trip history from the
historico.csv
file. This involved:- Reading the historical data.
- Creating a NumPy matrix to aggregate the number of trips and rides per hour of the day.
- Visualizing this data with a Matplotlib plot to show peak activity hours.
- Calculating and displaying key metrics like average trips per hour and the busiest hour for rides.
- Implemented a feature to analyze the trip history from the
To run this application, follow these steps:
-
Prerequisites:
- Ensure you have Python 3.x installed.
- Install the required libraries:
pip install numpy matplotlib
-
Execution:
- Navigate to the project's root directory in your terminal.
- Run the main script:
python ProjetoProgramação_AndréSilvestre_CDA1_Nº104532.py
(Note: Replace
ProjetoProgramação_AndréSilvestre_CDA1_Nº104532.py
with the actual name of your main executable script.) -
Interaction:
- The program will display a menu of options. Enter the number corresponding to the action you wish to perform.
This project was developed using Portuguese from Portugal 🇵🇹.