[object Object]

← back to Homesonspec

auto-save: 2026-07-29T01:34:44 (1 files) — scripts/backfill-drh-geo-refetch.sh

c806053de1560102929ed837d89692e20c7c1e03 · 2026-07-29 01:34:51 -0700 · Steve Abrams

Files touched

Diff

commit c806053de1560102929ed837d89692e20c7c1e03
Author: Steve Abrams <steve@designerwallcoverings.com>
Date:   Wed Jul 29 01:34:51 2026 -0700

    auto-save: 2026-07-29T01:34:44 (1 files) — scripts/backfill-drh-geo-refetch.sh
---
 scripts/backfill-drh-geo-refetch.sh | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/scripts/backfill-drh-geo-refetch.sh b/scripts/backfill-drh-geo-refetch.sh
new file mode 100644
index 00000000..2885d289
--- /dev/null
+++ b/scripts/backfill-drh-geo-refetch.sh
@@ -0,0 +1,29 @@
+#!/usr/bin/env bash
+# One-time dr-horton geo re-fetch backfill (yolo iter-5, DTD verdict C). The cache backfill got the
+# communities whose snapshots survived; ~7,496 were GC'd. This re-fetches dr-horton per-state with
+# FORCE_REEXTRACT so those pages are re-snapshotted + re-extracted, and the (now-fixed) publisher
+# UPDATE branch promotes the in-feed community coords. $0, polite 10rpm, community-level geo, state-
+# gated. Long-running (~hours) + autonomous. Only touches states that still have null-geo DRH homes.
+set -uo pipefail
+ROOT="$(cd "$(dirname "$0")/.." && pwd)"; cd "$ROOT/apps/workers" || exit 1
+export DATABASE_URL="${DATABASE_URL:-postgresql://macstudio3@localhost/homesonspec?host=/tmp}"
+slug() { case "$1" in
+  AL) echo alabama;; AZ) echo arizona;; AR) echo arkansas;; CA) echo california;; CO) echo colorado;;
+  DE) echo delaware;; FL) echo florida;; GA) echo georgia;; IA) echo iowa;; ID) echo idaho;;
+  IL) echo illinois;; IN) echo indiana;; KS) echo kansas;; KY) echo kentucky;; LA) echo louisiana;;
+  MD) echo maryland;; MN) echo minnesota;; MS) echo mississippi;; MO) echo missouri;; NC) echo north-carolina;;
+  NE) echo nebraska;; NV) echo nevada;; NJ) echo new-jersey;; NM) echo new-mexico;; NY) echo new-york;;
+  OH) echo ohio;; OK) echo oklahoma;; OR) echo oregon;; PA) echo pennsylvania;; SC) echo south-carolina;;
+  TN) echo tennessee;; TX) echo texas;; UT) echo utah;; VA) echo virginia;; WA) echo washington;;
+  WI) echo wisconsin;; WV) echo west-virginia;; HI) echo hawaii;; *) echo "$(echo "$1" | tr '[:upper:]' '[:lower:]')";; esac; }
+# states still holding null-geo DRH homes, most first
+STATES=$(psql "$DATABASE_URL" -tAc "select h.state from \"InventoryHome\" h join \"Builder\" b on b.slug='dr-horton' where b.id=h.\"builderId\" and h.status='PUBLISHED' and h.lat is null and h.state is not null group by h.state order by count(*) desc;")
+for st in $STATES; do
+  s=$(slug "$st")
+  before=$(psql "$DATABASE_URL" -tAc "select count(*) from \"InventoryHome\" h join \"Builder\" b on b.slug='dr-horton' where b.id=h.\"builderId\" and h.status='PUBLISHED' and h.lat is not null;")
+  echo "[$(date '+%m-%d %H:%M:%S')] re-fetch dr-horton $st ($s)…"
+  FORCE_REEXTRACT=1 DRHORTON_STATE="$s" DRHORTON_PAGE_LIMIT=800 npx tsx src/cli.ts --adapter=dr-horton-site >/dev/null 2>&1 || echo "  ($st failed, continuing)"
+  after=$(psql "$DATABASE_URL" -tAc "select count(*) from \"InventoryHome\" h join \"Builder\" b on b.slug='dr-horton' where b.id=h.\"builderId\" and h.status='PUBLISHED' and h.lat is not null;")
+  echo "  $st: dr-horton geocoded $before -> $after"
+done
+echo "[$(date '+%m-%d %H:%M:%S')] dr-horton geo re-fetch backfill DONE."

← 12220514 publisher: promote lat/lon on the UPDATE branch too (contrar  ·  back to Homesonspec  ·  geocode: shea per-home coord backfill from detail pages (yol ee8b7a7c →