Skip to main content

Architecture Decision Records

· 2 min read

This directory contains Architecture Decision Records (ADRs) for the CTA Public Transport Optimisation system. ADRs are generated by reverse-engineering the codebase as of 2026-03-12.

Index

ADRTitleStatus
ADR-001Apache Kafka as the Central Event BusAccepted
ADR-002Avro Schemas + Confluent Schema RegistryAccepted
ADR-003Kafka Connect JDBC Source for PostgreSQLAccepted
ADR-004Dual Stream Processing — Faust + KSQLAccepted
ADR-005Kafka REST Proxy for Weather ProducerAccepted
ADR-006Tornado Async Web Server for DashboardAccepted

System Architecture Overview

┌─────────────────────────────────────────────────────────────────────┐
│ PRODUCER LAYER │
│ │
│ simulation.py │
│ ├─ Line (Blue/Red/Green) │
│ │ ├─ Station ──────────────────► org.chicago.cta.station. │
│ │ │ (AvroProducer) arrivals.t001 │
│ │ └─ Turnstile ─────────────────► com.cta.stations. │
│ │ (AvroProducer) turnstile.entry │
│ └─ Weather ──────────────────────► org.chicago.cta.weather.v1 │
│ (REST Proxy HTTP POST) │
│ │
│ connector.py ──[JDBC Source]──► com.cta.stations.data.rawt001. │
│ (Kafka Connect) stations (from PostgreSQL) │
└────────────────────────────┬────────────────────────────────────────┘
│ Apache Kafka (+ Schema Registry)
┌────────────────────────────▼────────────────────────────────────────┐
│ STREAM PROCESSING LAYER │
│ │
│ faust_stream.py │
│ com.cta.stations.data.rawt001.stations │
│ ──[transform]──► org.chicago.cta.stations.table.v1t001 │
│ │
│ ksql.py │
│ com.cta.stations.turnstile.entry │
│ ──[GROUP BY station_id]──► TURNSTILE_SUMMARY (JSON) │
└────────────────────────────┬────────────────────────────────────────┘

┌────────────────────────────▼────────────────────────────────────────┐
│ CONSUMER / DASHBOARD LAYER │
│ │
│ server.py (Tornado, port 8888) │
│ KafkaConsumer × 4 ──► in-memory Weather + Lines state │
│ GET / ──► status.html │
└─────────────────────────────────────────────────────────────────────┘

Key Technology Choices

ConcernTechnologyADR
Event streamingApache Kafka (Confluent 5.2.2)ADR-001
Schema enforcementApache Avro + Confluent Schema RegistryADR-002
DB-to-Kafka ingestionKafka Connect JDBC SourceADR-003
Station transformationFaust (Python stream processor)ADR-004
Turnstile aggregationKSQLADR-004
HTTP-based produce pathKafka REST ProxyADR-005
Real-time web dashboardTornado async web serverADR-006
InfrastructureDocker Compose (single-broker dev cluster)ADR-001