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

  1. Reklamspärr gateisScbAdvertisingBlocked(input.org_nr). If blocked, log RoPA SKIP and return { enrichment_status: 'blocked', lead_score: 0 }. See Reklamspärr.
  2. Redis cacheenrich:${org_nr} key, 6-month TTL. Skip everything else if hit (unless bypass_cache).
  3. Bolagsverket VärdefullaDatamängderfetchBolagsverketOrganisation(org_nr) returns name, address, SNI codes, trade names, business description.
  4. Domain discoveryfindCompanyDomain(name, org_nr, city). See Domain Discovery.
  5. Google PlacesqueryGooglePlaces(name, city). See Google Places.
  6. Crawlee scrapescrapeWithCrawlee(domain, name) if domain found. Up to 12 pages, 6 strategies. See Crawlee Scraper.
  7. Score and returnbuildResult(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.