Schema
Schema Overview
Section titled “Schema Overview”| Column Name | Data Type | Description | Example |
|---|---|---|---|
is_deleted |
boolean | If this record should be considered soft deleted; all columns excluding primary keys will be NULL if TRUE | false |
age |
integer | Patient age in years | 43 |
date_of_birth |
timestamp(6) | Patient date of birth, rounded to the first of the month | 2023-05-01 00:00:00.000000 UTC |
date_of_death |
timestamp(6) | Patient date of death | 2023-05-12 00:00:00.000000 UTC |
ethnicity_code_id |
bigint | EMIS code ID of ethnicity code | 3 |
has_carer |
boolean | Indicates whether the patient has a carer | true |
has_died |
boolean | Indicates if the patient has died | false |
imd_rounded_2019 |
double | Rounded Index of Multiple Deprivation score based on 2011 lsoa boundaries | 21100 |
imd_rounded_2025 |
double | Rounded Index of Multiple Deprivation score based on 2021 lsoa boundaries | 18400 |
index_of_multiple_deprivation_decile_2019 |
bigint | IMD decile (1 = most deprived, 10 = least deprived) based on 2011 lsoa boundaries | 5 |
index_of_multiple_deprivation_decile_2025 |
bigint | IMD decile (1 = most deprived, 10 = least deprived) based on 2021 lsoa boundaries | 4 |
is_active |
boolean | Indicates if the patient record is active | true |
is_consent_9nu0 |
boolean | Indicates whether a patient has consented for data sharing; FALSE = Patient HAS a type 1 opt-out, TRUE/NULL = Patient DOES NOT have a type 1 opt-out | true |
is_national_data_opted_in |
boolean | Indicates if the patient opted in to national data sharing; FALSE = Patient is OPTED OUT, TRUE/NULL = Patient is OPTED IN | true |
middle_level_super_output_area_code_2011 |
varchar | Patient middle super output area (MSOA) code based on 2011 boundaries | E02000001 |
middle_level_super_output_area_code_2021 |
varchar | Patient middle super output area (MSOA) code based on 2021 boundaries | E02006927 |
model_updated_datetime |
timestamp(6) | Date and time the model last updated this record | 2023-05-12 14:30:15.000000 UTC |
nhs_number |
varbinary | Pseudonymised National Health Service number | F422B34E0AC397B6A8C9D0E1F2345678 |
organisation_id |
varbinary | Pseudonymised organisation identifier associated with the patient row | 9A4FC1D2B7E893100B2A4E6D8C1F3A5E |
patient_id |
varbinary | Unique patient identifier | F422B34E0AC397B6A8C9D0E1F2345678 |
preferred_language_code_id |
bigint | EMIS code ID of preferred language code | 1 |
registration_end_datetime |
timestamp(6) | Date and time the patient registration ended with the practice | 2023-05-12 14:30:15.000000 UTC |
registration_start_datetime |
timestamp(6) | Date and time the patient registered with the practice | 2023-05-12 14:30:15.000000 UTC |
residential_institute_code |
varchar | Provides both current and legacy residential institute codes | RI001 |
sex |
varchar | Patient sex | Male |
sexual_orientation_code_id |
bigint | EMIS code ID of sexual orientation code | 2 |
transform_datetime |
timestamp(6) | Date and time the data was made available in the model with a relevant change | 2023-05-12 14:30:15.000000 UTC |
Example Query
Section titled “Example Query”Use this query to preview recent rows and validate expected columns:
SELECT *FROM explorer_open_safely.patientLIMIT 100;