# sayedelmasry2/real-time-big-data-platform architecture

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

- Interactive diagram: https://gitdiagram.com/sayedelmasry2/real-time-big-data-platform
- Repository: https://github.com/sayedelmasry2/real-time-big-data-platform

## Overview

This repository implements a local real-time medallion lakehouse: synthetic and external data enter through batch or Kafka ingestion, land in Bronze, are conformed in Silver, and feed Gold analytics, reconciliation, and Power BI exports. Airflow schedules the pipeline runner, which owns the staged transformation and quality workflow. The README documents Trino, dbt, and observability capabilities; where their wiring is not shown in sampled code, relationships are documented rather than inferred. Some ingestion, streaming, and serving paths are represented at subsystem level because their implementation was not sampled.

Main entry points: [`src/services/pipeline_runner.py`](https://github.com/sayedelmasry2/real-time-big-data-platform/blob/main/src/services/pipeline_runner.py) (Pipeline Runner), [`src/lakehouse/catalog.py`](https://github.com/sayedelmasry2/real-time-big-data-platform/blob/main/src/lakehouse/catalog.py) (Iceberg Catalog), [`src/streaming/stream_consumer.py`](https://github.com/sayedelmasry2/real-time-big-data-platform/blob/main/src/streaming/stream_consumer.py) (Stream Consumer), [`src/lakehouse/bronze_ddl.py`](https://github.com/sayedelmasry2/real-time-big-data-platform/blob/main/src/lakehouse/bronze_ddl.py) (Bronze Tables)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ingest["Data Ingestion"]
  node_generators["Synthetic Generator<br/>[generator.py]"]
  node_extractors["External Extractors"]
  node_kafka["Kafka Backbone"]
  node_stream_consumer["Stream Consumer<br/>[stream_consumer.py]"]
  node_dlq["Dead Letter Queue"]
  node_archive["Raw Archiver<br/>[raw_archiver.py]"]
  node_spark_stream["Spark Order Stream<br/>[orders_stream.py]"]
end

subgraph group_lakehouse["Lakehouse Storage"]
  node_bronze[("Bronze Tables<br/>[bronze_ddl.py]")]
  node_catalog[("Iceberg Catalog<br/>[catalog.py]")]
end

subgraph group_processing["Pipeline Processing"]
  node_pipeline_runner["Pipeline Runner<br/>[pipeline_runner.py]"]
  node_silver["Silver Transformations<br/>[silver_layer.py]"]
  node_quality["Quality Gate<br/>[dq_runner.py]"]
  node_gold["Gold Aggregations"]
  node_dbt["dbt Transformations<br/>[dbt_runner.py]"]
end

subgraph group_analytics["Analytics and BI"]
  node_trino_client["Trino Client<br/>[trino_client.py]"]
  node_trino["Trino SQL Engine"]
  node_reconciliation["Financial Reconciliation<br/>[reconciliation.py]"]
  node_powerbi_export["Power BI Export"]
end

subgraph group_operations["Operations and Monitoring"]
  node_airflow["Airflow Scheduler"]
  node_metrics["Metrics Exporter"]
end

node_data_user(("Data Producer"))
node_object_storage[("Object Storage")]
node_powerbi["Power BI Reports"]
node_prometheus["Prometheus and Grafana"]

node_data_user -->|"generates data"| node_generators
node_generators -->|"publishes events"| node_kafka
node_data_user -.->|"requests source data"| node_extractors
node_extractors -->|"archives extracts"| node_object_storage
node_kafka -->|"delivers events"| node_stream_consumer
node_stream_consumer -->|"routes invalid records"| node_dlq
node_stream_consumer -->|"writes events"| node_bronze
node_stream_consumer -.->|"archives raw data"| node_archive
node_archive -->|"writes raw files"| node_object_storage
node_bronze -->|"registers tables"| node_catalog
node_airflow -->|"schedules pipeline"| node_pipeline_runner
node_pipeline_runner -->|"runs transformations"| node_silver
node_pipeline_runner -->|"runs quality checks"| node_quality
node_pipeline_runner -->|"runs aggregations"| node_gold
node_pipeline_runner -->|"runs dbt"| node_dbt
node_pipeline_runner -->|"runs audit"| node_reconciliation
node_pipeline_runner -->|"exports datasets"| node_powerbi_export
node_bronze -->|"conforms data"| node_silver
node_silver -->|"feeds marts"| node_gold
node_gold -->|"stores Iceberg tables"| node_catalog
node_silver -->|"reads and writes tables"| node_catalog
node_quality -->|"validates tables"| node_catalog
node_dbt -->|"transforms with"| node_trino
node_trino_client -->|"executes queries"| node_trino
node_reconciliation -->|"reads lakehouse data"| node_catalog
node_reconciliation -.->|"queries analytics"| node_trino_client
node_powerbi_export -->|"reads datasets"| node_catalog
node_powerbi_export -->|"serves exports"| node_powerbi
node_metrics -->|"exports metrics"| node_prometheus
node_metrics -->|"observes lakehouse"| node_catalog
node_metrics -->|"observes streaming"| node_stream_consumer
node_kafka -.->|"streams orders"| node_spark_stream
node_spark_stream -.->|"loads Bronze"| node_bronze

click node_generators "https://github.com/sayedelmasry2/real-time-big-data-platform/blob/main/data/generators/generator.py"
click node_extractors "https://github.com/sayedelmasry2/real-time-big-data-platform/tree/main/src/ingestion"
click node_stream_consumer "https://github.com/sayedelmasry2/real-time-big-data-platform/blob/main/src/streaming/stream_consumer.py"
click node_archive "https://github.com/sayedelmasry2/real-time-big-data-platform/blob/main/src/storage/raw_archiver.py"
click node_bronze "https://github.com/sayedelmasry2/real-time-big-data-platform/blob/main/src/lakehouse/bronze_ddl.py"
click node_catalog "https://github.com/sayedelmasry2/real-time-big-data-platform/blob/main/src/lakehouse/catalog.py"
click node_pipeline_runner "https://github.com/sayedelmasry2/real-time-big-data-platform/blob/main/src/services/pipeline_runner.py"
click node_silver "https://github.com/sayedelmasry2/real-time-big-data-platform/blob/main/src/transformations/silver_layer.py"
click node_quality "https://github.com/sayedelmasry2/real-time-big-data-platform/blob/main/src/quality/dq_runner.py"
click node_gold "https://github.com/sayedelmasry2/real-time-big-data-platform/blob/main/src/transformations/gold_aggregations.py"
click node_dbt "https://github.com/sayedelmasry2/real-time-big-data-platform/blob/main/src/transformations/dbt_runner.py"
click node_airflow "https://github.com/sayedelmasry2/real-time-big-data-platform/tree/main/airflow/dags"
click node_trino_client "https://github.com/sayedelmasry2/real-time-big-data-platform/blob/main/src/analytics/trino_client.py"
click node_reconciliation "https://github.com/sayedelmasry2/real-time-big-data-platform/blob/main/src/analytics/reconciliation.py"
click node_powerbi_export "https://github.com/sayedelmasry2/real-time-big-data-platform/blob/main/scripts/export_to_powerbi.py"
click node_metrics "https://github.com/sayedelmasry2/real-time-big-data-platform/blob/main/src/observability/metrics_exporter.py"
click node_spark_stream "https://github.com/sayedelmasry2/real-time-big-data-platform/blob/main/src/streaming/orders_stream.py"

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_generators,node_extractors,node_kafka,node_stream_consumer,node_dlq,node_archive,node_spark_stream toneBlue
class node_bronze,node_catalog,node_object_storage toneAmber
class node_pipeline_runner,node_silver,node_quality,node_gold,node_dbt toneMint
class node_trino_client,node_trino,node_reconciliation,node_powerbi_export toneRose
class node_airflow,node_metrics,node_data_user,node_powerbi,node_prometheus toneIndigo
```

## Components

### Data Ingestion

- [Synthetic Generator](https://github.com/sayedelmasry2/real-time-big-data-platform/blob/main/data/generators/generator.py): `data/generators/generator.py`
- [External Extractors](https://github.com/sayedelmasry2/real-time-big-data-platform/tree/main/src/ingestion): `src/ingestion`
- **Kafka Backbone**
- [Stream Consumer](https://github.com/sayedelmasry2/real-time-big-data-platform/blob/main/src/streaming/stream_consumer.py): `src/streaming/stream_consumer.py`
- **Dead Letter Queue**
- [Raw Archiver](https://github.com/sayedelmasry2/real-time-big-data-platform/blob/main/src/storage/raw_archiver.py): `src/storage/raw_archiver.py`
- [Spark Order Stream](https://github.com/sayedelmasry2/real-time-big-data-platform/blob/main/src/streaming/orders_stream.py): `src/streaming/orders_stream.py`

### Lakehouse Storage

- [Bronze Tables](https://github.com/sayedelmasry2/real-time-big-data-platform/blob/main/src/lakehouse/bronze_ddl.py): `src/lakehouse/bronze_ddl.py`
- [Iceberg Catalog](https://github.com/sayedelmasry2/real-time-big-data-platform/blob/main/src/lakehouse/catalog.py): `src/lakehouse/catalog.py`

### Pipeline Processing

- [Pipeline Runner](https://github.com/sayedelmasry2/real-time-big-data-platform/blob/main/src/services/pipeline_runner.py): `src/services/pipeline_runner.py`
- [Silver Transformations](https://github.com/sayedelmasry2/real-time-big-data-platform/blob/main/src/transformations/silver_layer.py): `src/transformations/silver_layer.py`
- [Quality Gate](https://github.com/sayedelmasry2/real-time-big-data-platform/blob/main/src/quality/dq_runner.py): `src/quality/dq_runner.py`
- [Gold Aggregations](https://github.com/sayedelmasry2/real-time-big-data-platform/blob/main/src/transformations/gold_aggregations.py): `src/transformations/gold_aggregations.py`
- [dbt Transformations](https://github.com/sayedelmasry2/real-time-big-data-platform/blob/main/src/transformations/dbt_runner.py): `src/transformations/dbt_runner.py`

### Analytics and BI

- [Trino Client](https://github.com/sayedelmasry2/real-time-big-data-platform/blob/main/src/analytics/trino_client.py): `src/analytics/trino_client.py`
- **Trino SQL Engine**
- [Financial Reconciliation](https://github.com/sayedelmasry2/real-time-big-data-platform/blob/main/src/analytics/reconciliation.py): `src/analytics/reconciliation.py`
- [Power BI Export](https://github.com/sayedelmasry2/real-time-big-data-platform/blob/main/scripts/export_to_powerbi.py): `scripts/export_to_powerbi.py`

### Operations and Monitoring

- [Airflow Scheduler](https://github.com/sayedelmasry2/real-time-big-data-platform/tree/main/airflow/dags): `airflow/dags`
- [Metrics Exporter](https://github.com/sayedelmasry2/real-time-big-data-platform/blob/main/src/observability/metrics_exporter.py): `src/observability/metrics_exporter.py`

### Other components

- **Data Producer**
- **Object Storage**
- **Power BI Reports**
- **Prometheus and Grafana**

## Connections

- Data Producer → Synthetic Generator: generates data
- Synthetic Generator → Kafka Backbone: publishes events
- Data Producer → External Extractors: requests source data
- External Extractors → Object Storage: archives extracts (evidence: `src/ingestion/dummyjson_extractor.py`)
- Kafka Backbone → Stream Consumer: delivers events
- Stream Consumer → Dead Letter Queue: routes invalid records (evidence: `src/streaming/stream_consumer.py`)
- Stream Consumer → Bronze Tables: writes events (evidence: `src/streaming/stream_consumer.py`)
- Stream Consumer → Raw Archiver: archives raw data
- Raw Archiver → Object Storage: writes raw files (evidence: `src/storage/raw_archiver.py`)
- Bronze Tables → Iceberg Catalog: registers tables (evidence: `src/lakehouse/bronze_ddl.py`)
- Airflow Scheduler → Pipeline Runner: schedules pipeline
- Pipeline Runner → Silver Transformations: runs transformations (evidence: `src/services/pipeline_runner.py`)
- Pipeline Runner → Quality Gate: runs quality checks (evidence: `src/services/pipeline_runner.py`)
- Pipeline Runner → Gold Aggregations: runs aggregations (evidence: `src/services/pipeline_runner.py`)
- Pipeline Runner → dbt Transformations: runs dbt (evidence: `src/services/pipeline_runner.py`)
- Pipeline Runner → Financial Reconciliation: runs audit (evidence: `src/services/pipeline_runner.py`)
- Pipeline Runner → Power BI Export: exports datasets (evidence: `src/services/pipeline_runner.py`)
- Bronze Tables → Silver Transformations: conforms data
- Silver Transformations → Gold Aggregations: feeds marts
- Gold Aggregations → Iceberg Catalog: stores Iceberg tables (evidence: `src/transformations/gold_aggregations.py`)
- Silver Transformations → Iceberg Catalog: reads and writes tables (evidence: `src/transformations/silver_layer.py`)
- Quality Gate → Iceberg Catalog: validates tables (evidence: `src/quality/dq_runner.py`)
- dbt Transformations → Trino SQL Engine: transforms with
- Trino Client → Trino SQL Engine: executes queries (evidence: `src/analytics/trino_client.py`)
- Financial Reconciliation → Iceberg Catalog: reads lakehouse data (evidence: `src/analytics/reconciliation.py`)
- Financial Reconciliation → Trino Client: queries analytics
- Power BI Export → Iceberg Catalog: reads datasets (evidence: `scripts/export_to_powerbi.py`)
- Power BI Export → Power BI Reports: serves exports
- Metrics Exporter → Prometheus and Grafana: exports metrics
- Metrics Exporter → Iceberg Catalog: observes lakehouse (evidence: `src/observability/metrics_exporter.py`)
- Metrics Exporter → Stream Consumer: observes streaming (evidence: `src/observability/metrics_exporter.py`)
- Kafka Backbone → Spark Order Stream: streams orders
- Spark Order Stream → Bronze Tables: loads Bronze
