← back to Costa Rica
costa-rica: resumable Hacienda enrichment drain (25k cedulas, $0 gov API) — TK-10346
e74733879ed75da2caa3dbe3fe0edfec97284cd3 · 2026-08-07 09:36:49 -0700 · Steve
Files touched
A scripts/ingest/hacienda-drain.sh
Diff
commit e74733879ed75da2caa3dbe3fe0edfec97284cd3
Author: Steve <steve@designerwallcoverings.com>
Date: Fri Aug 7 09:36:49 2026 -0700
costa-rica: resumable Hacienda enrichment drain (25k cedulas, $0 gov API) — TK-10346
---
scripts/ingest/hacienda-drain.sh | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/scripts/ingest/hacienda-drain.sh b/scripts/ingest/hacienda-drain.sh
new file mode 100755
index 0000000..cd139d6
--- /dev/null
+++ b/scripts/ingest/hacienda-drain.sh
@@ -0,0 +1,15 @@
+#!/usr/bin/env bash
+# Resumable full drain of the Hacienda enrichment over all un-enriched cedulas.
+# Idempotent: each chunk skips already-enriched rows. Safe to re-run after a crash.
+set -euo pipefail
+cd "$(dirname "$0")/../.."
+LOG=data/hacienda-drain.log
+: > "$LOG"
+echo "[drain] start $(date)" | tee -a "$LOG"
+while true; do
+ REMAIN=$(psql -h /tmp -U stevestudio2 -d costa_rica_directory -tAc \
+ "SELECT count(*) FROM places WHERE cedula_juridica IS NOT NULL AND hacienda_enriched_at IS NULL;")
+ echo "[drain] remaining=$REMAIN $(date)" | tee -a "$LOG"
+ if [ "$REMAIN" -eq 0 ]; then echo "[drain] COMPLETE $(date)" | tee -a "$LOG"; break; fi
+ HACIENDA_BATCH=2000 HACIENDA_THROTTLE_MS=1000 node scripts/ingest/hacienda-enricher.js 2>&1 | tee -a "$LOG"
+done
← e36298c costa-rica: marketplace schema migration 004 (bookings, paym
·
back to Costa Rica
·
costa-rica: OSM Overpass fetch (3257 CR POIs) feeding cr-osm aea4cf6 →