Documentation / Under the hood

The matching run, stage by stage

Stage A (match), stage B (golden build), decisions and stable ids.

Stage A – per resource type, masters first

  1. Scan: the type's source records are read page by page.
  2. Blocking and pair scoring as in How a pair is scored; relationship attributes compare the golden entity a reference points to, which is known because masters were clustered earlier.
  3. Steward decisions are applied: a stored merge forces records together, a stored not a match keeps them apart (even against an automatic score).
  4. Clustering: automatic and approved pairs are joined with union-find into clusters.
  5. Persist: clusters keep stable ids; clusters keep their ids when members are added, and when two clusters merge the absorbed one is retired but remembered ("merged golden ids").

Stage B – golden build

  1. References of every member are rewritten to golden ids; merged targets collapse into the surviving golden resource; references that cannot be resolved become reference issues.
  2. Survivorship picks the value per element.
  3. Bookkeeping is added: id gld-<type>-<cluster>, tag golden-record, one source-record identifier per member, the golden-sources extension, and Patient.link refer.
  4. The result is written by the batch loader; unchanged content is not rewritten (hashdiff), so reruns are cheap.

When a steward decides, only the clusters involved are rebuilt (incrementally), not the whole type.

NoteLimits: one resource type is held in memory at a time; deletes in the raw vault are not tracked; golden writes are chunked at 400 resources per transaction.