[object Object]

← back to Costa Rica

OSM matcher: honest provenance — social profiles tagged -social, missing region centroid tags -nogeo instead of silently passing the geo gate

1a69c32483643dad7c0b75513a2906a5f97b75bb · 2026-07-22 21:31:31 -0700 · Steve

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

Files touched

Diff

commit 1a69c32483643dad7c0b75513a2906a5f97b75bb
Author: Steve <steve@designerwallcoverings.com>
Date:   Wed Jul 22 21:31:31 2026 -0700

    OSM matcher: honest provenance — social profiles tagged -social, missing region centroid tags -nogeo instead of silently passing the geo gate
    
    Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
---
 scripts/cr-osm-match.js | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/scripts/cr-osm-match.js b/scripts/cr-osm-match.js
index 8f08193..6588e69 100644
--- a/scripts/cr-osm-match.js
+++ b/scripts/cr-osm-match.js
@@ -74,15 +74,23 @@ const km = (a, b, c, d) => {
     if (cands.length > 1) { ambiguous++; continue; }
     const c = cands[0];
     if (!c.website) continue;
-    // geo sanity: if both sides have coords, must be within 60km of the region
-    if (p.rlat && c.lat && km(Number(p.rlat), Number(p.rlng), c.lat, c.lon) > 60) { geoRejected++; continue; }
+    // geo sanity: within 60km of the region centroid. A missing centroid is
+    // NOT a pass — matches without geo confirmation get '-nogeo' provenance
+    // so the UI/audits can treat them as weaker evidence.
+    let geoTag = '';
+    if (p.rlat && c.lat) {
+      if (km(Number(p.rlat), Number(p.rlng), c.lat, c.lon) > 60) { geoRejected++; continue; }
+    } else {
+      geoTag = '-nogeo';
+    }
+    const socialTag = /facebook\.com|instagram\.com/i.test(c.website) ? '-social' : '';
     await pool.query(
       `UPDATE places SET website = $1,
               phone = COALESCE(phone, $2),
               email = COALESCE(email, $3),
               website_source = $4
        WHERE id = $5`,
-      [c.website, c.phone, c.email, 'osm-' + via, p.id]);
+      [c.website, c.phone, c.email, 'osm-' + via + socialTag + geoTag, p.id]);
     matched++;
   }
   console.log(`DONE matched=${matched} geo_rejected=${geoRejected} ambiguous_skipped=${ambiguous}`);

← 7bcb527 Portal detail-page crawler: 79 websites + 61 phones + 14 ema  ·  back to Costa Rica  ·  Card badges for website/phone presence (site vs social disti a52fd3f →