enrichV7
Main orchestrator. File: src/enrichment/pipeline.ts. Called by Enrich_Job in the Pipeline.
Source: docs/SYSTEM_OVERVIEW.md § enrichV7 — step by step.
Signature
export async function enrichV7(input: EnrichmentInput): Promise<EnrichmentResult>Types in src/enrichment/types.ts. Key output fields: contacts[], lead_score, company.google_maps, enrichment_status.
Seven steps
- Reklamspärr gate —
isScbAdvertisingBlocked(input.org_nr). If blocked, log RoPA SKIP and return{ enrichment_status: 'blocked', lead_score: 0 }. See Reklamspärr. - Redis cache —
enrich:${org_nr}key, 6-month TTL. Skip everything else if hit (unlessbypass_cache). - Bolagsverket VärdefullaDatamängder —
fetchBolagsverketOrganisation(org_nr)returns name, address, SNI codes, trade names, business description. - Domain discovery —
findCompanyDomain(name, org_nr, city). See Domain Discovery. - Google Places —
queryGooglePlaces(name, city). See Google Places. - Crawlee scrape —
scrapeWithCrawlee(domain, name)if domain found. Up to 12 pages, 6 strategies. See Crawlee Scraper. - Score and return —
buildResult(bvData, places, crawlResult, domain). See Lead Scoring.
P0 — Reklamspärr only enforced inside enrichV7
Warning
The reklamspärr check at step 1 runs after the queue worker has already scheduled the job. The Scrape_Job worker should call
isScbAdvertisingBlocked()before enqueueing Enrich_Job — currently it does not. See Pipeline and Known Issues.
See also
Pipeline, Reklamspärr, Crawlee Scraper, Google Places, Domain Discovery, Lead Scoring, Known Issues.