# fabienbeaumontdm/portable-data-stack-airflow architecture

> Architecture diagram of the GitHub repository fabienbeaumontdm/portable-data-stack-airflow, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-22). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/fabienbeaumontdm/portable-data-stack-airflow
- Repository: https://github.com/fabienbeaumontdm/portable-data-stack-airflow

## Overview

##### Component Relationships and Data Flow
- Double lines: API/Service connections

##### Detailed Component Breakdown

For each major component, include sub-components:

Generator:
- Python scripts
- Data generation logic
- Export functionality

Airflow:
- DAG workflows (show the 5 main DAGs)
- Orchestration connections
- PostgreSQL metadata store

DBT:
- Sources
- Staging models
- Dimension models
- Fact models
- Tests

##### Additional Elements

Annotations for:
- Authentication points
- Data refresh frequencies
- Critical dependencies
- Testing points

## Diagram (Mermaid)

```mermaid
graph TB
    %% Define styles
    classDef source fill:#ff9966,stroke:#333,stroke-width:2px
    classDef integration fill:#90EE90,stroke:#333,stroke-width:2px
    classDef warehouse fill:#87CEEB,stroke:#333,stroke-width:2px
    classDef transform fill:#DDA0DD,stroke:#333,stroke-width:2px
    classDef presentation fill:#FFD700,stroke:#333,stroke-width:2px
    classDef database cylinder
    
    %% Data Sources
    subgraph Sources
        OLTP[("OLTP PostgreSQL<br/>:54320")]:::database
        subgraph "Flat Files"
            XML["XML Files"]:::source
            CSV["CSV Files"]:::source
        end
    end

    %% Integration Layer
    subgraph Integration
        AF["Airflow<br/>:8080"]:::integration
        GEN["Generator Service"]:::integration
        subgraph "Airflow DAGs"
            MAIN_DAG["Main Data Import"]:::integration
            RES_DAG["Reseller Data Import"]:::integration
            DBT_DAG["DBT Processing"]:::integration
        end
    end

    %% Data Warehouse & Transformation
    subgraph "Data Warehouse"
        DW[("Data Warehouse<br/>PostgreSQL :54321")]:::database
        subgraph "DBT Layers"
            SRC["Source Layer"]:::transform
            STG["Staging Layer"]:::transform
            DIM["Dimension Layer"]:::transform
            FACT["Fact Layer"]:::transform
        end
        subgraph "Warehouse Tables"
            CHANNEL["Channel"]:::warehouse
            CUSTOMER["Customer"]:::warehouse
            PRODUCT["Product"]:::warehouse
            SALES["Sales"]:::warehouse
            GEO["Geography"]:::warehouse
        end
    end

    %% Presentation Layer
    subgraph Presentation
        SUP["Superset<br/>:8088"]:::presentation
    end

    %% Relationships
    OLTP --> |Extract| AF
    XML --> |Import| AF
    CSV --> |Import| AF
    GEN --> |Generate| OLTP
    AF --> |Load| DW
    AF --> |Orchestrate| DBT_DAG
    DW --> |Transform| SRC
    SRC --> STG
    STG --> DIM
    STG --> FACT
    DW --> SUP

    %% Click events
    click XML "https://github.com/fabienbeaumontDM/portable-data-stack-airflow/tree/main/import/xml/raw"
    click CSV "https://github.com/fabienbeaumontDM/portable-data-stack-airflow/tree/main/import/csv/raw"
    click GEN "https://github.com/fabienbeaumontDM/portable-data-stack-airflow/tree/main/generator"
    click AF "https://github.com/fabienbeaumontDM/portable-data-stack-airflow/tree/main/airflow"
    click MAIN_DAG "https://github.com/fabienbeaumontDM/portable-data-stack-airflow/blob/main/airflow/dags/import_main_data.py"
    click RES_DAG "https://github.com/fabienbeaumontDM/portable-data-stack-airflow/blob/main/airflow/dags/import_reseller_data.py"
    click DBT_DAG "https://github.com/fabienbeaumontDM/portable-data-stack-airflow/blob/main/airflow/dags/run_dbt_model.py"
    click SRC "https://github.com/fabienbeaumontDM/portable-data-stack-airflow/tree/main/dbt/dbt_company/models/src"
    click STG "https://github.com/fabienbeaumontDM/portable-data-stack-airflow/tree/main/dbt/dbt_company/models/staging"
    click DIM "https://github.com/fabienbeaumontDM/portable-data-stack-airflow/tree/main/dbt/dbt_company/models/dim"
    click FACT "https://github.com/fabienbeaumontDM/portable-data-stack-airflow/tree/main/dbt/dbt_company/models/fact"
    click SUP "https://github.com/fabienbeaumontDM/portable-data-stack-airflow/tree/main/superset"
    click CHANNEL "https://github.com/fabienbeaumontDM/portable-data-stack-airflow/blob/main/airflow/dags/sql/load_warehouse_channel.sql"
    click CUSTOMER "https://github.com/fabienbeaumontDM/portable-data-stack-airflow/blob/main/airflow/dags/sql/load_warehouse_customer.sql"
    click PRODUCT "https://github.com/fabienbeaumontDM/portable-data-stack-airflow/blob/main/airflow/dags/sql/load_warehouse_product.sql"
    click SALES "https://github.com/fabienbeaumontDM/portable-data-stack-airflow/blob/main/airflow/dags/sql/load_warehouse_sales.sql"
    click GEO "https://github.com/fabienbeaumontDM/portable-data-stack-airflow/blob/main/airflow/dags/sql/load_warehouse_geography.sql"
```
