# khprateek/enterprise-supply-chain-inventory-optimization-hub architecture

> Architecture diagram of the GitHub repository khprateek/enterprise-supply-chain-inventory-optimization-hub, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/khprateek/enterprise-supply-chain-inventory-optimization-hub
- Repository: https://github.com/khprateek/enterprise-supply-chain-inventory-optimization-hub

## Overview

This repository is an analytical supply-chain data platform: it generates operational data, transforms it into a dimensional warehouse, and exposes analytics through Power BI. The principal workflow runs from generated Parquet data through Airflow orchestration and dbt models to the semantic model and dashboards. The tree also documents an optional PySpark/Dataproc path; sampled files show its session and BigQuery I/O utilities, but not substantive Spark transformation jobs, so those are not represented as a processing stage.

Main entry points: [`python/orchestrator.py`](https://github.com/khprateek/enterprise-supply-chain-inventory-optimization-hub/blob/main/python/orchestrator.py) (Generation orchestrator), [`orchestration/airflow/dags`](https://github.com/khprateek/enterprise-supply-chain-inventory-optimization-hub/tree/main/orchestration/airflow/dags) (Airflow DAGs), [`dbt/models/marts`](https://github.com/khprateek/enterprise-supply-chain-inventory-optimization-hub/tree/main/dbt/models/marts) (Dimensional marts), [`dbt/models/staging`](https://github.com/khprateek/enterprise-supply-chain-inventory-optimization-hub/tree/main/dbt/models/staging) (Staging models)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_generation["Data generation"]
  node_generator["Generation orchestrator<br/>[orchestrator.py]"]
  node_dimensions["Dimensions"]
  node_procurement["Procurement"]
  node_sales["Sales fulfillment<br/>[generate_sales.py]"]
  node_otherfacts["Operational facts"]
  node_raw["Raw Parquet"]
end

subgraph group_pipeline["ELT orchestration"]
  node_airflow["Airflow DAGs"]
end

subgraph group_modeling["Warehouse modeling"]
  node_staging["Staging models"]
  node_intermediate["Intermediate metrics"]
  node_marts["Dimensional marts"]
  node_product_snapshot["Product SCD2"]
end

subgraph group_spark["Spark integration"]
  node_spark_session["Spark session<br/>[spark_session.py]"]
  node_bq_io["BigQuery I/O<br/>[bigquery_io.py]"]
end

subgraph group_analytics["Power BI analytics"]
  node_semantic["Semantic model<br/>[model_schema.json]"]
  node_measures["DAX measures"]
  node_dashboards["Analytics pages"]
end

node_sources(("Source systems"))
node_gcs[("Cloud Storage")]
node_bigquery[("BigQuery warehouse")]
node_users(("Planners and executives"))
node_powerbi_service["Power BI service"]

node_sources -->|"simulates inputs"| node_generator
node_generator -->|"generates"| node_dimensions
node_generator -->|"generates"| node_procurement
node_generator -->|"generates"| node_sales
node_generator -->|"generates"| node_otherfacts
node_generator -->|"persists Parquet"| node_raw
node_airflow -->|"checks landing"| node_gcs
node_airflow -->|"syncs partitions"| node_bigquery
node_airflow -->|"runs dbt"| node_staging
node_staging -->|"feeds models"| node_intermediate
node_staging -->|"feeds models"| node_marts
node_intermediate -->|"feeds metrics"| node_marts
node_product_snapshot -->|"tracks product history"| node_marts
node_marts -->|"materializes in"| node_bigquery
node_airflow -->|"triggers refresh"| node_powerbi_service
node_bigquery -->|"provides warehouse data"| node_semantic
node_semantic -->|"defines calculations"| node_measures
node_semantic -->|"supports pages"| node_dashboards
node_users -->|"explores analytics"| node_dashboards
node_airflow -.->|"submits Spark jobs"| node_spark_session
node_spark_session -->|"enables BigQuery access"| node_bq_io
node_bq_io -.->|"reads and writes"| node_bigquery

click node_generator "https://github.com/khprateek/enterprise-supply-chain-inventory-optimization-hub/blob/main/python/orchestrator.py"
click node_dimensions "https://github.com/khprateek/enterprise-supply-chain-inventory-optimization-hub/blob/main/python/generate_dimensions.py"
click node_procurement "https://github.com/khprateek/enterprise-supply-chain-inventory-optimization-hub/blob/main/python/generate_procurement.py"
click node_sales "https://github.com/khprateek/enterprise-supply-chain-inventory-optimization-hub/blob/main/python/generate_sales.py"
click node_otherfacts "https://github.com/khprateek/enterprise-supply-chain-inventory-optimization-hub/tree/main/python"
click node_raw "https://github.com/khprateek/enterprise-supply-chain-inventory-optimization-hub/tree/main/data/raw"
click node_airflow "https://github.com/khprateek/enterprise-supply-chain-inventory-optimization-hub/tree/main/orchestration/airflow/dags"
click node_staging "https://github.com/khprateek/enterprise-supply-chain-inventory-optimization-hub/tree/main/dbt/models/staging"
click node_intermediate "https://github.com/khprateek/enterprise-supply-chain-inventory-optimization-hub/tree/main/dbt/models/intermediate"
click node_marts "https://github.com/khprateek/enterprise-supply-chain-inventory-optimization-hub/tree/main/dbt/models/marts"
click node_product_snapshot "https://github.com/khprateek/enterprise-supply-chain-inventory-optimization-hub/blob/main/dbt/snapshots/snap_dim_product_scd2.sql"
click node_spark_session "https://github.com/khprateek/enterprise-supply-chain-inventory-optimization-hub/blob/main/pyspark_jobs/utils/spark_session.py"
click node_bq_io "https://github.com/khprateek/enterprise-supply-chain-inventory-optimization-hub/blob/main/pyspark_jobs/utils/bigquery_io.py"
click node_semantic "https://github.com/khprateek/enterprise-supply-chain-inventory-optimization-hub/blob/main/powerbi/model_definitions/model_schema.json"
click node_measures "https://github.com/khprateek/enterprise-supply-chain-inventory-optimization-hub/tree/main/powerbi/measures"
click node_dashboards "https://github.com/khprateek/enterprise-supply-chain-inventory-optimization-hub/tree/main/docs/powerbi"

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_generator,node_dimensions,node_procurement,node_sales,node_otherfacts,node_raw toneBlue
class node_airflow,node_gcs,node_bigquery toneAmber
class node_staging,node_intermediate,node_marts,node_product_snapshot toneMint
class node_spark_session,node_bq_io toneRose
class node_semantic,node_measures,node_dashboards,node_sources,node_users,node_powerbi_service toneIndigo
```

## Components

### Data generation

- [Generation orchestrator](https://github.com/khprateek/enterprise-supply-chain-inventory-optimization-hub/blob/main/python/orchestrator.py): `python/orchestrator.py`
- [Dimensions](https://github.com/khprateek/enterprise-supply-chain-inventory-optimization-hub/blob/main/python/generate_dimensions.py): `python/generate_dimensions.py`
- [Procurement](https://github.com/khprateek/enterprise-supply-chain-inventory-optimization-hub/blob/main/python/generate_procurement.py): `python/generate_procurement.py`
- [Sales fulfillment](https://github.com/khprateek/enterprise-supply-chain-inventory-optimization-hub/blob/main/python/generate_sales.py): `python/generate_sales.py`
- [Operational facts](https://github.com/khprateek/enterprise-supply-chain-inventory-optimization-hub/tree/main/python): `python`
- [Raw Parquet](https://github.com/khprateek/enterprise-supply-chain-inventory-optimization-hub/tree/main/data/raw): `data/raw`

### ELT orchestration

- [Airflow DAGs](https://github.com/khprateek/enterprise-supply-chain-inventory-optimization-hub/tree/main/orchestration/airflow/dags): `orchestration/airflow/dags`

### Warehouse modeling

- [Staging models](https://github.com/khprateek/enterprise-supply-chain-inventory-optimization-hub/tree/main/dbt/models/staging): `dbt/models/staging`
- [Intermediate metrics](https://github.com/khprateek/enterprise-supply-chain-inventory-optimization-hub/tree/main/dbt/models/intermediate): `dbt/models/intermediate`
- [Dimensional marts](https://github.com/khprateek/enterprise-supply-chain-inventory-optimization-hub/tree/main/dbt/models/marts): `dbt/models/marts`
- [Product SCD2](https://github.com/khprateek/enterprise-supply-chain-inventory-optimization-hub/blob/main/dbt/snapshots/snap_dim_product_scd2.sql): `dbt/snapshots/snap_dim_product_scd2.sql`

### Spark integration

- [Spark session](https://github.com/khprateek/enterprise-supply-chain-inventory-optimization-hub/blob/main/pyspark_jobs/utils/spark_session.py): `pyspark_jobs/utils/spark_session.py`
- [BigQuery I/O](https://github.com/khprateek/enterprise-supply-chain-inventory-optimization-hub/blob/main/pyspark_jobs/utils/bigquery_io.py): `pyspark_jobs/utils/bigquery_io.py`

### Power BI analytics

- [Semantic model](https://github.com/khprateek/enterprise-supply-chain-inventory-optimization-hub/blob/main/powerbi/model_definitions/model_schema.json): `powerbi/model_definitions/model_schema.json`
- [DAX measures](https://github.com/khprateek/enterprise-supply-chain-inventory-optimization-hub/tree/main/powerbi/measures): `powerbi/measures`
- [Analytics pages](https://github.com/khprateek/enterprise-supply-chain-inventory-optimization-hub/tree/main/docs/powerbi): `docs/powerbi`

### Other components

- **Source systems**
- **Cloud Storage**
- **BigQuery warehouse**
- **Planners and executives**
- **Power BI service**

## Connections

- Source systems → Generation orchestrator: simulates inputs
- Generation orchestrator → Dimensions: generates
- Generation orchestrator → Procurement: generates
- Generation orchestrator → Sales fulfillment: generates
- Generation orchestrator → Operational facts: generates
- Generation orchestrator → Raw Parquet: persists Parquet
- Airflow DAGs → Cloud Storage: checks landing
- Airflow DAGs → BigQuery warehouse: syncs partitions
- Airflow DAGs → Staging models: runs dbt
- Staging models → Intermediate metrics: feeds models
- Staging models → Dimensional marts: feeds models
- Intermediate metrics → Dimensional marts: feeds metrics
- Product SCD2 → Dimensional marts: tracks product history
- Dimensional marts → BigQuery warehouse: materializes in
- Airflow DAGs → Power BI service: triggers refresh
- BigQuery warehouse → Semantic model: provides warehouse data
- Semantic model → DAX measures: defines calculations
- Semantic model → Analytics pages: supports pages
- Planners and executives → Analytics pages: explores analytics
- Airflow DAGs → Spark session: submits Spark jobs
- Spark session → BigQuery I/O: enables BigQuery access
- BigQuery I/O → BigQuery warehouse: reads and writes
