# deo-haneesh/city_pulse architecture

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

- Interactive diagram: https://gitdiagram.com/deo-haneesh/city_pulse
- Repository: https://github.com/deo-haneesh/city_pulse

## Overview

CityPulse is a disaster-intelligence dashboard: it loads regional signals, combines them with reports and mitigation state to assess sector risk, then presents prioritized zones and supports operator actions. The README documents the map, ranked queue, live feed, recommendations, dispatch, and scenario controls; source excerpts show the frontend context coordinating live ingestion, Supabase snapshots, report creation/import, and scoring. Backend function details and some UI wiring are supported by the SOURCE INDEX rather than inspected excerpts, so uncertain connections are omitted.

Main entry points: [`src/context/DisasterContext.jsx`](https://github.com/deo-haneesh/city_pulse/blob/main/src/context/DisasterContext.jsx) (Disaster State), [`src/App.jsx`](https://github.com/deo-haneesh/city_pulse/blob/main/src/App.jsx) (Dashboard Shell), [`src/components/detail/ZoneDetailDrawer.jsx`](https://github.com/deo-haneesh/city_pulse/blob/main/src/components/detail/ZoneDetailDrawer.jsx) (Zone Detail), [`src/components/header/LiveStreamControls.jsx`](https://github.com/deo-haneesh/city_pulse/blob/main/src/components/header/LiveStreamControls.jsx) (Stream Controls)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_dashboard["Command Dashboard"]
  node_app["Dashboard Shell<br/>[App.jsx]"]
  node_map["Tactical Map<br/>[CityMap.jsx]"]
  node_queue["Priority Queue<br/>[PriorityQueue.jsx]"]
  node_feed["Live Report Feed<br/>[LiveReportFeed.jsx]"]
  node_zone_detail["Zone Detail"]
  node_risk_chart["Risk Trend Chart<br/>[RiskTrendChart.jsx]"]
  node_recommendations["Action Recommendations"]
end

subgraph group_operations["Operator Controls"]
  node_header["Command Header<br/>[CommandHeader.jsx]"]
  node_stream_controls["Stream Controls"]
  node_manual_report["Manual Reports"]
  node_data_import["Report Import"]
  node_replay["Scenario Replay<br/>[ReplayControls.jsx]"]
  node_auth["Supabase Auth"]
end

subgraph group_intelligence["Risk Intelligence"]
  node_context["Disaster State"]
  node_scoring["Risk Scoring Engine<br/>[scoringEngine.js]"]
  node_regions["Regional Sector Data"]
  node_realworld["Live Signal Ingestion"]
end

subgraph group_backend["Supabase Functions"]
  node_create_report["Create Report<br/>[index.ts]"]
  node_import_reports["Import Reports<br/>[index.ts]"]
  node_ingest_telemetry["Telemetry Ingestion<br/>[index.ts]"]
  node_dispatch_resource["Resource Dispatch<br/>[index.ts]"]
  node_server_scoring["Server Scoring<br/>[scoring.ts]"]
  node_server_client["Server Supabase Access<br/>[supabase.ts]"]
end

subgraph group_persistence["Data Services"]
  node_supabase_service["Supabase Data Service"]
  node_supabase_client["Supabase Client<br/>[supabaseClient.js]"]
  node_database[("Supabase Database")]
end

node_operator(("Emergency Operator"))
node_usgs["USGS Feed"]
node_openmeteo["Open-Meteo Feed"]
node_nasa["NASA EONET Feed"]

node_operator -->|"uses"| node_app
node_app -->|"provides state"| node_context
node_app -->|"renders"| node_header
node_app -->|"renders"| node_map
node_app -->|"renders"| node_queue
node_app -->|"renders"| node_feed
node_app -->|"renders"| node_zone_detail
node_map -->|"reads state"| node_context
node_queue -->|"reads state"| node_context
node_feed -->|"reads state"| node_context
node_zone_detail -->|"reads and acts"| node_context
node_zone_detail -->|"renders"| node_risk_chart
node_zone_detail -->|"renders"| node_recommendations
node_header -->|"reads state"| node_context
node_header -->|"renders"| node_stream_controls
node_stream_controls -->|"opens"| node_manual_report
node_stream_controls -->|"opens"| node_data_import
node_stream_controls -->|"renders"| node_replay
node_stream_controls -->|"renders"| node_auth
node_manual_report -->|"submits report"| node_context
node_data_import -->|"imports reports"| node_context
node_replay -->|"controls replay"| node_context
node_auth -->|"authenticates"| node_supabase_client
node_context -->|"selects region"| node_regions
node_context -->|"requests live data"| node_realworld
node_context -->|"loads and invokes"| node_supabase_service
node_context -->|"calculates actions"| node_scoring
node_realworld -->|"fetches events"| node_usgs
node_realworld -->|"fetches weather"| node_openmeteo
node_realworld -->|"fetches hazards"| node_nasa
node_supabase_service -->|"queries through"| node_supabase_client
node_supabase_service -.->|"reads and writes"| node_database
node_supabase_service -->|"invokes function"| node_create_report
node_supabase_service -->|"invokes function"| node_import_reports
node_supabase_client -.->|"connects"| node_database
node_create_report -->|"uses"| node_server_scoring
node_create_report -->|"accesses data"| node_server_client
node_import_reports -->|"uses"| node_server_scoring
node_import_reports -->|"accesses data"| node_server_client
node_ingest_telemetry -->|"uses"| node_server_scoring
node_ingest_telemetry -->|"accesses data"| node_server_client
node_dispatch_resource -->|"uses"| node_server_scoring
node_dispatch_resource -->|"accesses data"| node_server_client
node_server_scoring -.->|"updates risk state"| node_database
node_server_client -.->|"connects"| node_database
node_zone_detail -.->|"authorizes dispatch"| node_dispatch_resource

click node_app "https://github.com/deo-haneesh/city_pulse/blob/main/src/App.jsx"
click node_map "https://github.com/deo-haneesh/city_pulse/blob/main/src/components/map/CityMap.jsx"
click node_queue "https://github.com/deo-haneesh/city_pulse/blob/main/src/components/queue/PriorityQueue.jsx"
click node_feed "https://github.com/deo-haneesh/city_pulse/blob/main/src/components/feed/LiveReportFeed.jsx"
click node_zone_detail "https://github.com/deo-haneesh/city_pulse/blob/main/src/components/detail/ZoneDetailDrawer.jsx"
click node_risk_chart "https://github.com/deo-haneesh/city_pulse/blob/main/src/components/detail/RiskTrendChart.jsx"
click node_recommendations "https://github.com/deo-haneesh/city_pulse/blob/main/src/components/detail/RecommendationCard.jsx"
click node_header "https://github.com/deo-haneesh/city_pulse/blob/main/src/components/header/CommandHeader.jsx"
click node_stream_controls "https://github.com/deo-haneesh/city_pulse/blob/main/src/components/header/LiveStreamControls.jsx"
click node_manual_report "https://github.com/deo-haneesh/city_pulse/blob/main/src/components/header/ManualReportModal.jsx"
click node_data_import "https://github.com/deo-haneesh/city_pulse/blob/main/src/components/header/DataImportModal.jsx"
click node_replay "https://github.com/deo-haneesh/city_pulse/blob/main/src/components/header/ReplayControls.jsx"
click node_auth "https://github.com/deo-haneesh/city_pulse/blob/main/src/components/header/SupabaseAuthControl.jsx"
click node_context "https://github.com/deo-haneesh/city_pulse/blob/main/src/context/DisasterContext.jsx"
click node_scoring "https://github.com/deo-haneesh/city_pulse/blob/main/src/utils/scoringEngine.js"
click node_regions "https://github.com/deo-haneesh/city_pulse/blob/main/src/data/realWorldRegions.js"
click node_realworld "https://github.com/deo-haneesh/city_pulse/blob/main/src/services/realWorldDataService.js"
click node_supabase_service "https://github.com/deo-haneesh/city_pulse/blob/main/src/services/supabaseDataService.js"
click node_supabase_client "https://github.com/deo-haneesh/city_pulse/blob/main/src/services/supabaseClient.js"
click node_database "https://github.com/deo-haneesh/city_pulse/blob/main/supabase/migrations/202608230001_initial_schema.sql"
click node_create_report "https://github.com/deo-haneesh/city_pulse/blob/main/supabase/functions/create-report/index.ts"
click node_import_reports "https://github.com/deo-haneesh/city_pulse/blob/main/supabase/functions/import-reports/index.ts"
click node_ingest_telemetry "https://github.com/deo-haneesh/city_pulse/blob/main/supabase/functions/ingest-telemetry/index.ts"
click node_dispatch_resource "https://github.com/deo-haneesh/city_pulse/blob/main/supabase/functions/dispatch-resource/index.ts"
click node_server_scoring "https://github.com/deo-haneesh/city_pulse/blob/main/supabase/functions/_shared/scoring.ts"
click node_server_client "https://github.com/deo-haneesh/city_pulse/blob/main/supabase/functions/_shared/supabase.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_app,node_map,node_queue,node_feed,node_zone_detail,node_risk_chart,node_recommendations toneBlue
class node_header,node_stream_controls,node_manual_report,node_data_import,node_replay,node_auth toneAmber
class node_context,node_scoring,node_regions,node_realworld toneMint
class node_create_report,node_import_reports,node_ingest_telemetry,node_dispatch_resource,node_server_scoring,node_server_client toneRose
class node_supabase_service,node_supabase_client,node_database,node_operator,node_usgs,node_openmeteo,node_nasa toneIndigo
```

## Components

### Command Dashboard

- [Dashboard Shell](https://github.com/deo-haneesh/city_pulse/blob/main/src/App.jsx): `src/App.jsx`
- [Tactical Map](https://github.com/deo-haneesh/city_pulse/blob/main/src/components/map/CityMap.jsx): `src/components/map/CityMap.jsx`
- [Priority Queue](https://github.com/deo-haneesh/city_pulse/blob/main/src/components/queue/PriorityQueue.jsx): `src/components/queue/PriorityQueue.jsx`
- [Live Report Feed](https://github.com/deo-haneesh/city_pulse/blob/main/src/components/feed/LiveReportFeed.jsx): `src/components/feed/LiveReportFeed.jsx`
- [Zone Detail](https://github.com/deo-haneesh/city_pulse/blob/main/src/components/detail/ZoneDetailDrawer.jsx): `src/components/detail/ZoneDetailDrawer.jsx`
- [Risk Trend Chart](https://github.com/deo-haneesh/city_pulse/blob/main/src/components/detail/RiskTrendChart.jsx): `src/components/detail/RiskTrendChart.jsx`
- [Action Recommendations](https://github.com/deo-haneesh/city_pulse/blob/main/src/components/detail/RecommendationCard.jsx): `src/components/detail/RecommendationCard.jsx`

### Operator Controls

- [Command Header](https://github.com/deo-haneesh/city_pulse/blob/main/src/components/header/CommandHeader.jsx): `src/components/header/CommandHeader.jsx`
- [Stream Controls](https://github.com/deo-haneesh/city_pulse/blob/main/src/components/header/LiveStreamControls.jsx): `src/components/header/LiveStreamControls.jsx`
- [Manual Reports](https://github.com/deo-haneesh/city_pulse/blob/main/src/components/header/ManualReportModal.jsx): `src/components/header/ManualReportModal.jsx`
- [Report Import](https://github.com/deo-haneesh/city_pulse/blob/main/src/components/header/DataImportModal.jsx): `src/components/header/DataImportModal.jsx`
- [Scenario Replay](https://github.com/deo-haneesh/city_pulse/blob/main/src/components/header/ReplayControls.jsx): `src/components/header/ReplayControls.jsx`
- [Supabase Auth](https://github.com/deo-haneesh/city_pulse/blob/main/src/components/header/SupabaseAuthControl.jsx): `src/components/header/SupabaseAuthControl.jsx`

### Risk Intelligence

- [Disaster State](https://github.com/deo-haneesh/city_pulse/blob/main/src/context/DisasterContext.jsx): `src/context/DisasterContext.jsx`
- [Risk Scoring Engine](https://github.com/deo-haneesh/city_pulse/blob/main/src/utils/scoringEngine.js): `src/utils/scoringEngine.js`
- [Regional Sector Data](https://github.com/deo-haneesh/city_pulse/blob/main/src/data/realWorldRegions.js): `src/data/realWorldRegions.js`
- [Live Signal Ingestion](https://github.com/deo-haneesh/city_pulse/blob/main/src/services/realWorldDataService.js): `src/services/realWorldDataService.js`

### Supabase Functions

- [Create Report](https://github.com/deo-haneesh/city_pulse/blob/main/supabase/functions/create-report/index.ts): `supabase/functions/create-report/index.ts`
- [Import Reports](https://github.com/deo-haneesh/city_pulse/blob/main/supabase/functions/import-reports/index.ts): `supabase/functions/import-reports/index.ts`
- [Telemetry Ingestion](https://github.com/deo-haneesh/city_pulse/blob/main/supabase/functions/ingest-telemetry/index.ts): `supabase/functions/ingest-telemetry/index.ts`
- [Resource Dispatch](https://github.com/deo-haneesh/city_pulse/blob/main/supabase/functions/dispatch-resource/index.ts): `supabase/functions/dispatch-resource/index.ts`
- [Server Scoring](https://github.com/deo-haneesh/city_pulse/blob/main/supabase/functions/_shared/scoring.ts): `supabase/functions/_shared/scoring.ts`
- [Server Supabase Access](https://github.com/deo-haneesh/city_pulse/blob/main/supabase/functions/_shared/supabase.ts): `supabase/functions/_shared/supabase.ts`

### Data Services

- [Supabase Data Service](https://github.com/deo-haneesh/city_pulse/blob/main/src/services/supabaseDataService.js): `src/services/supabaseDataService.js`
- [Supabase Client](https://github.com/deo-haneesh/city_pulse/blob/main/src/services/supabaseClient.js): `src/services/supabaseClient.js`
- [Supabase Database](https://github.com/deo-haneesh/city_pulse/blob/main/supabase/migrations/202608230001_initial_schema.sql): `supabase/migrations/202608230001_initial_schema.sql`

### Other components

- **Emergency Operator**
- **USGS Feed**
- **Open-Meteo Feed**
- **NASA EONET Feed**

## Connections

- Emergency Operator → Dashboard Shell: uses (evidence: `README.md`)
- Dashboard Shell → Disaster State: provides state (evidence: `src/App.jsx`)
- Dashboard Shell → Command Header: renders (evidence: `src/App.jsx`)
- Dashboard Shell → Tactical Map: renders (evidence: `src/App.jsx`)
- Dashboard Shell → Priority Queue: renders (evidence: `src/App.jsx`)
- Dashboard Shell → Live Report Feed: renders (evidence: `src/App.jsx`)
- Dashboard Shell → Zone Detail: renders (evidence: `src/App.jsx`)
- Tactical Map → Disaster State: reads state (evidence: `src/components/map/CityMap.jsx`)
- Priority Queue → Disaster State: reads state (evidence: `src/components/queue/PriorityQueue.jsx`)
- Live Report Feed → Disaster State: reads state (evidence: `src/components/feed/LiveReportFeed.jsx`)
- Zone Detail → Disaster State: reads and acts (evidence: `src/components/detail/ZoneDetailDrawer.jsx`)
- Zone Detail → Risk Trend Chart: renders (evidence: `src/components/detail/ZoneDetailDrawer.jsx`)
- Zone Detail → Action Recommendations: renders (evidence: `src/components/detail/ZoneDetailDrawer.jsx`)
- Command Header → Disaster State: reads state (evidence: `src/components/header/CommandHeader.jsx`)
- Command Header → Stream Controls: renders (evidence: `src/components/header/CommandHeader.jsx`)
- Stream Controls → Manual Reports: opens (evidence: `src/components/header/LiveStreamControls.jsx`)
- Stream Controls → Report Import: opens (evidence: `src/components/header/LiveStreamControls.jsx`)
- Stream Controls → Scenario Replay: renders (evidence: `src/components/header/LiveStreamControls.jsx`)
- Stream Controls → Supabase Auth: renders (evidence: `src/components/header/LiveStreamControls.jsx`)
- Manual Reports → Disaster State: submits report (evidence: `src/components/header/ManualReportModal.jsx`)
- Report Import → Disaster State: imports reports (evidence: `src/components/header/DataImportModal.jsx`)
- Scenario Replay → Disaster State: controls replay (evidence: `src/components/header/ReplayControls.jsx`)
- Supabase Auth → Supabase Client: authenticates (evidence: `src/components/header/SupabaseAuthControl.jsx`)
- Disaster State → Regional Sector Data: selects region (evidence: `src/context/DisasterContext.jsx`)
- Disaster State → Live Signal Ingestion: requests live data (evidence: `src/context/DisasterContext.jsx`)
- Disaster State → Supabase Data Service: loads and invokes (evidence: `src/context/DisasterContext.jsx`)
- Disaster State → Risk Scoring Engine: calculates actions (evidence: `src/context/DisasterContext.jsx`)
- Live Signal Ingestion → USGS Feed: fetches events (evidence: `src/services/realWorldDataService.js`)
- Live Signal Ingestion → Open-Meteo Feed: fetches weather (evidence: `src/services/realWorldDataService.js`)
- Live Signal Ingestion → NASA EONET Feed: fetches hazards (evidence: `src/services/realWorldDataService.js`)
- Supabase Data Service → Supabase Client: queries through (evidence: `src/services/supabaseDataService.js`)
- Supabase Data Service → Supabase Database: reads and writes
- Supabase Data Service → Create Report: invokes function
- Supabase Data Service → Import Reports: invokes function
- Supabase Client → Supabase Database: connects
- Create Report → Server Scoring: uses (evidence: `supabase/functions/create-report/index.ts`)
- Create Report → Server Supabase Access: accesses data (evidence: `supabase/functions/create-report/index.ts`)
- Import Reports → Server Scoring: uses (evidence: `supabase/functions/import-reports/index.ts`)
- Import Reports → Server Supabase Access: accesses data (evidence: `supabase/functions/import-reports/index.ts`)
- Telemetry Ingestion → Server Scoring: uses (evidence: `supabase/functions/ingest-telemetry/index.ts`)
- Telemetry Ingestion → Server Supabase Access: accesses data (evidence: `supabase/functions/ingest-telemetry/index.ts`)
- Resource Dispatch → Server Scoring: uses (evidence: `supabase/functions/dispatch-resource/index.ts`)
- Resource Dispatch → Server Supabase Access: accesses data (evidence: `supabase/functions/dispatch-resource/index.ts`)
- Server Scoring → Supabase Database: updates risk state
- Server Supabase Access → Supabase Database: connects
- Zone Detail → Resource Dispatch: authorizes dispatch
