> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.joincandidhealth.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.joincandidhealth.com/_mcp/server.

# Patients & Payers

> Overview of Patients & Payers tables in Candid Data Share

## Overview

This group contains patient merge tracking and payer metadata.

### Patient Merge

`export_patient_merge` helps users track which patient records have been merged together. When a patient is merged, the `alternative_patient_mrn` represents the patient that was merged (the source), and the `primary_patient_mrn` represents the patient that received the merge (the target). All encounters and data associated with the alternative patient are consolidated under the primary patient.

### Payers

`export_payer` contains metadata about all payers on Candid.

## Table Relationships

```mermaid
erDiagram
    export_encounter }o--o| export_payer : "payer_uuid"
```

| Table                  | Primary Key        | Description                                     |
| ---------------------- | ------------------ | ----------------------------------------------- |
| `export_patient_merge` | `patient_merge_id` | Tracks merged patient records (source → target) |
| `export_payer`         | `payer_uuid`       | Payer metadata                                  |

## Common Queries

### Find Merged Patients

```sql
SELECT
  pm.primary_patient_mrn,
  pm.alternative_patient_mrn,
  pm.updated_at
FROM export_patient_merge pm
WHERE pm.deactivated = FALSE
```