How soham-darak/opti-pravah works
OPTI-PRAVAH models railway operations, predicts train delays, finds collision-aware reroutes, and presents network and train status to users. The principal workflow runs from a user request through the FastAPI routes to prediction or rerouting logic, then returns analysis for display. Separate capabilities include network topology and timetable views, scenario-based live telemetry, and train simulation. Source excerpts show the API, graph construction, prediction, routing, and simulation internals; the README documents broader UI behavior, while the listed frontend tree does not include the described Next.js application.
Main entry points: router.py API routes · auto_reroute.py Automatic rerouting · graph_builder.py Network graph builder · train_simulator.py Train movement simulation
Components 16
User interface
- Railway dashboard
frontend/app.js
API and operations
- FastAPI server
backend/api/main.py - API routes
backend/api/router.py - Request and response schemas
backend/api/schemas.py - Shared API resources
backend/api/dependencies.py - Railway datasets
backend/data/raw
Railway routing
- Network graph builder
backend/routing/graph_builder.py - Path finding
backend/routing/path_finder.py - Automatic rerouting
backend/routing/auto_reroute.py - Collision checks
backend/routing/collision_checker.py - Route feasibility
backend/routing/feasibility.py
Prediction and simulation
- Hybrid delay prediction
backend/ml/hybrid_engine.py - Delay model training
backend/ml/train_delay_model.py - Trained delay model
backend/data/model/delay_model.pkl - Train movement simulation
backend/simulation/train_simulator.py
Other components
- Railway operator
Connections 19
- Railway operator → Railway dashboard: uses
README.md - Railway dashboard → FastAPI server: requests services
README.md - FastAPI server → API routes: registers routes
backend/api/main.py - API routes → Request and response schemas: validates requests
backend/api/router.py - API routes → Shared API resources: resolves dependencies
backend/api/router.py - Shared API resources → Network graph builder: builds graph
backend/api/dependencies.py - Shared API resources → Hybrid delay prediction: initializes model
backend/api/dependencies.py - Network graph builder → Railway datasets: reads network data
- API routes → Hybrid delay prediction: predicts delay
backend/api/router.py - API routes → Automatic rerouting: requests reroute
backend/api/router.py - Automatic rerouting → Network graph builder: uses graph
backend/routing/auto_reroute.py - Automatic rerouting → Path finding: finds paths
backend/routing/auto_reroute.py - Automatic rerouting → Collision checks: checks occupancy
backend/routing/auto_reroute.py - Automatic rerouting → Route feasibility: checks feasibility
backend/routing/auto_reroute.py - Delay model training → Railway datasets: trains from data
- Delay model training → Trained delay model: saves model
backend/ml/train_delay_model.py - Train movement simulation → Network graph builder: loads graph
backend/simulation/train_simulator.py - Train movement simulation → Path finding: finds routes
backend/simulation/train_simulator.py - Train movement simulation → Collision checks: checks collisions
backend/simulation/train_simulator.py