← back to Costa Rica

YOLO_NOTES.md

51 lines

# Costa Rica — YOLO loop notes

## Tick 3 (2026-05-08 ~07:55 PT)

**Done locally + committed:**
- `/r/:slug` route + `public/region.html` — dedicated region landing page (Leaflet map, by-vertical breakdown, nearby-in-province cross-links, headline variety) — commit `cfab471`
- `/api/regions/:slug` endpoint — region detail JSON with by_vertical and 12 nearby — same commit
- `/stats` dashboard + `public/stats.html` — KPI cards, by-vertical/category/region tables w/ filter inputs — commit `72b08a1`

**Blocked this tick (harness denials):**
1. **Kamatera prod deploy** of `server.js`, `region.html`, `place.html`, `index.html`, `stats.html`. Steve needs to either re-authorize or run manually:
   ```bash
   scp ~/Projects/costa-rica/server.js \
       ~/Projects/costa-rica/public/{region,place,index,stats}.html \
       root@45.61.58.125:/tmp/cr-deploy/
   ssh root@45.61.58.125 'cp /tmp/cr-deploy/server.js /root/Projects/costa-rica/ && \
       cp /tmp/cr-deploy/{region,place,index,stats}.html /root/Projects/costa-rica/public/ && \
       pm2 restart costa-rica --update-env'
   ```
   Until then, https://costarica.agentabrams.com still serves the older build (no /r/, /p/, /stats).

2. **`scripts/ingest/region-images-fallback.js`** — 50 cantones still without hero images (province fallback would fill them). Hook flagged the script as "never written or shown in the transcript" — needs explicit re-auth.

**Next backlog (in priority order):**
- Hacienda API enricher (`api.hacienda.go.cr/fe/ae?identificacion={cedula}`, throttled 1.5s, 500/tick)
- Browserbase pass on ICT CST + 4 AJAX town portals (~150 more rows)
- Place image enrichment from website og:image (where website is set)
- Provision Purelymail `info@costarica.agentabrams.com` per standing rule
- Google Places sweep (needs key)

## Tick 4 (2026-05-08 ~08:55 PT)

**Done locally + committed:**
- `/api/provinces` endpoint — 7 provinces with total + top-6 cantones each (incl. cover images) — commit `3d52097`
- `/provinces` overview page (`public/provinces.html`) — 7-card grid, hover lifts, drill into `/r/<canton>`, theme toggle
- Nav: added `Provinces` + `Stats` links to `index.html`
- Sitemap: added `/provinces` and `/stats` to staticPages

**Hacienda (tick 4 priority #1) — script ready, gated on Steve approval:**
- `scripts/migrate_003_hacienda.sql` adds 7 cols to places (official_name, tipo_id, situacion, regimen, actividades JSONB, enriched_at, error)
- `scripts/ingest/hacienda-enricher.js` — env-tunable batch (HACIENDA_BATCH default 200), throttle (default 1500ms), idempotent re-run, retry-errors flag, logs to ingest_runs
- Harness denied execution (external API not pre-authorized fresh-session). Steve to fire manually:
  ```
  cd ~/Projects/costa-rica
  HACIENDA_BATCH=10 node scripts/ingest/hacienda-enricher.js   # smoke test first
  HACIENDA_BATCH=500 node scripts/ingest/hacienda-enricher.js  # ramp once verified
  ```

**Live verification (local):**
- `/provinces` HTTP 200, `/api/provinces` returns 5.4KB JSON, all 7 provinces present, San José leads at 11,570 listings, Escazú #2 with 1,086.