add dwh_tugas_akhir_daily dag (edoxid + informatika -> postgres dwh)
Daily ETL into the PostgreSQL DWH (Coolify "Data Warehouse IF"):
- raw: full-refresh copy of eDOXID submissions/verificators/users and
informatika mahasiswa/lulusan/dosen, without sensitive columns
- staging: normalize NIM/NIP, cast score/ipk/sks, fix known bad values
('2020/2010' academic year, Excel-corrupted lulusan.ipk)
- mart: dim_mahasiswa, dim_dosen, dim_tahap_ta, fact_ujian_ta,
fact_penugasan_dosen, mhs_progres_ta (risk flags), etl_log
for angkatan >= DWH_MIN_ANGKATAN (default 2019)
New env on airflow-scheduler: DWH_HOST, DWH_PASSWORD (+ optional
DWH_PORT, DWH_DATABASE, DWH_USERNAME, DWH_MIN_ANGKATAN).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
a357e0622e
commit
8ebedecdc3
@@ -0,0 +1,71 @@
|
||||
"""
|
||||
DAG harian: DWH tugas akhir (eDOXID + DB dashboard informatika) -> PostgreSQL DWH.
|
||||
|
||||
load_raw_edoxid ──────┐
|
||||
├──> build_staging ──> build_mart
|
||||
load_raw_informatika ─┘
|
||||
|
||||
raw : salinan tabel sumber tanpa kolom sensitif (full refresh)
|
||||
staging : tipe dirapikan, NIM/NIP dinormalisasi, nilai yang diketahui salah diperbaiki
|
||||
mart : dim_mahasiswa, dim_dosen, dim_tahap_ta, fact_ujian_ta,
|
||||
fact_penugasan_dosen, mhs_progres_ta (+ etl_log)
|
||||
-> dibaca dashboard PHP lewat user read-only dashboard_ro
|
||||
|
||||
Sumber hanya dibaca (SELECT). Lihat scripts/dwh_edoxid_etl.py dan scripts/dwh_edoxid_sql.py.
|
||||
|
||||
Environment yang wajib di-set di Coolify (service airflow-scheduler):
|
||||
DWH_HOST, DWH_PASSWORD -> PostgreSQL DWH (user etl_writer)
|
||||
EDOXID_DB_PASSWORD -> sama dengan edoxid_calendar_sync
|
||||
DB_HOST, DB_PORT, DB_USER, DB_PASS -> sama dengan scholar_penelitian_monthly
|
||||
Opsional: DWH_PORT (5432), DWH_DATABASE (dwh_informatika), DWH_USERNAME (etl_writer),
|
||||
DWH_MIN_ANGKATAN (2019).
|
||||
"""
|
||||
|
||||
from datetime import datetime, timedelta
|
||||
|
||||
from airflow import DAG
|
||||
from airflow.operators.python import PythonOperator
|
||||
|
||||
from scripts.dwh_edoxid_etl import (
|
||||
run_build_mart,
|
||||
run_build_staging,
|
||||
run_load_raw_edoxid,
|
||||
run_load_raw_informatika,
|
||||
)
|
||||
|
||||
with DAG(
|
||||
dag_id="dwh_tugas_akhir_daily",
|
||||
description="ETL tugas akhir eDOXID + data mahasiswa/dosen ke DWH PostgreSQL",
|
||||
start_date=datetime(2026, 10, 1),
|
||||
# 19:00 UTC = 02:00 WIB, di luar jam sibuk eDOXID
|
||||
schedule_interval="0 19 * * *",
|
||||
catchup=False,
|
||||
max_active_runs=1,
|
||||
default_args={
|
||||
"owner": "informatika",
|
||||
"retries": 2,
|
||||
"retry_delay": timedelta(minutes=10),
|
||||
},
|
||||
tags=["dwh", "edoxid", "tugas-akhir", "dashboard"],
|
||||
) as dag:
|
||||
load_edoxid = PythonOperator(
|
||||
task_id="load_raw_edoxid",
|
||||
python_callable=run_load_raw_edoxid,
|
||||
)
|
||||
|
||||
load_informatika = PythonOperator(
|
||||
task_id="load_raw_informatika",
|
||||
python_callable=run_load_raw_informatika,
|
||||
)
|
||||
|
||||
build_staging = PythonOperator(
|
||||
task_id="build_staging",
|
||||
python_callable=run_build_staging,
|
||||
)
|
||||
|
||||
build_mart = PythonOperator(
|
||||
task_id="build_mart",
|
||||
python_callable=run_build_mart,
|
||||
)
|
||||
|
||||
[load_edoxid, load_informatika] >> build_staging >> build_mart
|
||||
Reference in New Issue
Block a user