# wilsoncanetekamacupa/tpip architecture

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

- Interactive diagram: https://gitdiagram.com/wilsoncanetekamacupa/tpip
- Repository: https://github.com/wilsoncanetekamacupa/tpip

## Overview

TPIP is a Debrecen transit-priority intelligence platform. Its intended workflow is to assemble road, transit, and operational data; analyze delays and rank priority locations; recommend interventions; and present results through a GIS dashboard and API. The sampled analytics code supports scoring and intervention logic, while the README documents impact simulation. The dashboard excerpt confirms live-incident status and map-oriented analysis, but does not show its full data-loading or analytics invocation, so those connections are not asserted.

Main entry points: [`src/analytics.py`](https://github.com/wilsoncanetekamacupa/tpip/blob/master/src/analytics.py) (Priority analytics), [`api/main.py`](https://github.com/wilsoncanetekamacupa/tpip/blob/master/api/main.py) (REST API), [`src/tomtom_api.py`](https://github.com/wilsoncanetekamacupa/tpip/blob/master/src/tomtom_api.py) (TomTom incident fetcher), [`dashboard/app.py`](https://github.com/wilsoncanetekamacupa/tpip/blob/master/dashboard/app.py) (GIS dashboard)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_inputs["Data inputs"]
  node_roadnet["Road network"]
  node_transitdata[("Transit datasets")]
  node_mentorsheets["Operational spreadsheets"]
  node_generator["Network data generator<br/>[data_generator.py]"]
  node_mentorintegrator["Mentor data integrator"]
end

subgraph group_analysis["Intelligence analysis"]
  node_analytics["Priority analytics<br/>[analytics.py]"]
  node_recommendations["Recommendations"]
  node_priorityresults["Priority analysis"]
  node_stopresults["Stop analysis<br/>[stop_analysis.csv]"]
end

subgraph group_delivery["User-facing delivery"]
  node_dashboard["GIS dashboard<br/>[app.py]"]
  node_api["REST API<br/>[main.py]"]
end

subgraph group_integrations["Live traffic integration"]
  node_tomtom["TomTom incident fetcher<br/>[tomtom_api.py]"]
  node_liveincidents[("Live incident data<br/>[live_incidents.csv]")]
  node_status["Sync status<br/>[tomtom_status.json]"]
end

node_planner(("City planner"))
node_tomtomservice{{"TomTom Traffic API"}}

node_generator -->|"saves network"| node_roadnet
node_generator -->|"generates datasets"| node_transitdata
node_mentorintegrator -->|"reads spreadsheets"| node_mentorsheets
node_mentorintegrator -->|"writes summaries"| node_transitdata
node_analytics -->|"loads data"| node_transitdata
node_analytics -.->|"ranks locations"| node_priorityresults
node_analytics -.->|"analyzes stops"| node_stopresults
node_analytics -.->|"derives interventions"| node_recommendations
node_planner -->|"explores results"| node_dashboard
node_planner -->|"requests data"| node_api
node_api -->|"reads"| node_priorityresults
node_api -->|"reads"| node_recommendations
node_api -->|"reads"| node_stopresults
node_tomtom -->|"fetches incidents"| node_tomtomservice
node_tomtom -->|"writes incidents"| node_liveincidents
node_tomtom -->|"writes status"| node_status
node_dashboard -->|"imports fetcher"| node_tomtom
node_dashboard -->|"reads status"| node_status

click node_roadnet "https://github.com/wilsoncanetekamacupa/tpip/blob/master/data/debrecen_network.graphml"
click node_transitdata "https://github.com/wilsoncanetekamacupa/tpip/tree/master/data"
click node_mentorsheets "https://github.com/wilsoncanetekamacupa/tpip/tree/master/data"
click node_generator "https://github.com/wilsoncanetekamacupa/tpip/blob/master/src/data_generator.py"
click node_mentorintegrator "https://github.com/wilsoncanetekamacupa/tpip/blob/master/src/mentor_data_integrator.py"
click node_analytics "https://github.com/wilsoncanetekamacupa/tpip/blob/master/src/analytics.py"
click node_dashboard "https://github.com/wilsoncanetekamacupa/tpip/blob/master/dashboard/app.py"
click node_api "https://github.com/wilsoncanetekamacupa/tpip/blob/master/api/main.py"
click node_tomtom "https://github.com/wilsoncanetekamacupa/tpip/blob/master/src/tomtom_api.py"
click node_liveincidents "https://github.com/wilsoncanetekamacupa/tpip/blob/master/data/live_incidents.csv"
click node_status "https://github.com/wilsoncanetekamacupa/tpip/blob/master/data/tomtom_status.json"
click node_recommendations "https://github.com/wilsoncanetekamacupa/tpip/blob/master/data/recommendations.csv"
click node_priorityresults "https://github.com/wilsoncanetekamacupa/tpip/blob/master/data/priority_analysis.csv"
click node_stopresults "https://github.com/wilsoncanetekamacupa/tpip/blob/master/data/stop_analysis.csv"

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_roadnet,node_transitdata,node_mentorsheets,node_generator,node_mentorintegrator toneBlue
class node_analytics,node_recommendations,node_priorityresults,node_stopresults toneAmber
class node_dashboard,node_api,node_tomtomservice toneMint
class node_tomtom,node_liveincidents,node_status toneRose
class node_planner toneIndigo
```

## Components

### Data inputs

- [Road network](https://github.com/wilsoncanetekamacupa/tpip/blob/master/data/debrecen_network.graphml): `data/debrecen_network.graphml`
- [Transit datasets](https://github.com/wilsoncanetekamacupa/tpip/tree/master/data): `data`
- [Operational spreadsheets](https://github.com/wilsoncanetekamacupa/tpip/tree/master/data): `data`
- [Network data generator](https://github.com/wilsoncanetekamacupa/tpip/blob/master/src/data_generator.py): `src/data_generator.py`
- [Mentor data integrator](https://github.com/wilsoncanetekamacupa/tpip/blob/master/src/mentor_data_integrator.py): `src/mentor_data_integrator.py`

### Intelligence analysis

- [Priority analytics](https://github.com/wilsoncanetekamacupa/tpip/blob/master/src/analytics.py): `src/analytics.py`
- [Recommendations](https://github.com/wilsoncanetekamacupa/tpip/blob/master/data/recommendations.csv): `data/recommendations.csv`
- [Priority analysis](https://github.com/wilsoncanetekamacupa/tpip/blob/master/data/priority_analysis.csv): `data/priority_analysis.csv`
- [Stop analysis](https://github.com/wilsoncanetekamacupa/tpip/blob/master/data/stop_analysis.csv): `data/stop_analysis.csv`

### User-facing delivery

- [GIS dashboard](https://github.com/wilsoncanetekamacupa/tpip/blob/master/dashboard/app.py): `dashboard/app.py`
- [REST API](https://github.com/wilsoncanetekamacupa/tpip/blob/master/api/main.py): `api/main.py`

### Live traffic integration

- [TomTom incident fetcher](https://github.com/wilsoncanetekamacupa/tpip/blob/master/src/tomtom_api.py): `src/tomtom_api.py`
- [Live incident data](https://github.com/wilsoncanetekamacupa/tpip/blob/master/data/live_incidents.csv): `data/live_incidents.csv`
- [Sync status](https://github.com/wilsoncanetekamacupa/tpip/blob/master/data/tomtom_status.json): `data/tomtom_status.json`

### Other components

- **City planner**
- **TomTom Traffic API**

## Connections

- Network data generator → Road network: saves network (evidence: `src/data_generator.py`)
- Network data generator → Transit datasets: generates datasets (evidence: `src/data_generator.py`)
- Mentor data integrator → Operational spreadsheets: reads spreadsheets (evidence: `src/mentor_data_integrator.py`)
- Mentor data integrator → Transit datasets: writes summaries (evidence: `src/mentor_data_integrator.py`)
- Priority analytics → Transit datasets: loads data (evidence: `src/analytics.py`)
- Priority analytics → Priority analysis: ranks locations
- Priority analytics → Stop analysis: analyzes stops
- Priority analytics → Recommendations: derives interventions
- City planner → GIS dashboard: explores results (evidence: `README.md`)
- City planner → REST API: requests data (evidence: `README.md`)
- REST API → Priority analysis: reads (evidence: `api/main.py`)
- REST API → Recommendations: reads (evidence: `api/main.py`)
- REST API → Stop analysis: reads (evidence: `api/main.py`)
- TomTom incident fetcher → TomTom Traffic API: fetches incidents (evidence: `src/tomtom_api.py`)
- TomTom incident fetcher → Live incident data: writes incidents (evidence: `src/tomtom_api.py`)
- TomTom incident fetcher → Sync status: writes status (evidence: `src/tomtom_api.py`)
- GIS dashboard → TomTom incident fetcher: imports fetcher (evidence: `dashboard/app.py`)
- GIS dashboard → Sync status: reads status (evidence: `dashboard/app.py`)
