# 2smt-ai/financial-etl-pipeline architecture

> Architecture diagram of the GitHub repository 2smt-ai/financial-etl-pipeline, 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/2smt-ai/financial-etl-pipeline
- Repository: https://github.com/2smt-ai/financial-etl-pipeline

## Overview

This repository is a scheduled financial-data ETL pipeline for GOOGL, with PostgreSQL storage and a Plotly Dash dashboard. The principal workflow is Airflow scheduling extraction and validation, KPI transformation, database loading, and verification; the dashboard separately reads transformed records for charts and summary cards. The README also documents CSV as an extraction fallback. The DAG and ETL code were excerpted; that fallback and the database schema are represented from README documentation, not inspected implementation.

Main entry points: [`dags/financial_etl_dag.py`](https://github.com/2smt-ai/financial-etl-pipeline/blob/main/dags/financial_etl_dag.py) (Financial ETL DAG), [`etl/extract.py`](https://github.com/2smt-ai/financial-etl-pipeline/blob/main/etl/extract.py) (Stock extraction), [`etl/load.py`](https://github.com/2smt-ai/financial-etl-pipeline/blob/main/etl/load.py) (Database loading), [`sql/init.sql`](https://github.com/2smt-ai/financial-etl-pipeline/blob/main/sql/init.sql) (PostgreSQL)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_orchestration["Orchestration"]
  node_dag["Financial ETL DAG"]
end

subgraph group_etl["ETL stages"]
  node_extract["Stock extraction<br/>[extract.py]"]
  node_validation["Data validation<br/>[extract.py]"]
  node_transform["KPI transformation<br/>[transform.py]"]
  node_load["Database loading<br/>[load.py]"]
  node_verify["Load verification<br/>[load.py]"]
end

subgraph group_storage["Data storage"]
  node_postgres[("PostgreSQL<br/>[init.sql]")]
end

subgraph group_visualization["Dashboard"]
  node_dashboard["Financial dashboard<br/>[app.py]"]
end

node_scheduler(("Airflow scheduler"))
node_yahoo["Yahoo Finance"]
node_csv["CSV fallback"]
node_dashboard_user(("Dashboard user"))

node_scheduler -->|"triggers"| node_dag
node_dag -->|"dispatches"| node_extract
node_dag -->|"dispatches"| node_validation
node_dag -->|"dispatches"| node_transform
node_dag -->|"dispatches"| node_load
node_dag -->|"dispatches"| node_verify
node_extract -->|"fetches prices"| node_yahoo
node_csv -.->|"provides fallback"| node_extract
node_extract -->|"validates data"| node_validation
node_dag -->|"passes raw data"| node_transform
node_dag -->|"passes datasets"| node_load
node_load -->|"upserts records"| node_postgres
node_verify -->|"checks records"| node_postgres
node_dashboard_user -->|"views charts"| node_dashboard
node_dashboard -->|"queries transformed data"| node_postgres

click node_dag "https://github.com/2smt-ai/financial-etl-pipeline/blob/main/dags/financial_etl_dag.py"
click node_extract "https://github.com/2smt-ai/financial-etl-pipeline/blob/main/etl/extract.py"
click node_validation "https://github.com/2smt-ai/financial-etl-pipeline/blob/main/etl/extract.py"
click node_transform "https://github.com/2smt-ai/financial-etl-pipeline/blob/main/etl/transform.py"
click node_load "https://github.com/2smt-ai/financial-etl-pipeline/blob/main/etl/load.py"
click node_verify "https://github.com/2smt-ai/financial-etl-pipeline/blob/main/etl/load.py"
click node_postgres "https://github.com/2smt-ai/financial-etl-pipeline/blob/main/sql/init.sql"
click node_dashboard "https://github.com/2smt-ai/financial-etl-pipeline/blob/main/dashboard/app.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_dag,node_dashboard_user toneBlue
class node_extract,node_validation,node_transform,node_load,node_verify toneAmber
class node_postgres toneMint
class node_dashboard,node_scheduler toneRose
class node_yahoo,node_csv toneIndigo
```

## Components

### Orchestration

- [Financial ETL DAG](https://github.com/2smt-ai/financial-etl-pipeline/blob/main/dags/financial_etl_dag.py): `dags/financial_etl_dag.py`

### ETL stages

- [Stock extraction](https://github.com/2smt-ai/financial-etl-pipeline/blob/main/etl/extract.py): `etl/extract.py`
- [Data validation](https://github.com/2smt-ai/financial-etl-pipeline/blob/main/etl/extract.py): `etl/extract.py`
- [KPI transformation](https://github.com/2smt-ai/financial-etl-pipeline/blob/main/etl/transform.py): `etl/transform.py`
- [Database loading](https://github.com/2smt-ai/financial-etl-pipeline/blob/main/etl/load.py): `etl/load.py`
- [Load verification](https://github.com/2smt-ai/financial-etl-pipeline/blob/main/etl/load.py): `etl/load.py`

### Data storage

- [PostgreSQL](https://github.com/2smt-ai/financial-etl-pipeline/blob/main/sql/init.sql): `sql/init.sql`

### Dashboard

- [Financial dashboard](https://github.com/2smt-ai/financial-etl-pipeline/blob/main/dashboard/app.py): `dashboard/app.py`

### Other components

- **Airflow scheduler**
- **Yahoo Finance**
- **CSV fallback**
- **Dashboard user**

## Connections

- Airflow scheduler → Financial ETL DAG: triggers (evidence: `README.md`)
- Financial ETL DAG → Stock extraction: dispatches (evidence: `dags/financial_etl_dag.py`)
- Financial ETL DAG → Data validation: dispatches (evidence: `dags/financial_etl_dag.py`)
- Financial ETL DAG → KPI transformation: dispatches (evidence: `dags/financial_etl_dag.py`)
- Financial ETL DAG → Database loading: dispatches (evidence: `dags/financial_etl_dag.py`)
- Financial ETL DAG → Load verification: dispatches (evidence: `dags/financial_etl_dag.py`)
- Stock extraction → Yahoo Finance: fetches prices (evidence: `etl/extract.py`)
- CSV fallback → Stock extraction: provides fallback (evidence: `README.md`)
- Stock extraction → Data validation: validates data (evidence: `dags/financial_etl_dag.py`)
- Financial ETL DAG → KPI transformation: passes raw data (evidence: `dags/financial_etl_dag.py`)
- Financial ETL DAG → Database loading: passes datasets (evidence: `dags/financial_etl_dag.py`)
- Database loading → PostgreSQL: upserts records (evidence: `etl/load.py`)
- Load verification → PostgreSQL: checks records (evidence: `etl/load.py`)
- Dashboard user → Financial dashboard: views charts (evidence: `dashboard/app.py`)
- Financial dashboard → PostgreSQL: queries transformed data (evidence: `dashboard/app.py`)
