Skip to content
Partner Developer Portal

How should I work with registration history?

OpenSafely presents a deduplicated current-registration view in the patient model and exposes previous registration type and status entries in patient_registration_history. This supports consistent cohort construction while still allowing longitudinal analysis of registration changes.

  • A patient appears once in patient for their current registration.
  • When a patient transfers practice, the patient row is updated to the new organisation context.
  • Historical registration entries remain available in patient_registration_history and are linked through the deduplicated patient representation.

For full transfer behaviour, see Practice Transfers and Patient De-duplication.

  • For current population analyses, use the patient model as the authoritative registration view.
  • For longitudinal clinical analyses, use stable patient identifiers (nhs_number) and time-filtered event models.
  • For longitudinal registration analyses, use patient_registration_history and filter by recorded_datetime, recorded_date, or recorded_year.
SELECT
p.patient_id,
p.organisation_id,
p.registration_start_datetime,
p.registration_end_datetime,
p.is_active,
p.has_died
FROM explorer_open_safely.patient AS p
WHERE p.is_active = TRUE

Registration history over time

SELECT
patient_id,
patient_status_description,
patient_type_description,
is_registered,
has_left,
has_died,
recorded_datetime
FROM explorer_open_safely.patient_registration_history
WHERE patient_id = <patient_id>
ORDER BY recorded_datetime DESC