Katkat

Resolve routing-number to bank mapping

PlaidSoftware Engineer · Technical Screen

Last updated

This question evaluates a candidate's skills in data normalization, deduplication, aggregation, and conflict resolution across multiple JSON data sources, with emphasis on canonicalization of aliases and handling inconsistent mappings.

You are given bank-routing data coming from one or more JSON sources.

Each source provides a list of records like:

{ "routing": "026009593", "bank_name": "Bank of America" }

Complications:

  • The same bank may appear under multiple names (e.g., "Bank of America", "BoA", "BofA").
  • The same routing number may appear multiple times (even within a source).
  • Across multiple sources, the same routing number may map to different banks (conflicts).

Task:

  1. Normalize bank names using a provided alias mapping (e.g., a dictionary that maps each observed name to a canonical bank id/name).
  2. Produce a final mapping routing -> canonical_bank.
  3. If multiple sources disagree for the same routing number, resolve it using this policy:
  • Choose the canonical bank that appears in the most sources for that routing number (majority vote across sources).
  • If there is a tie, break ties by a given source-priority order (e.g., SourceA > SourceB > SourceC).
  1. Also output a list of routings that had conflicts (i.e., more than one canonical bank was claimed across sources), along with the votes that led to the decision.

Write a function that takes:

  • sources: List[List[Record]] (each inner list is one source’s records)
  • alias_to_canonical: Map[str, str]
  • source_priority: List[int] (or equivalent)

and returns the resolved mapping and the conflict report.