add dwh_spota_daily dag (spota api -> postgres dwh), ganti spota_antrean_daily
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>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
d01fd5e94d
commit
02a9e6f848
@@ -0,0 +1,50 @@
|
||||
"""
|
||||
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
|
||||
@@ -1,44 +0,0 @@
|
||||
"""
|
||||
DAG harian: catat antrean penetapan pembimbing SPOTA ke DB dashboard akreditasi
|
||||
(dasar "median masa tunggu pembimbing" di Executive > Monitoring SPOTA).
|
||||
|
||||
Task catat_antrean_pembimbing : tarik getListTugasAkhir?withoutKep dari API legacy SPOTA,
|
||||
catat topik yang disetujui Ketua KK tapi pembimbing 1/2 belum
|
||||
lengkap, plus hari pertama pembimbing terlihat terisi, ke tabel
|
||||
spota_antrean_pembimbing (dibuat otomatis bila belum ada).
|
||||
|
||||
Environment yang wajib di-set di Coolify (service airflow-scheduler):
|
||||
DB_HOST, DB_PORT, DB_USER, DB_PASS, DB_NAME -> MySQL dashboard (Coolify)
|
||||
SPOTA_API_SECRET -> secret API legacy SPOTA
|
||||
Opsional: SPOTA_API_URL (default https://spota.untan.ac.id/steven/API).
|
||||
|
||||
Jadwal 18:00 UTC = 01:00 WIB. Ketelitian masa tunggu = 1 hari, jadi jangan dijarangkan.
|
||||
"""
|
||||
|
||||
from datetime import datetime, timedelta
|
||||
|
||||
from airflow import DAG
|
||||
from airflow.operators.python import PythonOperator
|
||||
|
||||
# Import fungsi dari folder scripts
|
||||
from scripts.spota_antrean import run
|
||||
|
||||
with DAG(
|
||||
dag_id="spota_antrean_daily",
|
||||
description="Catat antrean penetapan pembimbing SPOTA (topik disetujui KK, pembimbing belum lengkap)",
|
||||
start_date=datetime(2026, 10, 1),
|
||||
schedule_interval="0 18 * * *",
|
||||
catchup=False,
|
||||
max_active_runs=1,
|
||||
default_args={
|
||||
"owner": "dashboard-informatika",
|
||||
"retries": 3,
|
||||
"retry_delay": timedelta(minutes=20),
|
||||
},
|
||||
tags=["spota", "tugas-akhir", "dashboard"],
|
||||
) as dag:
|
||||
|
||||
PythonOperator(
|
||||
task_id="catat_antrean_pembimbing",
|
||||
python_callable=run,
|
||||
)
|
||||
Reference in New Issue
Block a user