1 min lesson
Dedup and merge
Rebuild the sequence in "Dedup and merge" from memory, ending with the check that proves the outcome.
Step 1 of 2
Dedup and merge
Dedup is where good schemas get tested. You need matching keys, a fuzzy fallback and a deterministic conflict-resolution rule so two runs never disagree.
- 1Exact keys first. Normalize and match on email and company domain. Lowercase, strip plus-addressing, map
gmail.com/googlemail.com. Most matches resolve here, cheaply and unambiguously. - 2Fuzzy fallback. When exact fails, match on normalized company name plus enriched domain or person name plus account. Set a similarity threshold and route anything below it to manual review instead of guessing.
- 3Deterministic conflict resolution. When two records disagree on a field, pick the winner by an explicit rule: most recent verified value or highest-trust source. Never "last write wins" by accident.
- 4Merge, don't delete. Collapse duplicates into a survivor record but keep the merge history, so a wrong merge is reversible and an audit can see what happened.