Skip to content
Partner Developer Portal

Schema

Column NameData TypeDescriptionExample
patient_history_idvarbinaryPseudonymised unique identifier for the patient history recordF422B34E0AC397B6A8C9D0E1F2345678
organisationvarcharThe unique EXA identifier for the data source organisationCDB-1234
load_datetimetimestamp(6) with time zoneDate and time that the record was last upserted into the EXA data lake from EMIS Web with a relevant source change2023-05-12 14:30:15.000000 UTC
is_deletedbooleanIf this record should be considered soft deleted; data fields excluding primary keys and lineage fields will be NULL if TRUEfalse
transform_datetimetimestamp(6) with time zoneDate and time the data was made available in the model with a relevant change2023-05-12 14:30:15.000000 UTC
patient_idvarbinaryPseudonymised unique patient identifierF422B34E0AC397B6A8C9D0E1F2345678
nhs_numbervarbinaryPseudonymised National Health Service number. This is stable across organisation transfers and is used to retain history for deduplicated patientsF422B34E0AC397B6A8C9D0E1F2345678
is_valid_hc_numberbooleanIndicates whether the patient’s Health and Care number is valid where presenttrue
has_diedbooleanIndicates whether the patient has died. True when the patient is recorded as deceased, has a recorded date of death, or their caseload patient status is ‘Dead’false
has_leftbooleanIndicates whether the patient has left the organisation. True when the patient is not deceased, has no recorded date of death, and their caseload patient status is ‘Left’false
patient_status_descriptionvarcharDescription of the patient’s status in the registration cycleRecord Received
is_registeredbooleanIndicates whether the history row is considered fully registered. Regular patients are registered through the GP registration lifecycle; non-regular patients are registered when correctly registeredtrue
patient_type_descriptionvarcharDescription of the patient type, such as Regular, Temporary, Emergency, Immediately Necessary, Private, or DummyRegular
recorded_datetimetimestamp(6) with time zoneDate and time that the registration history entry was recorded in EMIS Web2023-05-12 10:15:30.000000 UTC
recorded_datedateDate that the registration history entry was recorded in EMIS Web2023-05-12
recorded_yearbigintYear that the registration history entry was recorded in EMIS Web2023
model_updated_datetimetimestamp(6) with time zoneDate and time the model last updated this record2023-05-12 14:30:15.000000 UTC

Use is_registered for filtering registered history rows. OpenSafely exposes the registration status and patient type descriptions that customers can use to understand which registration entries are included.

Patient TypeStatus DescriptionDescription
RegularNotification of registrationThe organisation has received notification that the patient is registering
RegularMedical record sentThe patient’s medical record has been sent
RegularRecord ReceivedThe patient’s medical record has been received
Non-regularCorrectly registeredThe patient is correctly registered for the relevant non-regular context

The following query filters to the registered status descriptions exposed by the model:

SELECT
patient_id,
patient_status_description,
patient_type_description,
recorded_datetime
FROM explorer_open_safely.patient_registration_history
WHERE patient_status_description IN (
'Notification of registration',
'Medical record sent',
'Record Received',
'Correctly registered'
)
ORDER BY recorded_datetime DESC;

Use this query to preview recent rows and validate expected columns:

SELECT *
FROM explorer_open_safely.patient_registration_history
ORDER BY recorded_datetime DESC
LIMIT 100;