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.
What to expect
Section titled “What to expect”- A patient appears once in
patientfor 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_historyand are linked through the deduplicated patient representation.
For full transfer behaviour, see Practice Transfers and Patient De-duplication.
Study design guidance
Section titled “Study design guidance”- For current population analyses, use the
patientmodel 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_historyand filter byrecorded_datetime,recorded_date, orrecorded_year.
Practical SQL pattern
Section titled “Practical SQL pattern”SELECT p.patient_id, p.organisation_id, p.registration_start_datetime, p.registration_end_datetime, p.is_active, p.has_diedFROM explorer_open_safely.patient AS pWHERE p.is_active = TRUERegistration history over time
SELECT patient_id, patient_status_description, patient_type_description, is_registered, has_left, has_died, recorded_datetimeFROM explorer_open_safely.patient_registration_historyWHERE patient_id = <patient_id>ORDER BY recorded_datetime DESC