# yashkumawat143/city_pulse architecture

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

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

## Overview

CityPulse’s current React/FastAPI application monitors simulated civic signals, derives anomalies and possible multi-signal events, and presents live city intelligence through dashboard views. The main user workflow runs from authenticated access, through REST/WebSocket snapshot updates, to dashboard, event, alert, source, and simulation views; users can also inspect events. The backend excerpt identifies its simulated-data analytics stages, while the README documents broader capabilities. Backend internals share one source file; wiring beyond the sampled excerpts is represented only where documented.

Main entry points: [`CityPulse/frontend/src/App.jsx`](https://github.com/yashkumawat143/city_pulse/blob/main/CityPulse/frontend/src/App.jsx) (App routing), [`CityPulse/backend/main.py`](https://github.com/yashkumawat143/city_pulse/blob/main/CityPulse/backend/main.py) (REST and WebSocket API), [`CityPulse/frontend/src/hooks/useCityPulse.js`](https://github.com/yashkumawat143/city_pulse/blob/main/CityPulse/frontend/src/hooks/useCityPulse.js) (Live data hook), [`CityPulse/frontend/src/pages/Auth.jsx`](https://github.com/yashkumawat143/city_pulse/blob/main/CityPulse/frontend/src/pages/Auth.jsx) (Sign-in views)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_backend["Civic intelligence backend"]
  node_simulator["Signal simulator<br/>[main.py]"]
  node_anomaly["Anomaly analysis<br/>[main.py]"]
  node_multisignal["Event analysis<br/>[main.py]"]
  node_healthrisk["Health and risk<br/>[main.py]"]
  node_replay["Replay history<br/>[main.py]"]
  node_api["REST and WebSocket API<br/>[main.py]"]
end

subgraph group_client["Web application"]
  node_app["App routing<br/>[App.jsx]"]
  node_authpage["Sign-in views<br/>[Auth.jsx]"]
  node_citypulsehook["Live data hook<br/>[useCityPulse.js]"]
  node_apiclient["API client<br/>[api.js]"]
  node_eventdrawer["Event inspection<br/>[EventDrawer.jsx]"]
end

subgraph group_views["Monitoring views"]
  node_dashboard["City dashboard<br/>[Dashboard.jsx]"]
  node_events["Event monitoring<br/>[Events.jsx]"]
  node_anomalies["Anomaly view<br/>[Anomalies.jsx]"]
  node_alerts["Alert view<br/>[Alerts.jsx]"]
  node_sources["Source status<br/>[Sources.jsx]"]
  node_simulation["Scenario simulation<br/>[Simulation.jsx]"]
end

subgraph group_identity["Browser identity"]
  node_authlib["Local account logic<br/>[auth.js]"]
end

node_user(("CityPulse user"))
node_browserstore[("Browser local storage")]

node_user -->|"opens"| node_app
node_app -->|"routes"| node_authpage
node_authpage -->|"authenticates"| node_authlib
node_authlib -->|"reads and writes"| node_browserstore
node_app -->|"starts monitoring"| node_citypulsehook
node_citypulsehook -->|"requests data"| node_apiclient
node_apiclient -->|"calls REST and WebSocket"| node_api
node_simulator -->|"generates signals for"| node_anomaly
node_simulator -->|"generates signals for"| node_multisignal
node_anomaly -->|"serves findings through"| node_api
node_multisignal -->|"serves events through"| node_api
node_healthrisk -->|"serves scores through"| node_api
node_replay -->|"serves replay through"| node_api
node_api -->|"streams and returns snapshots"| node_citypulsehook
node_app -->|"routes snapshot to"| node_dashboard
node_app -->|"routes snapshot to"| node_events
node_app -->|"routes snapshot to"| node_anomalies
node_app -->|"routes snapshot to"| node_alerts
node_app -->|"routes snapshot to"| node_sources
node_app -->|"routes snapshot to"| node_simulation
node_app -->|"opens selected event"| node_eventdrawer
node_user -->|"monitors"| node_dashboard

click node_simulator "https://github.com/yashkumawat143/city_pulse/blob/main/CityPulse/backend/main.py"
click node_anomaly "https://github.com/yashkumawat143/city_pulse/blob/main/CityPulse/backend/main.py"
click node_multisignal "https://github.com/yashkumawat143/city_pulse/blob/main/CityPulse/backend/main.py"
click node_healthrisk "https://github.com/yashkumawat143/city_pulse/blob/main/CityPulse/backend/main.py"
click node_replay "https://github.com/yashkumawat143/city_pulse/blob/main/CityPulse/backend/main.py"
click node_api "https://github.com/yashkumawat143/city_pulse/blob/main/CityPulse/backend/main.py"
click node_app "https://github.com/yashkumawat143/city_pulse/blob/main/CityPulse/frontend/src/App.jsx"
click node_authpage "https://github.com/yashkumawat143/city_pulse/blob/main/CityPulse/frontend/src/pages/Auth.jsx"
click node_authlib "https://github.com/yashkumawat143/city_pulse/blob/main/CityPulse/frontend/src/lib/auth.js"
click node_citypulsehook "https://github.com/yashkumawat143/city_pulse/blob/main/CityPulse/frontend/src/hooks/useCityPulse.js"
click node_apiclient "https://github.com/yashkumawat143/city_pulse/blob/main/CityPulse/frontend/src/lib/api.js"
click node_dashboard "https://github.com/yashkumawat143/city_pulse/blob/main/CityPulse/frontend/src/pages/Dashboard.jsx"
click node_events "https://github.com/yashkumawat143/city_pulse/blob/main/CityPulse/frontend/src/pages/Events.jsx"
click node_anomalies "https://github.com/yashkumawat143/city_pulse/blob/main/CityPulse/frontend/src/pages/Anomalies.jsx"
click node_alerts "https://github.com/yashkumawat143/city_pulse/blob/main/CityPulse/frontend/src/pages/Alerts.jsx"
click node_sources "https://github.com/yashkumawat143/city_pulse/blob/main/CityPulse/frontend/src/pages/Sources.jsx"
click node_simulation "https://github.com/yashkumawat143/city_pulse/blob/main/CityPulse/frontend/src/pages/Simulation.jsx"
click node_eventdrawer "https://github.com/yashkumawat143/city_pulse/blob/main/CityPulse/frontend/src/components/EventDrawer.jsx"

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_simulator,node_anomaly,node_multisignal,node_healthrisk,node_replay,node_api,node_user toneBlue
class node_app,node_authpage,node_citypulsehook,node_apiclient,node_eventdrawer,node_browserstore toneAmber
class node_dashboard,node_events,node_anomalies,node_alerts,node_sources,node_simulation toneMint
class node_authlib toneRose
```

## Components

### Civic intelligence backend

- [Signal simulator](https://github.com/yashkumawat143/city_pulse/blob/main/CityPulse/backend/main.py): `CityPulse/backend/main.py`
- [Anomaly analysis](https://github.com/yashkumawat143/city_pulse/blob/main/CityPulse/backend/main.py): `CityPulse/backend/main.py`
- [Event analysis](https://github.com/yashkumawat143/city_pulse/blob/main/CityPulse/backend/main.py): `CityPulse/backend/main.py`
- [Health and risk](https://github.com/yashkumawat143/city_pulse/blob/main/CityPulse/backend/main.py): `CityPulse/backend/main.py`
- [Replay history](https://github.com/yashkumawat143/city_pulse/blob/main/CityPulse/backend/main.py): `CityPulse/backend/main.py`
- [REST and WebSocket API](https://github.com/yashkumawat143/city_pulse/blob/main/CityPulse/backend/main.py): `CityPulse/backend/main.py`

### Web application

- [App routing](https://github.com/yashkumawat143/city_pulse/blob/main/CityPulse/frontend/src/App.jsx): `CityPulse/frontend/src/App.jsx`
- [Sign-in views](https://github.com/yashkumawat143/city_pulse/blob/main/CityPulse/frontend/src/pages/Auth.jsx): `CityPulse/frontend/src/pages/Auth.jsx`
- [Live data hook](https://github.com/yashkumawat143/city_pulse/blob/main/CityPulse/frontend/src/hooks/useCityPulse.js): `CityPulse/frontend/src/hooks/useCityPulse.js`
- [API client](https://github.com/yashkumawat143/city_pulse/blob/main/CityPulse/frontend/src/lib/api.js): `CityPulse/frontend/src/lib/api.js`
- [Event inspection](https://github.com/yashkumawat143/city_pulse/blob/main/CityPulse/frontend/src/components/EventDrawer.jsx): `CityPulse/frontend/src/components/EventDrawer.jsx`

### Monitoring views

- [City dashboard](https://github.com/yashkumawat143/city_pulse/blob/main/CityPulse/frontend/src/pages/Dashboard.jsx): `CityPulse/frontend/src/pages/Dashboard.jsx`
- [Event monitoring](https://github.com/yashkumawat143/city_pulse/blob/main/CityPulse/frontend/src/pages/Events.jsx): `CityPulse/frontend/src/pages/Events.jsx`
- [Anomaly view](https://github.com/yashkumawat143/city_pulse/blob/main/CityPulse/frontend/src/pages/Anomalies.jsx): `CityPulse/frontend/src/pages/Anomalies.jsx`
- [Alert view](https://github.com/yashkumawat143/city_pulse/blob/main/CityPulse/frontend/src/pages/Alerts.jsx): `CityPulse/frontend/src/pages/Alerts.jsx`
- [Source status](https://github.com/yashkumawat143/city_pulse/blob/main/CityPulse/frontend/src/pages/Sources.jsx): `CityPulse/frontend/src/pages/Sources.jsx`
- [Scenario simulation](https://github.com/yashkumawat143/city_pulse/blob/main/CityPulse/frontend/src/pages/Simulation.jsx): `CityPulse/frontend/src/pages/Simulation.jsx`

### Browser identity

- [Local account logic](https://github.com/yashkumawat143/city_pulse/blob/main/CityPulse/frontend/src/lib/auth.js): `CityPulse/frontend/src/lib/auth.js`

### Other components

- **CityPulse user**
- **Browser local storage**

## Connections

- CityPulse user → App routing: opens
- App routing → Sign-in views: routes
- Sign-in views → Local account logic: authenticates
- Local account logic → Browser local storage: reads and writes
- App routing → Live data hook: starts monitoring
- Live data hook → API client: requests data
- API client → REST and WebSocket API: calls REST and WebSocket
- Signal simulator → Anomaly analysis: generates signals for
- Signal simulator → Event analysis: generates signals for
- Anomaly analysis → REST and WebSocket API: serves findings through
- Event analysis → REST and WebSocket API: serves events through
- Health and risk → REST and WebSocket API: serves scores through
- Replay history → REST and WebSocket API: serves replay through
- REST and WebSocket API → Live data hook: streams and returns snapshots
- App routing → City dashboard: routes snapshot to
- App routing → Event monitoring: routes snapshot to
- App routing → Anomaly view: routes snapshot to
- App routing → Alert view: routes snapshot to
- App routing → Source status: routes snapshot to
- App routing → Scenario simulation: routes snapshot to
- App routing → Event inspection: opens selected event
- CityPulse user → City dashboard: monitors
