# anaydhawan/ucip architecture

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

- Interactive diagram: https://gitdiagram.com/anaydhawan/ucip
- Repository: https://github.com/anaydhawan/ucip

## Overview

UCIP is a research-backed decision-support platform for ranking Mumbai wards by heat vulnerability and explaining where cooling interventions may help. Its main workflow transforms Earth-observation and city data through an orchestrated analysis pipeline into HVI scores and nature-based-solutions recommendations; the web dashboard and read-only API expose ward, cell, lookup, and export data. Python and TypeScript clients, plus an MCP server, provide alternate access. The README documents green-cover change and methodology capabilities; sampled-source limits mean some pipeline and UI connections are documented rather than verified in code.

Main entry points: [`frontend/src/app/api/v1`](https://github.com/anaydhawan/ucip/tree/main/frontend/src/app/api/v1) (Public API routes), [`pipeline/05_hvi.py`](https://github.com/anaydhawan/ucip/blob/main/pipeline/05_hvi.py) (HVI scoring), [`frontend/src/app/api/v1/_lib.ts`](https://github.com/anaydhawan/ucip/blob/main/frontend/src/app/api/v1/_lib.ts) (API data access), [`frontend/src/app/dashboard/page.tsx`](https://github.com/anaydhawan/ucip/blob/main/frontend/src/app/dashboard/page.tsx) (Ward dashboard)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_pipeline["Analysis pipeline"]
  node_runner["Pipeline runner<br/>[run_pipeline.py]"]
  node_earth["Earth observation<br/>[02_gee_layers.py]"]
  node_grid["Spatial grid<br/>[01_grid.py]"]
  node_hvi["HVI scoring<br/>[05_hvi.py]"]
  node_nbs["Cooling recommendations<br/>[06_nbs.py]"]
  node_change["Green-cover change<br/>[09_ndvi_change.py]"]
  node_profile["Ward profiles<br/>[10_ward_profile.py]"]
  node_publish["Data publishing<br/>[_publish.py]"]
end

subgraph group_serving["Data and API"]
  node_api["Public API routes"]
  node_apiutil["API data access<br/>[_lib.ts]"]
  node_supabase[("Supabase database")]
  node_snapshot["Committed snapshots"]
end

subgraph group_web["Web experience"]
  node_dashboard["Ward dashboard<br/>[page.tsx]"]
  node_warddata["Ward data client<br/>[useWardData.ts]"]
  node_methodology["Methodology view<br/>[page.tsx]"]
  node_simulator["Budget simulator<br/>[page.tsx]"]
end

subgraph group_integrations["External access"]
  node_pyclient["Python client<br/>[client.py]"]
  node_tsclient["TypeScript client<br/>[index.ts]"]
  node_mcp["MCP tools<br/>[index.ts]"]
  node_mcpclient["MCP API client<br/>[client.ts]"]
end

node_planners(("Planners"))

node_planners -.->|"explore wards"| node_dashboard
node_runner -.->|"runs stages"| node_earth
node_earth -.->|"derive layers"| node_grid
node_grid -.->|"score cells"| node_hvi
node_hvi -.->|"inform recommendations"| node_nbs
node_hvi -.->|"analyze alongside"| node_change
node_hvi -.->|"roll up wards"| node_profile
node_runner -->|"publishes run log"| node_publish
node_publish -.->|"publish data"| node_snapshot
node_api -->|"uses shared access"| node_apiutil
node_apiutil -->|"queries"| node_supabase
node_apiutil -->|"reads fallback"| node_snapshot
node_dashboard -.->|"loads ward data"| node_warddata
node_warddata -.->|"requests data"| node_api
node_methodology -.->|"explains scoring"| node_dashboard
node_simulator -.->|"uses platform data"| node_api
node_pyclient -.->|"calls REST API"| node_api
node_tsclient -.->|"calls REST API"| node_api
node_mcp -->|"dispatches tools"| node_mcpclient
node_mcpclient -.->|"calls REST API"| node_api

click node_runner "https://github.com/anaydhawan/ucip/blob/main/pipeline/run_pipeline.py"
click node_earth "https://github.com/anaydhawan/ucip/blob/main/pipeline/02_gee_layers.py"
click node_grid "https://github.com/anaydhawan/ucip/blob/main/pipeline/01_grid.py"
click node_hvi "https://github.com/anaydhawan/ucip/blob/main/pipeline/05_hvi.py"
click node_nbs "https://github.com/anaydhawan/ucip/blob/main/pipeline/06_nbs.py"
click node_change "https://github.com/anaydhawan/ucip/blob/main/pipeline/09_ndvi_change.py"
click node_profile "https://github.com/anaydhawan/ucip/blob/main/pipeline/10_ward_profile.py"
click node_publish "https://github.com/anaydhawan/ucip/blob/main/pipeline/_publish.py"
click node_api "https://github.com/anaydhawan/ucip/tree/main/frontend/src/app/api/v1"
click node_apiutil "https://github.com/anaydhawan/ucip/blob/main/frontend/src/app/api/v1/_lib.ts"
click node_dashboard "https://github.com/anaydhawan/ucip/blob/main/frontend/src/app/dashboard/page.tsx"
click node_warddata "https://github.com/anaydhawan/ucip/blob/main/frontend/src/lib/useWardData.ts"
click node_methodology "https://github.com/anaydhawan/ucip/blob/main/frontend/src/app/methodology/page.tsx"
click node_simulator "https://github.com/anaydhawan/ucip/blob/main/frontend/src/app/simulate/page.tsx"
click node_pyclient "https://github.com/anaydhawan/ucip/blob/main/clients/python/src/ucip/client.py"
click node_tsclient "https://github.com/anaydhawan/ucip/blob/main/clients/typescript/src/index.ts"
click node_mcp "https://github.com/anaydhawan/ucip/blob/main/mcp-server/src/index.ts"
click node_mcpclient "https://github.com/anaydhawan/ucip/blob/main/mcp-server/src/client.ts"

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_runner,node_earth,node_grid,node_hvi,node_nbs,node_change,node_profile,node_publish toneBlue
class node_api,node_apiutil,node_supabase,node_snapshot toneAmber
class node_dashboard,node_warddata,node_methodology,node_simulator toneMint
class node_pyclient,node_tsclient,node_mcp,node_mcpclient toneRose
class node_planners toneIndigo
```

## Components

### Analysis pipeline

- [Pipeline runner](https://github.com/anaydhawan/ucip/blob/main/pipeline/run_pipeline.py): `pipeline/run_pipeline.py`
- [Earth observation](https://github.com/anaydhawan/ucip/blob/main/pipeline/02_gee_layers.py): `pipeline/02_gee_layers.py`
- [Spatial grid](https://github.com/anaydhawan/ucip/blob/main/pipeline/01_grid.py): `pipeline/01_grid.py`
- [HVI scoring](https://github.com/anaydhawan/ucip/blob/main/pipeline/05_hvi.py): `pipeline/05_hvi.py`
- [Cooling recommendations](https://github.com/anaydhawan/ucip/blob/main/pipeline/06_nbs.py): `pipeline/06_nbs.py`
- [Green-cover change](https://github.com/anaydhawan/ucip/blob/main/pipeline/09_ndvi_change.py): `pipeline/09_ndvi_change.py`
- [Ward profiles](https://github.com/anaydhawan/ucip/blob/main/pipeline/10_ward_profile.py): `pipeline/10_ward_profile.py`
- [Data publishing](https://github.com/anaydhawan/ucip/blob/main/pipeline/_publish.py): `pipeline/_publish.py`

### Data and API

- [Public API routes](https://github.com/anaydhawan/ucip/tree/main/frontend/src/app/api/v1): `frontend/src/app/api/v1`
- [API data access](https://github.com/anaydhawan/ucip/blob/main/frontend/src/app/api/v1/_lib.ts): `frontend/src/app/api/v1/_lib.ts`
- **Supabase database**
- **Committed snapshots**

### Web experience

- [Ward dashboard](https://github.com/anaydhawan/ucip/blob/main/frontend/src/app/dashboard/page.tsx): `frontend/src/app/dashboard/page.tsx`
- [Ward data client](https://github.com/anaydhawan/ucip/blob/main/frontend/src/lib/useWardData.ts): `frontend/src/lib/useWardData.ts`
- [Methodology view](https://github.com/anaydhawan/ucip/blob/main/frontend/src/app/methodology/page.tsx): `frontend/src/app/methodology/page.tsx`
- [Budget simulator](https://github.com/anaydhawan/ucip/blob/main/frontend/src/app/simulate/page.tsx): `frontend/src/app/simulate/page.tsx`

### External access

- [Python client](https://github.com/anaydhawan/ucip/blob/main/clients/python/src/ucip/client.py): `clients/python/src/ucip/client.py`
- [TypeScript client](https://github.com/anaydhawan/ucip/blob/main/clients/typescript/src/index.ts): `clients/typescript/src/index.ts`
- [MCP tools](https://github.com/anaydhawan/ucip/blob/main/mcp-server/src/index.ts): `mcp-server/src/index.ts`
- [MCP API client](https://github.com/anaydhawan/ucip/blob/main/mcp-server/src/client.ts): `mcp-server/src/client.ts`

### Other components

- **Planners**

## Connections

- Planners → Ward dashboard: explore wards
- Pipeline runner → Earth observation: runs stages (evidence: `pipeline/run_pipeline.py`)
- Earth observation → Spatial grid: derive layers
- Spatial grid → HVI scoring: score cells
- HVI scoring → Cooling recommendations: inform recommendations
- HVI scoring → Green-cover change: analyze alongside
- HVI scoring → Ward profiles: roll up wards
- Pipeline runner → Data publishing: publishes run log (evidence: `pipeline/run_pipeline.py`)
- Data publishing → Committed snapshots: publish data
- Public API routes → API data access: uses shared access (evidence: `frontend/src/app/api/v1/wards/route.ts`)
- API data access → Supabase database: queries (evidence: `frontend/src/app/api/v1/_lib.ts`)
- API data access → Committed snapshots: reads fallback (evidence: `frontend/src/app/api/v1/_lib.ts`)
- Ward dashboard → Ward data client: loads ward data
- Ward data client → Public API routes: requests data
- Methodology view → Ward dashboard: explains scoring
- Budget simulator → Public API routes: uses platform data
- Python client → Public API routes: calls REST API (evidence: `clients/python/src/ucip/client.py`)
- TypeScript client → Public API routes: calls REST API (evidence: `clients/typescript/src/index.ts`)
- MCP tools → MCP API client: dispatches tools (evidence: `mcp-server/src/index.ts`)
- MCP API client → Public API routes: calls REST API (evidence: `mcp-server/src/client.ts`)
