← back to Nationalrealestate
usre: CA-area-code guard on firm-phone enrichment (TK-10687)
48550431ccd240fe674553c0701e253300de9052 · 2026-08-18 13:58:18 -0700 · Steve Abrams
Domain-token matching alone still false-matched shared surnames onto wrong
businesses (payneglasses.com, douglascuddletoy.com TOYS, jacuzzi.com hot-tubs,
baileyhats.com, grandviewhealth.com). Since every firm in scope is CA-licensed, the
office line is a CA area code — require one. Kills the out-of-state wrong-business
matches at ~zero cost. Cleaned 16 non-CA false writes. Precision-first: better no
number than a wrong one for a directory Frank calls.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Files touched
M scripts/enrich-firm-contacts.mjs
Diff
commit 48550431ccd240fe674553c0701e253300de9052
Author: Steve Abrams <steve@designerwallcoverings.com>
Date: Tue Aug 18 13:58:18 2026 -0700
usre: CA-area-code guard on firm-phone enrichment (TK-10687)
Domain-token matching alone still false-matched shared surnames onto wrong
businesses (payneglasses.com, douglascuddletoy.com TOYS, jacuzzi.com hot-tubs,
baileyhats.com, grandviewhealth.com). Since every firm in scope is CA-licensed, the
office line is a CA area code — require one. Kills the out-of-state wrong-business
matches at ~zero cost. Cleaned 16 non-CA false writes. Precision-first: better no
number than a wrong one for a directory Frank calls.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
---
scripts/enrich-firm-contacts.mjs | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/scripts/enrich-firm-contacts.mjs b/scripts/enrich-firm-contacts.mjs
index 40cae78..3f89c3f 100644
--- a/scripts/enrich-firm-contacts.mjs
+++ b/scripts/enrich-firm-contacts.mjs
@@ -124,6 +124,11 @@ function pageMatchesFirm(page, tokens) {
}
// NANP sanity: area/exchange codes start 2-9 (already in PHONE_RE); reject a few impossible ones.
function plausiblePhone(p) { const m = p.match(/\((\d{3})\)/); return m && /^[2-9]\d{2}$/.test(m[1]) && !/(^0|555$)/.test(m[1]); }
+// These are all CA firms, so the office line is a CA area code. A non-CA number that domain-matched
+// on a shared surname/word (payneglasses 412, douglascuddletoy TOYS 800, jacuzzi.com hot-tubs 844)
+// is the WRONG business — reject it. Better no number than a wrong one for a call directory.
+const CA_AREA = new Set(['209','213','279','310','323','341','350','408','415','424','442','510','530','559','562','619','626','628','650','657','661','669','707','714','747','760','805','818','820','831','840','858','909','916','925','949','951']);
+function caPhone(p) { const m = p.match(/\((\d{3})\)/); return m && CA_AREA.has(m[1]); }
// ── free web discovery (DuckDuckGo HTML) ─────────────────────────────────────────────────────────
const AGG = /(zillow|redfin|realtor\.com|realty\.com|loopnet|crexi|yelp|mapquest|bbb\.org|facebook|linkedin|indeed|glassdoor|manta|dnb\.com|bizapedia|buzzfile|nestfully|mlslistings|homes\.com|point2homes|trulia)/i;
@@ -230,8 +235,9 @@ async function enrichFirm(firm) {
// NON-toll-free aggregator numbers (toll-free from an aggregator ≈ a lead line, dropped).
const own = scored.filter(p => !p.agg).sort((a, b) => b.phones.length - a.phones.length);
const agg = scored.filter(p => p.agg).sort((a, b) => b.phones.length - a.phones.length);
- const ownPhones = [...new Set(own.flatMap(p => p.phones))].slice(0, 12);
- const aggPhones = [...new Set(agg.flatMap(p => p.phones))].filter(p => !TOLLFREE.test(p)).slice(0, 12);
+ // CA firms → require a CA area code (kills wrong-business domain matches on shared surnames).
+ const ownPhones = [...new Set(own.flatMap(p => p.phones))].filter(caPhone).slice(0, 12);
+ const aggPhones = [...new Set(agg.flatMap(p => p.phones))].filter(p => !TOLLFREE.test(p) && caPhone(p)).slice(0, 12);
const best = own.find(p => p.phones.length) || own[0] || agg.find(p => p.phones.length) || agg[0];
if (!best) return { status: 'unreachable' };
const confidence = best.agg ? 'agg' : 'own';
← 88312fc usre: Tier-1 accurate firm-phone backfill from cre office li
·
back to Nationalrealestate
·
auto-data-snapshot: 2026-08-18T14:00:27 (1 data files) — dat 36ef14f →