> ## Documentation Index
> Fetch the complete documentation index at: https://docs.encoreos.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Patient Duplicates

> Review MPI-flagged duplicate patient candidates, compare records side-by-side, and initiate or undo patient merges.

The Patient Duplicates page presents groups of patient records flagged by the Master Patient Index as potential duplicates, enabling authorized users to compare and merge them. Route: `/pm/patients/duplicates`.

## Overview

`PatientDuplicatesPage` loads candidate groups via `useDuplicateCandidates` and recent merges via `useMergeLog`. Groups are keyed by shared last name and date of birth. When a group has more than two records, users select two candidates to compare; groups with exactly two records are automatically ready to compare. The `PatientMergeResolutionWizard` opens as a sheet to walk through the merge. Recent merges (up to 10) are shown with an **Undo** action gated by a server-side undo window via `useUndoPatientMerge`.

## Who it's for

Requires permission `pm.patients.merge` (`PM_PERMISSIONS.PATIENTS_MERGE`).

## Before you start

* Review the records in each candidate group before initiating a merge; merges may be difficult to reverse once the undo window expires.
* Undo capability is time-limited; the window is enforced server-side.

## Steps

<Steps>
  <Step title="Open the duplicates list">
    Navigate to **Practice Management → Patients → Duplicates**, or go to `/pm/patients/duplicates`.
  </Step>

  <Step title="Review candidate groups">
    Each card shows a shared last name and date of birth with the count of potential duplicates in the group.
  </Step>

  <Step title="Select records to compare (for groups with more than two)">
    Click individual patient cards to select two records for comparison. Selection is toggled; only two records can be selected at a time.
  </Step>

  <Step title="Open the merge wizard">
    With two records selected (or for a two-record group), click the compare/merge action to open `PatientMergeResolutionWizard`.
  </Step>

  <Step title="Complete the merge">
    Follow the wizard steps to resolve field conflicts and confirm the merge.
  </Step>

  <Step title="Undo a recent merge (if needed)">
    In the recent merge log, click **Undo** on an eligible merge record. The undo button is only shown within the server-enforced undo window.
  </Step>
</Steps>

## Key concepts

* **MPI candidate group** — records sharing last name and date of birth, flagged for potential duplicate review.
* **Undo window** — a time-limited period after a merge during which the operation can be reversed; duration is server-enforced.

## Related

<Columns cols={2}>
  <Card title="Practice Management" icon="briefcase" href="/pm/overview">
    Practice Management core overview.
  </Card>

  <Card title="Governance & parity" icon="scale-balanced" href="/governance/index" />
</Columns>

<Note>
  This page documents shipped product behavior. It is not medical, legal, or
  billing advice. Verify against your organization's policies and applicable
  regulations before using it for clinical, compliance, or billing decisions.
  Protected health information (PHI) shown in the product is governed by your
  tenant's access controls and is never exposed in this documentation.
</Note>

<Accordion title="Documentation sources">
  * src/routes/pm.tsx
  * src/cores/pm/pages/PatientDuplicatesPage.tsx
  * src/cores/pm/hooks/useDuplicateCandidates.ts
  * src/cores/pm/hooks/useMergeLog.ts
  * src/cores/pm/hooks/useUndoPatientMerge.ts
</Accordion>
