Cluster Duplicate Healthcare Provider Records by Shared Identifiers

Last updated: November 29, 2026

Quick Overview

Given healthcare provider records that may carry an NPI, an email and a phone number, group records that refer to the same provider when any normalized identifier is shared directly or through a chain of other records.

Veeva Systems
Coding & Algorithms
Software Engineer
Veeva Systems
November 29, 2026
Software Engineer
Onsite
Coding & Algorithms
Medium

0

0

0 solved


Given healthcare provider records that may carry an NPI, an email and a phone number, group records that refer to the same provider when any normalized identifier is shared directly or through a chain of other records.

Reference data products like OpenData and Network ingest provider records from many feeds, and the same doctor often appears several times with partial identifiers. The interviewer looks for recognizing transitive matching as connected components, a clean union-find, and sensible identifier normalization.

What the Interviewer Expects
  • Recognizes the problem as connected components over records linked by shared keys
  • Uses union-find (or BFS over an identifier index) without comparing all pairs
  • Normalizes identifiers: case and whitespace for email, digits only for phone
  • Ignores missing or empty identifiers rather than merging on them
  • States near-linear complexity and explains why O(n^2) pairwise matching is too slow
Key Topics to Cover
union-find
entity resolution
normalization
connected components
master data management
How to Approach This
  1. Clarify input constraints and edge cases before writing code.
  2. Walk through your approach verbally and confirm with the interviewer before coding.
  3. Start with a brute force solution, then optimize. Mention time and space complexity.
  4. Test your solution with examples, including edge cases like empty input or duplicates.
  5. Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
  • One shared phone number belongs to a whole clinic front desk; how do you stop it from merging unrelated doctors?
  • How would you make the clustering incremental as new records arrive daily?
  • How would you add fuzzy name matching without blowing up the comparison count?
  • How would a data steward review and undo a bad merge?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice DSA Problems
Sample Answer
Requirements

Each record has an id and optional npi, email, phone. Two records belong together if they share any normalized identifier; the relation is transitive (A shares an NPI with B, B shares a phone ...

High-Level Design

Pairwise comparison is O(n^2). Instead, map each (field, normalized value) to the first record that carried it. When a later record has the same key, union the two records. Union-find with path compre...


Submit Your Answer
Markdown supported

Related Questions