# kendelja/urban-insights-dashboard architecture

> Architecture diagram of the GitHub repository kendelja/urban-insights-dashboard, 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/kendelja/urban-insights-dashboard
- Repository: https://github.com/kendelja/urban-insights-dashboard
- Video tour (about a minute): https://gitdiagram.com/kendelja/urban-insights-dashboard/video

## Overview

Urban Insights Dashboard is a Toronto neighbourhood safety-and-affordability map. The intended user workflow is to explore neighbourhoods, switch between crime and rent overlays, and inspect metrics in map tooltips. The sampled runtime shows the map fetching neighbourhood JSON through a FastAPI endpoint; a separate CSV processor computes crime rates, while README-described cleaning, normalization, and boundary merging are not fully evidenced as connected runtime stages. Rent figures appear embedded in the map component. Unsampled processing and overlay details are represented only where documented.

Main entry points: [`frontend/src/map/baseMap.jsx`](https://github.com/kendelja/urban-insights-dashboard/blob/main/frontend/src/map/baseMap.jsx) (Interactive map), [`routers/neighbourhoods.py`](https://github.com/kendelja/urban-insights-dashboard/blob/main/routers/neighbourhoods.py) (Neighbourhood endpoint), [`frontend/src/main.jsx`](https://github.com/kendelja/urban-insights-dashboard/blob/main/frontend/src/main.jsx) (Frontend entry), [`services/processData.py`](https://github.com/kendelja/urban-insights-dashboard/blob/main/services/processData.py) (Crime rate calculation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Map experience"]
  node_entry["Frontend entry<br/>[main.jsx]"]
  node_app["Starter app<br/>[App.jsx]"]
  node_map["Interactive map<br/>[baseMap.jsx]"]
  node_fetcher["Neighbourhood fetch<br/>[getData.js]"]
end

subgraph group_backend["API delivery"]
  node_api["FastAPI app<br/>[main.py]"]
  node_route["Neighbourhood endpoint<br/>[neighbourhoods.py]"]
  node_service["Data service"]
end

subgraph group_analytics["Data analytics"]
  node_crimecalc["Crime rate calculation<br/>[processData.py]"]
end

subgraph group_assets["Data assets"]
  node_crimecsv["Crime input data"]
  node_serveddata[("Neighbourhood JSON<br/>[torontoData.json]")]
  node_boundaries["GeoJSON boundaries"]
end

node_visitor(("Map user"))
node_tilemap["Basemap tiles"]

node_entry -->|"renders"| node_map
node_entry -->|"imports"| node_app
node_visitor -.->|"explores overlays"| node_map
node_map -->|"requests data"| node_fetcher
node_fetcher -->|"fetches endpoint"| node_route
node_map -->|"loads tiles"| node_tilemap
node_api -->|"registers router"| node_route
node_route -->|"calls"| node_service
node_service -->|"reads JSON"| node_serveddata
node_crimecalc -->|"reads rows"| node_crimecsv
node_crimecalc -.->|"merges with boundaries"| node_boundaries

click node_entry "https://github.com/kendelja/urban-insights-dashboard/blob/main/frontend/src/main.jsx"
click node_app "https://github.com/kendelja/urban-insights-dashboard/blob/main/frontend/src/App.jsx"
click node_map "https://github.com/kendelja/urban-insights-dashboard/blob/main/frontend/src/map/baseMap.jsx"
click node_fetcher "https://github.com/kendelja/urban-insights-dashboard/blob/main/frontend/src/api/getData.js"
click node_api "https://github.com/kendelja/urban-insights-dashboard/blob/main/main.py"
click node_route "https://github.com/kendelja/urban-insights-dashboard/blob/main/routers/neighbourhoods.py"
click node_service "https://github.com/kendelja/urban-insights-dashboard/blob/main/services/neighbourhood_service.py"
click node_crimecalc "https://github.com/kendelja/urban-insights-dashboard/blob/main/services/processData.py"
click node_crimecsv "https://github.com/kendelja/urban-insights-dashboard/blob/main/data/torontoCrimeData.csv"
click node_serveddata "https://github.com/kendelja/urban-insights-dashboard/blob/main/data/torontoData.json"
click node_boundaries "https://github.com/kendelja/urban-insights-dashboard/blob/main/data/toronto_crs84_clean.geojson"

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_entry,node_app,node_map,node_fetcher,node_visitor toneBlue
class node_api,node_route,node_service toneAmber
class node_crimecalc toneMint
class node_crimecsv,node_serveddata,node_boundaries toneRose
class node_tilemap toneIndigo
```

## Components

### Map experience

- [Frontend entry](https://github.com/kendelja/urban-insights-dashboard/blob/main/frontend/src/main.jsx): `frontend/src/main.jsx`
- [Starter app](https://github.com/kendelja/urban-insights-dashboard/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Interactive map](https://github.com/kendelja/urban-insights-dashboard/blob/main/frontend/src/map/baseMap.jsx): `frontend/src/map/baseMap.jsx`
- [Neighbourhood fetch](https://github.com/kendelja/urban-insights-dashboard/blob/main/frontend/src/api/getData.js): `frontend/src/api/getData.js`

### API delivery

- [FastAPI app](https://github.com/kendelja/urban-insights-dashboard/blob/main/main.py): `main.py`
- [Neighbourhood endpoint](https://github.com/kendelja/urban-insights-dashboard/blob/main/routers/neighbourhoods.py): `routers/neighbourhoods.py`
- [Data service](https://github.com/kendelja/urban-insights-dashboard/blob/main/services/neighbourhood_service.py): `services/neighbourhood_service.py`

### Data analytics

- [Crime rate calculation](https://github.com/kendelja/urban-insights-dashboard/blob/main/services/processData.py): `services/processData.py`

### Data assets

- [Crime input data](https://github.com/kendelja/urban-insights-dashboard/blob/main/data/torontoCrimeData.csv): `data/torontoCrimeData.csv`
- [Neighbourhood JSON](https://github.com/kendelja/urban-insights-dashboard/blob/main/data/torontoData.json): `data/torontoData.json`
- [GeoJSON boundaries](https://github.com/kendelja/urban-insights-dashboard/blob/main/data/toronto_crs84_clean.geojson): `data/toronto_crs84_clean.geojson`

### Other components

- **Map user**
- **Basemap tiles**

## Connections

- Frontend entry → Interactive map: renders (evidence: `frontend/src/main.jsx`)
- Frontend entry → Starter app: imports (evidence: `frontend/src/main.jsx`)
- Map user → Interactive map: explores overlays (evidence: `README.md`)
- Interactive map → Neighbourhood fetch: requests data (evidence: `frontend/src/map/baseMap.jsx`)
- Neighbourhood fetch → Neighbourhood endpoint: fetches endpoint (evidence: `frontend/src/api/getData.js`)
- Interactive map → Basemap tiles: loads tiles (evidence: `frontend/src/map/baseMap.jsx`)
- FastAPI app → Neighbourhood endpoint: registers router (evidence: `main.py`)
- Neighbourhood endpoint → Data service: calls (evidence: `routers/neighbourhoods.py`)
- Data service → Neighbourhood JSON: reads JSON (evidence: `services/neighbourhood_service.py`)
- Crime rate calculation → Crime input data: reads rows (evidence: `services/processData.py`)
- Crime rate calculation → GeoJSON boundaries: merges with boundaries (evidence: `README.md`)
