feat(telemetry): live telemetry ingestion, server-side clustering, and GeoParquet historical archive on R2 #36
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
Implement an end-to-end telemetry pipeline that:
O(N)) and payload pruning on live KLHK SiPongi+ hotspots to eliminate client-side UI freezing.telemetry/current/latest-clusters.json).telemetry/archive/year=YYYY/month=MM/data.parquet)./api/hotspots/historical) using DuckDB to query remote GeoParquet archives over HTTP byte-range requests without requiring a stateful database.Technical specifications
Target files:
src/lib/gis/spatial-clustering.ts: RefactorclusterHotspots()to use a 2D spatial grid hash map (Math.floor(lon / eps),Math.floor(lat / eps)), checking only adjacent 3x3 cells. Execution time must drop fromO(N^2)(~8.6s) toO(N)(<50ms) for 20,000 points.src/app/api/hotspots/route.ts: Pre-cluster and prune payload on the server. Return pre-calculated clusters (~120 KB) and compact coordinate arrays instead of 7.8 MB of raw GeoJSON. Add background revalidation so clients never block on SiPongi upstream latency.scripts/ingest-hotspots-geoparquet.py: Python CLI ingestion script fetching SiPongi historical periods, validating coordinates against Indonesia bounding box[94.0, -11.5, 141.5, 6.5], generating GeoParquet with Snappy/Zstd compression and row-group bounding boxes, and syncing to R2.src/lib/services/geoparquet-query.ts: Embedded DuckDB query interface executing spatial SQL queries (read_parquet('https://tiles.gambut.nokopia.com/telemetry/archive/...')) using HTTP range requests.src/app/api/hotspots/historical/route.ts: Historical query API route supporting temporal (startDate,endDate), spatial (provinsi,bbox), and attribute (confidence_level) filtering..forgejo/workflows/sync-tiles-r2.yml: Add step to run daily historical telemetry ingestion and Parquet sync to R2.GeoParquet Schema & Partitioning:
hs_id(VARCHAR),geometry(GEOMETRY / WKB Point),lon(DOUBLE),lat(DOUBLE),waktu_utc(TIMESTAMP),waktu_wib(VARCHAR),sumber(VARCHAR),confidence_level(VARCHAR),counter(INTEGER),provinsi(VARCHAR),kabkota(VARCHAR),kecamatan(VARCHAR),desa(VARCHAR),peat_depth(VARCHAR),is_gambut(BOOLEAN).telemetry/archive/year=YYYY/month=MM/data.parquet.Performance & SLA Requirements:
/api/hotspotsresponse time: <50ms on cache HIT, <200ms on server-side re-clustering.Acceptance criteria
/api/hotspots/historicalsuccessfully answers time-series queries using DuckDB HTTP range requests without downloading entire Parquet files.Authoritative Specifications & Reference Documentation
docs/ARCHITECTURE.mdsrc/lib/services/sipongi.tsIssue 23: [Backend] Automated live telemetry ingestion & spatial enrichment worker (to [Backend] Automated live telemetry ingestion & spatial enrichment worker (rustgis ingest-telemetry)rustgis ingest-telemetry)[Backend] Automated live telemetry ingestion & spatial enrichment worker (to Automated live telemetry ingestion & spatial enrichment worker (rustgis ingest-telemetry)rustgis ingest-telemetry)Automated live telemetry ingestion & spatial enrichment worker (to feat(telemetry): live telemetry ingestion & spatial peatland enrichment servicerustgis ingest-telemetry)feat(telemetry): live telemetry ingestion & spatial peatland enrichment serviceto feat(telemetry): live telemetry ingestion, server-side clustering, and GeoParquet historical archive on R2