Project ini adalah sistem End-to-End Data Engineering Pipeline yang dirancang untuk mengotomatisasi proses pengambilan (Extract), penyimpanan (Load), dan tranformasi (Transform) data cuaca secara berkala.
Sistem ini mengambil data cuaca real-time dari Weatherstack API untuk 8 kota besar dunia (Jakarta, London, New York, Tokyo, dll), menyimpannya ke dalam Data Warehouse berbasis PostgreSQL, melakukan transformasi data menggunakan dbt (data build tool) untuk kebutuhan analitik, dan diorkestrasi sepenuhnya menggunakan Apache Airflow.
Weatherstack API → Airflow (Ingest) → PostgreSQL (Raw) → dbt (Transform) → Metabase (Visualize)
┌─────────────────────────────────────────────────────────────────┐
│ APACHE AIRFLOW │
│ │
│ ┌──────────────────┐ ┌──────────────────────────┐ │
│ │ Task 1 │ │ Task 2 │ │
│ │ api-weather- │ ──────► │ dbt-weather- │ │
│ │ ingest │ │ transformation │ │
│ └──────────────────┘ └──────────────────────────┘ │
│ │ │ │
└───────────┼───────────────────────────────┼─────────────────────┘
│ │
▼ ▼
┌─────────────────┐ ┌──────────────────┐
│ Weatherstack │ │ PostgreSQL DW │
│ API │ │ │
│ (8 Cities) │ │ stg_weather │
└─────────────────┘ │ daily_avg │
│ weather_report │
└──────────────────┘
│
▼
┌──────────────────┐
│ Metabase │
│ Dashboard │
└──────────────────┘
| Komponen | Teknologi | Keterangan |
|---|---|---|
| Orchestration | Apache Airflow | Scheduling & workflow management |
| Language | Python 3.10 | Custom scripting untuk ingestion |
| Data Warehouse | PostgreSQL 13 | Penyimpanan raw & transformed data |
| Transformation | dbt Core | SQL-based data modeling & testing |
| Visualization | Metabase | Interactive dashboard & reporting |
| Infrastructure | Podman (Docker-compatible) | Containerization seluruh service |
| External API | Weatherstack API | Sumber data cuaca real-time |
ETL-Project-Weatherstack/
│
├── dags/ # Apache Airflow DAG definitions
│ └── weather_etl_dag.py # Main ETL pipeline DAG
│
├── dbt/ # dbt project untuk transformasi data
│ ├── models/
│ │ ├── staging/
│ │ │ └── stg_weather.sql # Staging model (data cleaning)
│ │ └── marts/
│ │ ├── daily_avg.sql # Agregat rata-rata suhu harian
│ │ └── weather_report.sql # Final reporting table
│ └── dbt_project.yml
│
├── postgres/ # PostgreSQL initialization scripts
│ └── init.sql # Schema & table definitions
│
├── docker-compose.yml # Podman/Docker service definitions
├── .gitignore
└── README.md
Arsitektur & Alur Data (Data Flow)
-
Ingestion (Extract & Load)
- Apache Airflow memicu task Python (api-weather-ingest) sesuai jadwal.
- Script Python melakukan request ke API cuaca (mendukung mode Live API dan Mock Data untuk efisiensi kuota).
- Data mentah (Raw Data) disimpan ke tabel weather_data di PostgreSQL dengan penanganan duplikasi (ON CONFLICT DO NOTHING).
-
Transformation (Transform)
- Setelah data masuk, Airflow memicu task dbt (dbt-weather-transformation).
- dbt membersihkan data (stg_weather), menghitung agregat seperti rata-rata suhu harian (daily_avg), dan menyusun tabel laporan final (weather_report).
- Data Quality Tests dijalankan otomatis oleh dbt untuk memastikan integritas data.
-
Visualization
- Data yang sudah bersih dihubungkan ke Metabase untuk visualisasi tren suhu dan cuaca antar kota.
Using API from wetherstack API (free)