A comprehensive Python-based interactive dashboard for simulating the Bangalore Metro system with route planning, fare calculation, and admin management features.
- Visual representation of Green Line & Purple Line
- All stations with interchange points (Majestic)
- Interactive station selection
- Real-time route highlighting
- Automatic fare calculation based on distance
- Pricing: ₹10 for first 2 stations, ₹2 per additional station
- Displays:
- Total fare
- Number of stops
- Estimated travel time (45 seconds per station)
- Animated train movement along selected route
- Station-by-station breakdown
- Interchange station indicators
- Journey progress visualization
- Add/Edit/Delete stations
- Update fare rules dynamically
- View system analytics
- Manage metro lines
- Export/Import station data
- Most popular routes
- Revenue tracking
- Peak hours analysis
- User journey statistics
P4/
├── app.py # Main Streamlit application
├── metro_logic.py # Route finding & fare calculation (BFS)
├── admin.py # Admin control panel
├── data/
│ └── stations.json # Station data (Green & Purple Lines)
├── pages/
│ ├── 1_Passenger_Portal.py # Basic passenger interface
│ ├── 2_Admin_Dashboard.py # Database admin interface
│ └── 8_Enhanced_Passenger_Portal.py # Interactive route planner
├── utils/
│ ├── authentication.py # User authentication
│ ├── helpers.py # Utility functions
│ └── query_helper.py # Database queries
├── database/
│ ├── database_setup.py # Database initialization
│ ├── unified_connector.py # Database connector
│ └── metro.db # SQLite database
├── requirements.txt # Python dependencies
└── README.md # This file
- Python 3.8 or higher
- pip (Python package manager)
-
Navigate to the project folder:
cd P4 -
Install dependencies:
pip install -r requirements.txt
-
Run the application:
streamlit run app.py
-
Access the dashboard:
- Open your browser to
http://localhost:8501 - Default admin credentials:
- Username:
admin - Password:
admin123
- Username:
- Open your browser to
- Login with your credentials (or register a new account)
- Navigate to "Enhanced Passenger Portal" from the sidebar
- Select Route:
- Choose source station (e.g., "Yelachenahalli")
- Choose destination station (e.g., "MG Road")
- View Route Details:
- Number of stops
- Total fare
- Estimated travel time
- Lines used
- Watch Live Preview: See animated train movement
- Book Ticket: Confirm and book your journey
- Login with admin credentials
- Navigate to "Admin Dashboard" or run
streamlit run admin.py - Manage Stations:
- Add new stations with coordinates
- Edit existing stations
- Delete stations
- Update Fare Rules:
- Modify base fare
- Change per-station pricing
- Update travel time settings
- View Analytics:
- Popular routes
- Revenue statistics
- Peak hours data
The system uses a simple, transparent fare structure:
if stops <= 2:
fare = ₹10
else:
fare = ₹10 + (stops - 2) × ₹2Examples:
- 1-2 stops: ₹10
- 3 stops: ₹12
- 5 stops: ₹16
- 8 stops: ₹22
- 10 stops: ₹26
- Route: Nagasandra → Yelachenahalli
- Stations: 24
- Color: #00A651
- Route: Challaghatta → Mahalakshmi
- Stations: 18
- Color: #8B008B
- Majestic: Connects Green and Purple Lines
- Algorithm: Breadth-First Search (BFS)
- Time Complexity: O(V + E) where V = stations, E = connections
- Guarantees: Shortest path by number of stops
- Format: JSON for station data
- Database: SQLite for user/ticket management
- Backup: Automatic database backups
- Frontend: Streamlit (Python)
- Backend: Python 3.8+
- Database: SQLite / MySQL (configurable)
- Data Format: JSON
- Algorithms: BFS for pathfinding
- Stops: 8
- Fare: ₹22
- Time: ~6 minutes
- Route: Green Line → Purple Line (via Majestic)
- Stops: 15
- Fare: ₹36
- Time: ~11 minutes
- Route: Green Line → Purple Line (via Majestic)
- Stops: 3
- Fare: ₹12
- Time: ~2 minutes
- Route: Purple Line only
- Purple and green color palette
- Clean, modern interface
- Responsive layout
- Intuitive navigation
- Dropdown station selectors
- Animated route preview
- Progress bars for journey simulation
- Real-time fare calculation
- One-click booking
- Journey history tracking
- Achievement system
- Helpful travel tips
- User authentication system
- Role-based access control (Admin/Passenger)
- Password protection
- Session management
- Real-time train tracking
- Mobile app integration
- QR code ticket generation
- Payment gateway integration
- Multi-language support
- Accessibility features
- Route optimization with time preferences
- Integration with Google Maps
- Push notifications for delays
- Loyalty rewards program
Solution: Install dependencies
pip install -r requirements.txtSolution: Initialize database
python database/database_setup.pySolution: Use a different port
streamlit run app.py --server.port 8502Edit database/db_config.py to switch between SQLite and MySQL:
USE_MYSQL = False # Set to True for MySQLEdit .streamlit/config.toml for custom settings:
[theme]
primaryColor = "#8B008B"
backgroundColor = "#FFFFFF"
secondaryBackgroundColor = "#F0F2F6"Contributions are welcome! Please follow these steps:
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
This project is for educational and demonstration purposes.
- Developer: Bangalore Metro Simulation Team
- Data Source: Bangalore Metro Rail Corporation (BMRCL)
- Framework: Streamlit
For issues or questions:
- Check the troubleshooting section
- Review the code documentation
- Contact the development team
Current Version: 1.0.0 Last Updated: November 13, 2025
🚇 Bangalore Metro Simulation Dashboard - Your Smart Travel Companion
Made with ❤️ using Python & Streamlit