fix(scoring): definitive grantmaker exclusion + full-pool matching
Candidate orgs now also exclude any org whose EIN appears in the funders table — an org that files a 990-PF IS a private foundation regardless of its NTEE code (Bean/McIninch-style grantmakers carry E/S codes or none). 1,692 stale pending matches for PF-filer orgs cleaned. Candidate limit raised to 2,000 after the enrichment drain grew the pool 56 -> 887. Full-pool run: 856 candidates, 42,800 matches, 850 easy wins across 373 orgs, top heroes led by community-precedent pairs (Seacoast Pathways -> Foundation for Seacoast Health; Granite Backcountry Alliance -> Gibson-Woodbury). Known residual: hospital-legacy 'health foundation' grantmakers file 990 (not 990-PF), so the PF roster can't catch them — they reach the queue and rely on the human reject gate; profiler-based classification is the durable fix. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -44,7 +44,7 @@ import type { NodePgDatabase } from 'drizzle-orm/node-postgres';
|
|||||||
|
|
||||||
export type OutreachDb = NodePgDatabase<typeof schema>;
|
export type OutreachDb = NodePgDatabase<typeof schema>;
|
||||||
|
|
||||||
const CANDIDATE_ORG_LIMIT = 500;
|
const CANDIDATE_ORG_LIMIT = 2_000;
|
||||||
const GRANTS_PER_ORG = 50;
|
const GRANTS_PER_ORG = 50;
|
||||||
const MIN_DAYS_TO_DEADLINE = 21;
|
const MIN_DAYS_TO_DEADLINE = 21;
|
||||||
const MIN_AWARD_CEILING = 10_000;
|
const MIN_AWARD_CEILING = 10_000;
|
||||||
|
|||||||
@@ -46,6 +46,12 @@ export async function serverListMatchCandidateOrgs(
|
|||||||
isNull(schema.orgs.nteeCode),
|
isNull(schema.orgs.nteeCode),
|
||||||
sql`${schema.orgs.nteeCode} NOT LIKE 'T%'`,
|
sql`${schema.orgs.nteeCode} NOT LIKE 'T%'`,
|
||||||
),
|
),
|
||||||
|
// Definitive grantmaker check: an org that files a 990-PF IS a
|
||||||
|
// private foundation, whatever its NTEE code says (many carry
|
||||||
|
// E/S codes or none). The funders table is exactly that roster.
|
||||||
|
sql`NOT EXISTS (
|
||||||
|
SELECT 1 FROM funders f WHERE f.ein = ${schema.orgs.ein}
|
||||||
|
)`,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
.limit(limit);
|
.limit(limit);
|
||||||
|
|||||||
Reference in New Issue
Block a user