Engineering Sub-Second B2B Lead Enrichment & 2-Opt Route Optimization Pipelines in Python
Описание и применение
Пайплайн на Python 3.11 очищает списки B2B‑контактов от фрагментов и недействительных доменов, а также оптимизирует маршруты с помощью 2‑Opt TSP, экономя время и обходя платные API.
Задача
Sales operations teams face dirty B2B lead lists with corporate chains and dead domains, and inefficient zig‑zag field routes that waste 25–35% of a rep’s shift.
Результат
The pipelines run in a 256 MB container, process 2,000 leads in sub‑second time, remove 53% of invalid contacts, and produce a route that cuts travel time by up to 35% without paying per‑element API fees.
Рабочий процесс
- Scrape 2,000 clinic URLs from a local map directory
- Extract raw email candidates using a regex
- Filter out asset filenames, Sentry DSNs, and junk domains
- Validate domains asynchronously with DNS MX and A record lookups using dnspython
- Cache results to avoid repeated lookups
- Return verified email list and classify corporate chains
- Generate geographic coordinates for each verified lead
- Apply nearest‑neighbor heuristic to order stops
- Run 2‑Opt TSP to refine route
- Output optimized route and distance metrics
Доказательства
Both problems can be solved in pure Python 3.11 inside a 256 MB container with zero headless browsers and zero paid third‑party API keys.
You scrape 2,000 healthcare, dental, audiology, or veterinary clinics from a local map directory—only to realize 35% of them are disguised franchises or private‑equity DSOs/MSOs, and another 18% of scraped emails are sentry.wixpress.com telemetry strings or dead domains.
Zig‑Zag Field Territory Routes: Once you have 15–25 verified local prospects in a metro area, ordering visits chronologically or alphabetically wastes 25–35% of a rep’s shift crisscrossing highways—while enterprise Route Matrix APIs charge steep per‑element fees (N × N matrix billing).
- Дата записи: 2026-11-01T08:44:00.715Z