# gandamallapradyumn/heatmap architecture

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

- Interactive diagram: https://gitdiagram.com/gandamallapradyumn/heatmap
- Repository: https://github.com/gandamallapradyumn/heatmap

## Overview

Passenger Heatmap is a Streamlit app for exploring passenger counts between transit stops. The workflow selects a local CSV or browser upload, previews data, selects a boarding/dropping pair, builds a day-by-time passenger pivot, and presents KPIs, a heatmap, and an optional CSV download. Local-file analysis uses DuckDB; uploads use PyArrow and pandas. The sampled excerpts show the core helpers and UI fragments, while some wiring and the pandas route-filter helper are documented in the README; those documented links are cited there.

Main entry points: [`HEAT.PY`](https://github.com/gandamallapradyumn/heatmap/blob/main/HEAT.PY) (Streamlit interface)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_inputs["Data inputs"]
  node_interface["Streamlit interface<br/>[HEAT.PY]"]
  node_local_discovery["Local CSV discovery<br/>[HEAT.PY]"]
  node_duckdb_preview["DuckDB preview and count<br/>[HEAT.PY]"]
  node_duckdb_stages["DuckDB stage lookup<br/>[HEAT.PY]"]
  node_upload_loader["PyArrow upload loader<br/>[HEAT.PY]"]
end

subgraph group_analysis["Route analysis"]
  node_duckdb_route["DuckDB route query<br/>[HEAT.PY]"]
  node_pandas_route["Pandas route filter<br/>[HEAT.PY]"]
  node_pivot["Passenger pivot builder<br/>[HEAT.PY]"]
end

subgraph group_results["Results"]
  node_kpis["Route KPIs<br/>[HEAT.PY]"]
  node_heatmap["Heatmap renderer<br/>[HEAT.PY]"]
  node_csv_export["Pivot CSV download<br/>[HEAT.PY]"]
end

node_user(("Transit analyst"))

node_user -->|"uses"| node_interface
node_interface -->|"detects files"| node_local_discovery
node_interface -->|"requests preview"| node_duckdb_preview
node_interface -->|"requests stages"| node_duckdb_stages
node_interface -->|"loads upload"| node_upload_loader
node_interface -->|"requests route data"| node_duckdb_route
node_upload_loader -->|"provides dataframe"| node_pandas_route
node_interface -->|"filters selected route"| node_pandas_route
node_duckdb_route -->|"provides route rows"| node_pivot
node_pandas_route -->|"provides route rows"| node_pivot
node_interface -->|"builds pivot"| node_pivot
node_interface -->|"calculates metrics"| node_kpis
node_interface -->|"renders pivot"| node_heatmap
node_interface -->|"offers download"| node_csv_export

click node_interface "https://github.com/gandamallapradyumn/heatmap/blob/main/HEAT.PY"
click node_local_discovery "https://github.com/gandamallapradyumn/heatmap/blob/main/HEAT.PY"
click node_duckdb_preview "https://github.com/gandamallapradyumn/heatmap/blob/main/HEAT.PY"
click node_duckdb_stages "https://github.com/gandamallapradyumn/heatmap/blob/main/HEAT.PY"
click node_upload_loader "https://github.com/gandamallapradyumn/heatmap/blob/main/HEAT.PY"
click node_duckdb_route "https://github.com/gandamallapradyumn/heatmap/blob/main/HEAT.PY"
click node_pandas_route "https://github.com/gandamallapradyumn/heatmap/blob/main/HEAT.PY"
click node_pivot "https://github.com/gandamallapradyumn/heatmap/blob/main/HEAT.PY"
click node_kpis "https://github.com/gandamallapradyumn/heatmap/blob/main/HEAT.PY"
click node_heatmap "https://github.com/gandamallapradyumn/heatmap/blob/main/HEAT.PY"
click node_csv_export "https://github.com/gandamallapradyumn/heatmap/blob/main/HEAT.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_interface,node_local_discovery,node_duckdb_preview,node_duckdb_stages,node_upload_loader toneBlue
class node_duckdb_route,node_pandas_route,node_pivot toneAmber
class node_kpis,node_heatmap,node_csv_export toneMint
class node_user toneIndigo
```

## Components

### Data inputs

- [Streamlit interface](https://github.com/gandamallapradyumn/heatmap/blob/main/HEAT.PY): `HEAT.PY`
- [Local CSV discovery](https://github.com/gandamallapradyumn/heatmap/blob/main/HEAT.PY): `HEAT.PY`
- [DuckDB preview and count](https://github.com/gandamallapradyumn/heatmap/blob/main/HEAT.PY): `HEAT.PY`
- [DuckDB stage lookup](https://github.com/gandamallapradyumn/heatmap/blob/main/HEAT.PY): `HEAT.PY`
- [PyArrow upload loader](https://github.com/gandamallapradyumn/heatmap/blob/main/HEAT.PY): `HEAT.PY`

### Route analysis

- [DuckDB route query](https://github.com/gandamallapradyumn/heatmap/blob/main/HEAT.PY): `HEAT.PY`
- [Pandas route filter](https://github.com/gandamallapradyumn/heatmap/blob/main/HEAT.PY): `HEAT.PY`
- [Passenger pivot builder](https://github.com/gandamallapradyumn/heatmap/blob/main/HEAT.PY): `HEAT.PY`

### Results

- [Route KPIs](https://github.com/gandamallapradyumn/heatmap/blob/main/HEAT.PY): `HEAT.PY`
- [Heatmap renderer](https://github.com/gandamallapradyumn/heatmap/blob/main/HEAT.PY): `HEAT.PY`
- [Pivot CSV download](https://github.com/gandamallapradyumn/heatmap/blob/main/HEAT.PY): `HEAT.PY`

### Other components

- **Transit analyst**

## Connections

- Transit analyst → Streamlit interface: uses (evidence: `README.md`)
- Streamlit interface → Local CSV discovery: detects files (evidence: `HEAT.PY`)
- Streamlit interface → DuckDB preview and count: requests preview (evidence: `README.md`)
- Streamlit interface → DuckDB stage lookup: requests stages (evidence: `README.md`)
- Streamlit interface → PyArrow upload loader: loads upload (evidence: `README.md`)
- Streamlit interface → DuckDB route query: requests route data (evidence: `README.md`)
- PyArrow upload loader → Pandas route filter: provides dataframe (evidence: `README.md`)
- Streamlit interface → Pandas route filter: filters selected route (evidence: `README.md`)
- DuckDB route query → Passenger pivot builder: provides route rows (evidence: `README.md`)
- Pandas route filter → Passenger pivot builder: provides route rows (evidence: `README.md`)
- Streamlit interface → Passenger pivot builder: builds pivot (evidence: `README.md`)
- Streamlit interface → Route KPIs: calculates metrics (evidence: `HEAT.PY`)
- Streamlit interface → Heatmap renderer: renders pivot (evidence: `README.md`)
- Streamlit interface → Pivot CSV download: offers download (evidence: `README.md`)
