dwh_spota: KK prodi pakai singkatan AI/NS/SE/IS
1 = AI (Computation & Artificial Intelligence), 2 = NS (Networking & Security), 3 = SE (Software Engineering & Mobile Computing), 4 = IS (Information System & Data Spatial). KK lain tetap memakai nama dari getListKK, atau "KK <id>" bila tidak terbaca. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
ddf7ed0a17
commit
7d5a19344b
@@ -86,12 +86,12 @@ def _waktu(v) -> datetime | None:
|
|||||||
|
|
||||||
|
|
||||||
def _kk_rows() -> list:
|
def _kk_rows() -> list:
|
||||||
"""(id, nama) kelompok keahlian dari getListKK. Bentuk responsnya tidak terdokumentasi, jadi nama kolom
|
"""(id, nama) kelompok keahlian dari getListKK, untuk KK selain 4 KK prodi yang memakai singkatan tetap
|
||||||
dicari dari beberapa kemungkinan; bila gagal, staging memakai daftar cadangan (lihat dwh_spota_sql.py)."""
|
(lihat dwh_spota_sql.py). Bentuk responsnya tidak terdokumentasi, jadi nama kolom dicari dari beberapa kemungkinan."""
|
||||||
try:
|
try:
|
||||||
data = _spota_get("getListKK.php")
|
data = _spota_get("getListKK.php")
|
||||||
except Exception as exc: # noqa: BLE001 - KK hanya label, jangan gagalkan seluruh load
|
except Exception as exc: # noqa: BLE001 - KK hanya label, jangan gagalkan seluruh load
|
||||||
logger.warning("getListKK tidak terbaca, pakai daftar KK cadangan: %s", exc)
|
logger.warning("getListKK tidak terbaca, KK selain AI/NS/SE/IS tampil sebagai 'KK <id>': %s", exc)
|
||||||
return []
|
return []
|
||||||
rows = []
|
rows = []
|
||||||
for k in data:
|
for k in data:
|
||||||
|
|||||||
@@ -63,16 +63,13 @@ STAGING_SQL = r"""
|
|||||||
DROP TABLE IF EXISTS staging.spota_topik;
|
DROP TABLE IF EXISTS staging.spota_topik;
|
||||||
CREATE TABLE staging.spota_topik AS
|
CREATE TABLE staging.spota_topik AS
|
||||||
WITH kk_nama AS (
|
WITH kk_nama AS (
|
||||||
-- getListDataTAMahasiswa mengirim ID KK (tb_kelompok_keahlian.idKK); nama dari getListKK,
|
-- getListDataTAMahasiswa mengirim ID KK (tb_kelompok_keahlian.idKK). KK prodi memakai singkatan
|
||||||
-- cadangan dari tabel SPOTA bila endpoint itu tidak terbaca
|
-- yang disepakati (1 Computation & AI, 2 Networking & Security, 3 Software Engineering &
|
||||||
SELECT id, nama FROM raw.spota_kk WHERE id IS NOT NULL AND nama IS NOT NULL
|
-- Mobile Computing, 4 Information System & Data Spatial); KK lain memakai nama dari getListKK.
|
||||||
UNION ALL
|
|
||||||
SELECT v.id, v.nama
|
SELECT v.id, v.nama
|
||||||
FROM (VALUES (1, 'Computation & Artificial Intelligence'),
|
FROM (VALUES (1, 'AI'), (2, 'NS'), (3, 'SE'), (4, 'IS')) AS v (id, nama)
|
||||||
(2, 'Networking & Security'),
|
UNION ALL
|
||||||
(3, 'Software Engineering & Mobile Computing'),
|
SELECT id, nama FROM raw.spota_kk WHERE id NOT IN (1, 2, 3, 4) AND nama IS NOT NULL
|
||||||
(4, 'Information System & Data Spatial')) AS v (id, nama)
|
|
||||||
WHERE NOT EXISTS (SELECT 1 FROM raw.spota_kk k WHERE k.id = v.id AND k.nama IS NOT NULL)
|
|
||||||
),
|
),
|
||||||
kk_id AS (
|
kk_id AS (
|
||||||
SELECT DISTINCT ON (id) id, nullif(trim(kelompok_keahlian), '') AS kk
|
SELECT DISTINCT ON (id) id, nullif(trim(kelompok_keahlian), '') AS kk
|
||||||
|
|||||||
Reference in New Issue
Block a user