# traffic-forecasting-thesis-group/antroute architecture

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

- Interactive diagram: https://gitdiagram.com/traffic-forecasting-thesis-group/antroute
- Repository: https://github.com/traffic-forecasting-thesis-group/antroute

## Overview

ANTROUTE combines a React Native client with a FastAPI service and traffic-intelligence code. The main user journey is to enter an origin and destinations, request candidate routes, and view route options and comparison metrics. The backend can use a risk-aware graph-routing pipeline when its monitored network data is available, or fall back to placeholder routes and OSRM geometry. The README also describes traffic-data ingestion, text/vision preprocessing, model development, and routing capabilities. Several of those internal links are documented but their runtime orchestration was not sampled, so they are shown only where supported or marked unverified.

Main entry points: [`traffic_system/app/risk_routing.py`](https://github.com/traffic-forecasting-thesis-group/antroute/blob/main/traffic_system/app/risk_routing.py) (Risk routing), [`traffic_system/app/routers/routes.py`](https://github.com/traffic-forecasting-thesis-group/antroute/blob/main/traffic_system/app/routers/routes.py) (Route endpoints), [`traffic_system/src/routing/dynamic_weight.py`](https://github.com/traffic-forecasting-thesis-group/antroute/blob/main/traffic_system/src/routing/dynamic_weight.py) (Dynamic weights), [`frontend/src/navigation/AppNavigator.tsx`](https://github.com/traffic-forecasting-thesis-group/antroute/blob/main/frontend/src/navigation/AppNavigator.tsx) (App navigation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Mobile app"]
  node_app["App shell<br/>[App.js]"]
  node_navigation["App navigation<br/>[AppNavigator.tsx]"]
  node_route_screen["Route planning UI<br/>[HomeScreen.tsx]"]
  node_account_screens["Account screens"]
  node_auth_client["Auth service<br/>[authService.ts]"]
  node_route_client["Route service<br/>[routeService.ts]"]
  node_api_client["HTTP client<br/>[client.ts]"]
end

subgraph group_service["API service"]
  node_route_api["Route endpoints<br/>[routes.py]"]
  node_auth_api["Auth endpoints<br/>[auth.py]"]
  node_places_api["Places endpoints<br/>[places.py]"]
  node_route_engine["Route orchestration<br/>[route_engine.py]"]
  node_database[("Database access<br/>[database.py]")]
end

subgraph group_intelligence["Traffic intelligence"]
  node_risk_router["Risk routing<br/>[risk_routing.py]"]
  node_graph["Road graph<br/>[graph_data.py]"]
  node_weight_engine["Dynamic weights<br/>[dynamic_weight.py]"]
  node_eta["ETA calculation<br/>[eta_engine.py]"]
  node_aco["ACO routing<br/>[aco_routing.py]"]
  node_events["Traffic events<br/>[event_layer.py]"]
  node_models["Traffic models"]
end

subgraph group_data["Data pipelines"]
  node_ingestion["Traffic ingestion"]
  node_vision["CCTV vision pipeline"]
  node_text_prep["Text preprocessing<br/>[nlp_pipeline.py]"]
  node_text_cleaner["Text cleaning<br/>[text_cleaner.py]"]
end

node_traveler(("Traveler"))
node_osrm["OSRM routing"]
node_route_results["Route options"]

node_traveler -->|"opens app"| node_app
node_app -->|"renders"| node_navigation
node_navigation -->|"routes to"| node_route_screen
node_navigation -->|"routes to"| node_account_screens
node_route_screen -->|"requests routes"| node_route_client
node_account_screens -->|"uses auth"| node_auth_client
node_auth_client -->|"sends requests"| node_api_client
node_route_client -->|"sends requests"| node_api_client
node_route_client -->|"posts route plan"| node_route_api
node_route_api -->|"plans routes"| node_route_engine
node_route_api -->|"fetches paths"| node_osrm
node_route_api -->|"returns options"| node_route_results
node_route_engine -->|"tries real routes"| node_risk_router
node_risk_router -->|"loads graph"| node_graph
node_risk_router -->|"builds weighted graph"| node_weight_engine
node_risk_router -.->|"loads travel times"| node_eta
node_risk_router -->|"runs route search"| node_aco
node_risk_router -.->|"loads events"| node_events
node_weight_engine -->|"uses graph"| node_graph
node_eta -->|"scores path"| node_weight_engine
node_aco -->|"evaluates paths"| node_weight_engine
node_auth_api -->|"uses sessions"| node_database
node_places_api -.->|"queries places"| node_database
node_ingestion -.->|"provides road data"| node_graph
node_vision -.->|"supplies visual inputs"| node_models
node_text_prep -.->|"prepares text"| node_text_cleaner
node_text_prep -.->|"generates embeddings"| node_models

click node_app "https://github.com/traffic-forecasting-thesis-group/antroute/blob/main/frontend/App.js"
click node_navigation "https://github.com/traffic-forecasting-thesis-group/antroute/blob/main/frontend/src/navigation/AppNavigator.tsx"
click node_route_screen "https://github.com/traffic-forecasting-thesis-group/antroute/blob/main/frontend/src/screens/HomeScreen.tsx"
click node_account_screens "https://github.com/traffic-forecasting-thesis-group/antroute/tree/main/frontend/src/screens"
click node_auth_client "https://github.com/traffic-forecasting-thesis-group/antroute/blob/main/frontend/src/api/authService.ts"
click node_route_client "https://github.com/traffic-forecasting-thesis-group/antroute/blob/main/frontend/src/api/routeService.ts"
click node_api_client "https://github.com/traffic-forecasting-thesis-group/antroute/blob/main/frontend/src/api/client.ts"
click node_route_api "https://github.com/traffic-forecasting-thesis-group/antroute/blob/main/traffic_system/app/routers/routes.py"
click node_auth_api "https://github.com/traffic-forecasting-thesis-group/antroute/blob/main/traffic_system/app/routers/auth.py"
click node_places_api "https://github.com/traffic-forecasting-thesis-group/antroute/blob/main/traffic_system/app/routers/places.py"
click node_route_engine "https://github.com/traffic-forecasting-thesis-group/antroute/blob/main/traffic_system/app/route_engine.py"
click node_risk_router "https://github.com/traffic-forecasting-thesis-group/antroute/blob/main/traffic_system/app/risk_routing.py"
click node_graph "https://github.com/traffic-forecasting-thesis-group/antroute/blob/main/traffic_system/src/data/graph_data.py"
click node_weight_engine "https://github.com/traffic-forecasting-thesis-group/antroute/blob/main/traffic_system/src/routing/dynamic_weight.py"
click node_eta "https://github.com/traffic-forecasting-thesis-group/antroute/blob/main/traffic_system/src/routing/eta_engine.py"
click node_aco "https://github.com/traffic-forecasting-thesis-group/antroute/blob/main/traffic_system/src/routing/aco_routing.py"
click node_events "https://github.com/traffic-forecasting-thesis-group/antroute/blob/main/traffic_system/src/routing/event_layer.py"
click node_ingestion "https://github.com/traffic-forecasting-thesis-group/antroute/tree/main/traffic_system/src/ingestion"
click node_vision "https://github.com/traffic-forecasting-thesis-group/antroute/tree/main/traffic_system/src/vision"
click node_text_prep "https://github.com/traffic-forecasting-thesis-group/antroute/blob/main/traffic_system/src/preprocessing/nlp_pipeline.py"
click node_text_cleaner "https://github.com/traffic-forecasting-thesis-group/antroute/blob/main/traffic_system/src/preprocessing/text_cleaner.py"
click node_models "https://github.com/traffic-forecasting-thesis-group/antroute/tree/main/traffic_system/src/models"
click node_database "https://github.com/traffic-forecasting-thesis-group/antroute/blob/main/traffic_system/app/database.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_navigation,node_route_screen,node_account_screens,node_auth_client,node_route_client,node_api_client toneBlue
class node_route_api,node_auth_api,node_places_api,node_route_engine,node_database toneAmber
class node_risk_router,node_graph,node_weight_engine,node_eta,node_aco,node_events,node_models,node_route_results toneMint
class node_ingestion,node_vision,node_text_prep,node_text_cleaner toneRose
class node_traveler,node_osrm toneIndigo
```

## Components

### Mobile app

- [App shell](https://github.com/traffic-forecasting-thesis-group/antroute/blob/main/frontend/App.js): `frontend/App.js`
- [App navigation](https://github.com/traffic-forecasting-thesis-group/antroute/blob/main/frontend/src/navigation/AppNavigator.tsx): `frontend/src/navigation/AppNavigator.tsx`
- [Route planning UI](https://github.com/traffic-forecasting-thesis-group/antroute/blob/main/frontend/src/screens/HomeScreen.tsx): `frontend/src/screens/HomeScreen.tsx`
- [Account screens](https://github.com/traffic-forecasting-thesis-group/antroute/tree/main/frontend/src/screens): `frontend/src/screens`
- [Auth service](https://github.com/traffic-forecasting-thesis-group/antroute/blob/main/frontend/src/api/authService.ts): `frontend/src/api/authService.ts`
- [Route service](https://github.com/traffic-forecasting-thesis-group/antroute/blob/main/frontend/src/api/routeService.ts): `frontend/src/api/routeService.ts`
- [HTTP client](https://github.com/traffic-forecasting-thesis-group/antroute/blob/main/frontend/src/api/client.ts): `frontend/src/api/client.ts`

### API service

- [Route endpoints](https://github.com/traffic-forecasting-thesis-group/antroute/blob/main/traffic_system/app/routers/routes.py): `traffic_system/app/routers/routes.py`
- [Auth endpoints](https://github.com/traffic-forecasting-thesis-group/antroute/blob/main/traffic_system/app/routers/auth.py): `traffic_system/app/routers/auth.py`
- [Places endpoints](https://github.com/traffic-forecasting-thesis-group/antroute/blob/main/traffic_system/app/routers/places.py): `traffic_system/app/routers/places.py`
- [Route orchestration](https://github.com/traffic-forecasting-thesis-group/antroute/blob/main/traffic_system/app/route_engine.py): `traffic_system/app/route_engine.py`
- [Database access](https://github.com/traffic-forecasting-thesis-group/antroute/blob/main/traffic_system/app/database.py): `traffic_system/app/database.py`

### Traffic intelligence

- [Risk routing](https://github.com/traffic-forecasting-thesis-group/antroute/blob/main/traffic_system/app/risk_routing.py): `traffic_system/app/risk_routing.py`
- [Road graph](https://github.com/traffic-forecasting-thesis-group/antroute/blob/main/traffic_system/src/data/graph_data.py): `traffic_system/src/data/graph_data.py`
- [Dynamic weights](https://github.com/traffic-forecasting-thesis-group/antroute/blob/main/traffic_system/src/routing/dynamic_weight.py): `traffic_system/src/routing/dynamic_weight.py`
- [ETA calculation](https://github.com/traffic-forecasting-thesis-group/antroute/blob/main/traffic_system/src/routing/eta_engine.py): `traffic_system/src/routing/eta_engine.py`
- [ACO routing](https://github.com/traffic-forecasting-thesis-group/antroute/blob/main/traffic_system/src/routing/aco_routing.py): `traffic_system/src/routing/aco_routing.py`
- [Traffic events](https://github.com/traffic-forecasting-thesis-group/antroute/blob/main/traffic_system/src/routing/event_layer.py): `traffic_system/src/routing/event_layer.py`
- [Traffic models](https://github.com/traffic-forecasting-thesis-group/antroute/tree/main/traffic_system/src/models): `traffic_system/src/models`

### Data pipelines

- [Traffic ingestion](https://github.com/traffic-forecasting-thesis-group/antroute/tree/main/traffic_system/src/ingestion): `traffic_system/src/ingestion`
- [CCTV vision pipeline](https://github.com/traffic-forecasting-thesis-group/antroute/tree/main/traffic_system/src/vision): `traffic_system/src/vision`
- [Text preprocessing](https://github.com/traffic-forecasting-thesis-group/antroute/blob/main/traffic_system/src/preprocessing/nlp_pipeline.py): `traffic_system/src/preprocessing/nlp_pipeline.py`
- [Text cleaning](https://github.com/traffic-forecasting-thesis-group/antroute/blob/main/traffic_system/src/preprocessing/text_cleaner.py): `traffic_system/src/preprocessing/text_cleaner.py`

### Other components

- **Traveler**
- **OSRM routing**
- **Route options**

## Connections

- Traveler → App shell: opens app (evidence: `frontend/App.js`)
- App shell → App navigation: renders (evidence: `frontend/App.js`)
- App navigation → Route planning UI: routes to (evidence: `frontend/src/navigation/AppNavigator.tsx`)
- App navigation → Account screens: routes to (evidence: `frontend/src/navigation/AppNavigator.tsx`)
- Route planning UI → Route service: requests routes (evidence: `frontend/src/screens/HomeScreen.tsx`)
- Account screens → Auth service: uses auth (evidence: `frontend/src/screens/EditProfileScreen.tsx`)
- Auth service → HTTP client: sends requests (evidence: `frontend/src/api/authService.ts`)
- Route service → HTTP client: sends requests (evidence: `frontend/src/api/routeService.ts`)
- Route service → Route endpoints: posts route plan (evidence: `frontend/src/api/routeService.ts`)
- Route endpoints → Route orchestration: plans routes (evidence: `traffic_system/app/routers/routes.py`)
- Route endpoints → OSRM routing: fetches paths (evidence: `traffic_system/app/routers/routes.py`)
- Route endpoints → Route options: returns options (evidence: `traffic_system/app/routers/routes.py`)
- Route orchestration → Risk routing: tries real routes (evidence: `traffic_system/app/route_engine.py`)
- Risk routing → Road graph: loads graph (evidence: `traffic_system/app/risk_routing.py`)
- Risk routing → Dynamic weights: builds weighted graph (evidence: `traffic_system/app/risk_routing.py`)
- Risk routing → ETA calculation: loads travel times (evidence: `traffic_system/app/risk_routing.py`)
- Risk routing → ACO routing: runs route search (evidence: `traffic_system/app/risk_routing.py`)
- Risk routing → Traffic events: loads events (evidence: `traffic_system/app/risk_routing.py`)
- Dynamic weights → Road graph: uses graph (evidence: `traffic_system/src/routing/dynamic_weight.py`)
- ETA calculation → Dynamic weights: scores path (evidence: `traffic_system/src/routing/eta_engine.py`)
- ACO routing → Dynamic weights: evaluates paths (evidence: `traffic_system/src/routing/aco_routing.py`)
- Auth endpoints → Database access: uses sessions (evidence: `traffic_system/app/routers/auth.py`)
- Places endpoints → Database access: queries places
- Traffic ingestion → Road graph: provides road data
- CCTV vision pipeline → Traffic models: supplies visual inputs
- Text preprocessing → Text cleaning: prepares text
- Text preprocessing → Traffic models: generates embeddings
