feat: initial commit for merica-pipeline delivery

This commit is contained in:
MERICA Admin
2026-10-08 19:33:15 +07:00
commit 42fedab752
46 changed files with 5484 additions and 0 deletions
+12
View File
@@ -0,0 +1,12 @@
-- dbt Gold Model: fct_spku_daily_mart
{{ config(materialized='table', schema='gold') }}
SELECT
stasiun_id,
nama_stasiun_clean,
AVG(ispu_value) AS avg_daily_ispu,
MAX(ispu_value) AS max_daily_ispu,
COUNT(*) AS total_readings,
CURRENT_DATE AS mart_date
FROM {{ ref('stg_spku_realtime') }}
GROUP BY stasiun_id, nama_stasiun_clean
@@ -0,0 +1,16 @@
{{ config(
materialized='table',
schema='gold'
) }}
SELECT
stasiun_id,
nama_stasiun,
CAST(recorded_at AS DATE) AS observation_date,
AVG(pm25_value) AS avg_pm25,
MAX(pm25_value) AS max_pm25,
AVG(pm10_value) AS avg_pm10,
MAX(pm10_value) AS max_pm10,
CURRENT_TIMESTAMP AS refreshed_at_gold
FROM {{ ref('silver_spku_sensor_clean') }}
GROUP BY 1, 2, 3
@@ -0,0 +1,13 @@
{{ config(
materialized='table',
schema='gold'
) }}
SELECT
CAST(issued_date AS DATE) AS permit_date,
permit_type,
permit_status,
COUNT(permit_id) AS total_permits,
CURRENT_TIMESTAMP AS refreshed_at_gold
FROM {{ ref('silver_environmental_permits_clean') }}
GROUP BY 1, 2, 3
@@ -0,0 +1,14 @@
{{ config(
materialized='table',
schema='gold'
) }}
SELECT
kecamatan,
tanggal_laporan,
COUNT(lokasi_tps) AS total_tps,
SUM(volume_sampah_m3) AS total_volume_sampah_m3,
AVG(volume_sampah_m3) AS avg_volume_per_tps_m3,
CURRENT_TIMESTAMP AS refreshed_at_gold
FROM {{ ref('silver_gws_waste_reports_clean') }}
GROUP BY 1, 2