raw : topik/draft TA, KK, jadwal ujian, angkatan, nama dosen dari API SPOTA
(tanpa nama/email/HP/foto mahasiswa) + raw.spota_riwayat_pembimbing (kumulatif:
hari pertama pembimbing 1/2 terlihat terisi)
staging : NIM/NIP dinormalisasi, kode semester -> periode, KK per topik, jadwal
mart : spota_topik (keputusan, KK, pembimbing, masa tunggu, tahap ujian eDOXID/SPOTA),
spota_mhs_judul (mahasiswa aktif belum lulus + status judul)
Jadwal 20:00 UTC (03:00 WIB), setelah dwh_tugas_akhir_daily karena memakai
mart.dim_mahasiswa, mart.dim_dosen, mart.fact_ujian_ta. spota_antrean_daily (MySQL dashboard)
dihapus. Env: SPOTA_API_SECRET (sudah ada di docker-compose).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
51 lines
2.4 KiB
Python
51 lines
2.4 KiB
Python
"""
|
|
DAG harian: DWH SPOTA (API legacy SPOTA) -> PostgreSQL DWH.
|
|
|
|
load_raw_spota ──> build_staging_spota ──> build_mart_spota
|
|
|
|
raw : topik/draft TA, KK, jadwal ujian, angkatan mahasiswa, nama dosen dari API SPOTA
|
|
(tanpa nama/email/HP/foto mahasiswa) + raw.spota_riwayat_pembimbing, satu-satunya tabel
|
|
kumulatif: hari pertama pembimbing 1/2 terlihat terisi (API tidak menyimpan tanggal ini)
|
|
staging : NIM/NIP dinormalisasi, kode semester -> periode, KK per topik, jadwal dirapikan
|
|
mart : spota_topik (keputusan, KK, pembimbing, masa tunggu, tahap ujian eDOXID/SPOTA),
|
|
spota_mhs_judul (mahasiswa aktif belum lulus + status judul) (+ etl_log)
|
|
-> dibaca dashboard PHP (halaman Executive "Monitoring SPOTA") lewat user dashboard_ro
|
|
|
|
Butuh mart.dim_mahasiswa, mart.dim_dosen, mart.fact_ujian_ta dari dwh_tugas_akhir_daily, jadi
|
|
dijadwalkan sesudahnya. Lihat scripts/dwh_spota_etl.py dan scripts/dwh_spota_sql.py.
|
|
|
|
Environment yang wajib di-set di Coolify (service airflow-scheduler):
|
|
DWH_HOST, DWH_PASSWORD -> sama dengan dwh_tugas_akhir_daily (user etl_writer)
|
|
SPOTA_API_SECRET -> secret API legacy SPOTA
|
|
Opsional: SPOTA_API_URL (default https://spota.untan.ac.id/steven/API).
|
|
"""
|
|
|
|
from datetime import datetime, timedelta
|
|
|
|
from airflow import DAG
|
|
from airflow.operators.python import PythonOperator
|
|
|
|
from scripts.dwh_spota_etl import run_build_mart_spota, run_build_staging_spota, run_load_raw_spota
|
|
|
|
with DAG(
|
|
dag_id="dwh_spota_daily",
|
|
description="ETL draft TA & penetapan pembimbing (API SPOTA) ke DWH PostgreSQL",
|
|
start_date=datetime(2026, 10, 1),
|
|
# 20:00 UTC = 03:00 WIB, setelah dwh_tugas_akhir_daily (02:00) & dwh_tracer_daily (02:30).
|
|
# Harian karena ketelitian masa tunggu pembimbing = 1 hari.
|
|
schedule_interval="0 20 * * *",
|
|
catchup=False,
|
|
max_active_runs=1,
|
|
default_args={
|
|
"owner": "informatika",
|
|
"retries": 2,
|
|
"retry_delay": timedelta(minutes=10),
|
|
},
|
|
tags=["dwh", "spota", "tugas-akhir", "dashboard"],
|
|
) as dag:
|
|
load_spota = PythonOperator(task_id="load_raw_spota", python_callable=run_load_raw_spota)
|
|
build_staging = PythonOperator(task_id="build_staging_spota", python_callable=run_build_staging_spota)
|
|
build_mart = PythonOperator(task_id="build_mart_spota", python_callable=run_build_mart_spota)
|
|
|
|
load_spota >> build_staging >> build_mart
|