# rakeshraja06/spa_9_urbancity architecture

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

- Interactive diagram: https://gitdiagram.com/rakeshraja06/spa_9_urbancity
- Repository: https://github.com/rakeshraja06/spa_9_urbancity

## Overview

UrbanPulse is a smart-city telemetry streaming and analytics platform. Its workflow begins with independent bus, traffic, air-quality, and meter producers publishing to Kafka; stream consumers enrich bus GPS, isolate priority traffic handling, validate bad payloads, and drive Flink incident alerts and Spark ward-energy and health-advisory outputs. The README documents capabilities beyond the excerpts, including the DLQ and Kafka cluster; those links are shown from documentation where appropriate. Source excerpts do not establish every runtime topic subscription, so unsupported wiring is omitted.

Main entry points: [`Source_code/KAFKA/docker-compose.yml`](https://github.com/rakeshraja06/spa_9_urbancity/blob/main/Source_code/KAFKA/docker-compose.yml) (Kafka Topics), [`Source_code/KAFKA/kafka_streams_bus_join.py`](https://github.com/rakeshraja06/spa_9_urbancity/blob/main/Source_code/KAFKA/kafka_streams_bus_join.py) (Bus Route Enrichment), [`Source_code/SPARK/health_advisory_sql.py`](https://github.com/rakeshraja06/spa_9_urbancity/blob/main/Source_code/SPARK/health_advisory_sql.py) (Health Advisory Analytics), [`Source_code/PRODUCER/bus_gps_producer.py`](https://github.com/rakeshraja06/spa_9_urbancity/blob/main/Source_code/PRODUCER/bus_gps_producer.py) (Bus GPS Producer)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ingest["Telemetry Ingestion"]
  node_busgps["Bus GPS Producer"]
  node_traffic["Traffic Producer"]
  node_air["Air Quality Producer"]
  node_meters["Smart Meter Producer"]
end

subgraph group_transport["Kafka Platform"]
  node_kafka[("Kafka Topics<br/>[docker-compose.yml]")]
  node_enrichment["Bus Route Enrichment"]
  node_schedule["Route Schedule<br/>[route_schedule.csv]"]
  node_dlq["DLQ Validator<br/>[dlq_validator.py]"]
end

subgraph group_realtime["Real-Time Processing"]
  node_priority["Priority Consumers"]
  node_flink["Incident Detection"]
end

subgraph group_analytics["Urban Analytics"]
  node_energy["Ward Energy Analytics"]
  node_health["Health Advisory Analytics"]
  node_zoneprofile["Zone Profile<br/>[zone_profile.csv]"]
end

node_operator(("City Operations"))

node_busgps -->|"publishes GPS"| node_kafka
node_traffic -->|"publishes signals"| node_kafka
node_air -->|"publishes AQI"| node_kafka
node_meters -->|"publishes readings"| node_kafka
node_enrichment -->|"reads and writes"| node_kafka
node_enrichment -->|"loads lookup"| node_schedule
node_priority -->|"consumes signals"| node_kafka
node_dlq -.->|"validates messages"| node_kafka
node_flink -.->|"detects incidents"| node_kafka
node_energy -->|"reads and outputs"| node_kafka
node_health -->|"reads and publishes"| node_kafka
node_health -->|"joins profile"| node_zoneprofile
node_kafka -.->|"supports city response"| node_operator

click node_busgps "https://github.com/rakeshraja06/spa_9_urbancity/blob/main/Source_code/PRODUCER/bus_gps_producer.py"
click node_traffic "https://github.com/rakeshraja06/spa_9_urbancity/blob/main/Source_code/PRODUCER/traffic_signals_producer.py"
click node_air "https://github.com/rakeshraja06/spa_9_urbancity/blob/main/Source_code/PRODUCER/air_quality_producer.py"
click node_meters "https://github.com/rakeshraja06/spa_9_urbancity/blob/main/Source_code/PRODUCER/smart_meter_producer.py"
click node_kafka "https://github.com/rakeshraja06/spa_9_urbancity/blob/main/Source_code/KAFKA/docker-compose.yml"
click node_enrichment "https://github.com/rakeshraja06/spa_9_urbancity/blob/main/Source_code/KAFKA/kafka_streams_bus_join.py"
click node_schedule "https://github.com/rakeshraja06/spa_9_urbancity/blob/main/Source_code/KAFKA/route_schedule.csv"
click node_dlq "https://github.com/rakeshraja06/spa_9_urbancity/blob/main/Source_code/KAFKA/dlq_validator.py"
click node_priority "https://github.com/rakeshraja06/spa_9_urbancity/blob/main/Source_code/CONSUMER/traffic_priority_consumer.py"
click node_flink "https://github.com/rakeshraja06/spa_9_urbancity/blob/main/Source_code/FLINK/urbanpulse_alerts.py"
click node_energy "https://github.com/rakeshraja06/spa_9_urbancity/blob/main/Source_code/SPARK/ward_energy_streaming.py"
click node_health "https://github.com/rakeshraja06/spa_9_urbancity/blob/main/Source_code/SPARK/health_advisory_sql.py"
click node_zoneprofile "https://github.com/rakeshraja06/spa_9_urbancity/blob/main/Source_code/SPARK/zone_profile.csv"

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_busgps,node_traffic,node_air,node_meters toneBlue
class node_kafka,node_enrichment,node_schedule,node_dlq toneAmber
class node_priority,node_flink toneMint
class node_energy,node_health,node_zoneprofile toneRose
class node_operator toneIndigo
```

## Components

### Telemetry Ingestion

- [Bus GPS Producer](https://github.com/rakeshraja06/spa_9_urbancity/blob/main/Source_code/PRODUCER/bus_gps_producer.py): `Source_code/PRODUCER/bus_gps_producer.py`
- [Traffic Producer](https://github.com/rakeshraja06/spa_9_urbancity/blob/main/Source_code/PRODUCER/traffic_signals_producer.py): `Source_code/PRODUCER/traffic_signals_producer.py`
- [Air Quality Producer](https://github.com/rakeshraja06/spa_9_urbancity/blob/main/Source_code/PRODUCER/air_quality_producer.py): `Source_code/PRODUCER/air_quality_producer.py`
- [Smart Meter Producer](https://github.com/rakeshraja06/spa_9_urbancity/blob/main/Source_code/PRODUCER/smart_meter_producer.py): `Source_code/PRODUCER/smart_meter_producer.py`

### Kafka Platform

- [Kafka Topics](https://github.com/rakeshraja06/spa_9_urbancity/blob/main/Source_code/KAFKA/docker-compose.yml): `Source_code/KAFKA/docker-compose.yml`
- [Bus Route Enrichment](https://github.com/rakeshraja06/spa_9_urbancity/blob/main/Source_code/KAFKA/kafka_streams_bus_join.py): `Source_code/KAFKA/kafka_streams_bus_join.py`
- [Route Schedule](https://github.com/rakeshraja06/spa_9_urbancity/blob/main/Source_code/KAFKA/route_schedule.csv): `Source_code/KAFKA/route_schedule.csv`
- [DLQ Validator](https://github.com/rakeshraja06/spa_9_urbancity/blob/main/Source_code/KAFKA/dlq_validator.py): `Source_code/KAFKA/dlq_validator.py`

### Real-Time Processing

- [Priority Consumers](https://github.com/rakeshraja06/spa_9_urbancity/blob/main/Source_code/CONSUMER/traffic_priority_consumer.py): `Source_code/CONSUMER/traffic_priority_consumer.py`
- [Incident Detection](https://github.com/rakeshraja06/spa_9_urbancity/blob/main/Source_code/FLINK/urbanpulse_alerts.py): `Source_code/FLINK/urbanpulse_alerts.py`

### Urban Analytics

- [Ward Energy Analytics](https://github.com/rakeshraja06/spa_9_urbancity/blob/main/Source_code/SPARK/ward_energy_streaming.py): `Source_code/SPARK/ward_energy_streaming.py`
- [Health Advisory Analytics](https://github.com/rakeshraja06/spa_9_urbancity/blob/main/Source_code/SPARK/health_advisory_sql.py): `Source_code/SPARK/health_advisory_sql.py`
- [Zone Profile](https://github.com/rakeshraja06/spa_9_urbancity/blob/main/Source_code/SPARK/zone_profile.csv): `Source_code/SPARK/zone_profile.csv`

### Other components

- **City Operations**

## Connections

- Bus GPS Producer → Kafka Topics: publishes GPS (evidence: `Source_code/PRODUCER/bus_gps_producer.py`)
- Traffic Producer → Kafka Topics: publishes signals (evidence: `README.md`)
- Air Quality Producer → Kafka Topics: publishes AQI (evidence: `Source_code/PRODUCER/air_quality_producer.py`)
- Smart Meter Producer → Kafka Topics: publishes readings (evidence: `README.md`)
- Bus Route Enrichment → Kafka Topics: reads and writes (evidence: `Source_code/KAFKA/kafka_streams_bus_join.py`)
- Bus Route Enrichment → Route Schedule: loads lookup (evidence: `Source_code/KAFKA/kafka_streams_bus_join.py`)
- Priority Consumers → Kafka Topics: consumes signals
- DLQ Validator → Kafka Topics: validates messages (evidence: `README.md`)
- Incident Detection → Kafka Topics: detects incidents (evidence: `README.md`)
- Ward Energy Analytics → Kafka Topics: reads and outputs (evidence: `Source_code/SPARK/ward_energy_streaming.py`)
- Health Advisory Analytics → Kafka Topics: reads and publishes (evidence: `Source_code/SPARK/health_advisory_sql.py`)
- Health Advisory Analytics → Zone Profile: joins profile (evidence: `Source_code/SPARK/health_advisory_sql.py`)
- Kafka Topics → City Operations: supports city response (evidence: `README.md`)
