The Cab Management System is a comprehensive solution designed to manage cabs, bookings, and cities efficiently. This system includes functionalities to register and update cabs, handle bookings, manage city data, and perform various analytics. The system is implemented in Python and leverages a modular structure to ensure clean, maintainable, and extensible code.
- Register new cabs: Easily register new cabs with unique IDs and assign them to cities.
- Update existing cabs' state and city: Change the state (e.g., IDLE, ON_TRIP) of a cab and reassign it to different cities.
- View booking history of cabs: Access the complete booking history of individual cabs.
- View state change history of cabs: Track the state changes of cabs over time.
- Book a cab in a specified city: Reserve a cab for a trip within a specific city.
- End a trip and make the cab available: Conclude a trip and make the cab available for future bookings.
- Add new cities: Introduce new cities into the system where cabs can be registered and operate.
- View all cabs in a city: List all the cabs currently available in a specified city.
- View cabs in a city by their state: Filter and view cabs based on their state (e.g., IDLE, ON_TRIP) within a city.
- Remove cities: Remove cities from the system, provided they do not have any associated cabs.
- Calculate total idle time of a cab in a given duration: Compute the total idle time for a cab within a specified time range.
- View the state change history of cabs: Access the history of state changes for individual cabs.
- Identify cities with the highest demand for cabs and peak times: Analyze and determine high-demand cities and peak booking times.
- Clone the repository:
git clone <repository-url>
- Navigate to the project directory:
cd cab-management - Install the required dependencies (if any). You can use a package manager like
pipto install dependencies listed in arequirements.txtfile, if available:pip install -r requirements.txt
- Run the main application:
python src/cab_management/main.py
- Follow the on-screen menu to navigate through the various functionalities. The menu will provide options for cab management, booking management, city management, and analytics.
- To load initial data, select the option to load data from a JSON file. Ensure that the file structure matches the expected format for cities, cabs, and bookings.
- Initial Data Loading: Initial data can be loaded from a JSON file. Ensure the file structure matches the expected format for cities, cabs, and bookings. The application will prompt you to enter the path to the JSON file when you choose to load initial data.
- Make sure to have Python installed on your machine. The application is compatible with Python 3.x.
- For any issues or contributions, please refer to the project's issue tracker on the repository.
cab-management/
│
├── data/
│ ├── initial_data.json
│ └── input.json
│
├── src/
│ ├── cab_management/
│ │ ├── __init__.py
│ │ ├── analytics.py
│ │ ├── booking_manager.py
│ │ ├── booking.py
│ │ ├── cab_manager.py
│ │ ├── cab.py
│ │ ├── city_manager.py
│ │ ├── city.py
│ │ ├── utils.py
│ │ └── main.py
│
├── tests/
│ ├── __init__.py
│ ├── test_analytics.py
│ ├── test_booking_manager.py
│ ├── test_booking.py
│ ├── test_cab_manager.py
│ ├── test_cab.py
│ ├── test_city_manager.py
│ ├── test_city.py
│ └── test_utils.py
│
├── .gitignore
└── README.md
The main entry point for running the cab management portal. It initializes the managers and provides a user interface for interacting with the system.
Defines the Cab class which represents a cab and handles its state, city, booking history, and state change history.
Manages the operations related to cabs, including registration, updates, and fetching cabs.
Manages city-related operations, including adding, removing, and fetching cabs by city.
Handles booking-related operations, including creating and ending bookings.
Provides analytical functions such as calculating idle times, tracking state changes, and identifying high-demand cities.
Utility functions for tasks such as loading initial data from JSON files.
-
Register a Cab:
- Register a cab with ID 101 in city with ID 1:
python src/cab_management/main.py
- Choose the cab management menu, then choose to register a cab. Enter 101 as the cab ID and 1 as the city ID.
- Register a cab with ID 101 in city with ID 1:
-
Book a Cab:
- Book a cab in city with ID 1:
python src/cab_management/main.py
- Choose the booking management menu, then choose to book a cab. Enter 1 as the city ID.
- Book a cab in city with ID 1:
-
View Analytics:
- View cab idle time:
python src/cab_management/main.py
- Choose the analytics menu, then choose to show cab idle time. Enter the cab ID and the time range.
- View cab idle time:
Contributions are welcome! Please create a pull request with a detailed description of your changes.
For any issues, please open an issue on the project's GitHub repository.