The situation
When dealing with multiple data sources searching for leads, your pipeline often processes duplicated leads. A restaurant, across several data sources, can have the same name, or it can have its name written differently; a duplicated character, a restaurant chain with the area name, a reformatted name based on the pronunciation, and other similar cases.
The problem to solve is to make sure that the sales team don’t receive duplicated leads, and instead to receive a clean list of potential restaurants to address.
What I built
A batch pipeline that automatically get triggers (through orchestrated DAG) after the scraping and ingestion script:
- It loads all the ingested possible leads across all the data sources (+100K detected leads on every monthly run)
- It extracts the key info of every lead and load them to raw tables to BigQuery
- It cleans the data, and try to exclude pre-existing leads through a dump match (based on exact name, address, phone number, etc) with the pre-existing leads we have.
- For the remaining unmatched leads, the pipeline run a fuzzy matching process, grouping restaurants with the same zip code. For every new lead, it’s treated guilty :
- We group it with all the pre-existing restaurants that have the same zip code and roughly the same street address
- For every pair, we run a fuzzy matching on the name and compare the street
- If the street is the same and the name score is above 85%, it’s a likely match, and it gets flagged to the sales team to confirm or deny
- If it’s a match, the new lead is excluded. We only take its up-to-date info: reviews, rating, and any missing info (phone number, website, social media links, etc.) is added to the pre-existing restaurant
- If no match is found, the lead is imported to Salesforce as a new one, so the sales team can proceed with it
- Every run is logged in BigQuery, and a Google Data Studio dashboard shows per run how many new restaurants were detected, how many were excluded, how many were flagged to sales for confirmation, and how many pre-existing restaurants got enriched
The result
The sales team receives only new leads, without duplicates. Pre-existing restaurants stay up to date without manual work, and only the uncertain cases need a human decision.
The tools
- The pipelines were developed using Apache beam and deployed to Google Dataflow
- Dashboard was built using Google Data Studio back in the times (today it was rebrand to Looker)
- Fuzzy matching logic was built from scratch using a fuzzy matching algorithm - developed in Python
- Salesforce API was also used for loading data to salesforce.