How official NDMA and PDMA figures, river levels and OpenStreetMap facilities reach Nigraan automatically, and how the jobs handle failure.
Two scheduled jobs on GitHub Actions keep Nigraan's official data and its facility map up to date, with no one pressing a button. Both write to Supabase with a service key that exists only as a GitHub Actions secret. Neither app ever holds it.
Workflow: .github/workflows/ndma-ingest.yml
Runs: three times a day, timed for after NDMA's usual publishing hours (about 13:00, 18:30 and 22:45 Pakistan time). It can also be started by hand, including as a dry run.
Code: frontend/scripts/pipeline/
Each run:
pdftotext (poppler).parseNdmaSitrep.mjs, parseNdmaRelief.mjs, parsePdmaAdvisory.mjs and others), each with tests built from real documents.official_reports and official_relief, so running twice never duplicates anything.River flood stages come from PMD and reservoir levels from FFC. PMD refuses requests from GitHub's servers, so that step is off in the scheduled job.
Workflow: .github/workflows/osm-facilities.yml
Runs: daily.
Code: frontend/scripts/buildOsmFacilities.mjs
The job asks OpenStreetMap's Overpass service for hospitals, clinics, drinking water, fire stations and ambulance stations across Pakistan. It assigns each facility's province and district from OpenStreetMap's own boundaries, and writes the result as a single row in osm_facilities.
Guards against bad data:
The public Overpass servers sometimes refuse automated requests to protect themselves. The job tries each server in turn over several rounds and never asks one again after it has refused. Most days it succeeds; on a day it does not, users see no gap.
The forecast layer is not a scheduled job: each visitor's browser calls the free Open-Meteo forecast API directly, for about 55 places across Pakistan, and the site scores the results for rain, heat and wind risk.