Skip to content

Commit ba816a2

Browse files
mpstatonclaude
andcommitted
feat(crm-starter-export): person match sees through trailing role words — "James Patterson Philanthropy Advisor" anchors to the person
Progressive right-trim on the person-match pass (exact full-name match only, never below two tokens — the first-name-prefix lesson from the org matcher applies double for people). Landed alongside the operator's triage rulings: James Patterson (the author; direct giving via a philanthropy advisor, no foundation — and NOT Sarasota's unrelated Patterson Foundation, disambiguation recorded as observations) and Joshua Biber (Toolbox Family Fund has no other internet presence; person-anchored with an operates_fund observation). Files changed: - scripts/export-crm-orgs-csv.mjs Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RW28dw3kQAKXr2ZNefCukE
1 parent 3d4d5ce commit ba816a2

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

scripts/export-crm-orgs-csv.mjs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,20 @@ const personMatch = (name) => {
174174
// "Toolbox Family Fund (Joshua Biber)" — the parenthetical often names
175175
// the person the deal actually anchors to.
176176
const paren = /\(([^)]+)\)/.exec(String(name))?.[1];
177-
return paren ? (personByNorm.get(normName(paren)) ?? null) : null;
177+
if (paren) {
178+
const p = personByNorm.get(normName(paren));
179+
if (p) return p;
180+
}
181+
// "James Patterson Philanthropy Advisor" — trailing role words after a
182+
// person's full name. Progressive right-trim, EXACT full-name match only,
183+
// never below two tokens (the first-name-prefix lesson from the org
184+
// matcher applies double for people).
185+
const toks = normName(name).split(' ');
186+
for (let drop = 1; drop <= 3 && toks.length - drop >= 2; drop += 1) {
187+
const p = personByNorm.get(toks.slice(0, toks.length - drop).join(' '));
188+
if (p) return p;
189+
}
190+
return null;
178191
};
179192

180193
// 5. Pipeline record set over NATS — newest record set whose name matches.

0 commit comments

Comments
 (0)