This repository provides two powerful tools for visualizing and analyzing train seat availability in Bangladesh.
-
Segmented Seat Matrix
Visualize and analyze train seat matrices for different seat types on specific train routes in Bangladesh. It features scripts that fetch seat availability from a public API and construct segmented travel routes when direct routes are not available. This tool offers detailed seat information, including VAT. -
Detailed Seat Availability
Fetches and categorizes seat layouts intoAvailable
orIn Booking Process
groups, organizes seat numbers by prefixes for clarity, and uses color-coded output for enhanced readability.
- Real-Time Data Fetching: Retrieves seat availability for different train routes and seat types.
- Seat Matrix Display: Presents seat matrices for each seat type in a tabular format.
- Segmented Route Finder: Calculates and displays alternative travel paths if a direct route is unavailable.
- Mixed Seat-Type Fallback: Automatically finds a mixed seat-type segmented route when no full same-type route is available.
- Detailed Fare Breakdown: Shows base fare, VAT, service charges, and bedding charges (for specific seat types) for direct and segmented routes.
- Interactive User Interface: Menu-driven prompts for ease of use.
Below is an example of the script running in the terminal:
- Clone the repository:
git clone https://github.com/nishatrhythm/Bangladesh-Railway-Segmented-Seat-Matrix-and-Details-Seat-Availabilty.git cd Bangladesh-Railway-Segmented-Seat-Matrix-and-Details-Seat-Availabilty
- Install required Python packages: Ensure you have the required Python packages installed:
pip install requests tabulate colorama
-
Modify the script:
- You need to update the
target_train_model
anddate_of_journey
variables in theseatMatrixWithSegmentation.py
script to match your desired train model and date.
target_train_model = "781" # This can be set to match the desired train model date_of_journey = "15-Nov-2024" # This can be modified as needed
- You need to update the
-
Run the script:
python seatMatrixWithSegmentation.py
-
Menu Options:
- Select 1 to check seat availability and enter origin and destination stations.
- Select 2 to exit the program.
-
Output Details:
- Displays seat matrices for each seat type if seats are available.
- Shows direct routes with a breakdown of base fare and VAT.
- Finds and displays segmented routes if a direct route is not available.
- Displays mixed seat-type segmented routes as fallback when same-type routes are not available.
- Clearly highlights segment dates when journey spans multiple days.
Enter the origin station: Dhaka
Enter the destination station: Cox's Bazar
Finding segmented route for seat type: AC_B
Direct route available for seat type AC_B from Dhaka to Cox's Bazar.
Base Fare: 2069 | VAT: 311 | Charge: 20 | Bedding: 50
Total Fare: 2450
Finding segmented route for seat type: SNIGDHA
Segmented route found for seat type SNIGDHA:
- Dhaka to Chattogram (starts from Dhaka on 18-May-2025)
Base Fare: 743 | VAT: 112 | Charge: 20 | Total: 875
- Chattogram to Cox's Bazar (starts from Chattogram on 19-May-2025)
Base Fare: 408 | VAT: 62 | Charge: 20 | Total: 490
Total Fare: 1365
- Detailed Seat Layout: Fetches and displays the seat layout, categorizing seats as available or in the booking process.
- Grouped Seat Information: Groups seat numbers by their prefixes for better clarity.
- Color-Coded Output: Utilizes colorama to color-code the output for enhanced readability.
Below is an example of the script running in the terminal:
Ensure you have the following Python packages installed:
pip install requests tabulate colorama
-
Configure the Script:
Update the following variables in the
detailsSeatAvailability.py
script:TOKEN = 'your_token_here' # Replace with your authorization token CONFIG = { 'from_city': 'Dhaka', # Set the origin city 'to_city': 'Joydebpur', # Set the destination city 'date_of_journey': '03-Dec-2024', # Set the date of journey 'seat_class': 'S_CHAIR' # No need to change this }
-
Run the Script:
python detailsSeatAvailability.py
-
Output Details:
- Train Details: Displays train name, departure, and arrival times for the selected route.
- Seat Availability: Categorized by seat type, with seats grouped by prefixes for better organization.
- Color-Coded Table: Indicates available seats and those in the booking process with visual distinctions for easy comprehension.
TISTA EXPRESS (707) (03 Dec, 07:30 am - 03 Dec, 08:19 am) (Dhaka - Joydebpur)
================================================================================
Seat Type: SNIGDHA
Available Tickets: 0 ticket | In Booking Process: 2 tickets
+-------------------------------------+----------------+
| Status | Seat Numbers |
+=====================================+================+
| In Booking Process (JA) - 2 tickets | JA-4, JA-19 |
+-------------------------------------+----------------+
Seat Type: S_CHAIR
Available Tickets: 19 tickets | In Booking Process: 2 tickets
+--------------------------------------+-------------------------------------------------+
| Status | Seat Numbers |
+======================================+=================================================+
| Available (THA) - 19 tickets | THA-4, THA-6, THA-10, THA-12, THA-14, THA-17, |
| | THA-18, THA-20, THA-23, THA-31, THA-32, THA-30, |
| | THA-29, THA-34, THA-36, THA-35, THA-39, THA-40, |
| | THA-38 |
+--------------------------------------+-------------------------------------------------+
| In Booking Process (NEO) - 2 tickets | NEO-55, NEO-56 |
+--------------------------------------+-------------------------------------------------+
No seat details available for seat type: AC_S