Skip to content

arasghorbani9090-web/historical-traffic-routing

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Historical Traffic Routing Platform

🛰 Historical Traffic Routing Platform

Time-aware routing & simulation over real road networks.

What was the fastest route at 8:15 AM last Tuesday? This platform answers questions a live router can't.

Status FastAPI Python OpenStreetMap

Public portfolio repository. Architecture, design, and roadmap are open; core implementation is private. Code walkthrough available under NDA — arasghorbani9090@gmail.com.


📖 Overview

Most routing engines answer one question: "What's the fastest way right now?" But planners, researchers, and logistics teams need a different one: "What did traffic actually do over time, and how would different routes have performed?"

The Historical Traffic Routing Platform layers time onto routing. It replays historical road-network conditions through an OSRM engine built on OpenStreetMap, so you can compute routes as they would have been at any point in a time series — then simulate, compare, and analyze them at scale.

Use cases

  • 📊 Traffic analysis — quantify congestion patterns across hours, days, and corridors.
  • 🚚 Fleet & logistics planning — evaluate routing strategies against real historical conditions.
  • 🧪 Routing research — A/B route policies on reproducible, time-stamped network states.

✨ Features

  • Historical routing — compute routes against road-network conditions at a chosen timestamp, not just live state.
  • 🔁 Simulation framework — replay journeys across time windows to study how route choice and travel time evolve.
  • 🗺 OSM-native — built directly on OpenStreetMap data, so coverage extends anywhere OSM does.
  • 🚀 OSRM core — fast shortest-path computation over contracted road graphs.
  • 🌐 Clean FastAPI service — typed, documented HTTP API with automatic OpenAPI docs.
  • 📈 Analysis outputs — structured route + timing data ready for notebooks and dashboards.

🏗 Architecture

flowchart LR
    subgraph Client["Clients"]
        NB["Notebooks / Analysis"]
        APP["Apps / Dashboards"]
    end

    subgraph API["⚡ FastAPI Service"]
        ROUTES["/route /simulate /analyze"]
        VALID["Request validation (Pydantic)"]
        SIM["Simulation orchestrator"]
    end

    subgraph Engine["🧭 Routing Engine"]
        OSRM["OSRM backend"]
        GRAPH["Contracted road graph"]
    end

    subgraph DataLayer["🗄 Data"]
        OSM[("OpenStreetMap extracts")]
        HIST[("Historical traffic time series")]
    end

    NB --> ROUTES
    APP --> ROUTES
    ROUTES --> VALID --> SIM
    SIM --> OSRM
    OSRM --> GRAPH
    GRAPH --> OSM
    SIM -. weight by time .-> HIST
Loading

Simulation flow

sequenceDiagram
    participant U as Analyst
    participant API as FastAPI
    participant SIM as Simulator
    participant OSRM as OSRM
    participant H as Historical store

    U->>API: POST /simulate {origin, dest, time window}
    loop each timestep
        API->>SIM: advance(t)
        SIM->>H: conditions at t
        H-->>SIM: edge weights
        SIM->>OSRM: route with weights(t)
        OSRM-->>SIM: path + duration
    end
    SIM-->>API: time series of routes
    API-->>U: comparative analysis
Loading

🧱 Tech Stack

Layer Technology
API FastAPI, Pydantic, Uvicorn
Routing OSRM (Open Source Routing Machine)
Map data OpenStreetMap extracts
Language Python 3.11+
Analysis NumPy / Pandas-friendly structured outputs
Packaging Docker (OSRM + service)

📂 Folder Structure

Representative — illustrative of organization, not a source dump.

historical-traffic-routing/
├── app/
│   ├── api/                # FastAPI routers: route, simulate, analyze
│   ├── core/               # config, settings
│   ├── routing/            # OSRM client + graph weighting
│   ├── simulation/         # time-stepped replay engine
│   └── schemas/            # Pydantic request/response models
├── data/
│   ├── osm/                # OpenStreetMap extracts & build artifacts
│   └── historical/         # time-series traffic conditions
├── notebooks/              # analysis & validation
└── docker/                 # OSRM + service compose

🖼 Screenshots

Placeholders — add captures to docs/screenshots/.

Route over time Congestion heatmap API docs
Routes Heatmap Docs

🗺 Roadmap

  • OSRM + OSM routing core
  • FastAPI service with typed endpoints
  • Time-stepped simulation framework
  • Historical condition ingestion pipeline (batch + streaming)
  • Corridor-level congestion analytics
  • Scenario comparison API (policy A vs B)
  • Caching layer for repeated time-window queries
  • Hosted demo + sample datasets

📈 Development Status

🟡 Active R&D — routing core and simulation framework are functional; current work is on historical-data ingestion and analytics surfaces.


🤝 Contact

📧 arasghorbani9090@gmail.com · 🔗 LinkedIn

Public architecture & docs. Implementation is proprietary.

Source Code

The production source code is maintained in a private repository. The portfolio repository demonstrates the architecture, features, and technical design. Source code can be shared for employment or collaboration opportunities under appropriate confidentiality terms.

About

Time-aware routing and simulation over real road networks - replay historical conditions with OSRM and OpenStreetMap. FastAPI, Python.

Topics

Resources

Contributing

Stars

Watchers

Forks

Releases

Packages

Contributors