# ali-ahmed-farag/depi-data-engineering-graduation-project architecture

> Architecture diagram of the GitHub repository ali-ahmed-farag/depi-data-engineering-graduation-project, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ali-ahmed-farag/depi-data-engineering-graduation-project
- Repository: https://github.com/ali-ahmed-farag/depi-data-engineering-graduation-project

## Overview

This platform collects Metro prices, currency/gold rates, and economic indicators, then preserves raw responses, rebuilds cleaned staging data, checks quality, loads a historical warehouse, and serves analytics through an API and Grafana. Airflow schedules the source pipelines and records run and quality outcomes. The graph retains the four source-specific schedules and the distinct connector, raw, staging, quality, warehouse, and serving responsibilities. Some SQL load details and dashboard/API query implementations were not sampled; those relationships are shown only where the README documents them.

Main entry points: [`src/common/pipeline.py`](https://github.com/ali-ahmed-farag/depi-data-engineering-graduation-project/blob/main/src/common/pipeline.py) (Pipeline runner), [`src/connectors/static_site.py`](https://github.com/ali-ahmed-farag/depi-data-engineering-graduation-project/blob/main/src/connectors/static_site.py) (Metro scraper), [`src/connectors/base.py`](https://github.com/ali-ahmed-farag/depi-data-engineering-graduation-project/blob/main/src/connectors/base.py) (Connector contract), [`src/connectors/official_file.py`](https://github.com/ali-ahmed-farag/depi-data-engineering-graduation-project/blob/main/src/connectors/official_file.py) (CBE file connector)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_schedules["Scheduled ingestion"]
  node_fx_dag["FX gold schedule<br/>[fx_gold_daily.py]"]
  node_metro_dag["Metro schedule<br/>[metro_daily.py]"]
  node_official_dag["CBE schedule"]
  node_world_dag["World Bank schedule"]
  node_pipeline["Pipeline runner<br/>[pipeline.py]"]
end

subgraph group_ingestion["Connectors and raw"]
  node_base["Connector contract<br/>[base.py]"]
  node_fx_connector["FX gold connector<br/>[fx_gold.py]"]
  node_metro_connector["Metro scraper<br/>[static_site.py]"]
  node_official_connector["CBE file connector<br/>[official_file.py]"]
  node_world_connector["World Bank connector<br/>[world_bank.py]"]
  node_raw_store["Raw persistence<br/>[raw_store.py]"]
end

subgraph group_processing["Staging and quality"]
  node_cleaning["Shared cleaning<br/>[cleaning.py]"]
  node_api_staging["API staging<br/>[api_staging.py]"]
  node_metro_staging["Metro staging"]
  node_official_staging["CBE staging"]
  node_quality["Quality checks<br/>[checks.py]"]
end

subgraph group_warehouse["Warehouse and operations"]
  node_raw_db[("Raw schema<br/>[20_raw.sql]")]
  node_staging_db[("Staging schema<br/>[30_staging.sql]")]
  node_dwh_db[("Star warehouse<br/>[40_dwh.sql]")]
  node_serving_db[("Serving views<br/>[60_serving.sql]")]
  node_ops_log["Run and quality logs<br/>[ops_log.py]"]
end

subgraph group_consumers["Analytics access"]
  node_api["REST API<br/>[main.py]"]
  node_grafana["Grafana dashboards"]
end

node_fx_source(("Currency API"))
node_metro_source(("Metro shop"))
node_cbe_source(("CBE workbook"))
node_world_source(("World Bank API"))

node_fx_dag -->|"builds schedule"| node_pipeline
node_metro_dag -->|"builds schedule"| node_pipeline
node_official_dag -->|"builds schedule"| node_pipeline
node_world_dag -->|"builds schedule"| node_pipeline
node_pipeline -->|"logs runs"| node_ops_log
node_pipeline -->|"runs checks"| node_quality
node_fx_dag -->|"dispatches"| node_fx_connector
node_metro_dag -->|"dispatches"| node_metro_connector
node_official_dag -->|"dispatches"| node_official_connector
node_world_dag -->|"dispatches"| node_world_connector
node_fx_connector -->|"fetches from"| node_fx_source
node_world_connector -->|"fetches from"| node_world_source
node_metro_connector -->|"scrapes"| node_metro_source
node_official_connector -->|"reads workbook"| node_cbe_source
node_fx_connector -->|"implements"| node_base
node_metro_connector -->|"implements"| node_base
node_official_connector -->|"implements"| node_base
node_world_connector -->|"implements"| node_base
node_base -->|"stores responses"| node_raw_store
node_metro_connector -->|"stores pages"| node_raw_store
node_official_connector -->|"registers file"| node_raw_store
node_metro_connector -->|"normalizes text"| node_cleaning
node_api_staging -->|"reads payloads"| node_raw_db
node_metro_staging -->|"reads pages"| node_raw_db
node_official_staging -->|"reads files"| node_raw_db
node_api_staging -->|"rebuilds rows"| node_staging_db
node_metro_staging -->|"rebuilds rows"| node_staging_db
node_official_staging -->|"loads indicators"| node_staging_db
node_pipeline -->|"calls staging"| node_api_staging
node_pipeline -->|"calls staging"| node_metro_staging
node_pipeline -->|"calls staging"| node_official_staging
node_quality -->|"checks rows"| node_staging_db
node_quality -->|"records results"| node_ops_log
node_pipeline -->|"loads warehouse"| node_dwh_db
node_dwh_db -->|"feeds views"| node_serving_db
node_api -->|"reads views"| node_serving_db
node_grafana -->|"reads analytics"| node_serving_db
node_grafana -->|"shows monitoring"| node_ops_log

click node_fx_dag "https://github.com/ali-ahmed-farag/depi-data-engineering-graduation-project/blob/main/dags/fx_gold_daily.py"
click node_metro_dag "https://github.com/ali-ahmed-farag/depi-data-engineering-graduation-project/blob/main/dags/metro_daily.py"
click node_official_dag "https://github.com/ali-ahmed-farag/depi-data-engineering-graduation-project/blob/main/dags/official_file_monthly.py"
click node_world_dag "https://github.com/ali-ahmed-farag/depi-data-engineering-graduation-project/blob/main/dags/world_bank_weekly.py"
click node_pipeline "https://github.com/ali-ahmed-farag/depi-data-engineering-graduation-project/blob/main/src/common/pipeline.py"
click node_base "https://github.com/ali-ahmed-farag/depi-data-engineering-graduation-project/blob/main/src/connectors/base.py"
click node_fx_connector "https://github.com/ali-ahmed-farag/depi-data-engineering-graduation-project/blob/main/src/connectors/fx_gold.py"
click node_metro_connector "https://github.com/ali-ahmed-farag/depi-data-engineering-graduation-project/blob/main/src/connectors/static_site.py"
click node_official_connector "https://github.com/ali-ahmed-farag/depi-data-engineering-graduation-project/blob/main/src/connectors/official_file.py"
click node_world_connector "https://github.com/ali-ahmed-farag/depi-data-engineering-graduation-project/blob/main/src/connectors/world_bank.py"
click node_raw_store "https://github.com/ali-ahmed-farag/depi-data-engineering-graduation-project/blob/main/src/common/raw_store.py"
click node_cleaning "https://github.com/ali-ahmed-farag/depi-data-engineering-graduation-project/blob/main/src/common/cleaning.py"
click node_api_staging "https://github.com/ali-ahmed-farag/depi-data-engineering-graduation-project/blob/main/src/transform/api_staging.py"
click node_metro_staging "https://github.com/ali-ahmed-farag/depi-data-engineering-graduation-project/blob/main/src/transform/static_site_staging.py"
click node_official_staging "https://github.com/ali-ahmed-farag/depi-data-engineering-graduation-project/blob/main/src/transform/official_staging.py"
click node_quality "https://github.com/ali-ahmed-farag/depi-data-engineering-graduation-project/blob/main/src/quality/checks.py"
click node_raw_db "https://github.com/ali-ahmed-farag/depi-data-engineering-graduation-project/blob/main/sql/20_raw.sql"
click node_staging_db "https://github.com/ali-ahmed-farag/depi-data-engineering-graduation-project/blob/main/sql/30_staging.sql"
click node_dwh_db "https://github.com/ali-ahmed-farag/depi-data-engineering-graduation-project/blob/main/sql/40_dwh.sql"
click node_serving_db "https://github.com/ali-ahmed-farag/depi-data-engineering-graduation-project/blob/main/sql/60_serving.sql"
click node_ops_log "https://github.com/ali-ahmed-farag/depi-data-engineering-graduation-project/blob/main/src/common/ops_log.py"
click node_api "https://github.com/ali-ahmed-farag/depi-data-engineering-graduation-project/blob/main/api/main.py"
click node_grafana "https://github.com/ali-ahmed-farag/depi-data-engineering-graduation-project/tree/main/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_fx_dag,node_metro_dag,node_official_dag,node_world_dag,node_pipeline toneBlue
class node_base,node_fx_connector,node_metro_connector,node_official_connector,node_world_connector,node_raw_store toneAmber
class node_cleaning,node_api_staging,node_metro_staging,node_official_staging,node_quality,node_fx_source,node_world_source toneMint
class node_raw_db,node_staging_db,node_dwh_db,node_serving_db,node_ops_log toneRose
class node_api,node_grafana,node_metro_source,node_cbe_source toneIndigo
```

## Components

### Scheduled ingestion

- [FX gold schedule](https://github.com/ali-ahmed-farag/depi-data-engineering-graduation-project/blob/main/dags/fx_gold_daily.py): `dags/fx_gold_daily.py`
- [Metro schedule](https://github.com/ali-ahmed-farag/depi-data-engineering-graduation-project/blob/main/dags/metro_daily.py): `dags/metro_daily.py`
- [CBE schedule](https://github.com/ali-ahmed-farag/depi-data-engineering-graduation-project/blob/main/dags/official_file_monthly.py): `dags/official_file_monthly.py`
- [World Bank schedule](https://github.com/ali-ahmed-farag/depi-data-engineering-graduation-project/blob/main/dags/world_bank_weekly.py): `dags/world_bank_weekly.py`
- [Pipeline runner](https://github.com/ali-ahmed-farag/depi-data-engineering-graduation-project/blob/main/src/common/pipeline.py): `src/common/pipeline.py`

### Connectors and raw

- [Connector contract](https://github.com/ali-ahmed-farag/depi-data-engineering-graduation-project/blob/main/src/connectors/base.py): `src/connectors/base.py`
- [FX gold connector](https://github.com/ali-ahmed-farag/depi-data-engineering-graduation-project/blob/main/src/connectors/fx_gold.py): `src/connectors/fx_gold.py`
- [Metro scraper](https://github.com/ali-ahmed-farag/depi-data-engineering-graduation-project/blob/main/src/connectors/static_site.py): `src/connectors/static_site.py`
- [CBE file connector](https://github.com/ali-ahmed-farag/depi-data-engineering-graduation-project/blob/main/src/connectors/official_file.py): `src/connectors/official_file.py`
- [World Bank connector](https://github.com/ali-ahmed-farag/depi-data-engineering-graduation-project/blob/main/src/connectors/world_bank.py): `src/connectors/world_bank.py`
- [Raw persistence](https://github.com/ali-ahmed-farag/depi-data-engineering-graduation-project/blob/main/src/common/raw_store.py): `src/common/raw_store.py`

### Staging and quality

- [Shared cleaning](https://github.com/ali-ahmed-farag/depi-data-engineering-graduation-project/blob/main/src/common/cleaning.py): `src/common/cleaning.py`
- [API staging](https://github.com/ali-ahmed-farag/depi-data-engineering-graduation-project/blob/main/src/transform/api_staging.py): `src/transform/api_staging.py`
- [Metro staging](https://github.com/ali-ahmed-farag/depi-data-engineering-graduation-project/blob/main/src/transform/static_site_staging.py): `src/transform/static_site_staging.py`
- [CBE staging](https://github.com/ali-ahmed-farag/depi-data-engineering-graduation-project/blob/main/src/transform/official_staging.py): `src/transform/official_staging.py`
- [Quality checks](https://github.com/ali-ahmed-farag/depi-data-engineering-graduation-project/blob/main/src/quality/checks.py): `src/quality/checks.py`

### Warehouse and operations

- [Raw schema](https://github.com/ali-ahmed-farag/depi-data-engineering-graduation-project/blob/main/sql/20_raw.sql): `sql/20_raw.sql`
- [Staging schema](https://github.com/ali-ahmed-farag/depi-data-engineering-graduation-project/blob/main/sql/30_staging.sql): `sql/30_staging.sql`
- [Star warehouse](https://github.com/ali-ahmed-farag/depi-data-engineering-graduation-project/blob/main/sql/40_dwh.sql): `sql/40_dwh.sql`
- [Serving views](https://github.com/ali-ahmed-farag/depi-data-engineering-graduation-project/blob/main/sql/60_serving.sql): `sql/60_serving.sql`
- [Run and quality logs](https://github.com/ali-ahmed-farag/depi-data-engineering-graduation-project/blob/main/src/common/ops_log.py): `src/common/ops_log.py`

### Analytics access

- [REST API](https://github.com/ali-ahmed-farag/depi-data-engineering-graduation-project/blob/main/api/main.py): `api/main.py`
- [Grafana dashboards](https://github.com/ali-ahmed-farag/depi-data-engineering-graduation-project/tree/main/grafana/dashboards): `grafana/dashboards`

### Other components

- **Currency API**
- **Metro shop**
- **CBE workbook**
- **World Bank API**

## Connections

- FX gold schedule → Pipeline runner: builds schedule (evidence: `dags/fx_gold_daily.py`)
- Metro schedule → Pipeline runner: builds schedule (evidence: `dags/metro_daily.py`)
- CBE schedule → Pipeline runner: builds schedule (evidence: `dags/official_file_monthly.py`)
- World Bank schedule → Pipeline runner: builds schedule (evidence: `dags/world_bank_weekly.py`)
- Pipeline runner → Run and quality logs: logs runs (evidence: `src/common/pipeline.py`)
- Pipeline runner → Quality checks: runs checks (evidence: `src/common/pipeline.py`)
- FX gold schedule → FX gold connector: dispatches (evidence: `dags/fx_gold_daily.py`)
- Metro schedule → Metro scraper: dispatches (evidence: `dags/metro_daily.py`)
- CBE schedule → CBE file connector: dispatches (evidence: `dags/official_file_monthly.py`)
- World Bank schedule → World Bank connector: dispatches (evidence: `dags/world_bank_weekly.py`)
- FX gold connector → Currency API: fetches from (evidence: `src/connectors/fx_gold.py`)
- World Bank connector → World Bank API: fetches from (evidence: `src/connectors/world_bank.py`)
- Metro scraper → Metro shop: scrapes (evidence: `README.md`)
- CBE file connector → CBE workbook: reads workbook (evidence: `README.md`)
- FX gold connector → Connector contract: implements (evidence: `src/connectors/fx_gold.py`)
- Metro scraper → Connector contract: implements (evidence: `src/connectors/static_site.py`)
- CBE file connector → Connector contract: implements (evidence: `src/connectors/official_file.py`)
- World Bank connector → Connector contract: implements (evidence: `src/connectors/world_bank.py`)
- Connector contract → Raw persistence: stores responses (evidence: `src/connectors/base.py`)
- Metro scraper → Raw persistence: stores pages (evidence: `src/connectors/static_site.py`)
- CBE file connector → Raw persistence: registers file (evidence: `src/connectors/official_file.py`)
- Metro scraper → Shared cleaning: normalizes text (evidence: `src/connectors/static_site.py`)
- API staging → Raw schema: reads payloads (evidence: `src/transform/api_staging.py`)
- Metro staging → Raw schema: reads pages (evidence: `src/transform/static_site_staging.py`)
- CBE staging → Raw schema: reads files (evidence: `src/transform/official_staging.py`)
- API staging → Staging schema: rebuilds rows (evidence: `src/transform/api_staging.py`)
- Metro staging → Staging schema: rebuilds rows (evidence: `src/transform/static_site_staging.py`)
- CBE staging → Staging schema: loads indicators (evidence: `src/transform/official_staging.py`)
- Pipeline runner → API staging: calls staging (evidence: `src/common/pipeline.py`)
- Pipeline runner → Metro staging: calls staging (evidence: `src/common/pipeline.py`)
- Pipeline runner → CBE staging: calls staging (evidence: `src/common/pipeline.py`)
- Quality checks → Staging schema: checks rows (evidence: `src/quality/checks.py`)
- Quality checks → Run and quality logs: records results (evidence: `src/quality/checks.py`)
- Pipeline runner → Star warehouse: loads warehouse (evidence: `README.md`)
- Star warehouse → Serving views: feeds views (evidence: `README.md`)
- REST API → Serving views: reads views (evidence: `README.md`)
- Grafana dashboards → Serving views: reads analytics (evidence: `README.md`)
- Grafana dashboards → Run and quality logs: shows monitoring (evidence: `README.md`)
