[object Object]

← back to Rentv Sheet Enrich

TK-10579: read-only preflight_matches.py dry-run — 19 staged matches still to write, 0 unmatched; LinkedIn col 1152; Email sha intact

16af7e5f578f16417b719f39be47f4d1cf5a62d3 · 2026-08-24 09:00:10 -0700 · Steve Abrams

Files touched

Diff

commit 16af7e5f578f16417b719f39be47f4d1cf5a62d3
Author: Steve Abrams <steve@designerwallcoverings.com>
Date:   Mon Aug 24 09:00:10 2026 -0700

    TK-10579: read-only preflight_matches.py dry-run — 19 staged matches still to write, 0 unmatched; LinkedIn col 1152; Email sha intact
---
 preflight_matches.py | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/preflight_matches.py b/preflight_matches.py
new file mode 100644
index 0000000..5f1e3d2
--- /dev/null
+++ b/preflight_matches.py
@@ -0,0 +1,34 @@
+#!/usr/bin/env python3
+"""Dry-run: for every staged fanout_batch*_result_navfix.json, resolve each entry against
+the LIVE sheet exactly like write_by_contact.py would (by normalized company+name), and
+report matched-row / cell-empty / would-write — WITHOUT writing anything."""
+import sys, os, re, json, glob
+sys.path.insert(0, os.path.dirname(__file__))
+import lib
+GID = 3823360; TITLE = "Unique Contacts (all tabs)"
+def norm(s): return re.sub(r'[^a-z0-9]', '', (s or '').lower())
+tok = lib.access_token()
+rows = lib.read_tab(tok, TITLE)
+hr = next((i for i in range(min(4,len(rows))) for j,v in enumerate(rows[i]) if v.strip()=="Contact Name"),0)
+hdr = rows[hr]
+def hidx(l): return next((i for i in range(len(hdr)) if (hdr[i] if i<len(hdr) else "").strip()==l),None)
+NAME,CO,LIC = hidx("Contact Name"),hidx("Company/Venue"),hidx("LinkedIn (Contact)")
+def cell(r,i): return (rows[r][i] if i is not None and r<len(rows) and i<len(rows[r]) else "").strip()
+idx={}
+for r in range(hr+1,len(rows)):
+    k=(norm(cell(r,CO)),norm(cell(r,NAME)))
+    if k[0] or k[1]: idx.setdefault(k,[]).append(r)
+would_write=already=unmatched=0
+for f in sorted(glob.glob("data/fanout_batch*_result_navfix.json")):
+    for it in json.load(open(f)):
+        key=(norm(it.get("company","")),norm(it.get("name","")))
+        tgt=idx.get(key)
+        if not tgt:
+            tgt=[r for (co,nm),rs in idx.items() if nm and nm==key[1] and key[0] and (key[0] in co or co in key[0]) for r in rs]
+        nm=it.get("name",""); 
+        if not tgt: print(f"  UNMATCHED  {nm} @ {it.get('company','')}"); unmatched+=1; continue
+        r0=tgt[0]
+        if cell(r0,LIC): print(f"  filled     {nm} (row {r0+1} already has LinkedIn)"); already+=1
+        else: print(f"  WILL WRITE {nm} -> row {r0+1}"); would_write+=1
+print(f"\nSUMMARY: {would_write} will write, {already} already filled, {unmatched} unmatched")
+print(f"Current LinkedIn(Contact) nonempty: {sum(1 for r in range(hr+1,len(rows)) if cell(r,LIC))}")

← 7e480d7 yoloforever cycle 12: subagent recovered, +16 LI (coverage 1  ·  back to Rentv Sheet Enrich  ·  yoloforever cycle 13: wb_038 +23 contact-LinkedIn (1185/4297 8221a3d →