The seed data layer consists of two parts: theDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/astrxnomo/manizalesdepie/llms.txt
Use this file to discover all available pages before exploring further.
supabase/seed.sql file which populates known aid sites from press and institutional reporting, and the scripts/seed-barrios.mjs script which loads the 114 official barrio polygons into the neighborhood table. Neither part is optional — the map needs neighborhood boundaries before site pins can be assigned to a barrio, and the site rows give curators something to geocode and publish from day one.
The seed.sql file
supabase/seed.sql carries real shelter names, collection points, blood donation centers, and census points sourced from press and institutional reporting about the August 2026 earthquake in Manizales and Villamaría. It inserts:
- Shelters (
shelter) — Coliseo Mayor, Coliseo Menor, CIC Aranjuez, Coliseo de la Universidad de Caldas, and Coliseo de Villamaría. - Blood donation sites (
blood_donation) — Canchas auxiliares de Palogrande and Hemocentro del Café, both flagged with O-positive and O-negative urgency. - Collection points (
collection_point) — Cruz Roja Caldas and Banco de Alimentos de Manizales, each pre-populated withsite_itemrows that specify what is needed and what is explicitly not accepted (used clothing and near-expiry food are refused). - Medical/coordination post (
medical_post) — Puesto de Mando Unificado at Bomberos Manizales. - Neighborhood status rows — gas suspension notices for La Estrella, Milán, and Centro, derived from Efigas reporting.
- Work orders — eleven individual household requests sourced from press and community mapping reports on 14–15 August, with coordinates rounded to three decimal places (~100 m) to avoid publishing a precise household address.
published = false by default.
Apply the seed with:
barrios.sql (generated by fetch-barrios.mjs) before this file when possible. The sites above rely on a trigger that stamps each row with its neighborhood_id by resolving the site’s coordinates against barrio boundary polygons — that resolution returns null until the polygons exist.
Loading neighborhood data
Three scripts manage neighborhood geometry, and they must be run in order.scripts/fetch-barrios.mjs
Downloads the official barrio layer from the Alcaldía de Manizales ArcGIS open data portal (geodata-manizales-sigalcmzl.opendata.arcgis.com) — specifically the “Límite de barrios Municipio de Manizales” layer, which encodes the 116 polygons defined by Acuerdo Municipal 589 de 2004 (amended by 1038 de 2019). The script then:
- Simplifies each ring with Ramer–Douglas–Peucker to reduce byte count over a potentially degraded network.
- Merges split polygons (barrios with non-contiguous parts, like Puerta del Sol/Corinto) into a single
MultiPolygonfeature. - Fixes accent marks by cross-referencing OSM neighbourhood nodes within Manizales’s administrative boundary via Overpass API. The unaccented all-caps names from the official dataset (“SAN JOSE”, “COLON”) are replaced with their properly accented OSM spellings where a match is found, and title-cased otherwise.
- Writes
public/barrios.geojsonand generatessupabase/barrios.sqlas a side effect.
public/barrios.geojson as a spelling cache, so a failed Overpass run never silently overwrites good accent marks with unaccented fallbacks.
The Overpass API is used only for accent correction, not for geometry. Overpass responds with HTTP 504 intermittently — the script has two mirror endpoints and falls back gracefully, logging a warning and continuing with title-cased names. The barrio boundary data itself comes entirely from the Alcaldía’s ArcGIS service and is unaffected by Overpass availability.
scripts/seed-barrios.mjs
Readspublic/barrios.geojson and upserts rows into the neighborhood table, calling the upsert_neighborhood Postgres RPC for each feature. The RPC receives three parameters per call:
p_name— the accented barrio name resolved byfetch-barrios.mjsp_comuna— the numeric commune identifier from the source layerp_geojson— the full simplified polygon or MultiPolygon geometry as a GeoJSON string
.env.local to bypass RLS. After inserting all barrios, it calls backfill_neighborhoods to re-stamp any site or work_order rows that were inserted before the boundary polygons existed.
The script is idempotent — it upserts on (name, municipality) — and is designed to be re-run whenever the Alcaldía publishes an updated layer.
Run order
Importing OSM sites
scripts/import-osm-sites.mjs queries the Overpass API for OSM nodes, ways, and relations tagged as hospitals, clinics, doctors, veterinary practices, and drinking water points within the administrative boundaries of Manizales and Villamaría. It deduplicates against existing site_public rows (skipping any candidate within 80 m of a known site) and inserts the remainder as site rows with status = 'unknown' and published = true, each carrying a source_url pointing to its OpenStreetMap object.
Run it with:
scripts/prune-osm-sites.mjs to clean up results before curator review. These rows are starting points for a curator to inspect — OSM knows the building is there; it knows nothing about whether a clinic is receiving patients three days after an earthquake.
Adapting for a different city
To use this codebase as the basis for a different emergency:- Replace
public/barrios.geojsonwith your city’s neighborhood polygon data. The file must be a GeoJSONFeatureCollectionwith each feature carrying at minimum anamestring property and aPolygonorMultiPolygongeometry. - Update the geographic bounds in the DTO schemas. The current bounds are
longitude: -76.2 to -74.8andlatitude: 4.6 to 5.6, corresponding to the Caldas department area. Out-of-area submissions are rejected at the DTO validation layer. - Update the
OUT_OF_AREAerror messages in each DTO to reference your city and region. - Run
node scripts/seed-barrios.mjswith the new GeoJSON to populate theneighborhoodtable. - Write new seed data for your emergency’s known aid sites, following the structure of
supabase/seed.sql.
