Skip to navigation

Patients & Payers

Overview

This group contains patient demographics, coverage and note history, appointments, referrals, authorizations, patient merge tracking, and payer metadata.

Patients

export_patient holds one row per patient with the patient’s current demographics, providers, emergency contacts, and non-insurance payer associations. Every other patient table joins to it on patient_id. To connect patients to encounters, match export_patient.mrn to export_encounter.patient_external_id within the same organization_id.

Patient History

These tables keep one row per version, so a patient has many rows over time. Use the latest-record flag to get current state, or the version timestamps for as-of queries.

  • export_patient_insurance_history — primary, secondary, and tertiary coverage for each patient version. Filter on is_latest_record = TRUE for current coverage.
  • export_patient_non_insurance_payer_history — one row per patient version and non-insurance payer association, with clinical trial details. Use valid_from / valid_to for as-of queries and is_latest_record_for_patient = TRUE for current associations.
  • export_patient_note_history — every version of every note on a patient. Filter on is_latest_record = TRUE for current note content.

Appointments, Referrals & Authorizations

These tables hold the latest state of each appointment, referral, and authorization on a patient.

  • export_patient_appointments — one row per appointment, including deactivated (cancelled) appointments.
  • export_patient_referrals — one row per referral, with its status and days until expiry.
  • export_patient_authorizations — one row per authorization, with its payer, status, and days until expiry.

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

TablePrimary KeyDescription
export_patientpatient_idCurrent patient demographics and identifiers
export_patient_insurance_historypatient_insurance_history_pkCoverage history, one row per patient insurance history version
export_patient_non_insurance_payer_historypatient_non_insurance_payer_history_pkNon-insurance payer and clinical trial history, one row per patient version and payer association
export_patient_note_historypatient_note_history_pkNote history, one row per note version
export_patient_appointmentsappointment_idLatest state of each appointment
export_patient_referralsreferral_idLatest state of each referral
export_patient_authorizationsauthorization_idLatest state of each authorization
export_patient_mergepatient_merge_idTracks merged patient records (source → target)
export_payerpayer_uuidPayer metadata

Common Queries

Current Coverage per Patient

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

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()

Find Merged Patients

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