ASAPify detects fire that is already smouldering inside peat soil but has not yet burned the vegetation on the surface. Two geostationary satellites, Himawari-9 and GK2A, observe every peat pixel in Sumatra and Kalimantan (15 provinces) every 10 minutes through the night. A deterministic rule engine (MAUT + neighbour support) flags pixels as AWAS; only then does a Gemini agent fetch the latest VIIRS data and imagery to verify, and an operator decides before the message goes to that province's subscribers (web inbox + Telegram DM). AI is not the detector.
Legend: ✅ decided · 💡 proposal, starting figures to calibrate · ❓ open item · ⚠️ not verified yet
✅ "Two-satellite observation + deterministic rules detect anomalies; neighbouring pixels validate them spatially; AWAS pixels are verified by AI with VIIRS and imagery; an operator decides; the message goes to subscribers who chose that province."
Three parts: A the logic flow (what happens, where decisions are made), B the service schematic (who talks to whom), and C a numbered table of links that explains every line in B.
Scroll the diagram sideways if it is cut off.
asapify-agent verifies and notifies the operator group; asapify-api serves operators and subscribers; once an operator publishes, it writes inbox entries and a queue per subscriber, and the asapify-notify worker sends them through Cloud Tasks (17, 20, 21). The Scheduler runs a sweep every minute to resume an interrupted queue. The browser only reads Storage through signed URLs for crop images and the static map layers in the public bucket.Scroll the diagram sideways if it is cut off.
| # | From → to | What passes | When | Access |
|---|---|---|---|---|
| 1 | Cloud Scheduler → 4 jobs + sweep | job run command (Cloud Run Admin API); POST /_internal/notifications/sweep to asapify-notify | ingest */10 20-23,0-4 · evaluate 5-59/10 20-23,0-4 · environment 0 12 (WIB) · sweep * * * * * | OAuth sa-scheduler (run.invoker); sweep: OIDC sa-task |
| 2 | NOAA Himawari-9 → ingest-himawari | B07 + B14, segments S05/S06 (.DAT.bz2) | every 10 minutes, at night | anonymous |
| 3 | NOAA GK2A → ingest-gk2a | sw038 + ir105 full-disk NetCDF (~30 MB/channel) | every 10 minutes, at night | anonymous |
| 4 | NASA POWER → environment | hourly TS + T2M in UTC, per POWER cell (0.5° × 0.625°) | daily; missing days only | no key |
| 5 | BIG + geoBoundaries → build | KHG polygons, 15 province boundaries | once | no key |
| 6 | All jobs ↔ Cloud Storage | ingest writes himawari/, gk2a/; environment writes environment/; evaluate reads all of them and writes score/; build writes peat/ (and the peat-pixel GeoJSON to the public bucket for the map layer) | every run | sa-jobs objectAdmin |
| 7 | All jobs → Firestore | runs (every job), clusters (evaluate) | every run | sa-jobs datastore.user |
| 8 | evaluate → asapify-agent | POST /verify {cluster_id, trigger_slot}; POST /cluster-closed {cluster_id} | /verify: only new AWAS clusters, or active ones last verified > 6 h ago · /cluster-closed: when a cluster closes | OIDC sa-jobs → run.invoker |
| 9 | agent ↔ Cloud Storage | reads score/; writes crops/ PNGs + 1-hour signed URLs | per verification | sa-agent objectAdmin + TokenCreator |
| 10 | agent ↔ Firestore | reads clusters, alerts; writes verifications, alerts.status, audit_log | per verification | sa-agent datastore.user |
| 11 | agent → Gemini | instructions, context, tool results, PNG images (multimodal) | ≤ 8 tool calls per verification | sa-agent aiplatform.user |
| 12 | agent → NASA FIRMS + GIBS | VIIRS detections in a ±10 km box, 48 hours; true-colour image for the latest date | per verification (on demand) | MAP_KEY (FIRMS); GIBS needs no key |
| 13 | agent → NOAA Himawari-9 | night thermal crop / daytime true colour (complementary capture) | per verification | anonymous |
| 14 | agent → Telegram | sendPhoto to the operator group | after a verification is saved | bot token |
| 15 | ASAPify web app ↔ asapify-api | /api/v1/operator/*: map, clusters, decisions, delivery status; /api/v1/notifications/*: preferences, inbox, confirmations | when an operator or subscriber opens the web app | Firebase token; /operator/* needs the claim role = operator, /notifications/* only a verified email |
| 16 | asapify-api ↔ Firestore | reads clusters, verifications; writes alerts, audit_log, subscriber preferences, inbox entries and channel jobs (notification_*) | per request, per decision | sa-api datastore.user |
| 17 | asapify-notify → Telegram + FCM | sendMessage text to subscriber DMs (with an "Open & confirm" button); FCM / Web Push for exercises only | per job, only after an operator publishes | bot token (secret on the worker); sa-notify FCM admin |
| 18 | build → Earth Engine | WorldCover class 50 → built-up fraction per 0.02° cell | once | sa-jobs earthengine.writer |
| 19 | asapify-api → Cloud Storage | reads score/ (map grid, cluster utility series); creates crops/ signed URLs for the browser | per web request | sa-api objectViewer + TokenCreator |
| 20 | asapify-api → Cloud Tasks → asapify-notify | one task per channel job; task name = hash, no personal data | after a publish decision and fan-out | OIDC sa-task → run.invoker on the worker |
| 21 | asapify-notify ↔ Firestore | claims a job, re-checks consent, confirmation and expiry, writes the delivery status | per job | sa-notify datastore.user |
p420_950 in Central Kalimantan: Himawari z_rel = 3.1 (u_H = 0.55), GK2A cloudy → n_sat = 1, U = 0.38 → WATCH. Links 2, 3, 6.z_rel Himawari 4.4 and GK2A 4.1 → u_H = u_G = 1; ΔLST = 2.5 K → u_LST = 0.5; ΔSAT = −1 K → 0; 2 of 3 nights → u_T = 0.67.U0 = (0.25 + 0.25 + 0.05 + 0 + 0.10) / 0.80 = 0.81; 3 of 8 neighbours U0 ≥ 0.5 → u_N = 0.375; U = (0.65 + 0.075) / 1.00 = 0.73 → AWAS (U ≥ 0.65, neighbours ≥ 0.25, both satellites agree). Cluster C-0924-002 (4 pixels) is created (7), POST /verify (8).get_latest_viirs: 1 NOAA-20 detection 1.4 km from the coordinate, 13 hours ago (12); VIIRS image from 24 Sep daytime: thin smoke drifting north-west (12); Himawari crop (13); Gemini reasons (11) → strong_evidence, saved (10); summary to the operator group (14)./cluster-closed (8); the alert is marked closed (10): inbox entries get the SELESAI label and jobs not yet sent are cancelled. (Closing alerts is not implemented in ktp-asapify-be yet.)Planck calculation: the brightness-temperature shift of one 2 km pixel caused by a 400 °C ember on a 298 K background. Applies to Himawari B07 (3.9 µm) and GK2A SW038 (3.8 µm).
| Ember area | 10.5–11.2 µm (B14 / IR105) | 3.8–3.9 µm (B07 / SW038) |
|---|---|---|
| 90 m² | 0.02 K | 0.5 K |
| 1,000 m² | 0.2 K | 5.4 K |
| 1 ha | 2.1 K | 33 K |
mir) carries the main signal; the 10.5–11.2 µm window channel (win) is used for cloud, ΔLST and ΔSAT.AWAS.✅ Mechanism: MAUT combines the two-satellite attributes, the environment baseline and time; neighbours validate spatially. 💡 The figures below are starting values calibrated in the backtest (A7, A8); changes are logged in WORKLOG section 7.
jobs/lib/maut.py)A satellite that is cloudy in that slot is dropped and the weights are renormalised, so the score stays 0–1.
| Term | Definition used in code |
|---|---|
| Night, slot | 20:00–04:00 WIB = 13:00–21:00 UTC; slot = 10-minute scan time in UTC, the same for both satellites. night_id = WIB date when the night starts. |
| Cloudy (per satellite) | window channel (B14 / IR105) < 270 K → that satellite's attribute is not used |
| Thermal baseline | median and MAD of mir per pixel per UTC hour over the previous 30 nights, per satellite; frozen for WATCH/AWAS pixels |
| ΔLST | win_max − TS_base(cell, hour) − b_LST(pixel, hour). TS_base = 30-day median of NASA POWER TS; b_LST = 30-night median of the same difference (removes per-pixel atmospheric and emissivity bias) |
| ΔSAT | win_max − T2M_base(cell, hour). On a normal night the surface is cooler than the air; above air temperature means a heat source ⚠️ check the distribution (open item 15) |
| u_T (temporal) | k = number of valid nights among the last 3 valid nights (including tonight) with ≥ 2 slots where max(u_H, u_G) ≥ 0.5 |
| Two satellites agree | u_H ≥ 0.5 and u_G ≥ 0.5, each in ≥ 1 slot within the last 60 minutes |
| Pixel status | Condition (evaluated every night slot by asapify-evaluate) | Meaning |
|---|---|---|
| AWAS | U ≥ 0.65 and u_N ≥ 0.25 (≥ 2 of 8 neighbours) and both satellites agree | Triggers verification. Not a confirmed fire. |
| WATCH | not AWAS, and U ≥ 0.30 | Includes isolated anomalies and single-satellite anomalies |
| NO_OBSERVATION | both satellites cloudy or no data in that slot | Missing data, not safe |
| SAFE | anything else | — |
Supported. 3 of 8 neighbours U0 ≥ 0.5 → u_N = 0.375. Can become AWAS.
Isolated. u_N = 0 → WATCH at most. More likely sensor noise.
Partly cloudy. Only observed neighbours count: 2 of 5 → u_N = 0.4.
Legend: P pixel being scored · A neighbour with U0 ≥ 0.5 · hatched = cloudy neighbour · dot = normal neighbour. Non-peat neighbours are not counted.
✅ The ADK agent is called per AWAS cluster, not on a schedule. Computation lives in deterministic tools; Gemini chooses the tool order, reads the images and writes the summary.
{
"cluster_id": "C-0924-002",
"pixel_id": "p420_950",
"result": "strong_evidence",
"smoke_visible": true,
"viirs_within_2km_48h": 1,
"evidence": [
{"source": "viirs_firms",
"finding": "NOAA-20, 1,4 km",
"finding_en": "NOAA-20, 1.4 km",
"age_h": 13},
{"source": "viirs_image",
"finding": "asap tipis ke barat laut",
"finding_en": "thin smoke drifting north-west",
"age_h": 9},
{"source": "himawari_image",
"finding": "titik terang di penanda",
"finding_en": "bright spot on the marker"}
],
"summary_id": "…",
"summary_en": "…"
}
strong_evidence when smoke is visible ≤ 5 km from the coordinate, or there is a VIIRS detection ≤ 2 km within 48 hoursinconclusive. No visible smoke is never grounds for rejectionviirs_within_2km_48h > 0 but the result is inconclusive, or when a number in the summary is not in the tool resultsYou verify AWAS thermal anomalies on Indonesian peatland. The rule engine has already identified the coordinate as AWAS. Your task is verification, not detection. 1. Read the candidate context (get_pixel_context). 2. Retrieve the latest VIIRS detections around the coordinate. 3. Retrieve the latest VIIRS true-colour image and a Himawari image of the same area. 4. Look for visible smoke or other visual evidence consistent with smouldering or fire activity. 5. Treat absence of visible smoke as inconclusive, never negative. 6. Never change the rule-engine status. Never invent numbers. 7. Save the result with save_verification.
Landsat passes over a given location only once every few days, so it does not suit early warning, which needs high frequency. ToPeCAl (Sofan et al. 2019) is used neither for detection nor for verification.
It can still be mentioned as a roadmap: post-event analysis, dataset validation, research, model evaluation.
| Agent result | Shown to the operator and in Telegram |
|---|---|
strong_evidence | "Strong evidence: …" (visible smoke / nearby VIIRS detection); in Telegram "Bukti kuat: …" |
inconclusive | "Inconclusive: …" (no visible smoke, cloudy, or an old image); in Telegram "Inkonklusif: …" |
Himawari-9 and GK2A = the two independent main observations. NASA POWER = environment baseline. VIIRS = on-demand verification evidence, for AWAS only. Himawari imagery = complementary capture for the agent.
| Source | Role and use | Not used for | Access | Frequency / resolution | Status |
|---|---|---|---|---|---|
| D1 · Himawari-9 AHI (B07 3.9 µm + B14 11.2 µm) | Main observation 1 Thermal features per peat pixel every 10 minutes, at night (MAUT: u_H, cloud, ΔLST, ΔSAT) | Agent verification | NOAA bucket noaa-himawari9, anonymous; segments S05 + S06 ⚠️ | 10 minutes · ~2 km at nadir · 140.7° E | ✅ |
| D2 · GK2A AMI (SW038 3.8 µm + IR105 10.5 µm) | Main observation 2 (independent) Thermal features per peat pixel every 10 minutes, at night (MAUT: u_G, cloud, ΔLST, ΔSAT) | Agent verification | NOAA bucket noaa-gk2a-pds, anonymous; full-disk NetCDF ~30 MB/channel | 10 minutes · 2 km · 128.2° E · archive since 16 Feb 2023 | ✅ checked |
| D3 · NASA POWER hourly: TS (= LST) + T2M (= SAT) | Environment baseline Expected skin and air temperature per cell per UTC hour (30-day median) for ΔLST and ΔSAT | Tonight's measurement; per-pixel LST | Point API /api/temporal/hourly/point, no key | Hourly · 0.5° × 0.625° (GEOS-IT) · ~1.5 day latency | ✅ checked |
| D4 · VIIRS FIRMS (3 satellites NRT; SP for the archive) | On-demand verification evidence Detections around an AWAS cluster (called by the agent); timing reference in the backtest | Detection; periodic ingest | FIRMS area API, free MAP_KEY; ≤ 5 days per request | 375 m · ± 2 passes/satellite/day · NRT ~3 hours | ✅ |
| D5 · VIIRS true colour (NASA GIBS, 3 satellites) | Visual evidence Daytime smoke imagery around the coordinate, read by Gemini | Detection; night | GIBS WMS epsg4326/best, no key | Daily daytime (~13:30) · often cloudy | ✅ tested |
| D6 · Himawari-9 imagery (night B07 crop, daytime true colour) | Complementary capture Imagery at whatever time AWAS happens, for the agent and the UI | MAUT | Same bucket as D1, fetched when the agent needs it | On request | ✅ |
| D7 · KHG Indicative Map (Dit. PKG KLHK) | Peat mask Decides which peat pixels are processed | Telling apart objects on top of peat | BIG REST layer 37, no key, GeoJSON, 1,000 features/request | Static | ✅ tested |
| D8 · ESA WorldCover v200 + province boundaries (geoBoundaries) | Building mask + area filter Pixels with built-up ≥ 0.2 are dropped; provinces 11–19, 21, 61–65 and subscriber region choice | — | Earth Engine once in asapify-build; geoBoundaries GeoJSON | Static | ✅ ODbL |
| Tools / services | Used for | Not used for |
|---|---|---|
| Gemini (Vertex AI, latest Flash model) | Choosing the tool order, reading VIIRS/Himawari images, writing ID/EN summaries | Computing scores, setting status |
| Agent Development Kit (ADK) | Agent loop, 5 tools, 8-call limit | Deterministic stages |
| Cloud Run jobs | ingest-himawari, ingest-gk2a, evaluate (10 minutes, at night), environment (daily), build (once) | Serving web requests |
| Cloud Run service asapify-agent | POST /verify: agent + tools, operator group notification | Public calls |
| Cloud Run service asapify-api | FastAPI for operators and subscribers: decisions, inbox, notification queue | Running the agent |
| Cloud Scheduler | 4 schedules (2 ingest, evaluate, environment) | — |
| Cloud Storage | Parquet peat/, himawari/, gk2a/, environment/, score/; PNG crops/; raw/ (manifests, cache) | Direct browser reads |
| Firestore | clusters, verifications, alerts, runs, audit_log, notification_* (subscribers, inbox, jobs) | Pixel time series |
| Secret Manager | firms-map-key (agent), telegram-bot-token (agent, notify), telegram-webhook-secret (api) | — |
| Earth Engine | WorldCover built-up fraction, once | Himawari, GK2A, Landsat |
| Firebase Hosting + Auth | Serving the web app (the judged URL), Google sign-in for operators and subscribers, operator role | — |
React 19 + Vite + MapLibre 6 (repo ktp-asapify-fe) | Web app: map, slot player, archive calendar, cluster detail, decisions; subscriber notifications page; mock mode for previews | Computing scores or status |
| Telegram Bot API | sendPhoto to the operator group; sendMessage to subscriber DMs; a webhook only to link accounts (/start) | Public alert groups, replying to messages |
| Cloud Tasks + FCM | Per-subscriber send queue (OIDC to the worker); browser push for exercises | Emergency alerts over FCM (not allowed by FCM policy) |
| Python | satpy (ahi_hsd, ami_l1b), pyresample, s3fs, xarray, netCDF4, numpy, pandas, pyarrow, geopandas, rasterio, shapely, scipy, httpx, pillow, earthengine-api, google-adk, google-genai, fastapi, pytest | — |
Endpoint details in Backend & API, setup commands in Cloud setup, screens in UI. One Docker image for everything.
B07 + B14 → himawari/
SW038 + IR105 → gk2a/
MAUT + neighbours → score/; clusters → Firestore; POST /verify.
NASA POWER + thermal baseline → environment/
WorldCover + KHG + provinces → peat/
ADK + Gemini + 5 tools; operator group.
Operators and subscribers, decisions, inbox, notification queue.
Map, night archive, cluster detail, publish/reject; subscriber notifications.
Sends Telegram DMs and exercise push per subscriber; sweep every minute.
Storage: per-pixel features and scores in Cloud Storage (Parquet); clusters, verifications, alerts and audit in Firestore. The browser never reads Firestore directly.
Closed: level mapping (replaced by publish/reject), old Landsat scenes (ToPeCAl dropped), Earth Engine eligibility (WorldCover once only), FIRMS (on demand), KHG via BIG REST, alert channel (DM + inbox per subscriber, 9 Oct).
| # | Question | Proposal 💡 | Due |
|---|---|---|---|
| 8 | Himawari and GK2A latency | Measure in Runbook S0-7; "late" threshold 40 minutes | 1 Oct |
| 11 | Backtest window | ✅ Central Kalimantan sub-area 113.5,-2.6,114.3,-1.9, 1 Sep – 15 Oct 2023; August 2023 warm-up. Check ≥ 20 detections in S0-6. 💡 Second window: OKI, South Sumatra 105.2,-3.7,106.0,-3.0, same period (planned, no figures yet) | 30 Sep |
| 12 | Province boundaries | ✅ geoBoundaries IDN ADM1 (ODbL, © OpenStreetMap contributors), attribution shown on the map and the About page (S0-8) | 1 Oct |
| 14 | MAUT calibration | Weights and thresholds calibrated against VIIRS SP in Sep 2023, tested on 1–15 Oct (A8) | 13 Oct |
| 15 | ΔSAT distribution | Check the 99th percentile of pixels without VIIRS; if > 0 K shift the ramp (A7) | 5 Oct |
| 16 | Number of POWER cells | Count in A1; if > 300, use cells holding ≥ 5 peat pixels | 2 Oct |
data/ref/.Central Kalimantan sub-area 113.5,-2.6,114.3,-1.9, 1 Sep – 15 Oct 2023, August 2023 warm-up baseline. Why: the GK2A archive starts on 16 Feb 2023; the 2023 fire season saw heavy haze over Central and South Kalimantan in late September and 713.23 ha of peat burned in Palangka Raya.
Outputs (A7): per cluster first_awas_at, first_viirs_at, lead_h, false alarms, misses, number of NO_OBSERVATION slots. VIIRS SP is used offline as the reference, not in the operational path.
Click a task ID to open its complete commands in the Runbook.
Status 6 Oct: the operator web app was finished early in the ktp-asapify-fe repo (mock mode); 9 Oct: Firebase sign-in, the notifications page, and the API + Notification Engine in ktp-asapify-be. This sprint connects them to pipeline data and turns sending on.
| Role | Main work |
|---|---|
| A · Observation & rule engine | Himawari and GK2A ingest, NASA POWER, peat mask, baselines, MAUT, neighbour support, status, backtest. Critical path. |
| B · Verification | VIIRS tools (FIRMS + GIBS), Himawari crops, testing access to verification data |
| C · Backend & AI | Cloud Run, Scheduler, ADK agent + Gemini, API, Firestore, IAM |
| D · Web, bot & pitch | Operator map, cluster detail, subscriber notifications, video, deck |