Deterministic peat fire danger scoring engine and cluster drawer #4
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What to build
Port the deterministic 0–100 Danger Score engine from
data_client.pyinto a pure, typed TypeScript domain module. Group nearby hotspots into ~2.5 km fire clusters, join them against peat soil depth and KHG status, calculate the danger score (Water Table 35 + Recurrence 30 + Peat Depth 20 + Weather 15), and display an interactive inspection drawer when a cluster or point is selected.Technical specifications
Target files:
src/lib/domain/danger-score.ts: Pure scoring function and TypeScript types.src/lib/domain/__tests__/danger-score.test.ts: Vitest unit tests covering all score brackets.src/lib/gis/spatial-clustering.ts: DBSCAN / grid clustering grouping points within 0.025° (~2.7 km).src/components/drawer/cluster-detail-drawer.tsx: Bottom/side inspection sheet with accessibility support.src/components/drawer/risk-factor-breakdown.tsx: Horizontal telemetry progress bars for the 4 factors.Deterministic 100-Point Formula:
TMAT < -40 cm: Full35 pts(exceeds legal peat water table dryness threshold).-40 cm <= TMAT <= 0 cm: Linear interpolationround((abs(TMAT) / 40) * 35).TMAT > 0 cm(saturated/flooded):0 pts.20 pts.3+recurring hotspots in same peat unit:30 pts(active recurring fire scar).1-2recorded hotspots:15 pts.0 pts.> 500 cm(Kubah Gambut Ekstrem):20 pts.300 - 500 cm(Gambut Sangat Dalam):17 pts.100 - 300 cm(Gambut Sedang):12 pts.< 100 cm(Gambut Dangkal):6 pts.0 pts.> 20 km/hand Relative Humidity< 60%:15 pts.10 - 20 km/h:8 pts.< 10 km/hor RH> 80%:2 pts.80 - 100: KRITIS (#dc2626/ red-600)60 - 79: TINGGI (#ea580c/ orange-600)40 - 59: SEDANG (#d97706/ amber-600)0 - 39: RENDAH (#16a34a/ green-600)Drawer component:
92 / 100 KRITIS), administrative location (Desa / Kecamatan, Kab, Prov), KHG name, dominant peat depth, and plain-language explanation.Escapecloses drawer).Acceptance criteria
danger-score.tsboundary calculations.Blocked by
Issue 4: Deterministic peat fire danger scoring engine and cluster drawerto Deterministic peat fire danger scoring engine and cluster drawer