# achahbounsaadallah/project-etl-for-credits architecture

> Architecture diagram of the GitHub repository achahbounsaadallah/project-etl-for-credits, 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/achahbounsaadallah/project-etl-for-credits
- Repository: https://github.com/achahbounsaadallah/project-etl-for-credits

## Overview

This repository implements an Airflow-orchestrated credit-data ETL: Excel workbooks for several reporting periods and layouts are normalized into staging records, loaded to SQL Server, transformed into a dimensional warehouse, and followed by a Power BI dataset refresh. Collector modules handle distinct workbook formats; the shared collector combines them before the database loader writes staging. The sampled DAG shows the runtime order. The README is empty, so unsampled capabilities and integrations are not inferred; edges below are limited to relationships visible in excerpts.

Main entry points: [`scripts/All_stg_data.py`](https://github.com/achahbounsaadallah/project-etl-for-credits/blob/saadbranch/scripts/All_stg_data.py) (Combined staging data), [`dags/etl_load_staging.py`](https://github.com/achahbounsaadallah/project-etl-for-credits/blob/saadbranch/dags/etl_load_staging.py) (ETL DAG), [`scripts/connection_to_db.py`](https://github.com/achahbounsaadallah/project-etl-for-credits/blob/saadbranch/scripts/connection_to_db.py) (Staging loader), [`spark/add_data_to_DW.py`](https://github.com/achahbounsaadallah/project-etl-for-credits/blob/saadbranch/spark/add_data_to_DW.py) (Warehouse transform)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ingest["Workbook ingestion"]
  node_legacy_collector["2024–25 collector"]
  node_nonstandard_collector["Nonstandard 2025 collector"]
  node_collector_2026["2026 collector<br/>[collecte_2026.py]"]
  node_collector_2026_v2["2026 v2 collector"]
  node_combined_collector["Combined staging data<br/>[All_stg_data.py]"]
end

subgraph group_orchestration["Pipeline orchestration"]
  node_airflow_dag["ETL DAG"]
  node_staging_loader["Staging loader"]
end

subgraph group_warehouse["SQL warehouse"]
  node_staging_db[("Staging database")]
  node_dw_transform["Warehouse transform<br/>[add_data_to_DW.py]"]
  node_dw_schema["Warehouse schema setup"]
  node_dw_database[("Credit data warehouse")]
end

subgraph group_analytics["BI refresh"]
  node_powerbi_refresh["Power BI refresh<br/>[powerbi.py]"]
  node_powerbi_retry["Retrying refresh client<br/>[pb2.py]"]
end

node_operator(("Pipeline operator"))
node_workbooks["Credit workbooks"]
node_azure_ad{{"Azure AD"}}
node_powerbi_service{{"Power BI service"}}

node_operator -.->|"triggers"| node_airflow_dag
node_workbooks -->|"reads"| node_legacy_collector
node_workbooks -->|"reads"| node_nonstandard_collector
node_workbooks -->|"reads"| node_collector_2026
node_workbooks -->|"reads"| node_collector_2026_v2
node_combined_collector -->|"calls"| node_legacy_collector
node_combined_collector -->|"calls"| node_nonstandard_collector
node_combined_collector -->|"calls"| node_collector_2026
node_combined_collector -->|"calls"| node_collector_2026_v2
node_airflow_dag -->|"runs"| node_staging_loader
node_staging_loader -->|"calls"| node_combined_collector
node_staging_loader -->|"writes staging"| node_staging_db
node_airflow_dag -->|"runs"| node_dw_transform
node_dw_transform -->|"reads staging"| node_staging_db
node_dw_transform -->|"writes dimensions and facts"| node_dw_database
node_dw_schema -->|"creates tables"| node_dw_database
node_airflow_dag -->|"runs"| node_powerbi_refresh
node_powerbi_refresh -->|"requests token"| node_azure_ad
node_powerbi_refresh -->|"triggers and polls refresh"| node_powerbi_service
node_powerbi_retry -->|"requests token"| node_azure_ad
node_powerbi_retry -->|"triggers and polls refresh"| node_powerbi_service

click node_legacy_collector "https://github.com/achahbounsaadallah/project-etl-for-credits/blob/saadbranch/scripts/Raw_Data_collecte_from_excel2024_et_2025.py"
click node_nonstandard_collector "https://github.com/achahbounsaadallah/project-etl-for-credits/blob/saadbranch/scripts/not_like_others_2025.py"
click node_collector_2026 "https://github.com/achahbounsaadallah/project-etl-for-credits/blob/saadbranch/scripts/collecte_2026.py"
click node_collector_2026_v2 "https://github.com/achahbounsaadallah/project-etl-for-credits/blob/saadbranch/scripts/collecte_2026_v2.py"
click node_combined_collector "https://github.com/achahbounsaadallah/project-etl-for-credits/blob/saadbranch/scripts/All_stg_data.py"
click node_airflow_dag "https://github.com/achahbounsaadallah/project-etl-for-credits/blob/saadbranch/dags/etl_load_staging.py"
click node_staging_loader "https://github.com/achahbounsaadallah/project-etl-for-credits/blob/saadbranch/scripts/connection_to_db.py"
click node_dw_transform "https://github.com/achahbounsaadallah/project-etl-for-credits/blob/saadbranch/spark/add_data_to_DW.py"
click node_dw_schema "https://github.com/achahbounsaadallah/project-etl-for-credits/blob/saadbranch/spark/Creation_of_DW_in_mysql.py"
click node_powerbi_refresh "https://github.com/achahbounsaadallah/project-etl-for-credits/blob/saadbranch/powerbi/powerbi.py"
click node_powerbi_retry "https://github.com/achahbounsaadallah/project-etl-for-credits/blob/saadbranch/powerbi/pb2.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_legacy_collector,node_nonstandard_collector,node_collector_2026,node_collector_2026_v2,node_combined_collector toneBlue
class node_airflow_dag,node_staging_loader toneAmber
class node_staging_db,node_dw_transform,node_dw_schema,node_dw_database toneMint
class node_powerbi_refresh,node_powerbi_retry toneRose
class node_operator,node_workbooks,node_azure_ad,node_powerbi_service toneIndigo
```

## Components

### Workbook ingestion

- [2024–25 collector](https://github.com/achahbounsaadallah/project-etl-for-credits/blob/saadbranch/scripts/Raw_Data_collecte_from_excel2024_et_2025.py): `scripts/Raw_Data_collecte_from_excel2024_et_2025.py`
- [Nonstandard 2025 collector](https://github.com/achahbounsaadallah/project-etl-for-credits/blob/saadbranch/scripts/not_like_others_2025.py): `scripts/not_like_others_2025.py`
- [2026 collector](https://github.com/achahbounsaadallah/project-etl-for-credits/blob/saadbranch/scripts/collecte_2026.py): `scripts/collecte_2026.py`
- [2026 v2 collector](https://github.com/achahbounsaadallah/project-etl-for-credits/blob/saadbranch/scripts/collecte_2026_v2.py): `scripts/collecte_2026_v2.py`
- [Combined staging data](https://github.com/achahbounsaadallah/project-etl-for-credits/blob/saadbranch/scripts/All_stg_data.py): `scripts/All_stg_data.py`

### Pipeline orchestration

- [ETL DAG](https://github.com/achahbounsaadallah/project-etl-for-credits/blob/saadbranch/dags/etl_load_staging.py): `dags/etl_load_staging.py`
- [Staging loader](https://github.com/achahbounsaadallah/project-etl-for-credits/blob/saadbranch/scripts/connection_to_db.py): `scripts/connection_to_db.py`

### SQL warehouse

- **Staging database**
- [Warehouse transform](https://github.com/achahbounsaadallah/project-etl-for-credits/blob/saadbranch/spark/add_data_to_DW.py): `spark/add_data_to_DW.py`
- [Warehouse schema setup](https://github.com/achahbounsaadallah/project-etl-for-credits/blob/saadbranch/spark/Creation_of_DW_in_mysql.py): `spark/Creation_of_DW_in_mysql.py`
- **Credit data warehouse**

### BI refresh

- [Power BI refresh](https://github.com/achahbounsaadallah/project-etl-for-credits/blob/saadbranch/powerbi/powerbi.py): `powerbi/powerbi.py`
- [Retrying refresh client](https://github.com/achahbounsaadallah/project-etl-for-credits/blob/saadbranch/powerbi/pb2.py): `powerbi/pb2.py`

### Other components

- **Pipeline operator**
- **Credit workbooks**
- **Azure AD**
- **Power BI service**

## Connections

- Pipeline operator → ETL DAG: triggers
- Credit workbooks → 2024–25 collector: reads (evidence: `scripts/Raw_Data_collecte_from_excel2024_et_2025.py`)
- Credit workbooks → Nonstandard 2025 collector: reads (evidence: `scripts/not_like_others_2025.py`)
- Credit workbooks → 2026 collector: reads (evidence: `scripts/collecte_2026.py`)
- Credit workbooks → 2026 v2 collector: reads (evidence: `scripts/collecte_2026_v2.py`)
- Combined staging data → 2024–25 collector: calls (evidence: `scripts/All_stg_data.py`)
- Combined staging data → Nonstandard 2025 collector: calls (evidence: `scripts/All_stg_data.py`)
- Combined staging data → 2026 collector: calls (evidence: `scripts/All_stg_data.py`)
- Combined staging data → 2026 v2 collector: calls (evidence: `scripts/All_stg_data.py`)
- ETL DAG → Staging loader: runs (evidence: `dags/etl_load_staging.py`)
- Staging loader → Combined staging data: calls (evidence: `scripts/connection_to_db.py`)
- Staging loader → Staging database: writes staging (evidence: `scripts/connection_to_db.py`)
- ETL DAG → Warehouse transform: runs (evidence: `dags/etl_load_staging.py`)
- Warehouse transform → Staging database: reads staging (evidence: `spark/add_data_to_DW.py`)
- Warehouse transform → Credit data warehouse: writes dimensions and facts (evidence: `spark/add_data_to_DW.py`)
- Warehouse schema setup → Credit data warehouse: creates tables (evidence: `spark/Creation_of_DW_in_mysql.py`)
- ETL DAG → Power BI refresh: runs (evidence: `dags/etl_load_staging.py`)
- Power BI refresh → Azure AD: requests token (evidence: `powerbi/powerbi.py`)
- Power BI refresh → Power BI service: triggers and polls refresh (evidence: `powerbi/powerbi.py`)
- Retrying refresh client → Azure AD: requests token (evidence: `powerbi/pb2.py`)
- Retrying refresh client → Power BI service: triggers and polls refresh (evidence: `powerbi/pb2.py`)
