KatInterview

Design a Multi-Source Data Reconciliation Pipeline

System DesignModel answer
HardModel answerSystem Designentity-resolutiondata-qualityrecord-linkage

Last updated

Design and implement a pipeline that merges messy person records from several sources into canonical entries, handling normalization, matching, conflict resolution, and validation.

You are building a system that takes in person records from several independent data sources and reconciles them into a clean, deduplicated dataset. Each record contains fields like name, email, phone, and address, but the data is noisy: values may be missing, inconsistently formatted, abbreviated, or even contradictory across sources. There is no shared primary key linking records between sources.

Your system must accomplish four things:

  1. Determine whether any two given records describe the same real-world individual.
  2. Cluster all records belonging to the same person into groups.
  3. Produce one canonical record per group by merging the available information.
  4. Keep records that have no match as standalone groups of size one.

You should be explicit about the following design decisions:

  • Field normalization: How do you clean each field type before comparison? Consider case differences, phone number formatting, address abbreviations, and name variations (nicknames, initials, middle names).
  • Matching strategy: What rules or scoring mechanism do you use to decide that two records refer to the same person? How do you weigh strong signals (exact email match) versus weaker composite signals (name plus address)? How do you handle negative evidence where non-null fields directly contradict each other?
  • Conflict resolution: When grouped records disagree on a field value, which value wins? Consider source authority, recency, and majority voting.
  • Quality validation: How would you measure precision and recall of your matcher? Would you introduce a manual-review band for borderline cases?

Constraints

  • Input is a list of records, each tagged with a source label and ideally a last_updated timestamp.
  • False positives (merging two distinct people) are more costly than false negatives (leaving one person split across groups), since silent over-merging corrupts data and is difficult to reverse.
  • The dataset is large enough that comparing every pair of records is prohibitively expensive. You must address throughput and candidate generation, not just correctness on a small example.
  • Fields are free-text and unstructured: emails may vary only in casing, phone numbers may include or omit country codes and separators, addresses use inconsistent abbreviations, and names may appear as full names, nicknames, or initials.

Clarifying Questions to Ask

  • Is a wrong merge considered worse than a missed merge, and is a manual-review threshold for borderline matches acceptable?
  • Are any sources considered authoritative (such as a verified or KYC source) whose values should take precedence on conflict? Is last_updated a reliable recency signal?
  • What scale are we targeting — thousands or tens of millions of records — and is this a batch process over a snapshot or an incremental stream?
  • Which fields serve as reliable identifiers in this domain? Is email or phone truly unique per person, or might they be shared? Are there additional fields not listed (date of birth, account ID) that could help?
  • Is there a labeled ground-truth dataset to measure against, or do we need to bootstrap one?

Hints

Hint 1

Start by normalizing each field independently before any comparison — this step alone resolves many near-duplicates deterministically.

Hint 2

Avoid all-pairs comparison by generating candidate pairs through blocking: group records by a shared key (like a normalized email prefix or phone hash) and only compare within blocks.

Hint 3

Use a tiered scoring system: strong signals like exact email or phone match can auto-merge, composite signals like name plus address contribute partial confidence, and contradictory non-null fields reduce the score.

Hint 4

Group matched pairs using connected components (union-find) to handle transitivity, but watch for weak edges chaining unrelated records together.