# mubashirmian/dwh_iba_ architecture

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

- Interactive diagram: https://gitdiagram.com/mubashirmian/dwh_iba_
- Repository: https://github.com/mubashirmian/dwh_iba_

## Overview

This repository implements a pharmaceutical cold-chain data warehouse and Sales & Demand Intelligence mart. Its principal workflow lands source files in Bronze, validates the landing, transforms data through dbt Silver and Gold, and runs dbt tests; Airflow orders those stages. Gold supports sales, hospital-demand, and inventory analysis, while benchmark, verification, and Prometheus/Grafana observability are additional capabilities. The workflow and capabilities are described in the README; unsampled dbt models and service wiring are represented only at subsystem level.

Main entry points: [`dags/dag_mart_sdi.py`](https://github.com/mubashirmian/dwh_iba_/blob/master/dags/dag_mart_sdi.py) (Airflow DAG), [`dbt/models/gold`](https://github.com/mubashirmian/dwh_iba_/tree/master/dbt/models/gold) (Gold star schema), [`scripts/load_bronze.py`](https://github.com/mubashirmian/dwh_iba_/blob/master/scripts/load_bronze.py) (Bronze loader), [`dbt/models/silver`](https://github.com/mubashirmian/dwh_iba_/tree/master/dbt/models/silver) (Silver transformations)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_orchestration["Orchestration"]
  node_airflow["Airflow DAG<br/>[dag_mart_sdi.py]"]
end

subgraph group_ingestion["Ingestion"]
  node_loader["Bronze loader<br/>[load_bronze.py]"]
  node_bronze[("Bronze tables")]
  node_bronze_check["Bronze validation<br/>[check_bronze.py]"]
  node_batch_generator["Batch generator"]
end

subgraph group_warehouse["Warehouse Modeling"]
  node_silver["Silver transformations"]
  node_gold[("Gold star schema")]
  node_dbt_tests["dbt data tests<br/>[schema.yml]"]
end

subgraph group_analytics["Analytics and Observability"]
  node_sdi_verification["SDI verification<br/>[verify_sdi.py]"]
  node_benchmarks["Gold benchmarks<br/>[run_bench.py]"]
  node_gold_optimizer["Gold optimization<br/>[optimize_gold.py]"]
  node_metric_publisher["Metric publisher"]
  node_pushgateway["Pushgateway"]
  node_prometheus["Prometheus<br/>[prometheus.yml]"]
  node_grafana["Grafana dashboards"]
end

node_source_files["Source data"]

node_source_files -->|"loads"| node_loader
node_airflow -->|"runs"| node_loader
node_loader -->|"lands data"| node_bronze
node_airflow -->|"runs next"| node_bronze_check
node_bronze_check -->|"validates"| node_bronze
node_airflow -->|"runs dbt"| node_silver
node_silver -->|"transforms"| node_bronze
node_airflow -->|"runs dbt"| node_gold
node_gold -->|"models from"| node_silver
node_airflow -->|"tests after build"| node_dbt_tests
node_batch_generator -.->|"generates batches"| node_source_files
node_sdi_verification -.->|"verifies source"| node_source_files
node_benchmarks -->|"queries"| node_gold
node_gold_optimizer -->|"indexes and benchmarks"| node_gold
node_metric_publisher -->|"pushes metrics"| node_pushgateway
node_prometheus -->|"scrapes"| node_pushgateway
node_grafana -->|"visualizes metrics"| node_prometheus

click node_airflow "https://github.com/mubashirmian/dwh_iba_/blob/master/dags/dag_mart_sdi.py"
click node_loader "https://github.com/mubashirmian/dwh_iba_/blob/master/scripts/load_bronze.py"
click node_bronze "https://github.com/mubashirmian/dwh_iba_/blob/master/sql/ddl/02_bronze_tables.sql"
click node_bronze_check "https://github.com/mubashirmian/dwh_iba_/blob/master/scripts/check_bronze.py"
click node_silver "https://github.com/mubashirmian/dwh_iba_/tree/master/dbt/models/silver"
click node_gold "https://github.com/mubashirmian/dwh_iba_/tree/master/dbt/models/gold"
click node_dbt_tests "https://github.com/mubashirmian/dwh_iba_/blob/master/dbt/models/schema.yml"
click node_batch_generator "https://github.com/mubashirmian/dwh_iba_/blob/master/scripts/generate_synthetic_batch.py"
click node_sdi_verification "https://github.com/mubashirmian/dwh_iba_/blob/master/scripts/verify_sdi.py"
click node_benchmarks "https://github.com/mubashirmian/dwh_iba_/blob/master/scripts/run_bench.py"
click node_gold_optimizer "https://github.com/mubashirmian/dwh_iba_/blob/master/scripts/optimize_gold.py"
click node_metric_publisher "https://github.com/mubashirmian/dwh_iba_/blob/master/scripts/push_all_metrics.py"
click node_prometheus "https://github.com/mubashirmian/dwh_iba_/blob/master/config/prometheus/prometheus.yml"
click node_grafana "https://github.com/mubashirmian/dwh_iba_/tree/master/config/grafana/dashboards"

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_airflow toneBlue
class node_loader,node_bronze,node_bronze_check,node_batch_generator toneAmber
class node_silver,node_gold,node_dbt_tests toneMint
class node_sdi_verification,node_benchmarks,node_gold_optimizer,node_metric_publisher,node_pushgateway,node_prometheus,node_grafana toneRose
class node_source_files toneIndigo
```

## Components

### Orchestration

- [Airflow DAG](https://github.com/mubashirmian/dwh_iba_/blob/master/dags/dag_mart_sdi.py): `dags/dag_mart_sdi.py`

### Ingestion

- [Bronze loader](https://github.com/mubashirmian/dwh_iba_/blob/master/scripts/load_bronze.py): `scripts/load_bronze.py`
- [Bronze tables](https://github.com/mubashirmian/dwh_iba_/blob/master/sql/ddl/02_bronze_tables.sql): `sql/ddl/02_bronze_tables.sql`
- [Bronze validation](https://github.com/mubashirmian/dwh_iba_/blob/master/scripts/check_bronze.py): `scripts/check_bronze.py`
- [Batch generator](https://github.com/mubashirmian/dwh_iba_/blob/master/scripts/generate_synthetic_batch.py): `scripts/generate_synthetic_batch.py`

### Warehouse Modeling

- [Silver transformations](https://github.com/mubashirmian/dwh_iba_/tree/master/dbt/models/silver): `dbt/models/silver`
- [Gold star schema](https://github.com/mubashirmian/dwh_iba_/tree/master/dbt/models/gold): `dbt/models/gold`
- [dbt data tests](https://github.com/mubashirmian/dwh_iba_/blob/master/dbt/models/schema.yml): `dbt/models/schema.yml`

### Analytics and Observability

- [SDI verification](https://github.com/mubashirmian/dwh_iba_/blob/master/scripts/verify_sdi.py): `scripts/verify_sdi.py`
- [Gold benchmarks](https://github.com/mubashirmian/dwh_iba_/blob/master/scripts/run_bench.py): `scripts/run_bench.py`
- [Gold optimization](https://github.com/mubashirmian/dwh_iba_/blob/master/scripts/optimize_gold.py): `scripts/optimize_gold.py`
- [Metric publisher](https://github.com/mubashirmian/dwh_iba_/blob/master/scripts/push_all_metrics.py): `scripts/push_all_metrics.py`
- **Pushgateway**
- [Prometheus](https://github.com/mubashirmian/dwh_iba_/blob/master/config/prometheus/prometheus.yml): `config/prometheus/prometheus.yml`
- [Grafana dashboards](https://github.com/mubashirmian/dwh_iba_/tree/master/config/grafana/dashboards): `config/grafana/dashboards`

### Other components

- **Source data**

## Connections

- Source data → Bronze loader: loads (evidence: `README.md`)
- Airflow DAG → Bronze loader: runs (evidence: `dags/dag_mart_sdi.py`)
- Bronze loader → Bronze tables: lands data (evidence: `README.md`)
- Airflow DAG → Bronze validation: runs next (evidence: `dags/dag_mart_sdi.py`)
- Bronze validation → Bronze tables: validates (evidence: `scripts/check_bronze.py`)
- Airflow DAG → Silver transformations: runs dbt (evidence: `dags/dag_mart_sdi.py`)
- Silver transformations → Bronze tables: transforms (evidence: `README.md`)
- Airflow DAG → Gold star schema: runs dbt (evidence: `dags/dag_mart_sdi.py`)
- Gold star schema → Silver transformations: models from (evidence: `README.md`)
- Airflow DAG → dbt data tests: tests after build (evidence: `dags/dag_mart_sdi.py`)
- Batch generator → Source data: generates batches
- SDI verification → Source data: verifies source
- Gold benchmarks → Gold star schema: queries (evidence: `scripts/run_bench.py`)
- Gold optimization → Gold star schema: indexes and benchmarks (evidence: `scripts/optimize_gold.py`)
- Metric publisher → Pushgateway: pushes metrics (evidence: `scripts/push_all_metrics.py`)
- Prometheus → Pushgateway: scrapes (evidence: `README.md`)
- Grafana dashboards → Prometheus: visualizes metrics (evidence: `README.md`)
