erDiagram
patient {
integer age
timestamp date_of_birth
timestamp date_of_death
bigint ethnicity_code_id FK
boolean has_carer
boolean has_died
double imd_rounded
bigint index_of_multiple_deprivation_decile
boolean is_active
boolean is_consent_93c1
boolean is_deleted
boolean is_national_data_opted_in
varchar middle_level_super_output_area
timestamp model_updated_datetime
varbinary nhs_number
varchar organisation
varbinary patient_id PK
bigint preferred_language_code_id FK
timestamp registration_end_datetime
timestamp registration_start_datetime
varchar residential_institute_code
varchar sex
bigint sexual_orientation_code_id FK
timestamp transform_datetime
}
mkb_mapping_ethnicity {
bigint code_id PK
}
mkb_mapping_attributes {
bigint code_id PK
}
patient }o--|| mkb_mapping_ethnicity : "ethnicity_code_id"
patient }o--|| mkb_mapping_attributes : "preferred_language_code_id"
patient }o--|| mkb_mapping_attributes : "sexual_orientation_code_id"