Skip to content
Partner Developer Portal

Schema

The core schema represents the Patient Registration History model schema. It is derived from EMIS Web patient history records and enriched with patient type, patient status, current patient identifiers, and lifecycle flags.

Please note that how much of this model is visible varies between flavours.

In the event of a record deletion, patient-identifiable and descriptive columns will be nulled in customer-facing outputs, while key and lineage fields are retained to support deltas and troubleshooting.

Column NameData TypeDescriptionExample / ValuesValue Retained
patient_history_idbigintThe unique internal identifier for the patient history record within an organisation987654✓
patient_history_uuidvarcharThe UUID derived from patient_history_id and organisation, providing a stable unique identifier‘a1b2c3d4-e5f6-4a5b-9c8d-0e1f2a3b4c5d’✓
organisationvarcharThe unique EXA identifier for the data source organisation‘CDB-1234’✓
load_datetimetimestamp(6) with time zoneThe datetime that the record was last upserted into the EXA data lake from EMIS source system with a relevant change from source system‘2023-05-12 14:30:15+00’✓
is_deletedbooleanIndicates whether the patient history record has been marked as deleted in the source systemFALSE✓
transform_datetimetimestamp(6) with time zoneThe timestamp indicating when the record was last processed and updated in the data model‘2023-05-12 14:30:15+00’✓
patient_idbigintThe unique internal identifier for the patient record within an organisation123456✓
patient_guidvarcharThe unique GUID for the patient record within an organisation‘a1b2c3d4-e5f6-4a5b-9c8d-0e1f2a3b4c5d’✓
patient_uuidvarcharThe UUID derived from patient_id and organisation, providing a stable unique identifier‘a1b2c3d4-e5f6-4a5b-9c8d-0e1f2a3b4c5d’✓
person_guidvarcharThe globally unique identifier across EMIS organisations for the person associated with this patient record‘b2c3d4e5-f6a7-5b6c-0d1e-2f3a4b5c6d7e’
nhs_numbervarcharThe patient’s NHS number, selected from their health service numbers‘9435797881’
chi_numbervarcharThe patient’s Community Health Index number, selected from their health service numbers‘0101201044’
hc_numbervarcharThe patient’s Health and Care number, selected from their health service numbers‘1234567890’
hospital_numbervarcharThe patient’s hospital number, selected from their health service numbers‘HOSP345678’
ssd_numbervarcharThe patient’s Social Services Department number, selected from their health service numbers‘SSD901234’
gha_numbervarcharThe patient’s Gibraltar Health Authority number, selected from their health service numbers‘GHA567890’
is_valid_nhs_numberbooleanIndicates whether the patient’s NHS number is validTRUE
is_valid_chi_numberbooleanIndicates whether the patient’s Community Health Index number is validTRUE
is_valid_hc_numberbooleanIndicates whether the patient’s Health and Care number is validTRUE
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_idbigintThe unique identifier for the patient’s status during the registration cycle6
patient_status_descriptionvarcharThe description of the patient’s status in the registration cycle‘Record Received’
caseload_patient_status_idbigintThe administrative caseload status linked to the patient status: Registered (1), Left (2), or Died (3)1
is_registeredbooleanIndicates whether the history row is considered fully registered:
* For regular patients (patient type 4), true when the registration status is between 4 and 7, covering notification of registration through receipt of the medical record.
* For all other patient types, true only when registration status is 8.
TRUE
patient_type_idbigintThe unique identifier for the type of patient this history row relates to4
patient_type_descriptionvarcharThe description of the patient type, such as Regular, Temporary, Emergency, Immediately Necessary, Private, or Dummy‘Regular’
recorded_datetimetimestamp(6) with time zoneThe date and time that the registration history entry was recorded in EMIS Web‘2023-05-12 10:15:30+00’
recorded_datedateThe date that the registration history entry was recorded in EMIS Web‘2023-05-12’
recorded_yearbigintThe year that the registration history entry was recorded in EMIS Web2023
_execution_datevarcharThe transform_datetime formatted as yyyyMMddHHmmss. This is a legacy column provided only for backward compatibility‘20230512143015’✓

The table below presents the expected flavour specific schema for the Vanilla V2 model and maps columns to the core model.

Column NameData TypeCore MappingComments
patient_history_idbigintpatient_history_id
patient_history_uuidvarcharpatient_history_uuid
organisationvarcharorganisation
load_datetimetimestamp(6) with time zoneload_datetime
is_deletedbooleanis_deleted
transform_datetimetimestamp(6) with time zonetransform_datetime
emis_patient_idbigintpatient_id
registration_guidvarcharpatient_guid
patient_uuidvarcharpatient_uuid
person_guidvarcharperson_guid
nhs_novarcharnhs_number
chi_numbervarcharchi_number
hc_numbervarcharhc_number
hospital_numbervarcharhospital_number
ssd_numbervarcharssd_number
gha_novarchargha_number
is_valid_nhs_numberbooleanis_valid_nhs_number
is_valid_chi_numberbooleanis_valid_chi_number
is_valid_hc_numberbooleanis_valid_hc_number
has_diedbooleanhas_died
has_leftbooleanhas_left
emis_registration_status_idbigintpatient_status_id
registration_status_descriptionvarcharpatient_status_description
caseload_patient_status_idbigintcaseload_patient_status_id
is_registeredbooleanis_registered
emis_registration_type_idbigintpatient_type_id
registration_type_descriptionvarcharpatient_type_description
recorded_datetimetimestamp(6) with time zonerecorded_datetime
recorded_datedaterecorded_date
recorded_yearbigintrecorded_year
_execution_datevarchar_execution_date

The following query uses the customer-facing status descriptions that normally represent registered rows:

SELECT
emis_patient_id,
registration_status_description,
registration_type_description,
recorded_datetime,
organisation
FROM hive.explorer_ipcv_vanilla.patient_registration_history
WHERE registration_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 hive.explorer_ipcv_vanilla.patient_registration_history
ORDER BY recorded_datetime DESC
LIMIT 100;