> 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.

# Patient 360

> Patients, coverage history, notes, appointments, referrals and authorizations in Candid Data Share

Each patient's current demographics, plus the history of their coverage (including non-insurance payers and clinical trials) and notes, and their appointments, referrals, authorizations and record merges. Every table joins to `export_patient` on `patient_id`.

## Tables

| Table                                                                                                              | One row per                             | Primary key                              | [Shape](/data-share/data-model#table-shapes) |
| ------------------------------------------------------------------------------------------------------------------ | --------------------------------------- | ---------------------------------------- | -------------------------------------------- |
| [`export_patient`](/data-share/patient-360/export-patient)                                                         | Patient                                 | `patient_id`                             | Current state                                |
| [`export_patient_insurance_history`](/data-share/patient-360/export-patient-insurance-history)                     | Patient coverage version                | `patient_insurance_history_pk`           | Version history                              |
| [`export_patient_non_insurance_payer_history`](/data-share/patient-360/export-patient-non-insurance-payer-history) | Patient version and non-insurance payer | `patient_non_insurance_payer_history_pk` | Version history                              |
| [`export_patient_note_history`](/data-share/patient-360/export-patient-note-history)                               | Note version                            | `patient_note_history_pk`                | Version history                              |
| [`export_patient_appointments`](/data-share/patient-360/export-patient-appointments)                               | Appointment, including cancelled ones   | `appointment_id`                         | Current state                                |
| [`export_patient_referrals`](/data-share/patient-360/export-patient-referrals)                                     | Referral                                | `referral_id`                            | Current state                                |
| [`export_patient_authorizations`](/data-share/patient-360/export-patient-authorizations)                           | Authorization                           | `authorization_id`                       | Current state                                |
| [`export_patient_merge`](/data-share/patient-360/export-patient-merge)                                             | Patient record merge                    | `patient_merge_id`                       | Current state                                |

## Notes

* **Patients to encounters:** match `export_patient.mrn` to `export_encounter.patient_external_id` within the same `organization_id`.
* **History tables have one row per version.** Filter `is_latest_record = TRUE` for current state (`is_latest_record_for_patient` on the non-insurance payer history). That table also has `valid_from` and `valid_to` for as-of queries.
* **Merges:** `alternative_patient_mrn` is the patient that was merged away, and `primary_patient_mrn` is the patient that received its records. All of the alternative patient's encounters and data move to the primary patient.

## Common queries

### Current coverage per patient

```sql
SELECT
  p.patient_id,
  p.mrn,
  ih.primary_coverage_payer_name,
  ih.primary_coverage_member_id,
  ih.secondary_coverage_payer_name
FROM export_patient p
JOIN export_patient_insurance_history ih
  ON ih.patient_id = p.patient_id
  AND ih.is_latest_record = TRUE
WHERE p.deactivated = FALSE
```

### Upcoming appointments

```sql
SELECT
  a.appointment_id,
  a.patient_id,
  a.start_timestamp,
  a.status,
  a.service_facility_name
FROM export_patient_appointments a
WHERE a.deactivated = FALSE
  AND a.start_timestamp >= CURRENT_TIMESTAMP()
```