# tinashe2023/ner-logistics-intelligence architecture

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

- Interactive diagram: https://gitdiagram.com/tinashe2023/ner-logistics-intelligence
- Repository: https://github.com/tinashe2023/ner-logistics-intelligence

## Overview

The repository is an early-stage logistics intelligence platform: it presents corridor risk and compares risk-aware routes, while supporting driver incident reports and dispatcher review. The main route-request path is visible in the sampled React app and FastAPI routes. README capabilities also include environmental risk inputs and incident-driven network updates. Some feature-processing and admin modules are represented by their exact tree paths, but their internal wiring was not sampled, so uncertain links are omitted.

Main entry points: [`backend/app/api/routes.py`](https://github.com/tinashe2023/ner-logistics-intelligence/blob/main/backend/app/api/routes.py) (Intelligence API), [`frontend/src/App.jsx`](https://github.com/tinashe2023/ner-logistics-intelligence/blob/main/frontend/src/App.jsx) (Dashboard app), [`php-admin/public/incidents.php`](https://github.com/tinashe2023/ner-logistics-intelligence/blob/main/php-admin/public/incidents.php) (Dispatcher admin), [`frontend/src/api.js`](https://github.com/tinashe2023/ner-logistics-intelligence/blob/main/frontend/src/api.js) (API client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_dashboard["Route dashboard"]
  node_app["Dashboard app<br/>[App.jsx]"]
  node_controls["Route controls<br/>[ControlPanel.jsx]"]
  node_map["Risk map<br/>[RiskMap.jsx]"]
  node_client["API client<br/>[api.js]"]
end

subgraph group_backend["Routing intelligence"]
  node_api["Intelligence API<br/>[routes.py]"]
  node_entry["API entrypoint<br/>[main.py]"]
  node_risk["Risk scoring<br/>[risk_score.py]"]
  node_router["Risk-aware router"]
  node_graph["Graph loader<br/>[graph_loader.py]"]
  node_featurejobs["Feature processing"]
end

subgraph group_incidents["Incident operations"]
  node_admin["Dispatcher admin<br/>[incidents.php]"]
  node_auth["Admin authentication<br/>[auth.php]"]
  node_incidentmodel["Incident records<br/>[incident.py]"]
end

subgraph group_state["Network data"]
  node_dbconfig["Database access<br/>[database.py]"]
  node_incidentdb[("Incident store")]
  node_networkdata["Road and incident data"]
end

node_dispatcher(("Dispatcher"))
node_driver(("Driver"))

node_driver -->|"uses dashboard"| node_app
node_dispatcher -->|"reviews reports"| node_admin
node_app -->|"requests data"| node_client
node_app -->|"renders controls"| node_controls
node_app -->|"renders map"| node_map
node_client -->|"calls API"| node_api
node_entry -->|"mounts routes"| node_api
node_api -->|"loads graph"| node_graph
node_api -->|"computes route"| node_router
node_api -->|"opens session"| node_dbconfig
node_dbconfig -->|"connects"| node_incidentdb
node_api -->|"queries records"| node_incidentmodel
node_incidentmodel -->|"maps table"| node_incidentdb
node_api -->|"bumps nearby risk"| node_graph
node_admin -->|"checks login"| node_auth
node_admin -.->|"reads and updates"| node_incidentdb
node_featurejobs -.->|"processes features"| node_networkdata
node_risk -.->|"scores inform cost"| node_router

click node_app "https://github.com/tinashe2023/ner-logistics-intelligence/blob/main/frontend/src/App.jsx"
click node_controls "https://github.com/tinashe2023/ner-logistics-intelligence/blob/main/frontend/src/components/ControlPanel.jsx"
click node_map "https://github.com/tinashe2023/ner-logistics-intelligence/blob/main/frontend/src/components/RiskMap.jsx"
click node_client "https://github.com/tinashe2023/ner-logistics-intelligence/blob/main/frontend/src/api.js"
click node_api "https://github.com/tinashe2023/ner-logistics-intelligence/blob/main/backend/app/api/routes.py"
click node_entry "https://github.com/tinashe2023/ner-logistics-intelligence/blob/main/backend/app/main.py"
click node_risk "https://github.com/tinashe2023/ner-logistics-intelligence/blob/main/backend/app/risk/risk_score.py"
click node_router "https://github.com/tinashe2023/ner-logistics-intelligence/blob/main/backend/app/routing/risk_aware_router.py"
click node_graph "https://github.com/tinashe2023/ner-logistics-intelligence/blob/main/backend/app/db/graph_loader.py"
click node_featurejobs "https://github.com/tinashe2023/ner-logistics-intelligence/tree/main/backend/scripts"
click node_admin "https://github.com/tinashe2023/ner-logistics-intelligence/blob/main/php-admin/public/incidents.php"
click node_auth "https://github.com/tinashe2023/ner-logistics-intelligence/blob/main/php-admin/includes/auth.php"
click node_incidentmodel "https://github.com/tinashe2023/ner-logistics-intelligence/blob/main/backend/app/models/incident.py"
click node_dbconfig "https://github.com/tinashe2023/ner-logistics-intelligence/blob/main/backend/app/db/database.py"
click node_networkdata "https://github.com/tinashe2023/ner-logistics-intelligence/tree/main/backend/data"

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_controls,node_map,node_client toneBlue
class node_api,node_entry,node_risk,node_router,node_graph,node_featurejobs toneAmber
class node_admin,node_auth,node_incidentmodel toneMint
class node_dbconfig,node_incidentdb,node_networkdata toneRose
class node_dispatcher,node_driver toneIndigo
```

## Components

### Route dashboard

- [Dashboard app](https://github.com/tinashe2023/ner-logistics-intelligence/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Route controls](https://github.com/tinashe2023/ner-logistics-intelligence/blob/main/frontend/src/components/ControlPanel.jsx): `frontend/src/components/ControlPanel.jsx`
- [Risk map](https://github.com/tinashe2023/ner-logistics-intelligence/blob/main/frontend/src/components/RiskMap.jsx): `frontend/src/components/RiskMap.jsx`
- [API client](https://github.com/tinashe2023/ner-logistics-intelligence/blob/main/frontend/src/api.js): `frontend/src/api.js`

### Routing intelligence

- [Intelligence API](https://github.com/tinashe2023/ner-logistics-intelligence/blob/main/backend/app/api/routes.py): `backend/app/api/routes.py`
- [API entrypoint](https://github.com/tinashe2023/ner-logistics-intelligence/blob/main/backend/app/main.py): `backend/app/main.py`
- [Risk scoring](https://github.com/tinashe2023/ner-logistics-intelligence/blob/main/backend/app/risk/risk_score.py): `backend/app/risk/risk_score.py`
- [Risk-aware router](https://github.com/tinashe2023/ner-logistics-intelligence/blob/main/backend/app/routing/risk_aware_router.py): `backend/app/routing/risk_aware_router.py`
- [Graph loader](https://github.com/tinashe2023/ner-logistics-intelligence/blob/main/backend/app/db/graph_loader.py): `backend/app/db/graph_loader.py`
- [Feature processing](https://github.com/tinashe2023/ner-logistics-intelligence/tree/main/backend/scripts): `backend/scripts`

### Incident operations

- [Dispatcher admin](https://github.com/tinashe2023/ner-logistics-intelligence/blob/main/php-admin/public/incidents.php): `php-admin/public/incidents.php`
- [Admin authentication](https://github.com/tinashe2023/ner-logistics-intelligence/blob/main/php-admin/includes/auth.php): `php-admin/includes/auth.php`
- [Incident records](https://github.com/tinashe2023/ner-logistics-intelligence/blob/main/backend/app/models/incident.py): `backend/app/models/incident.py`

### Network data

- [Database access](https://github.com/tinashe2023/ner-logistics-intelligence/blob/main/backend/app/db/database.py): `backend/app/db/database.py`
- **Incident store**
- [Road and incident data](https://github.com/tinashe2023/ner-logistics-intelligence/tree/main/backend/data): `backend/data`

### Other components

- **Dispatcher**
- **Driver**

## Connections

- Driver → Dashboard app: uses dashboard
- Dispatcher → Dispatcher admin: reviews reports
- Dashboard app → API client: requests data
- Dashboard app → Route controls: renders controls
- Dashboard app → Risk map: renders map
- API client → Intelligence API: calls API
- API entrypoint → Intelligence API: mounts routes
- Intelligence API → Graph loader: loads graph
- Intelligence API → Risk-aware router: computes route
- Intelligence API → Database access: opens session
- Database access → Incident store: connects
- Intelligence API → Incident records: queries records
- Incident records → Incident store: maps table
- Intelligence API → Graph loader: bumps nearby risk
- Dispatcher admin → Admin authentication: checks login
- Dispatcher admin → Incident store: reads and updates
- Feature processing → Road and incident data: processes features
- Risk scoring → Risk-aware router: scores inform cost
