51 lines
1.8 KiB
Python
51 lines
1.8 KiB
Python
"""
|
|
DAG bulanan: sync data penelitian dosen Informatika ke DB dashboard akreditasi.
|
|
|
|
Task 1 tarik_publikasi_serpapi : semua publikasi tiap dosen dari Google
|
|
Scholar via SerpAPI (berdasar dosen.scholar;
|
|
dosen.scholar/sinta yang kosong diisi
|
|
otomatis dari halaman departemen SINTA).
|
|
Task 2 update_kuartil_scopus_sinta : label kuartil Q1-Q4 dari view Scopus di
|
|
profil SINTA -> kolom penelitian.scopus.
|
|
|
|
Environment yang wajib di-set di Coolify (service airflow-scheduler):
|
|
DB_HOST, DB_PORT, DB_USER, DB_PASS, DB_NAME -> MySQL dashboard (Coolify)
|
|
SERPAPI_KEY -> kunci SerpAPI
|
|
Opsional: SERPAPI_MAX_REQUESTS (default 90), SINTA_USERNAME/SINTA_PASSWORD.
|
|
"""
|
|
|
|
from datetime import datetime, timedelta
|
|
|
|
from airflow import DAG
|
|
from airflow.operators.python import PythonOperator
|
|
|
|
# Import fungsi dari folder scripts
|
|
from scripts.scholar_api_scraper import run_publications, run_scopus
|
|
|
|
with DAG(
|
|
dag_id="scholar_penelitian_monthly",
|
|
description="Tarik publikasi dosen via SerpAPI + kuartil Scopus dari SINTA",
|
|
start_date=datetime(2026, 7, 1),
|
|
schedule_interval="0 2 1 * *",
|
|
catchup=False,
|
|
max_active_runs=1,
|
|
default_args={
|
|
"owner": "dashboard-informatika",
|
|
"retries": 1,
|
|
"retry_delay": timedelta(minutes=30),
|
|
},
|
|
tags=["scholar", "sinta", "penelitian", "dashboard"],
|
|
) as dag:
|
|
|
|
task_publikasi = PythonOperator(
|
|
task_id="tarik_publikasi_serpapi",
|
|
python_callable=run_publications,
|
|
)
|
|
|
|
task_scopus = PythonOperator(
|
|
task_id="update_kuartil_scopus_sinta",
|
|
python_callable=run_scopus,
|
|
)
|
|
|
|
task_publikasi >> task_scopus
|