# shubham39874/crypto-pipeline architecture

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

- Interactive diagram: https://gitdiagram.com/shubham39874/crypto-pipeline
- Repository: https://github.com/shubham39874/crypto-pipeline

## Overview

This repository is a real-time crypto market-data pipeline: it polls Yahoo Finance, publishes price events to Kafka, and runs several independent consumers for storage, validation, lakehouse processing, and telemetry. The Streamlit dashboard reads SQLite data for filtering, metrics, and charts. The README documents the Kafka/Docker setup and Medallion layers; sampled source shows the runtime calls and reads. Some README-described recovery and backpressure details are not independently verified in the excerpts.

Main entry points: [`lakehouse_consumer.py`](https://github.com/shubham39874/crypto-pipeline/blob/main/lakehouse_consumer.py) (Medallion Processor), [`obs_consumer.py`](https://github.com/shubham39874/crypto-pipeline/blob/main/obs_consumer.py) (Telemetry Consumer), [`producer.py`](https://github.com/shubham39874/crypto-pipeline/blob/main/producer.py) (Price Producer), [`db_consumer.py`](https://github.com/shubham39874/crypto-pipeline/blob/main/db_consumer.py) (Database Consumer)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ingest["Market Ingestion"]
  node_producer["Price Producer<br/>[producer.py]"]
end

subgraph group_stream["Kafka Stream"]
  node_topic["Crypto Topic"]
end

subgraph group_processing["Consumers and Quality"]
  node_consumer["Console Consumer<br/>[consumer.py]"]
  node_dbconsumer["Database Consumer<br/>[db_consumer.py]"]
  node_dqconsumer["Quality Consumer<br/>[dq_consumer.py]"]
  node_obsconsumer["Telemetry Consumer<br/>[obs_consumer.py]"]
  node_logs["Pipeline Logs<br/>[obs_consumer.py]"]
end

subgraph group_storage["SQLite Lakehouse"]
  node_lakehouse["Medallion Processor"]
  node_bronze[("Bronze Records")]
  node_silver[("Silver Records")]
  node_gold[("Gold Aggregates")]
  node_rawdb[("Raw Price Store<br/>[db_consumer.py]")]
  node_validateddb[("Validated Store<br/>[dq_consumer.py]")]
  node_monitoreddb[("Monitored Store<br/>[obs_consumer.py]")]
  node_sqlite[("SQLite Database")]
end

subgraph group_presentation["Dashboard"]
  node_dashboard["Streamlit Dashboard<br/>[dashboard.py]"]
end

node_market(("Yahoo Finance"))

node_market -->|"provides prices"| node_producer
node_producer -->|"publishes events"| node_topic
node_topic -->|"delivers events"| node_consumer
node_topic -->|"delivers events"| node_dbconsumer
node_topic -->|"delivers events"| node_dqconsumer
node_topic -->|"delivers events"| node_obsconsumer
node_topic -->|"delivers events"| node_lakehouse
node_dbconsumer -->|"writes records"| node_rawdb
node_dqconsumer -->|"writes valid records"| node_validateddb
node_obsconsumer -->|"writes records"| node_monitoreddb
node_obsconsumer -->|"logs telemetry"| node_logs
node_lakehouse -->|"stores raw events"| node_bronze
node_lakehouse -->|"writes parsed records"| node_silver
node_lakehouse -->|"updates aggregates"| node_gold
node_dashboard -->|"queries data"| node_sqlite
node_sqlite -.->|"contains table"| node_silver
node_sqlite -.->|"contains table"| node_rawdb
node_sqlite -.->|"contains table"| node_validateddb
node_sqlite -.->|"contains table"| node_monitoreddb

click node_producer "https://github.com/shubham39874/crypto-pipeline/blob/main/producer.py"
click node_consumer "https://github.com/shubham39874/crypto-pipeline/blob/main/consumer.py"
click node_dbconsumer "https://github.com/shubham39874/crypto-pipeline/blob/main/db_consumer.py"
click node_dqconsumer "https://github.com/shubham39874/crypto-pipeline/blob/main/dq_consumer.py"
click node_obsconsumer "https://github.com/shubham39874/crypto-pipeline/blob/main/obs_consumer.py"
click node_lakehouse "https://github.com/shubham39874/crypto-pipeline/blob/main/lakehouse_consumer.py"
click node_bronze "https://github.com/shubham39874/crypto-pipeline/blob/main/lakehouse_consumer.py"
click node_silver "https://github.com/shubham39874/crypto-pipeline/blob/main/lakehouse_consumer.py"
click node_gold "https://github.com/shubham39874/crypto-pipeline/blob/main/lakehouse_consumer.py"
click node_rawdb "https://github.com/shubham39874/crypto-pipeline/blob/main/db_consumer.py"
click node_validateddb "https://github.com/shubham39874/crypto-pipeline/blob/main/dq_consumer.py"
click node_monitoreddb "https://github.com/shubham39874/crypto-pipeline/blob/main/obs_consumer.py"
click node_logs "https://github.com/shubham39874/crypto-pipeline/blob/main/obs_consumer.py"
click node_dashboard "https://github.com/shubham39874/crypto-pipeline/blob/main/dashboard.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_producer toneBlue
class node_topic toneAmber
class node_consumer,node_dbconsumer,node_dqconsumer,node_obsconsumer,node_logs toneMint
class node_lakehouse,node_bronze,node_silver,node_gold,node_rawdb,node_validateddb,node_monitoreddb,node_sqlite toneRose
class node_dashboard,node_market toneIndigo
```

## Components

### Market Ingestion

- [Price Producer](https://github.com/shubham39874/crypto-pipeline/blob/main/producer.py): `producer.py`

### Kafka Stream

- **Crypto Topic**

### Consumers and Quality

- [Console Consumer](https://github.com/shubham39874/crypto-pipeline/blob/main/consumer.py): `consumer.py`
- [Database Consumer](https://github.com/shubham39874/crypto-pipeline/blob/main/db_consumer.py): `db_consumer.py`
- [Quality Consumer](https://github.com/shubham39874/crypto-pipeline/blob/main/dq_consumer.py): `dq_consumer.py`
- [Telemetry Consumer](https://github.com/shubham39874/crypto-pipeline/blob/main/obs_consumer.py): `obs_consumer.py`
- [Pipeline Logs](https://github.com/shubham39874/crypto-pipeline/blob/main/obs_consumer.py): `obs_consumer.py`

### SQLite Lakehouse

- [Medallion Processor](https://github.com/shubham39874/crypto-pipeline/blob/main/lakehouse_consumer.py): `lakehouse_consumer.py`
- [Bronze Records](https://github.com/shubham39874/crypto-pipeline/blob/main/lakehouse_consumer.py): `lakehouse_consumer.py`
- [Silver Records](https://github.com/shubham39874/crypto-pipeline/blob/main/lakehouse_consumer.py): `lakehouse_consumer.py`
- [Gold Aggregates](https://github.com/shubham39874/crypto-pipeline/blob/main/lakehouse_consumer.py): `lakehouse_consumer.py`
- [Raw Price Store](https://github.com/shubham39874/crypto-pipeline/blob/main/db_consumer.py): `db_consumer.py`
- [Validated Store](https://github.com/shubham39874/crypto-pipeline/blob/main/dq_consumer.py): `dq_consumer.py`
- [Monitored Store](https://github.com/shubham39874/crypto-pipeline/blob/main/obs_consumer.py): `obs_consumer.py`
- **SQLite Database**

### Dashboard

- [Streamlit Dashboard](https://github.com/shubham39874/crypto-pipeline/blob/main/dashboard.py): `dashboard.py`

### Other components

- **Yahoo Finance**

## Connections

- Yahoo Finance → Price Producer: provides prices (evidence: `producer.py`)
- Price Producer → Crypto Topic: publishes events (evidence: `producer.py`)
- Crypto Topic → Console Consumer: delivers events (evidence: `consumer.py`)
- Crypto Topic → Database Consumer: delivers events (evidence: `db_consumer.py`)
- Crypto Topic → Quality Consumer: delivers events (evidence: `dq_consumer.py`)
- Crypto Topic → Telemetry Consumer: delivers events (evidence: `obs_consumer.py`)
- Crypto Topic → Medallion Processor: delivers events (evidence: `lakehouse_consumer.py`)
- Database Consumer → Raw Price Store: writes records (evidence: `db_consumer.py`)
- Quality Consumer → Validated Store: writes valid records (evidence: `dq_consumer.py`)
- Telemetry Consumer → Monitored Store: writes records (evidence: `obs_consumer.py`)
- Telemetry Consumer → Pipeline Logs: logs telemetry (evidence: `obs_consumer.py`)
- Medallion Processor → Bronze Records: stores raw events (evidence: `lakehouse_consumer.py`)
- Medallion Processor → Silver Records: writes parsed records (evidence: `lakehouse_consumer.py`)
- Medallion Processor → Gold Aggregates: updates aggregates (evidence: `lakehouse_consumer.py`)
- Streamlit Dashboard → SQLite Database: queries data (evidence: `dashboard.py`)
- SQLite Database → Silver Records: contains table
- SQLite Database → Raw Price Store: contains table
- SQLite Database → Validated Store: contains table
- SQLite Database → Monitored Store: contains table
