# amodamrutkar/ride-pooling architecture

> Architecture diagram of the GitHub repository amodamrutkar/ride-pooling, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-09). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/amodamrutkar/ride-pooling
- Repository: https://github.com/amodamrutkar/ride-pooling

## Overview

PoolIQ is a ride-pooling dispatch engine with a React control-room UI. The main workflow accepts ride requests through the API, batches them, assigns routes, independently validates route plans, and computes fair fares and operational state for display. The graph also preserves the documented live route-diff, road-routing, fleet, traffic, and telemetry capabilities. Some links rely on the README or SOURCE INDEX; unsampled implementations and optional integrations are not inferred beyond that evidence.

Main entry points: [`backend/app/world.py`](https://github.com/amodamrutkar/ride-pooling/blob/main/backend/app/world.py) (World Orchestrator), [`frontend/src/App.jsx`](https://github.com/amodamrutkar/ride-pooling/blob/main/frontend/src/App.jsx) (Application Shell), [`frontend/src/pages/PoolScreen.jsx`](https://github.com/amodamrutkar/ride-pooling/blob/main/frontend/src/pages/PoolScreen.jsx) (Live Pool), [`frontend/src/utils/api.js`](https://github.com/amodamrutkar/ride-pooling/blob/main/frontend/src/utils/api.js) (API Client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Control Room"]
  node_app["Application Shell<br/>[App.jsx]"]
  node_pool["Live Pool<br/>[PoolScreen.jsx]"]
  node_route_screen["Corridors<br/>[RoutesScreen.jsx]"]
  node_fleet_screen["Fleet Telemetry<br/>[FleetScreen.jsx]"]
  node_stats["Efficiency Hub<br/>[StatsScreen.jsx]"]
  node_map["Map Rendering<br/>[LeafletMap.jsx]"]
  node_gate_ui["Gate Verification UI<br/>[ZeroTrustGate.jsx]"]
  node_diff_ui["Route Diff UI<br/>[RouteDiffView.jsx]"]
  node_geo_data["Nashik Map Data<br/>[nashikLocations.js]"]
  node_api_client["API Client<br/>[api.js]"]
end

subgraph group_platform["API and State"]
  node_api["REST API<br/>[routes.py]"]
  node_world["World Orchestrator<br/>[world.py]"]
  node_models["Domain Models<br/>[models.py]"]
  node_persistence[("State Persistence<br/>[persistence.py]")]
end

subgraph group_dispatch["Pooling Engine"]
  node_batcher["Sliding Batcher<br/>[sliding_window.py]"]
  node_strategies["Dispatch Strategies"]
  node_optimizer["VRPTW Optimizer<br/>[ortools_vrptw.py]"]
end

subgraph group_operations["Simulation and Routing"]
  node_sim["Simulation Services"]
  node_routing["Road and Matrix Routing"]
  node_eta["ETA and Lateness<br/>[eta_service.py]"]
end

subgraph group_assurance["Verification and Fare"]
  node_validator["Independent Route Gate<br/>[validator.py]"]
  node_gps["GPS Integrity<br/>[gps_verifier.py]"]
  node_pricing["Shapley Fare and Audit<br/>[shapley.py]"]
  node_metrics["Network Metrics<br/>[metrics.py]"]
end

node_rider(("Operator / Rider"))
node_road_service["OSRM Routing"]

node_rider -->|"submits ride"| node_pool
node_app -->|"shows"| node_pool
node_app -->|"shows"| node_route_screen
node_app -->|"shows"| node_fleet_screen
node_app -->|"shows"| node_stats
node_pool -->|"requests API"| node_api_client
node_api_client -->|"calls"| node_api
node_app -->|"polls state"| node_api_client
node_api -->|"routes operations"| node_world
node_world -->|"batches requests"| node_batcher
node_world -->|"runs dispatch"| node_strategies
node_world -.->|"checks routes"| node_validator
node_world -->|"calculates fares"| node_pricing
node_world -->|"computes metrics"| node_metrics
node_world -->|"persists state"| node_persistence
node_world -.->|"advances simulation"| node_sim
node_world -.->|"tracks ETAs"| node_eta
node_world -.->|"verifies positions"| node_gps
node_strategies -->|"polishes routes"| node_optimizer
node_strategies -->|"queries travel costs"| node_routing
node_validator -->|"checks feasibility"| node_routing
node_eta -->|"queries travel times"| node_routing
node_gps -->|"checks distance"| node_routing
node_routing -.->|"gets road routes"| node_road_service
node_pricing -->|"uses ride models"| node_models
node_route_screen -->|"loads corridors"| node_geo_data
node_fleet_screen -->|"renders fleet"| node_map
node_route_screen -->|"renders corridors"| node_map
node_pool -->|"offers verification"| node_gate_ui
node_pool -->|"shows route changes"| node_diff_ui
node_gate_ui -.->|"requests checks"| node_api_client
node_diff_ui -->|"fetches route diff"| node_api_client
node_stats -.->|"displays telemetry"| node_metrics

click node_app "https://github.com/amodamrutkar/ride-pooling/blob/main/frontend/src/App.jsx"
click node_pool "https://github.com/amodamrutkar/ride-pooling/blob/main/frontend/src/pages/PoolScreen.jsx"
click node_route_screen "https://github.com/amodamrutkar/ride-pooling/blob/main/frontend/src/pages/RoutesScreen.jsx"
click node_fleet_screen "https://github.com/amodamrutkar/ride-pooling/blob/main/frontend/src/pages/FleetScreen.jsx"
click node_stats "https://github.com/amodamrutkar/ride-pooling/blob/main/frontend/src/pages/StatsScreen.jsx"
click node_map "https://github.com/amodamrutkar/ride-pooling/blob/main/frontend/src/components/LeafletMap.jsx"
click node_gate_ui "https://github.com/amodamrutkar/ride-pooling/blob/main/frontend/src/components/ZeroTrustGate.jsx"
click node_diff_ui "https://github.com/amodamrutkar/ride-pooling/blob/main/frontend/src/components/RouteDiffView.jsx"
click node_geo_data "https://github.com/amodamrutkar/ride-pooling/blob/main/frontend/src/data/nashikLocations.js"
click node_api_client "https://github.com/amodamrutkar/ride-pooling/blob/main/frontend/src/utils/api.js"
click node_api "https://github.com/amodamrutkar/ride-pooling/blob/main/backend/app/routes.py"
click node_world "https://github.com/amodamrutkar/ride-pooling/blob/main/backend/app/world.py"
click node_models "https://github.com/amodamrutkar/ride-pooling/blob/main/backend/app/models.py"
click node_persistence "https://github.com/amodamrutkar/ride-pooling/blob/main/backend/app/persistence.py"
click node_batcher "https://github.com/amodamrutkar/ride-pooling/blob/main/backend/engine/batching/sliding_window.py"
click node_strategies "https://github.com/amodamrutkar/ride-pooling/tree/main/backend/engine/dispatch"
click node_optimizer "https://github.com/amodamrutkar/ride-pooling/blob/main/backend/engine/optimizer/ortools_vrptw.py"
click node_sim "https://github.com/amodamrutkar/ride-pooling/tree/main/backend/engine/sim"
click node_routing "https://github.com/amodamrutkar/ride-pooling/tree/main/backend/engine/routing"
click node_validator "https://github.com/amodamrutkar/ride-pooling/blob/main/backend/engine/validator/validator.py"
click node_gps "https://github.com/amodamrutkar/ride-pooling/blob/main/backend/engine/integrity/gps_verifier.py"
click node_pricing "https://github.com/amodamrutkar/ride-pooling/blob/main/backend/engine/pricing/shapley.py"
click node_metrics "https://github.com/amodamrutkar/ride-pooling/blob/main/backend/engine/metrics/metrics.py"
click node_eta "https://github.com/amodamrutkar/ride-pooling/blob/main/backend/engine/sim/eta_service.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_app,node_pool,node_route_screen,node_fleet_screen,node_stats,node_map,node_gate_ui,node_diff_ui,node_geo_data,node_api_client toneBlue
class node_api,node_world,node_models,node_persistence toneAmber
class node_batcher,node_strategies,node_optimizer toneMint
class node_sim,node_routing,node_eta toneRose
class node_validator,node_gps,node_pricing,node_metrics,node_rider,node_road_service toneIndigo
```

## Components

### Control Room

- [Application Shell](https://github.com/amodamrutkar/ride-pooling/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Live Pool](https://github.com/amodamrutkar/ride-pooling/blob/main/frontend/src/pages/PoolScreen.jsx): `frontend/src/pages/PoolScreen.jsx`
- [Corridors](https://github.com/amodamrutkar/ride-pooling/blob/main/frontend/src/pages/RoutesScreen.jsx): `frontend/src/pages/RoutesScreen.jsx`
- [Fleet Telemetry](https://github.com/amodamrutkar/ride-pooling/blob/main/frontend/src/pages/FleetScreen.jsx): `frontend/src/pages/FleetScreen.jsx`
- [Efficiency Hub](https://github.com/amodamrutkar/ride-pooling/blob/main/frontend/src/pages/StatsScreen.jsx): `frontend/src/pages/StatsScreen.jsx`
- [Map Rendering](https://github.com/amodamrutkar/ride-pooling/blob/main/frontend/src/components/LeafletMap.jsx): `frontend/src/components/LeafletMap.jsx`
- [Gate Verification UI](https://github.com/amodamrutkar/ride-pooling/blob/main/frontend/src/components/ZeroTrustGate.jsx): `frontend/src/components/ZeroTrustGate.jsx`
- [Route Diff UI](https://github.com/amodamrutkar/ride-pooling/blob/main/frontend/src/components/RouteDiffView.jsx): `frontend/src/components/RouteDiffView.jsx`
- [Nashik Map Data](https://github.com/amodamrutkar/ride-pooling/blob/main/frontend/src/data/nashikLocations.js): `frontend/src/data/nashikLocations.js`
- [API Client](https://github.com/amodamrutkar/ride-pooling/blob/main/frontend/src/utils/api.js): `frontend/src/utils/api.js`

### API and State

- [REST API](https://github.com/amodamrutkar/ride-pooling/blob/main/backend/app/routes.py): `backend/app/routes.py`
- [World Orchestrator](https://github.com/amodamrutkar/ride-pooling/blob/main/backend/app/world.py): `backend/app/world.py`
- [Domain Models](https://github.com/amodamrutkar/ride-pooling/blob/main/backend/app/models.py): `backend/app/models.py`
- [State Persistence](https://github.com/amodamrutkar/ride-pooling/blob/main/backend/app/persistence.py): `backend/app/persistence.py`

### Pooling Engine

- [Sliding Batcher](https://github.com/amodamrutkar/ride-pooling/blob/main/backend/engine/batching/sliding_window.py): `backend/engine/batching/sliding_window.py`
- [Dispatch Strategies](https://github.com/amodamrutkar/ride-pooling/tree/main/backend/engine/dispatch): `backend/engine/dispatch`
- [VRPTW Optimizer](https://github.com/amodamrutkar/ride-pooling/blob/main/backend/engine/optimizer/ortools_vrptw.py): `backend/engine/optimizer/ortools_vrptw.py`

### Simulation and Routing

- [Simulation Services](https://github.com/amodamrutkar/ride-pooling/tree/main/backend/engine/sim): `backend/engine/sim`
- [Road and Matrix Routing](https://github.com/amodamrutkar/ride-pooling/tree/main/backend/engine/routing): `backend/engine/routing`
- [ETA and Lateness](https://github.com/amodamrutkar/ride-pooling/blob/main/backend/engine/sim/eta_service.py): `backend/engine/sim/eta_service.py`

### Verification and Fare

- [Independent Route Gate](https://github.com/amodamrutkar/ride-pooling/blob/main/backend/engine/validator/validator.py): `backend/engine/validator/validator.py`
- [GPS Integrity](https://github.com/amodamrutkar/ride-pooling/blob/main/backend/engine/integrity/gps_verifier.py): `backend/engine/integrity/gps_verifier.py`
- [Shapley Fare and Audit](https://github.com/amodamrutkar/ride-pooling/blob/main/backend/engine/pricing/shapley.py): `backend/engine/pricing/shapley.py`
- [Network Metrics](https://github.com/amodamrutkar/ride-pooling/blob/main/backend/engine/metrics/metrics.py): `backend/engine/metrics/metrics.py`

### Other components

- **Operator / Rider**
- **OSRM Routing**

## Connections

- Operator / Rider → Live Pool: submits ride
- Application Shell → Live Pool: shows (evidence: `frontend/src/App.jsx`)
- Application Shell → Corridors: shows (evidence: `frontend/src/App.jsx`)
- Application Shell → Fleet Telemetry: shows (evidence: `frontend/src/App.jsx`)
- Application Shell → Efficiency Hub: shows (evidence: `frontend/src/App.jsx`)
- Live Pool → API Client: requests API (evidence: `frontend/src/pages/PoolScreen.jsx`)
- API Client → REST API: calls (evidence: `frontend/src/utils/api.js`)
- Application Shell → API Client: polls state (evidence: `frontend/src/App.jsx`)
- REST API → World Orchestrator: routes operations (evidence: `backend/app/routes.py`)
- World Orchestrator → Sliding Batcher: batches requests (evidence: `backend/app/world.py`)
- World Orchestrator → Dispatch Strategies: runs dispatch (evidence: `backend/app/world.py`)
- World Orchestrator → Independent Route Gate: checks routes (evidence: `backend/app/world.py`)
- World Orchestrator → Shapley Fare and Audit: calculates fares (evidence: `backend/app/world.py`)
- World Orchestrator → Network Metrics: computes metrics (evidence: `backend/app/world.py`)
- World Orchestrator → State Persistence: persists state (evidence: `backend/app/world.py`)
- World Orchestrator → Simulation Services: advances simulation (evidence: `backend/app/world.py`)
- World Orchestrator → ETA and Lateness: tracks ETAs (evidence: `backend/app/world.py`)
- World Orchestrator → GPS Integrity: verifies positions (evidence: `backend/app/world.py`)
- Dispatch Strategies → VRPTW Optimizer: polishes routes (evidence: `backend/engine/dispatch/hybrid.py`)
- Dispatch Strategies → Road and Matrix Routing: queries travel costs (evidence: `backend/engine/dispatch/__init__.py`)
- Independent Route Gate → Road and Matrix Routing: checks feasibility (evidence: `backend/engine/validator/validator.py`)
- ETA and Lateness → Road and Matrix Routing: queries travel times (evidence: `backend/engine/sim/eta_service.py`)
- GPS Integrity → Road and Matrix Routing: checks distance (evidence: `backend/engine/integrity/gps_verifier.py`)
- Road and Matrix Routing → OSRM Routing: gets road routes
- Shapley Fare and Audit → Domain Models: uses ride models (evidence: `backend/engine/pricing/shapley.py`)
- Corridors → Nashik Map Data: loads corridors (evidence: `frontend/src/pages/RoutesScreen.jsx`)
- Fleet Telemetry → Map Rendering: renders fleet (evidence: `frontend/src/pages/FleetScreen.jsx`)
- Corridors → Map Rendering: renders corridors (evidence: `frontend/src/pages/RoutesScreen.jsx`)
- Live Pool → Gate Verification UI: offers verification (evidence: `frontend/src/pages/PoolScreen.jsx`)
- Live Pool → Route Diff UI: shows route changes (evidence: `frontend/src/pages/PoolScreen.jsx`)
- Gate Verification UI → API Client: requests checks
- Route Diff UI → API Client: fetches route diff (evidence: `frontend/src/components/RouteDiffView.jsx`)
- Efficiency Hub → Network Metrics: displays telemetry
