Remote Subscriber Database (RSD) Schema (Compass 2): Difference between revisions

From Discovery Data Service
Jump to navigation Jump to search
No edit summary
 
(8 intermediate revisions by the same user not shown)
Line 45: Line 45:
|-
|-
|clinical_effective_date
|clinical_effective_date
|Date
|date
|DEFAULT NULL
|DEFAULT NULL
|The date the clinical code is  recorded for
|The date the clinical code is  recorded for
Line 123: Line 123:
|-
|-
|organization_id
|organization_id
|varchar(36)
|bigint
|NOT NULL
|NOT NULL
|Owning organisation (i.e.  publisher)
|Owning organisation (i.e.  publisher)
Line 129: Line 129:
|-
|-
|patient_id
|patient_id
|varchar(36)
|bigint
|NOT NULL
|NOT NULL
|The organisations record for  this person’s registration. Patients may have multiple records across  clinical systems and may have registered at an organisation multiple times
|The organisations record for  this person’s registration. Patients may have multiple records across  clinical systems and may have registered at an organisation multiple times
Line 225: Line 225:
|-
|-
| colspan="5" |ON UPDATE NO ACTION ON DELETE NO ACTION
| colspan="5" |ON UPDATE NO ACTION ON DELETE NO ACTION
|}
== Table: appointment_status ==
PRIMARY KEY (id)
{| class="wikitable sortable mw-collapsible mw-collapsed"
|'''Column name'''
|'''Data type'''
|'''Constraint'''
|'''Comments'''
|'''References'''
|-
|id
|smallint(6)
|NOT NULL
|Unique Id of the appointment  status
|
|-
|Value
|varchar(50)
|NOT NULL
|The value of the appointment  status
|
|-
| colspan="5" |CONSTRAINT  PRIMARY KEY (id)
|}
|}


Line 260: Line 236:
|'''References'''
|'''References'''
|-
|-
|Dbid
|dbid
|int(11)
|int(11)
|NOT NULL
|NOT NULL
Line 314: Line 290:
|
|
|-
|-
|updated datetime
|updated
|datetime
|datetime
|NOT NULL
|NOT NULL
Line 324: Line 300:


== Table: concept_map ==
== Table: concept_map ==
PRIMARY KEY (legacy)
PRIMARY KEY (id)
{| class="wikitable sortable mw-collapsible mw-collapsed"
{| class="wikitable sortable mw-collapsible mw-collapsed"
|'''Column name'''
|'''Column name'''
Line 350: Line 326:
|
|
|-
|-
| colspan="5" |CONSTRAINT PRIMARY KEY (legacy)
|id
|}
|int(11)
 
|
== Table: concept_property_object ==
|
{| class="wikitable sortable mw-collapsible mw-collapsed"
|
|'''Column name'''
|-
|deleted
|tinyint(1)
|
|
|
|-
| colspan="5" |CONSTRAINT PRIMARY KEY (id)
|}
 
== Table: diagnostic_order ==
PRIMARY KEY (organization_id,person_id,id)
{| class="wikitable sortable mw-collapsible mw-collapsed"
|'''Column name'''
|'''Data type'''
|'''Data type'''
|'''Constraint'''
|'''Constraint'''
Line 361: Line 350:
|'''References'''
|'''References'''
|-
|-
|dbid
|id
|int(11)
|bigint
|NOT NULL
|NOT NULL
|Unique Id of the concept
|Unique Id of the diagnostic  order
|
|
|-
|-
|group
|organization_id
|int(11)
|bigint
|NOT NULL
|NOT NULL
|Grouping identifier
|Owning organisation (i.e.  publisher)
|
|
|-
|-
|property
|patient_id
|int(11)
|bigint
|NOT NULL
|NOT NULL
|The property concept
|The organisations record for  this person’s registration. Patients may have multiple records across  clinical systems and may have registered at an organisation multiple times
|
|
|-
|-
|value
|person_id
|int(11)
|bigint
|NOT NULL
|NOT NULL
|The value concept for the given concepts property
|Unique individual across all organisations
|
|
|-
|-
|updated
|encounter_id
|datetime
|bigint
|NOT NULL
|DEFAULT NULL
|Timestamp the property value was updated/added
|Reference to the encounter the  observation was recorded at
|
|
|}
== Table: concept_tct ==
{| class="wikitable sortable mw-collapsible mw-collapsed"
|'''Column name'''
|'''Data type'''
|'''Constraint'''
|'''Comments'''
|'''References'''
|-
|-
|Source
|practitioner_id
|int(11)
|bigint
|DEFAULT NULL
|DEFAULT NULL
|Source concept
|The clinician the activity is  recorded against
|
|
|-
|-
|Property
|clinical_effective_date
|int(11)
|date
|DEFAULT NULL
|DEFAULT NULL
|Property concept
|The date the diagnostic order  was identified by a clinician
|
|
|-
|-
|Level
|date_precision_concept_id
|int(11)
|int
|DEFAULT NULL
|DEFAULT NULL
|The "distance" of the  from source (1=parent, 2=grandparent, etc)
|Identifies the precision of the  clinical effectiveness date to either year (1) month (2) day (5) minute (12) second  (13) millisecond (14)
|
|
|-
|-
|Target
|result_value
|int(11)
|real
|DEFAULT NULL
|DEFAULT NULL
|The target
|The value of the result of the  observation
|
|
|-
|-
|Status
|result_value_units
|int(11)
|varchar(50)
|DEFAULT NULL
|DEFAULT NULL
|Whether the concept is active
|The units of the result of the  observation
|
|
|-
|-
|created_date
|result_date
|datetime
|date
|DEFAULT NULL
|DEFAULT NULL
|When the concept was created
|The date of the result
|
|
|}
== Table: consent_code ==
{| class="wikitable sortable mw-collapsible mw-collapsed"
|'''Column name'''
|'''Data type'''
|'''Constraint'''
|'''Comments'''
|'''References'''
|-
|-
|STATUS
|result_text
|varchar(10)
|text
|DEFAULT NULL
|DEFAULT NULL
|Whether the consent code is active
|Any text associated with the  result
|
|
|-
|-
|DESCRIPTION
|result_concept_id
|varchar(100)
|int
|DEFAULT NULL
|DEFAULT NULL
|Description of the consent code
|Reference to the clinical  coding of the result
|
|-
|is_problem
|boolean
|NOT NULL
|Whether the observation is marked  as a problem
|
|-
|is_review
|boolean
|NOT NULL
|Whether the observation is a  review of an existing problem
|
|
|-
|-
|CODE
|problem_end_date
|varchar(20)
|date
|DEFAULT NULL
|DEFAULT NULL
|The actual consent code
|The end date of the problem
|
|
|-
|-
|TERM_CODE
|parent_observation_id
|varchar(20)
|bigint
|DEFAULT NULL
|DEFAULT NULL
|The clinical term code
|Reference to the parent  observation in a complex observation eg systolic and diastolic blood  pressures will have a parent observation of Blood pressure
|
|
|-
|-
|TERM
|core_concept_id
|varchar(100)
|int
|DEFAULT NULL
|DEFAULT NULL
|The clinical term
|Reference to the clinical coding of the observation
|
|
|}
== Table: date_precision ==
PRIMARY KEY(id)
{| class="wikitable sortable mw-collapsible mw-collapsed"
|'''Column name'''
|'''Data type'''
|'''Constraint'''
|'''Comments'''
|'''References'''
|-
|-
|Id
|non_core_concept_id
|smallint(6)
|int
|NOT NULL
|DEFAULT NULL
|Reference to the clinical  coding of the observation
|
|
|-
|age_at_event
|decimal (5,2)
|DEFAULT NULL
|The age of the patient at the  time of the observation
|
|
|-
|-
|Value
|episodicity_concept_id
|varchar(11)
|int
|NOT NULL
|DEFAULT NULL
|Reference to the episodicity of  the problem eg First, review, flare
|
|
|-
|is_primary
|boolean
|DEFAULT NULL
|Whether the diagnostic order is  a primary order
|
|
|-
|-
| colspan="5" |CONSTRAINT PRIMARY KEY (id)
| colspan="5" |CONSTRAINT pk_diagnostic_order_id PRIMARY KEY (`organization_id`,`person_id`,`id`),
|}
|-
 
| colspan="5" |CONSTRAINT fk_diagnostic_order_encounter_id FOREIGN KEY (encounter_id)
== Table: diagnostic_order ==
|-
| colspan="5" |REFERENCES encounter (id) MATCH SIMPLE
|-
| colspan="5" |ON UPDATE NO ACTION ON DELETE NO ACTION,
|-
| colspan="5" |CONSTRAINT fk_diagnostic_order_patient_id_organization_id FOREIGN KEY (patient_id, organization_id)
|-
| colspan="5" |REFERENCES patient (id, organization_id) MATCH SIMPLE
|-
| colspan="5" |ON UPDATE NO ACTION ON DELETE NO ACTION,
|-
| colspan="5" |CONSTRAINT fk_diagnostic_order_practitioner_id FOREIGN KEY (practitioner_id)
|-
| colspan="5" |REFERENCES practitioner (id) MATCH SIMPLE
|-
| colspan="5" |ON UPDATE NO ACTION ON DELETE NO ACTION
|}
 
== Table: encounter ==
PRIMARY KEY (organization_id,person_id,id)
PRIMARY KEY (organization_id,person_id,id)
{| class="wikitable sortable mw-collapsible mw-collapsed"
{| class="wikitable sortable mw-collapsible mw-collapsed"
Line 512: Line 515:
|bigint
|bigint
|NOT NULL
|NOT NULL
|Unique Id of the diagnostic  order
|Unique Id of the encounter
|
|
|-
|-
Line 533: Line 536:
|
|
|-
|-
|encounter_id
|practitioner_id
|bigint
|bigint
|DEFAULT NULL
|DEFAULT NULL
|Reference to the encounter the  observation was recorded at
|The clinician the activity is recorded against
|
|
|-
|-
|practitioner_id
|appointment_id
|bigint
|bigint
|DEFAULT NULL
|DEFAULT NULL
|The clinician the activity is recorded against
|Reference to the appointment this encounter took part on
|
|
|-
|-
Line 548: Line 551:
|date
|date
|DEFAULT NULL
|DEFAULT NULL
|The date the diagnostic order was identified by a clinician
|The date the clinical code is recorded for
|
|
|-
|-
|date_precision_concept_id
|
date_precision_concept_id
|int
|int
|DEFAULT NULL
|DEFAULT NULL
|Identifies the precision of the clinical effectiveness date to either year (1) month (2) day (5) minute (12) second  (13) millisecond (14)
|Reference to the precision of the date of the encounter
|
|
|-
|-
|result_value
|episode_of_care_id
|real
|bigint
|DEFAULT NULL
|DEFAULT NULL
|The value of the result of the  observation
|Is this instance of the code a  review of a previous encounter
|
|
|-
|-
|result_value_units
|service_provider_organization_id
|varchar(50)
|bigint
|DEFAULT NULL
|DEFAULT NULL
|The units of the result of the  observation
|Reference to the service provider organisation
|
|
|-
|-
|result_date
|core_concept_id
|date
|int
|DEFAULT NULL
|DEFAULT NULL
|The date of the result
|Reference to the type of encounter
|
|
|-
|-
|result_text
|non_core_concept_id
|text
|int
|DEFAULT NULL
|DEFAULT NULL
|Any text associated with the  result
|Reference to the type of encounter
|
|
|-
|-
|result_concept_id
|age_at_event
|int
|decimal(5,2)
|DEFAULT NULL
|DEFAULT NULL
|Reference to the clinical coding of the result
|The age the patient was when this encounter took place
|
|
|-
|-
|is_problem
|Type
|boolean
|text
|NOT NULL
|DEFAULT NULL
|Whether the observation is marked  as a problem
|Unused
|
|
|-
|-
|is_review
|sub_type
|boolean
|text
|NOT NULL
|DEFAULT NULL
|Whether the observation is a  review of an existing problem
|Unused
|
|
|-
|-
|problem_end_date
|admission_method
|date
|varchar(40)
|DEFAULT NULL
|DEFAULT NULL
|The end date of the problem
|The admission method of the encounter
|
|
|-
|-
|parent_observation_id
|end_date
|bigint
|date
|DEFAULT NULL
|DEFAULT NULL
|Reference to the parent  observation in a complex observation eg systolic and diastolic blood  pressures will have a parent observation of Blood pressure
|The end date of the encounter
|
|
|-
|-
|core_concept_id
|institution_location_id
|int
|text
|DEFAULT NULL
|DEFAULT NULL
|Reference to the clinical coding of the observation
|Reference to the institution the encounter took place at
|
|
|-
|-
|non_core_concept_id
|date_recorded
|int
|datetime
|DEFAULT NULL
|DEFAULT NULL
|Reference to the clinical coding of the observation
|The date the encounter was recorded
|
|
|-
|-
|age_at_event
| colspan="5" |
|decimal (5,2)
CONSTRAINT pk_encounter_id PRIMARY KEY (organization_id,person_id,id),
|DEFAULT NULL
|The age of the patient at the  time of the observation
|
|-
|-
|episodicity_concept_id
| colspan="5" |CONSTRAINT fk_encounter_appointment_id FOREIGN KEY (appointment_id)
|int
|DEFAULT NULL
|Reference to the episodicity of  the problem eg First, review, flare
|
|-
|-
|is_primary
| colspan="5" |REFERENCES appointment (id) MATCH SIMPLE
|boolean
|DEFAULT NULL
|Whether the diagnostic order is  a primary order
|
|-
|-
| colspan="5" |CONSTRAINT pk_diagnostic_order_id PRIMARY KEY (`organization_id`,`person_id`,`id`),
| colspan="5" |ON UPDATE NO ACTION ON DELETE NO ACTION
|-
|-
| colspan="5" |CONSTRAINT fk_diagnostic_order_encounter_id FOREIGN KEY (encounter_id)
| colspan="5" |CONSTRAINT fk_encounter_patient_id_organization_id FOREIGN KEY (patient_id, organization_id)
|-
|-
| colspan="5" |REFERENCES encounter (id) MATCH SIMPLE
| colspan="5" |REFERENCES patient (id, organization_id) MATCH SIMPLE
|-
|-
| colspan="5" |ON UPDATE NO ACTION ON DELETE NO ACTION,
| colspan="5" |ON UPDATE NO ACTION ON DELETE NO ACTION,
|-
|-
| colspan="5" |CONSTRAINT fk_diagnostic_order_patient_id_organization_id FOREIGN KEY (patient_id, organization_id)
| colspan="5" |CONSTRAINT fk_encounter_practitioner_id FOREIGN KEY (practitioner_id)
|-
|-
| colspan="5" |REFERENCES patient (id, organization_id) MATCH SIMPLE
| colspan="5" |REFERENCES practitioner (id) MATCH SIMPLE
|-
|-
| colspan="5" |ON UPDATE NO ACTION ON DELETE NO ACTION,
| colspan="5" |ON UPDATE NO ACTION ON DELETE NO ACTION,
|-
|-
| colspan="5" |CONSTRAINT fk_diagnostic_order_practitioner_id FOREIGN KEY (practitioner_id)
| colspan="5" |CONSTRAINT fk_encounter_episode_of_care_id FOREIGN KEY (episode_of_care_id)
|-
| colspan="5" |REFERENCES episode_of_care (id) MATCH SIMPLE
|-
|-
| colspan="5" |REFERENCES practitioner (id) MATCH SIMPLE
| colspan="5" |ON UPDATE NO ACTION ON DELETE NO ACTION,
|-
|-
| colspan="5" |ON UPDATE NO ACTION ON DELETE NO ACTION
| colspan="5" |CONSTRAINT fk_encounter_service_provider_organization_id FOREIGN KEY (service_provider_organization_id)
|}
|-
| colspan="5" |REFERENCES organization (id) MATCH SIMPLE
|-
| colspan="5" |ON UPDATE NO ACTION ON DELETE NO ACTION
|}


== Table: encounter ==
== Table: encounter_additional ==
PRIMARY KEY (organization_id,person_id,id)
PRIMARY KEY (id, property_id, value_id)
{| class="wikitable sortable mw-collapsible mw-collapsed"
{| class="wikitable sortable mw-collapsible mw-collapsed"
|'''Column name'''
|'''Column name'''
Line 674: Line 673:
|bigint
|bigint
|NOT NULL
|NOT NULL
|Unique Id of the encounter
|same as the id column on the encounter table
|
|
|-
|-
|organization_id
|property_id
|bigint
|int
|NOT NULL
|NOT NULL
|Owning organisation (i.e. publisher)
|IM reference (i.e. Admission method)
|
|
|-
|-
|patient_id
|value_id
|bigint
|int
|NOT NULL
|NOT NULL
|The organisations record for  this person’s registration. Patients may have multiple records across  clinical systems and may have registered at an organisation multiple times
|IM reference (i.e. Emergency admission)
|
|
|-
|-
|person_id
|json_value
|bigint
|JSON
|NOT NULL
|NULL
|Unique individual across all  organisations
|where there is no mapped value_id, just raw JSON (i.e. birth delivery details)
|
|
|-
|-
|practitioner_id
|text_value
|bigint
|varchar(255)
|DEFAULT NULL
|NULL
|The clinician the activity is recorded against
|where there is no mapped value_id, or raw JSON, just a basic text value (i.e. FIN number)
|
|
|-
|-
|appointment_id
| colspan="5" |CONSTRAINT pk_encounter_additional_id PRIMARY KEY (id, property_id, value_id)
|}
 
== Table: encounter_event ==
PRIMARY KEY (organization_id, person_id, id)
{| class="wikitable sortable mw-collapsible mw-collapsed"
|'''Column name'''
|'''Data type'''
|'''Constraint'''
|'''Comments'''
|'''References'''
|-
|id
|bigint
|bigint
|DEFAULT NULL
|NOT NULL
|Reference to the appointment this encounter took part on
|Unique Id of the encounter event
|
|
|-
|-
|clinical_effective_date
|organization_id
|date
|bigint
|DEFAULT NULL
|NOT NULL
|The date the clinical code is recorded for
|Owning organisation (i.e. publisher)
|
|
|-
|-
|patient_id
|bigint
|NOT NULL
|The patient this event belongs  to
|
|
 
|-
 
|person_id
date_precision_concept_id
|bigint
|NOT NULL
|The person this event belongs  to
|
|-
|encounter_id
|bigint
|NOT NULL
|Reference to the parent  encounter record
|
|-
|practitioner_id
|bigint
|DEFAULT NULL
|The clinician the activity is  recorded against
|
|-
|appointment_id
|bigint
|DEFAULT NULL
|Reference to the appointment  this encounter took part on
|
|-
|clinical_effective_date
|datetime
|DEFAULT NULL
|The date the encounter took  place
|
|-
|date_precision_concept_id
|int
|int
|DEFAULT NULL
|DEFAULT NULL
Line 725: Line 769:
|bigint
|bigint
|DEFAULT NULL
|DEFAULT NULL
|Is this instance of the code a review of a previous encounter
|Reference to the episode of  care this encounter belongs to
|
|
|-
|-
Line 749: Line 793:
|decimal(5,2)
|decimal(5,2)
|DEFAULT NULL
|DEFAULT NULL
|The age the patient was when this encounter took place
|The age of the patient at the time of the encounter
|
|
|-
|-
|Type
|type
|text
|text
|DEFAULT NULL
|DEFAULT NULL
Line 777: Line 821:
|-
|-
|institution_location_id
|institution_location_id
|text
|bigint
|DEFAULT NULL
|DEFAULT NULL
|Reference to the institution  the encounter took place at
|Reference to the institution  the encounter took place at
Line 788: Line 832:
|
|
|-
|-
|service_provider_organization_id
|finished
|bigint(20)
|boolean
|DEFAULT NULL
|DEFAULT NULL
|Reference to the service  provider organisation
|Whether the encounter is finished
|
|
|-
|-
| colspan="5" |
| colspan="5" |CONSTRAINT pk_encounter_event_id PRIMARY KEY (organization_id, person_id, id),
 
 
CONSTRAINT pk_encounter_id PRIMARY KEY (organization_id,person_id,id),
|-
|-
| colspan="5" |CONSTRAINT fk_encounter_appointment_id FOREIGN KEY (appointment_id)
| colspan="5" |CONSTRAINT fk_encounter_event_patient_id_organization_id FOREIGN KEY (patient_id, organization_id)
|-
| colspan="5" |REFERENCES appointment (id) MATCH SIMPLE
|-
| colspan="5" |ON UPDATE NO ACTION ON DELETE NO ACTION,*/
|-
| colspan="5" |CONSTRAINT fk_encounter_patient_id_organization_id FOREIGN KEY (patient_id, organization_id)
|-
|-
| colspan="5" |REFERENCES patient (id, organization_id) MATCH SIMPLE
| colspan="5" |REFERENCES patient (id, organization_id) MATCH SIMPLE
Line 811: Line 846:
| colspan="5" |ON UPDATE NO ACTION ON DELETE NO ACTION,
| colspan="5" |ON UPDATE NO ACTION ON DELETE NO ACTION,
|-
|-
| colspan="5" |CONSTRAINT fk_encounter_practitioner_id FOREIGN KEY (practitioner_id)
| colspan="5" |CONSTRAINT fk_encounter_event_practitioner_id FOREIGN KEY (practitioner_id)
|-
|-
| colspan="5" |REFERENCES practitioner (id) MATCH SIMPLE
| colspan="5" |REFERENCES practitioner (id) MATCH SIMPLE
Line 817: Line 852:
| colspan="5" |ON UPDATE NO ACTION ON DELETE NO ACTION,
| colspan="5" |ON UPDATE NO ACTION ON DELETE NO ACTION,
|-
|-
| colspan="5" |CONSTRAINT fk_encounter_episode_of_care_id FOREIGN KEY (episode_of_care_id)
| colspan="5" |CONSTRAINT fk_encounter_event_episode_of_care_id FOREIGN KEY (episode_of_care_id)
|-
|-
| colspan="5" |REFERENCES episode_of_care (id) MATCH SIMPLE
| colspan="5" |REFERENCES episode_of_care (id) MATCH SIMPLE
Line 823: Line 858:
| colspan="5" |ON UPDATE NO ACTION ON DELETE NO ACTION,
| colspan="5" |ON UPDATE NO ACTION ON DELETE NO ACTION,
|-
|-
| colspan="5" |CONSTRAINT fk_encounter_service_provider_organization_id FOREIGN KEY (service_provider_organization_id)
| colspan="5" |CONSTRAINT fk_encounter_event_service_provider_organization_id FOREIGN KEY (service_provider_organization_id)
|-
|-
| colspan="5" |REFERENCES organization (id) MATCH SIMPLE
| colspan="5" |REFERENCES organization (id) MATCH SIMPLE
Line 830: Line 865:
|}
|}


== Table: encounter_additional ==
== Table: episode_of_care ==
PRIMARY KEY (id, property_id, value_id)
PRIMARY KEY (organization_id,person_id,id)
{| class="wikitable sortable mw-collapsible mw-collapsed"
{| class="wikitable sortable mw-collapsible mw-collapsed"
|'''Column name'''
|'''Column name'''
Line 842: Line 877:
|bigint
|bigint
|NOT NULL
|NOT NULL
|same as the id column on the encounter table
|Unique Id of the episode of  care
|
|
|-
|-
|property_id
|organization_id
|bigint
|bigint
|NOT NULL
|NOT NULL
|IM reference (i.e. Admission method)
|Owning organisation (i.e. publisher)
|
|organization.id
|-
|-
|value_id
|patient_id
|bigint
|bigint
|NOT NULL
|NOT NULL
|IM reference (i.e. Emergency admission)
|The organisations record for  this person’s registration. Patients may have multiple records across  clinical systems and may have registered at an organisation multiple times
|
|patient.id
|-
|-
| colspan="5" |CONSTRAINT pk_encounter_additional_id PRIMARY KEY (id, property_id, value_id)
|person_id
|}
 
== Table: encounter_event ==
PRIMARY KEY (organization_id, person_id, id)
{| class="wikitable sortable mw-collapsible mw-collapsed"
|'''Column name'''
|'''Data type'''
|'''Constraint'''
|'''Comments'''
|'''References'''
|-
|id
|bigint
|bigint
|NOT NULL
|NOT NULL
|Unique Id of the encounter  event
|Unique individual across all organisations
|
|person.id
|-
|-
|organization_id
|registration_type_concept_id
|bigint
|int
|NOT NULL
|DEFAULT NULL
|Owning organisation (i.e. publisher)
|Reference to the registration type of the patient
|
|registration.type.id
|-
|-
|patient_id
|registration_status_concept_id
|bigint
|int
|NOT NULL
|DEFAULT NULL
|The patient this event belongs  to
|Reference to the registration  status of the patient
|
|
|-
|-
|person_id
|date_registered
|bigint
|date
|NOT NULL
|DEFAULT NULL
|The person this event belongs  to
|The date the registration was  started  for this episode of care
|
|
|-
|-
|encounter_id
|date_registered_end
|bigint
|date
|NOT NULL
|DEFAULT NULL
|Reference to the parent encounter record
|The date the registration was ended  for this episode of care
|
|
|-
|-
|practitioner_id
|usual_gp_practitioner_id
|bigint
|bigint
|DEFAULT NULL
|DEFAULT NULL
|The clinician the activity is recorded against
|Reference to the usual GP for this episode of care
|
|Practitioner.id
|-
|-
|appointment_id
| colspan="5" |CONSTRAINT pk_episode_of_care_id PRIMARY KEY (`organization_id`,`person_id`,`id`),
|bigint
|DEFAULT NULL
|Reference to the appointment  this encounter took part on
|
|-
|-
|clinical_effective_date
| colspan="5" |CONSTRAINT fk_episode_of_care_patient_id_organisation_id FOREIGN KEY (patient_id, organization_id)
|datetime
|DEFAULT NULL
|The date the encounter took  place
|
|-
|-
|date_precision_concept_id
| colspan="5" |REFERENCES patient (id, organization_id) MATCH SIMPLE
|int
|DEFAULT NULL
|Reference to the precision of  the date of the encounter
|
|-
|-
|episode_of_care_id
| colspan="5" |ON UPDATE NO ACTION ON DELETE NO ACTION,
|bigint
|DEFAULT NULL
|Reference to the episode of  care this encounter belongs to
|
|-
|-
|service_provider_organization_id
| colspan="5" |CONSTRAINT fk_episode_of_care_practitioner_id FOREIGN KEY (usual_gp_practitioner_id)
|bigint
|DEFAULT NULL
|Reference to the service  provider organisation
|
|-
|-
|core_concept_id
| colspan="5" |REFERENCES practitioner (id) MATCH SIMPLE
|int
|DEFAULT NULL
|Reference to the type of  encounter
|
|-
|-
|non_core_concept_id
| colspan="5" |ON UPDATE NO ACTION ON DELETE NO ACTION
|int
|}
|DEFAULT NULL
 
|Reference to the type of  encounter
== Table: event_log ==
|
{| class="wikitable sortable mw-collapsible mw-collapsed"
|'''Column name'''
|'''Data type'''
|'''Constraint'''
|'''Comments'''
|'''References'''
|-
|-
|age_at_event
|dt_change
|decimal(5,2)
|datetime(3)
|DEFAULT NULL
|NOT NULL
|The age of the patient at the time of the encounter
|date time the change was made to this DB
|
|
|-
|-
|type
|change_type
|text
|tinyint
|DEFAULT NULL
|NOT NULL
|Unused
|type of transaction 0=insert, 1=update, 2=delete
|
|
|-
|-
|sub_type
|table_id
|text
|tinyint
|DEFAULT NULL
|NOT NULL
|Unused
|identifier of the table changed
|
|
|-
|-
|admission_method
|record_id
|varchar(40)
|bigint
|DEFAULT NULL
|NOT NULL
|The admission method of the encounter
|id of the record changed
|
|
|}
== Table: flag ==
PRIMARY KEY (organization_id,person_id,id)
{| class="wikitable sortable mw-collapsible mw-collapsed"
|'''Column name'''
|'''Data type'''
|'''Constraint'''
|'''Comments'''
|'''References'''
|-
|-
|end_date
|id
|date
|bigint(20)
|DEFAULT NULL
|NOT NULL
|The end date of the encounter
|Unique Id of the flag
|
|
|-
|-
|institution_location_id
|organization_id
|bigint
|bigint(20)
|DEFAULT NULL
|NOT NULL
|Reference to the institution the encounter took place at
|Owning organisation (i.e. publisher)
|
|
|-
|-
|date_recorded
|patient_id
|datetime
|bigint(20)
|DEFAULT NULL
|NOT NULL
|The date the encounter was  recorded
|The organisations record for  this person’s registration. Patients may have multiple records across  clinical systems and may have registered at an organisation multiple times
|patient.id
|-
|person_id
|bigint(20)
|NOT NULL
|Unique individual across all organisations
|person.id
|-
|effective_date
|date
|DEFAULT NULL
|The date the flag was entered  onto the patients record
|
|-
|date_precision_concept_id
|int
|DEFAULT NULL
|Identifies the precision of the  clinical effectiveness date to either year (1) month (2) day (5) minute (12) second (13) millisecond (14)
|
|
|-
|-
|finished
|is_active
|boolean
|boolean
|DEFAULT NULL
|NOT NULL
|Whether the encounter is finished
|Whether the flag is active or  not
|
|-
|flag_text
|text
|
|This is a warning set by the  publisher regarding he patient
|
|
|-
|-
| colspan="5" |CONSTRAINT pk_encounter_event_id PRIMARY KEY (organization_id, person_id, id),
| colspan="5" |CONSTRAINT pk_flag_id PRIMARY KEY (`organization_id`,`person_id`,`id`),
|-
|-
| colspan="5" |CONSTRAINT fk_encounter_event_patient_id_organization_id FOREIGN KEY (patient_id, organization_id)
| colspan="5" |CONSTRAINT fk_flag_patient_id_organization_id FOREIGN KEY (patient_id, organization_id)
|-
|-
| colspan="5" |REFERENCES patient (id, organization_id) MATCH SIMPLE
| colspan="5" |REFERENCES patient (id, organization_id) MATCH SIMPLE
|-
| colspan="5" |ON UPDATE NO ACTION ON DELETE NO ACTION,
|-
| colspan="5" |CONSTRAINT fk_encounter_event_practitioner_id FOREIGN KEY (practitioner_id)
|-
| colspan="5" |REFERENCES practitioner (id) MATCH SIMPLE
|-
| colspan="5" |ON UPDATE NO ACTION ON DELETE NO ACTION,
|-
| colspan="5" |CONSTRAINT fk_encounter_event_episode_of_care_id FOREIGN KEY (episode_of_care_id)
|-
| colspan="5" |REFERENCES episode_of_care (id) MATCH SIMPLE
|-
| colspan="5" |ON UPDATE NO ACTION ON DELETE NO ACTION,
|-
| colspan="5" |CONSTRAINT fk_encounter_event_service_provider_organization_id FOREIGN KEY (service_provider_organization_id)
|-
| colspan="5" |REFERENCES organization (id) MATCH SIMPLE
|-
|-
| colspan="5" |ON UPDATE NO ACTION ON DELETE NO ACTION
| colspan="5" |ON UPDATE NO ACTION ON DELETE NO ACTION
|}
|}


== Table: episode_of_care ==
== Table: location ==
PRIMARY KEY (organization_id,person_id,id)
PRIMARY KEY (pk_location_id PRIMARY KEY id)
{| class="wikitable sortable mw-collapsible mw-collapsed"
{| class="wikitable sortable mw-collapsible mw-collapsed"
|'''Column name'''
|'''Column name'''
Line 1,034: Line 1,054:
|bigint
|bigint
|NOT NULL
|NOT NULL
|Unique Id of the episode of  care
|Unique Id of the location
|
|
|-
|-
|organization_id
|name
|bigint
|varchar(255)
|NOT NULL
|DEFAULT NULL
|Owning organisation (i.e. publisher)
|The name of a location set by  the publisher. E.g. ward, clinic, domiciliary
|organization.id
|
|-
|-
|patient_id
|type_code,
|bigint
|varchar(50)
|NOT NULL
|The organisations record for  this person’s registration. Patients may have multiple records across  clinical systems and may have registered at an organisation multiple times
|patient.id
|-
|person_id
|bigint
|NOT NULL
|Unique individual across all organisations
|person.id
|-
|registration_type_concept_id
|int
|DEFAULT NULL
|DEFAULT NULL
|Reference to the registration  type of the patient
|The type of location
|registration.type.id
|
|-
|-
|registration_status_concept_id
|type_desc
|int
|varchar(255)
|DEFAULT NULL
|DEFAULT NULL
|Reference to the registration status of the patient
|Textual description of the type of location eg GP Practice
|
|
|-
|-
|date_registered date
|postcode
|date
|varchar10)
|DEFAULT NULL
|DEFAULT NULL
|The date the registration was  started  for this episode of care
|The postcode of the location
|
|
|-
|-
|date_registered_end date
|managing_organization_id
|date
|bigint
|DEFAULT NULL
|DEFAULT NULL
|The date the registration was ended  for this episode of care
|Reference to the managing organisation of the location
|
|
|-
|-
|usual_gp_practitioner_id
| colspan="5" |CONSTRAINT pk_location_id PRIMARY KEY (id)
|bigint
|DEFAULT NULL
|Reference to the usual GP for  this episode of care
|Practitioner.id
|-
|-
| colspan="5" |CONSTRAINT pk_episode_of_care_id PRIMARY KEY (`organization_id`,`person_id`,`id`),
| colspan="5" |CONSTRAINT fk_location_organisation_id FOREIGN KEY (managing_organization_id)
|-
|-
| colspan="5" |CONSTRAINT fk_episode_of_care_patient_id_organisation_id FOREIGN KEY (patient_id, organization_id)
| colspan="5" |REFERENCES organization (id)
|-
|-
| colspan="5" |REFERENCES patient (id, organization_id) MATCH SIMPLE
| colspan="5" |MATCH SIMPLE
|-
| colspan="5" |ON UPDATE NO ACTION ON DELETE NO ACTION,
|-
| colspan="5" |CONSTRAINT fk_episode_of_care_practitioner_id FOREIGN KEY (usual_gp_practitioner_id)
|-
| colspan="5" |REFERENCES practitioner (id) MATCH SIMPLE
|-
|-
| colspan="5" |ON UPDATE NO ACTION ON DELETE NO ACTION
| colspan="5" |ON UPDATE NO ACTION ON DELETE NO ACTION
|}
|}


== Table: ethnicity_lookup ==
== Table: medication_order ==
PRIMARY KEY(ethnic_code)
PRIMARY KEY (organization_id,person_id,id)
{| class="wikitable sortable mw-collapsible mw-collapsed"
{| class="wikitable sortable mw-collapsible mw-collapsed"
|'''Column name'''
|'''Column name'''
Line 1,109: Line 1,107:
|'''References'''
|'''References'''
|-
|-
|ethnic_code
|id
|char(1)
|bigint
|NOT NULL
|NOT NULL
|Ethnic code
|Unique Id of the medication  order
|
|
|-
|-
|ethnic_name
|organization_id
|varchar(100)
|bigint
|DEFAULT NULL
|NOT NULL
|Corresponding ethnicity name
|Owning organisation (i.e. publisher)
|
|organization.id
|-
|-
| colspan="5" |CONSTRAINT PRIMARY KEY (ethnic_code)
|patient_id
|}
|bigint
 
|NOT NULL
== Table: event_log ==
|The organisations record for  this person’s registration. Patients may have multiple records across  clinical systems and may have registered at an organisation multiple times
{| class="wikitable sortable mw-collapsible mw-collapsed"
|patient.id
|'''Column name'''
|'''Data type'''
|'''Constraint'''
|'''Comments'''
|'''References'''
|-
|-
|dt_change
|person_id
|datetime(3)
|bigint
|NOT NULL
|NOT NULL
|date time the change was made to this DB
|Unique individual across all  organisations
|
|person.id
|-
|-
|change_type
|encounter_id
|tinyint
|bigint
|NOT NULL
|DEFAULT NULL
|type of transaction 0=insert, 1=update, 2=delete
|Reference to the encounter the  medication order was issued in
|
|encounter.id
|-
|-
|table_id
|practitioner_id
|tinyint
|bigint
|NOT NULL
|DEFAULT NULL
|identifier of the table changed
|The clinician the activity is  recorded against
|
|practitioner.id
|-
|-
|record_id
|clinical_effective_date
|bigint
|date
|NOT NULL
|DEFAULT NULL
|id of the record changed
|The date the medication order  was issued
|
|
|}
== Table: flag ==
PRIMARY KEY (organization_id,person_id,id)
{| class="wikitable sortable mw-collapsible mw-collapsed"
|'''Column name'''
|'''Data type'''
|'''Constraint'''
|'''Comments'''
|'''References'''
|-
|-
|id
|date_precision_concept_id
|bigint(20)
|int
|NOT NULL
|DEFAULT NULL
|Unique Id of the flag
|Identifies the precision of the clinical effectiveness date to either year (1) month (2) day (5) minute (12)  second (13) millisecond (14)
|
|
|-
|-
|organization_id
|dose
|bigint(20)
|varchar(1000)
|NOT NULL
|DEFAULT NULL
|Owning organisation (i.e.  publisher)
|Textual description of the dose
|
|
|-
|-
|patient_id
|quantity_value
|bigint(20)
|real
|NOT NULL
|The organisations record for  this person’s registration. Patients may have multiple records across  clinical systems and may have registered at an organisation multiple times
|patient.id
|-
|person_id
|bigint(20)
|NOT NULL
|Unique individual across all organisations
|person.id
|-
|effective_date
|date
|DEFAULT NULL
|DEFAULT NULL
|The date the flag was entered  onto the patients record
|The value of the medication  that was prescribed eg 50
|
|
|-
|-
|date_precision_concept_id
|quantity_unit
|smallint(6)
|varchar(255)
|DEFAULT NULL
|DEFAULT NULL
|Identifies the precision of the  clinical effectiveness date to either year (1) month (2) day (5) minute (12)  second (13) millisecond (14)
|The unit of the medication that was prescribed eg tablets
|
|
|-
|-
|is_active
|duration_days
|tinyint(1)
|int
|NOT NULL
|DEFAULT NULL
|Whether the flag is active or not
|How many days the medication is  prescribed for
|
|
|-
|-
|flag_text
|estimated_cost
|text
|real
|
|DEFAULT NULL
|This is a warning set by the  publisher regarding he patient
|The estimated cost of the  medication
|
|
|-
|-
| colspan="5" |CONSTRAINT pk_flag_id PRIMARY KEY (`organization_id`,`person_id`,`id`),
|medication_statement_id
|-
| colspan="5" |CONSTRAINT fk_flag_patient_id_organization_id FOREIGN KEY (patient_id, organization_id)
|-
| colspan="5" |REFERENCES patient (id, organization_id) MATCH SIMPLE
|-
| colspan="5" |ON UPDATE NO ACTION ON DELETE NO ACTION
|}
 
== Table: location ==
PRIMARY KEY (pk_location_id PRIMARY KEY id)
{| class="wikitable sortable mw-collapsible mw-collapsed"
|'''Column name'''
|'''Data type'''
|'''Constraint'''
|'''Comments'''
|'''References'''
|-
|id
|bigint
|bigint
|NOT NULL
|DEFAULT NULL
|Unique Id of the location
|Reference to the medication  statement.  A medication statement can  have many medication orders
|
|medication.statement.id
|-
|-
|name
|core_concept_id
|varchar(255)
|int
|DEFAULT NULL
|DEFAULT NULL
|The name of a location set by  the publisher. E.g. ward, clinic, domiciliary
|Reference to the clinical  coding of the medication
|
|
|-
|-
|type_code,
|non_core_concept_id
|varchar(50)
|int
|DEFAULT NULL
|DEFAULT NULL
|The type of location
|Reference to the clinical  coding of the medication
|
|
|-
|-
|type_desc
|bnf_reference
|varchar(255)
|varchar(6)
|DEFAULT NULL
|DEFAULT NULL
|Textual description of the type of location eg GP Practice
|A reference to the drug in the  BNF dictionary
|
|
|-
|-
|postcode
|age_at_event
|varchar10)
|decimal(5,2)
|DEFAULT NULL
|DEFAULT NULL
|The postcode of the location
|The age the patient was at the  time of this event
|
|
|-
|-
|managing_organization_id
|issue_method
|bigint
|text
|DEFAULT NULL
|DEFAULT NULL
|Reference to the managing organisation of the location
|The issue method of the  medication eg hand written
|
|
|-
|-
| colspan="5" |CONSTRAINT pk_location_id PRIMARY KEY (id)
| colspan="5" |CONSTRAINT pk_medication_order_id PRIMARY KEY (`organization_id`,`person_id`,`id`),
|-
| colspan="5" |CONSTRAINT fk_medication_order_encounter_id FOREIGN KEY (encounter_id)
|-
| colspan="5" |REFERENCES encounter (id) MATCH SIMPLE
|-
|-
| colspan="5" |CONSTRAINT fk_location_organisation_id FOREIGN KEY (managing_organization_id)
| colspan="5" |ON UPDATE NO ACTION ON DELETE NO ACTION,
|-
|-
| colspan="5" |REFERENCES organization (id)
| colspan="5" |CONSTRAINT fk_medication_order_patient_id_organization_id FOREIGN KEY (patient_id, organization_id)
|-
|-
| colspan="5" |MATCH SIMPLE
| colspan="5" |REFERENCES patient (id, organization_id) MATCH SIMPLE
|-
|-
| colspan="5" |ON UPDATE NO ACTION ON DELETE NO ACTION
| colspan="5" |ON UPDATE NO ACTION ON DELETE NO ACTION,
|}
|-
 
| colspan="5" |CONSTRAINT fk_medication_order_practitioner_id FOREIGN KEY (practitioner_id)
== Table: medication_order ==
|-
| colspan="5" |REFERENCES practitioner (id) MATCH SIMPLE
|-
| colspan="5" |ON UPDATE NO ACTION ON DELETE NO ACTION
|}
 
== Table: medication_statement ==
PRIMARY KEY (organization_id,person_id,id)
PRIMARY KEY (organization_id,person_id,id)
{| class="wikitable sortable mw-collapsible mw-collapsed"
{| class="wikitable sortable mw-collapsible mw-collapsed"
Line 1,289: Line 1,252:
|-
|-
|id
|id
|bigint
|bigint(20)
|NOT NULL
|NOT NULL
|Unique Id of the medication order
|Unique Id of the medication
|
|
|-
|-
|organization_id
|organization_id
|bigint
|bigint(20)
|NOT NULL
|NOT NULL
|Owning organisation (i.e. publisher)
|Owning organisation (i.e. publisher)
|organization.id
|organization.id
|-
|-
|patient_id
|patient_id
|bigint
|bigint(20)
|NOT NULL
|NOT NULL
|The organisations record for  this person’s registration. Patients may have multiple records across  clinical systems and may have registered at an organisation multiple times
|The organisations record for  this person’s registration. Patients may have multiple records across  clinical systems and may have registered at an organisation multiple times
Line 1,307: Line 1,270:
|-
|-
|person_id
|person_id
|bigint
|bigint(20)
|NOT NULL
|NOT NULL
|Unique individual across all organisations
|Unique individual across all organisations
|person.id
|person.id
|-
|-
|encounter_id
|encounter_id
|bigint
|bigint(20)
|DEFAULT NULL
|DEFAULT NULL
|Reference to the encounter the medication order was issued in
|Reference to the encounter this medication was recorded in
|encounter.id
|encounter.id
|-
|-
|practitioner_id
|practitioner_id
|bigint
|bigint(20)
|DEFAULT NULL
|DEFAULT NULL
|The clinician the activity is  recorded against
|The clinician the activity is  recorded against
Line 1,327: Line 1,290:
|date
|date
|DEFAULT NULL
|DEFAULT NULL
|The date the medication order was issued
|The date the medication was clinical relevant
|
|
|-
|-
Line 1,333: Line 1,296:
|int
|int
|DEFAULT NULL
|DEFAULT NULL
|Identifies the precision of the  clinical effectiveness date to either year (1) month (2) day (5) minute (12)  second (13) millisecond (14)
|Identifies the precision of the  clinical effectiveness date to either year (1) month (2) day (5) minute (12) second (13) millisecond (14)
|
|
|-
|-
|dose
|is_active
|boolean
|DEFAULT NULL
|Whether the medication is  active or not
|
|-
|cancellation_date
|date
|DEFAULT NULL
|The date the medication was  cancelled
|
|-
|dose
|varchar(1000)
|varchar(1000)
|DEFAULT NULL
|DEFAULT NULL
|Textual description of the dose
|Texual description of the dose of the medication
|
|
|-
|-
Line 1,354: Line 1,329:
|
|
|-
|-
|duration_days
|authorisation_type_concept_id
|int
|int
|DEFAULT NULL
|DEFAULT NULL
|How many days the medication is prescribed for
|Reference to the authorisation type
|
|
|-
|estimated_cost
|real
|DEFAULT NULL
|The estimated cost of the  medication
|
|-
|medication_statement_id
|bigint
|DEFAULT NULL
|Reference to the medication  statement.  A medication statement can  have many medication orders
|medication.statement.id
|-
|-
|core_concept_id
|core_concept_id
Line 1,396: Line 1,359:
|
|
|-
|-
|issue_method
|Issue_method
|text
|text
|DEFAULT NULL
|DEFAULT NULL
Line 1,402: Line 1,365:
|
|
|-
|-
| colspan="5" |CONSTRAINT pk_medication_order_id PRIMARY KEY (`organization_id`,`person_id`,`id`),
| colspan="5" |CONSTRAINT pk_medication_statement_id PRIMARY KEY (`organization_id`,`person_id`,`id`),
|-
|-
| colspan="5" |CONSTRAINT fk_medication_order_encounter_id FOREIGN KEY (encounter_id)
| colspan="5" |CONSTRAINT fk_medication_statement_encounter_id FOREIGN KEY (encounter_id)
|-
|-
| colspan="5" |REFERENCES encounter (id) MATCH SIMPLE
| colspan="5" |REFERENCES encounter (id) MATCH SIMPLE
Line 1,410: Line 1,373:
| colspan="5" |ON UPDATE NO ACTION ON DELETE NO ACTION,
| colspan="5" |ON UPDATE NO ACTION ON DELETE NO ACTION,
|-
|-
| colspan="5" |CONSTRAINT fk_medication_order_patient_id_organization_id FOREIGN KEY (patient_id, organization_id)
| colspan="5" |CONSTRAINT fk_medication_statement_patient_id_organization_id FOREIGN KEY (patient_id, organization_id)
|-
|-
| colspan="5" |REFERENCES patient (id, organization_id) MATCH SIMPLE
| colspan="5" |REFERENCES patient (id, organization_id) MATCH SIMPLE
Line 1,416: Line 1,379:
| colspan="5" |ON UPDATE NO ACTION ON DELETE NO ACTION,
| colspan="5" |ON UPDATE NO ACTION ON DELETE NO ACTION,
|-
|-
| colspan="5" |CONSTRAINT fk_medication_order_practitioner_id FOREIGN KEY (practitioner_id)
| colspan="5" |CONSTRAINT fk_medication_statement_practitioner_id FOREIGN KEY (practitioner_id)
|-
|-
| colspan="5" |REFERENCES practitioner (id) MATCH SIMPLE
| colspan="5" |REFERENCES practitioner (id) MATCH SIMPLE
Line 1,423: Line 1,386:
|}
|}


== Table: medication_statement ==
== Table: observation ==
PRIMARY KEY (organization_id,person_id,id)
PRIMARY KEY (organization_id,person_id,id)
{| class="wikitable sortable mw-collapsible mw-collapsed"
{| class="wikitable sortable mw-collapsible mw-collapsed"
Line 1,435: Line 1,398:
|bigint(20)
|bigint(20)
|NOT NULL
|NOT NULL
|Unique Id of the medication
|Unique Id of the observation
|
|
|-
|-
Line 1,453: Line 1,416:
|bigint(20)
|bigint(20)
|NOT NULL
|NOT NULL
|Unique individual across all organisations
|Unique individual across all organisations
|person.id
|person.id
|-
|-
Line 1,459: Line 1,422:
|bigint(20)
|bigint(20)
|DEFAULT NULL
|DEFAULT NULL
|Reference to the encounter this medication was recorded in
|Reference to the encounter the observation was recorded at
|encounter.id
|encounter.id
|-
|-
Line 1,471: Line 1,434:
|date
|date
|DEFAULT NULL
|DEFAULT NULL
|The date the medication was  clinical relevant
|The date the observation was  identified by a clinician
|
|
|-
|-
|date_precision_concept_id
|date_precision_concept_id
|smallint(6)
|int
|DEFAULT NULL
|DEFAULT NULL
|Identifies the precision of the  clinical effectiveness date to either year (1) month (2) day (5) minute (12) second (13) millisecond (14)
|Identifies the precision of the  clinical effectiveness date to either year (1) month (2) day (5) minute (12) second (13) millisecond (14)
|
|
|-
|-
|is_active
|result_value
|tinyint(4)
|rea
|DEFAULT NULL
|DEFAULT NULL
|Whether the medication is active or not
|The value of the result of the  observation
|
|
|-
|-
|cancellation_date
|result_value_units
|date
|varchar(50)
|DEFAULT NULL
|DEFAULT NULL
|The date the medication was cancelled
|The units of the result of the  observation
|
|
|-
|-
|dose
|result_date
|varchar(1000)
|date
|DEFAULT NULL
|DEFAULT NULL
|Texual description of the dose  of the medication
|The date of the result
|
|
|-
|-
|quantity_value
|result_text
|double
|text
|
|Any text associated with the  result
|
|-
|result_concept_id
|int
|DEFAULT NULL
|DEFAULT NULL
|The value of the medication that was prescribed eg 50
|Reference to the clinical  coding of the result
|
|-
|is_problem
|boolean
|NOT NULL
|Whether the observation is  marked as a problem
|
|-
|is_review
|boolean
|NOT NULL
|Whether the observation is a review of an existing problem
|
|
|-
|-
|quantity_unit
|problem_end_date
|varchar(255)
|date
|DEFAULT NULL
|DEFAULT NULL
|The unit of the medication that  was prescribed eg tablets
|The end date of the problem
|
|
|-
|-
|authorisation_type_concept_id
|parent_observation_id
|int
|bigint(20)
|DEFAULT NULL
|DEFAULT NULL
|Reference to the authorisation type
|Reference to the parent observation in a complex observation eg systolic and diastolic blood  pressures will have a parent observation of Blood pressure
|
|
|-
|-
Line 1,519: Line 1,500:
|int
|int
|DEFAULT NULL
|DEFAULT NULL
|Reference to the clinical  coding of the medication
|Reference to the clinical  coding of the observation
|
|
|-
|-
Line 1,525: Line 1,506:
|int
|int
|DEFAULT NULL
|DEFAULT NULL
|Reference to the clinical  coding of the medication
|Reference to the clinical  coding of the observation
|
|-
|age_at_event
|decimal (5,2)
|DEFAULT NULL
|The age of the patient at the  time of the observation
|
|
|-
|-
|bnf_reference
|episodicity_concept_id
|varchar(6)
|int
|DEFAULT NULL
|DEFAULT NULL
|A reference to the drug in the BNF dictionary
|Reference to the episodicity of  the problem eg First, review, flare
|
|
|-
|-
|age_at_event
|is_primary
|decimal(5,2)
|boolean
|DEFAULT NULL
|DEFAULT NULL
|The age the patient was at the  time of this event
|Whether the observation is a primary observation
|
|
|-
|-
|Issue_method
|date_recorded
|text
|datetime
|DEFAULT NULL
|DEFAULT NULL
|The issue method of the  medication eg hand written
|The date the observation was recorded in the system
|
|
|-
|-
| colspan="5" |CONSTRAINT pk_medication_statement_id PRIMARY KEY (`organization_id`,`person_id`,`id`),
| colspan="5" |CONSTRAINT pk_observation_id PRIMARY KEY (`organization_id`,`person_id`,`id`),
|-
|-
| colspan="5" |CONSTRAINT fk_medication_statement_encounter_id FOREIGN KEY (encounter_id)
| colspan="5" |CONSTRAINT fk_observation_encounter_id FOREIGN KEY (encounter_id)
|-
|-
| colspan="5" |REFERENCES encounter (id) MATCH SIMPLE
| colspan="5" |REFERENCES encounter (id) MATCH SIMPLE
Line 1,554: Line 1,541:
| colspan="5" |ON UPDATE NO ACTION ON DELETE NO ACTION,
| colspan="5" |ON UPDATE NO ACTION ON DELETE NO ACTION,
|-
|-
| colspan="5" |CONSTRAINT fk_medication_statement_patient_id_organization_id FOREIGN KEY (patient_id, organization_id)
| colspan="5" |CONSTRAINT fk_observation_patient_id_organization_id FOREIGN KEY (patient_id, organization_id)
|-
|-
| colspan="5" |REFERENCES patient (id, organization_id) MATCH SIMPLE
| colspan="5" |REFERENCES patient (id, organization_id) MATCH SIMPLE
Line 1,560: Line 1,547:
| colspan="5" |ON UPDATE NO ACTION ON DELETE NO ACTION,
| colspan="5" |ON UPDATE NO ACTION ON DELETE NO ACTION,
|-
|-
| colspan="5" |CONSTRAINT fk_medication_statement_practitioner_id FOREIGN KEY (practitioner_id)
| colspan="5" |CONSTRAINT fk_observation_practitioner_id FOREIGN KEY (practitioner_id)
|-
|-
| colspan="5" |REFERENCES practitioner (id) MATCH SIMPLE
| colspan="5" |REFERENCES practitioner (id) MATCH SIMPLE
Line 1,567: Line 1,554:
|}
|}


== Table: observation ==
== Table: observation_additional ==
PRIMARY KEY (organization_id,person_id,id)
PRIMARY KEY (id, property_id)
{| class="wikitable sortable mw-collapsible mw-collapsed"
{| class="wikitable sortable mw-collapsible mw-collapsed"
|'''Column name'''
|'''Column name'''
Line 1,577: Line 1,564:
|-
|-
|id
|id
|bigint(20)
|bigint
|NOT NULL
|NOT NULL
|Unique Id of the observation
|
|
|
|-
|-
|organization_id
|property_id
|bigint(20)
|int
|NOT NULL
|NOT NULL
|Owning organisation (i.e. publisher)
|IM reference (i.e. significance)
|organization.id
|
|-
|-
|patient_id
|value_id
|bigint(20)
|int
|NOT NULL
|NULL
|The organisations record for  this person’s registration. Patients may have multiple records across  clinical systems and may have registered at an organisation multiple times
|IM reference (i.e. minor, significant)
|patient.id
|-
|person_id
|bigint(20)
|NOT NULL
|Unique individual across all  organisations
|person.id
|person.id
|-
|-
|encounter_id
|json_value
|bigint(20)
|json
|DEFAULT NULL
|NULL
|Reference to the encounter the  observation was recorded at
|Where there is no mapped value_id, just raw JSON
|encounter.id
|
|-
|-
|practitioner_id
|text_value
|bigint(20)
|varchar(255)
|DEFAULT NULL
|NULL
|The clinician the activity is recorded against
|Where there is no mapped value_id or raw JSON, just a basic text value
|practitioner.id
|
|-
| colspan="5" |CONSTRAINT pk_observation_additional_id PRIMARY KEY (id, property_id)
|}
 
== Table: organization ==
PRIMARY KEY (pk_organization_id PRIMARY KEY (id))
{| class="wikitable sortable mw-collapsible mw-collapsed"
|'''Column name'''
|'''Data type'''
|'''Constraint'''
|'''Comments'''
|'''References'''
|-
|-
|clinical_effective_date
|id
|date
|bigint
|DEFAULT NULL
|NOT NULL
|The date the observation was  identified by a clinician
|Unique Id of the organisation
|
|
|-
|-
|date_precision_concept_id
|ods_code
|smallint(6)
|varchar(50)
|DEFAULT NULL
|DEFAULT NULL
|Identifies the precision of the clinical effectiveness date to either year (1) month (2) day (5) minute (12)  second (13) millisecond (14)
|ODS Code of the organisation
|
|
|-
|-
|result_value
|Name
|double
|varchar(255)
|DEFAULT NULL
|DEFAULT NULL
|The value of the result of the  observation
|Name of the organisation
|
|
|-
|-
|result_value_units
|type_code
|varchar(50)
|varchar(50)
|DEFAULT NULL
|DEFAULT NULL
|The units of the result of the  observation
|The type of organisation
|
|
|-
|-
|result_date
|type_desc
|date
|varchar(255)
|DEFAULT NULL
|DEFAULT NULL
|The date of the result
|Textual description of the type  of organisation eg GP Practice
|
|
|-
|-
|result_text
|Postcode
|text
|varchar(10)
|
|DEFAULT NULL
|Any text associated with the  result
|The postcode of the  organisation
|
|
|-
|-
|result_concept_id
|parent_organization_id
|bigint(20)
|bigint
|DEFAULT NULL
|DEFAULT NULL
|Reference to the clinical coding of the result
|The id of the parent organisation
|
|
|-
|-
|is_problem
| colspan="5" |PRIMARY KEY pk_organization_id PRIMARY KEY (id)
|tinyint(1)
|}
|NOT NULL
 
|Whether the observation is  marked as a problem
== Table: organization_metadata ==
|
PRIMARY KEY (id, publishing_software)
{| class="wikitable sortable mw-collapsible mw-collapsed"
|'''Column name'''
|'''Data type'''
|'''Constraint'''
|'''Comments'''
|'''References'''
|-
|-
|is_review
|id
|tinyint(1)
|bigint
|NOT NULL
|NOT NULL
|Whether the observation is a  review of an existing problem
|corresponds to same ID in the organizaton table
|
|
|-
|-
|problem_end_date
|publishing_software
|date
|varchar(50)
|DEFAULT NULL
|DEFAULT NULL
|The end date of the problem
|software name of publishing system
|
|
|-
|-
|parent_observation_id
|last_data_to_dds
|bigint(20)
|datetime
|DEFAULT NULL
|DEFAULT NULL
|Reference to the parent  observation in a complex observation eg systolic and diastolic blood  pressures will have a parent observation of Blood pressure
|date time data was last sent to DDS
|
|
|-
|-
|core_concept_id
|last_data_cutoff
|int
|datetime
|DEFAULT NULL
|DEFAULT NULL
|Reference to the clinical  coding of the observation
|cutoff date time of the last extract from the publishing system
|
|
|-
|-
|non_core_concept_id
| colspan="5" |CONSTRAINT pk_organization_metadata PRIMARY KEY (id, publishing_software)
|int
|}
|DEFAULT NULL
 
|Reference to the clinical  coding of the observation
== Table: patient ==
|
PRIMARY KEY (organization_id,person_id,id)
|-
{| class="wikitable sortable mw-collapsible mw-collapsed"
|age_at_event
|'''Column name'''
|decimal (5,2)
|'''Data type'''
|DEFAULT NULL
|'''Constraint'''
|The age of the patient at the  time of the observation
|'''Comments'''
|'''References'''
|-
|id
|bigint
|NOT NULL
|Unique Id of the patient
|
|
|-
|-
|episodicity_concept_id
|organization_id
|int
|bigint
|DEFAULT NULL
|NOT NULL
|Reference to the episodicity of the problem eg First, review, flare
|Owning organisation (i.e. publisher)
|organization.id
|-
|person_id
|bigint
|NOT NULL
|Unique individual across all organisations
|person.id
|-
|title
|varchar(255)
|
|
|-
|The title of the patient
|is_primary
|boolean
|DEFAULT NULL
|Whether the observation is a  primary observation
|
|
|-
|-
|date_recorded
|first_names
|datetime
|varchar(255)
|DEFAULT NULL
|
|The date the observation was  recorded in the system
|The first names of the patient
|
|
|-
|-
| colspan="5" |CONSTRAINT pk_observation_id PRIMARY KEY (`organization_id`,`person_id`,`id`),
|last_name
|varchar(255)
|
|The last name of the patient
|
|-
|-
| colspan="5" |CONSTRAINT fk_observation_encounter_id FOREIGN KEY (encounter_id)
|gender_concept_id
|int
|
|Reference to the gender of the  patient
|patient.gender.id
|-
|-
| colspan="5" |REFERENCES encounter (id) MATCH SIMPLE
|nhs_number
|varchar(255)
|
|The NHS number of the patient
|
|-
|-
| colspan="5" |ON UPDATE NO ACTION ON DELETE NO ACTION,
|date_of_birth
|date
|
|The date of birth of the patient
|
|-
|-
| colspan="5" |CONSTRAINT fk_observation_patient_id_organization_id FOREIGN KEY (patient_id, organization_id)
|date_of_death
|-
|date
| colspan="5" |REFERENCES patient (id, organization_id) MATCH SIMPLE
|
|The date of death of the patient
|
|-
|-
| colspan="5" |ON UPDATE NO ACTION ON DELETE NO ACTION,
|current_address_id
|bigint
|
|Reference to the current  address of the  patient
|
|-
|-
| colspan="5" |CONSTRAINT fk_observation_practitioner_id FOREIGN KEY (practitioner_id)
|ethnic_code_concept_id
|int
|
|Reference to the ethnicity of the patient
|
|-
|-
| colspan="5" |REFERENCES practitioner (id) MATCH SIMPLE
|registered_practice_organization_id
|-
| colspan="5" |ON UPDATE NO ACTION ON DELETE NO ACTION
|}
 
== Table: organization ==
PRIMARY KEY (pk_organization_id PRIMARY KEY (id))
{| class="wikitable sortable mw-collapsible mw-collapsed"
|'''Column name'''
|'''Data type'''
|'''Constraint'''
|'''Comments'''
|'''References'''
|-
|id
|bigint
|bigint
|NOT NULL
|
|Unique Id of the organisation
|Reference to the organisation the patient is registered at
|
|
|-
|-
|ods_code
|birth_year
|varchar(50)
|smallint
|DEFAULT NULL
|
|ODS Code of the organisation
|
|
|
|-
|-
|Name
|birth_month
|varchar(255)
|tinyint
|DEFAULT NULL
|
|Name of the organisation
|
|
|-
|type_code
|varchar(50)
|DEFAULT NULL
|The type of organisation
|
|
|-
|-
|type_desc
|birth_week
|varchar(255)
|tinyint
|DEFAULT NULL
|Textual description of the type  of organisation eg GP Practice
|
|
|-
|Postcode
|varchar(10)
|DEFAULT NULL
|The postcode of the  organisation
|
|
|-
|parent_organization_id
|bigint
|DEFAULT NULL
|The id of the parent  organisation
|
|
|-
|-
| colspan="5" |PRIMARY KEY pk_organization_id PRIMARY KEY (id)
| colspan="5" |CONSTRAINT pk_patient_id_organization_id PRIMARY KEY (`organization_id`,`person_id`,`id`),
|-
| colspan="5" |CONSTRAINT fk_patient_organization_id FOREIGN KEY (organization_id)
|-
| colspan="5" |REFERENCES organization (id) MATCH SIMPLE
|}
|}


== Table: patient ==
== Table: patient_additional ==
PRIMARY KEY (organization_id,person_id,id)
PRIMARY KEY (id, property_id)
{| class="wikitable sortable mw-collapsible mw-collapsed"
{| class="wikitable sortable mw-collapsible mw-collapsed"
|'''Column name'''
|'''Column name'''
Line 1,804: Line 1,813:
|
|
|-
|-
|organization_id
|property_id
|bigint
|int
|NOT NULL
|NOT NULL
|Owning organisation (i.e. publisher)
|IM reference (e.g. cause of death)
|organization.id
|
|-
|-
|person_id
|value_id
|bigint
|int
|NOT NULL
|NULL
|Unique individual across all  organisations
|IM reference (e.g. COVID)
|person.id
|person.id
|-
|-
|title
|json_value
|varchar(255)
|json
|
|NULL
|The title of the patient
|Where there is no mapped value_id, just raw JSON
|
|
|-
|-
|first_names
|text_value
|varchar(255)
|varchar(255)
|
|NULL
|The first names of the patient
|Where there is no mapped value_id or raw JSON, just a basic text value
|
|
|-
|-
|last_name
| colspan="5" |CONSTRAINT pk_patient_additional_id PRIMARY KEY (id, property_id)
|varchar(255)
|}
|
 
|The last name of the patient
== Table: patient_address ==
|
PRIMARY KEY (organization_id,id,patient_id,person_id)
{| class="wikitable sortable mw-collapsible mw-collapsed"
|'''Column name'''
|'''Data type'''
|'''Constraint'''
|'''Comments'''
|'''References'''
|-
|-
|gender_concept_id
|Id
|int
|bigint
|NOT NULL
|Unique Id of the address
|
|
|Reference to the gender of the  patient
|patient.gender.id
|-
|-
|nhs_number
|organization_id
|varchar(255)
|bigint
|
|NOT NULL
|The NHS number of the patient
|Owning organisation (i.e.  publisher)
|
|organisation.id
|-
|patient_id
|bigint
|NOT NULL
|The organisations record for  this person’s registration. Patients may have multiple records across  clinical systems and may have registered at an organisation multiple times
|patient.id
|-
|-
|date_of_birth
|person_id
|date
|bigint
|
|DEFAULT NULL
|The date of birth of the patient
|Unique individual across all  organisations
|
|person.id
|-
|-
|date_of_death
|address_line_1
|date
|varchar(255)
|
|DEFAULT NULL
|The date of death of the patient
|The first line of the address
|
|
|-
|-
|current_address_id
|address_line_2
|bigint
|varchar(255)
|
|DEFAULT NULL
|Reference to the current  address of the  patient
|The second line of the address
|
|
|-
|-
|ethnic_code_concept_id
|address_line_3
|int
|varchar(255)
|DEFAULT NULL
|The third line of the address
|
|
|Reference to the ethnicity of the patient
|-
|address_line_4
|varchar(255)
|DEFAULT NULL
|The fourth line of the address
|
|
|-
|-
|registered_practice_organization_id
|city
|bigint
|varchar(255)
|DEFAULT NULL
|The city
|
|
|Reference to the organisation  the patient is registered at
|-
|postcode
|varchar(255)
|DEFAULT NULL
|The postcode
|
|
|-
|-
|birth_year
|use_concept_id
|smallint
|int
|
|NOT NULL
|
|use of address (e.g. home,  temporary)
|
|
|-
|-
|birth_month
|start_date
|tinyint
|date
|NOT NULL
|The start date of this address  being relevant
|
|
|-
|end_date
|date
|DEFAULT NULL
|The end date of this address  being relevant
|
|
|-
|lsoa_2001_code
|varchar(9)
|DEFAULT NULL
|A reference to the LSOA_2001  code
|
|
|-
|-
|birth_week
|lsoa_2011_code
|tinyint
|varchar(9)
|DEFAULT NULL
|A reference to the LSOA_2011  code
|
|
|-
|msoa_2001_code
|varchar(9)
|DEFAULT NULL
|A reference to the MSOA_2001  code
|
|
|-
|msoa_2011_code
|varchar(9)
|DEFAULT NULL
|A reference to the MSOA_2011  code
|
|
|-
|-
| colspan="5" |CONSTRAINT pk_patient_id_organization_id PRIMARY KEY (`organization_id`,`person_id`,`id`),
|ward_code
|varchar(9)
|DEFAULT NULL
|The ward the address belongs to
|
|-
|-
| colspan="5" |CONSTRAINT fk_patient_organization_id FOREIGN KEY (organization_id)
|local_authority_code
|-
|varchar(9)
| colspan="5" |REFERENCES organization (id) MATCH SIMPLE
|DEFAULT NULL
|The local authority the address  belongs to
|
|-
| colspan="5" |CONSTRAINT pk_organization_id_id_patient_id_person_id
|-
| colspan="5" |PRIMARY KEY (`organization_id`,`id`,`patient_id`,`person_id`)
|-
| colspan="5" |CONSTRAINT fk_patient_address_patient_id_organization_id
|-
| colspan="5" |FOREIGN KEY (patient_id, organization_id)
|-
| colspan="5" |REFERENCES patient (id, organization_id)
|-
| colspan="5" |COMMENT 'stores address details for patients'
|}
|}


== Table: patient_additional ==
== Table: patient_address_match ==
PRIMARY KEY (id, property_id)
PRIMARY KEY(id, uprn)
{| class="wikitable sortable mw-collapsible mw-collapsed"
{| class="wikitable sortable mw-collapsible mw-collapsed"
|'''Column name'''
|'''Column name'''
Line 1,910: Line 1,985:
|'''References'''
|'''References'''
|-
|-
|id
|Id
|bigint
|bigint(50)
|NOT NULL
|NOT NULL
|Unique Id of the patient
|Reference to the patient_address table
|
|
|-
|-
|property_id
|patient_address_id
|int
|bigint(20)
|NOT NULL
|NOT NULL
|IM reference (e.g. cause of death)
|
|
|
|-
|-
|value_id
|Uprn
|int
|varchar(255)
|NULL
|NOT NULL
|IM reference (e.g. COVID)
|The Unique Propery Reference  Number of the address
|person.id
|-
|json_value
|json
|NULL
|Where there is no mapped value_id, just raw JSON
|
|
|-
|-
|text_value
|uprn_ralf00
|varchar(255)
|varchar(255)
|NULL
|
|Where there is no mapped value_id or raw JSON, just a basic text value
|
|
|
|-
|-
| colspan="5" |CONSTRAINT pk_patient_additional_id PRIMARY KEY (id, property_id)
|Status
|}
|tinyint(1)
 
|DEFAULT NULL
== Table: patient_address ==
|Whether the UPRN is active
PRIMARY KEY (organization_id,id,patient_id,person_id)
|
{| class="wikitable sortable mw-collapsible mw-collapsed"
|'''Column name'''
|'''Data type'''
|'''Constraint'''
|'''Comments'''
|'''References'''
|-
|-
|Id
|uprn_property_classification
|bigint
|varchar(45)
|NOT NULL
|DEFAULT NULL
|Unique Id of the address
|Building type eg flat, pub,  house etc
|
|
|-
|-
|organization_id
|Latitude
|bigint
|double
|NOT NULL
|Owning organisation (i.e.  publisher)
|organisation.id
|-
|patient_id
|bigint
|NOT NULL
|The organisations record for  this person’s registration. Patients may have multiple records across  clinical systems and may have registered at an organisation multiple times
|patient.id
|-
|person_id
|bigint
|DEFAULT NULL
|DEFAULT NULL
|Unique individual across all  organisations
|The latitude of the UPRN
|person.id
|
|-
|-
|address_line_1
|Longitude
|varchar(255)
|double
|DEFAULT NULL
|DEFAULT NULL
|The first line of the address
|The longitude of the UPRN
|
|
|-
|-
|address_line_2
|uprn_xcoordinate
|varchar(255)
|double
|DEFAULT NULL
|DEFAULT NULL
|The second line of the address
|The x coordinate of the UPRN
|
|
|-
|-
|address_line_3
|uprn_ycoordinate
|varchar(255)
|double
|DEFAULT NULL
|DEFAULT NULL
|The third line of the address
|The y coordinate of the UPRN
|
|
|-
|-
|address_line_4
|qualifier
|varchar(255)
|varchar(50)
|DEFAULT NULL
|DEFAULT NULL
|The fourth line of the address
|How the match is determined eg  equivalent match, near match etc
|
|
|-
|-
|city
|match_rule
|varchar(255)
|varchar(4096)
|DEFAULT NULL
|DEFAULT NULL
|The city
|Which algorithm was used to  match the address to the UPRN
|
|
|-
|-
|postcode
|match_date
|varchar(255)
|datetime
|DEFAULT NULL
|DEFAULT NULL
|The postcode
|The date the match was made
|
|
|-
|-
|use_concept_id
|abp_address_number
|int
|varchar(255)
|NOT NULL
|DEFAULT NULL
|use of address (e.g. home, temporary)
|The number value of the address  in the ABP dictionary
|
|
|-
|-
|start_date
|abp_address_street
|Date
|varchar(255)
|NOT NULL
|DEFAULT NULL
|The start date of this address  being relevant
|The street value of the address  in the ABP dictionary
|
|
|-
|-
|end_date
|abp_address_locality
|Date
|varchar(255)
|DEFAULT NULL
|DEFAULT NULL
|The end date of this address being relevant
|The locality value of the  address in the ABP dictionary
|
|
|-
|-
|lsoa_2001_code
|abp_address_town
|varchar(9)
|varchar(255)
|DEFAULT NULL
|DEFAULT NULL
|A reference to the LSOA_2001 code
|The town value of the address in the ABP dictionary
|
|
|-
|-
|lsoa_2011_code
|abp_address_postcode
|varchar(9)
|varchar(10)
|DEFAULT NULL
|DEFAULT NULL
|A reference to the LSOA_2011 code
|The postcode value of the  address in the ABP dictionary
|
|
|-
|-
|msoa_2001_code
|abp_address_organization
|varchar(9)
|varchar(255)
|DEFAULT NULL
|DEFAULT NULL
|A reference to the MSOA_2001 code
|The organization value of the  address in the ABP dictionary
|
|
|-
|-
|msoa_2011_code
|match_pattern_postcode
|varchar(9)
|varchar(255)
|DEFAULT NULL
|DEFAULT NULL
|A reference to the MSOA_2011 code
|The qualifier used to match the  postcode
|
|
|-
|-
|ward_code
|match_pattern_street
|varchar(9)
|varchar(255)
|DEFAULT NULL
|DEFAULT NULL
|The ward the address belongs to
|The qualifier used to match the street
|
|
|-
|-
|local_authority_code
|match_pattern_number
|varchar(9)
|varchar(255)
|DEFAULT NULL
|DEFAULT NULL
|The local authority the address belongs to
|The qualifier used to match the  number
|
|
|-
|-
| colspan="5" |CONSTRAINT pk_organization_id_id_patient_id_person_id
|match_pattern_building
|varchar(255)
|DEFAULT NULL
|The qualifier used to match the  building
|
|-
|-
| colspan="5" |PRIMARY KEY (`organization_id`,`id`,`patient_id`,`person_id`)
|match_pattern_flat
|varchar(255)
|DEFAULT NULL
|The qualifier used to match the  flat
|
|-
|-
| colspan="5" |CONSTRAINT fk_patient_address_patient_id_organization_id
|algorithm_version
|varchar(255)
|DEFAULT NULL
|What version of the algorithm  was used to make the match
|
|-
|-
| colspan="5" |FOREIGN KEY (patient_id, organization_id)
|epoc
|varchar(255)
|DEFAULT NULL
|The version of the ABP files  the addresses were matched against
|
|-
|-
| colspan="5" |REFERENCES patient (id, organization_id)
| colspan="5" |  CONSTRAINT `patient_address_uprn_patient_address_id_fk` FOREIGN KEY (`patient_address_id`) REFERENCES `patient_address` (`id`)  
|-
| colspan="5" |COMMENT 'stores address details for patients'
|}
|}


== Table: patient_address_match ==
== Table: patient_address_ralf ==
PRIMARY KEY(id, uprn)
PRIMARY KEY (id, patient_address_id, patient_address_match_uprn_ralf00)
{| class="wikitable sortable mw-collapsible mw-collapsed"
{| class="wikitable sortable mw-collapsible mw-collapsed"
|'''Column name'''
|'''Column name'''
Line 2,089: Line 2,154:
|-
|-
|Id
|Id
|bigint(20)
|bigint
|NOT NULL
|NOT NULL
|Reference to the  patient_address table
|
|
|
|-
|-
|Uprn
|organization_id
|varchar(255)
|bigint
|NOT NULL
|NOT NULL
|The Unique Propery Reference  Number of the address
|
|
|
|-
|-
|Status
|patient_id
|smallint(6)
|bigint
|DEFAULT NULL
|NOT NULL
|Whether the UPRN is active
|
|
|
|-
|-
|Classification
|person_id
|varchar(45)
|bigint
|DEFAULT NULL
|NOT NULL
|Building type eg flat, pub,  house etc
|
|
|-
|Latitude
|double
|DEFAULT NULL
|The latitude of the UPRN
|
|
|-
|-
|Longitude
|patient_address_id
|double
|bigint
|DEFAULT NULL
|NOT NULL
|The longitude of the UPRN
|
|
|-
|Xcoordinate
|double
|DEFAULT NULL
|The x coordinate of the UPRN
|
|
|-
|-
|Ycoordinate
|patient_address_match_uprn_ralf00
|double
|varchar(255)
|DEFAULT NULL
|NOT NULL
|The y coordinate of the UPRN
|
|
|
|-
|-
|Qualifier
|salt_name
|varchar(50)
|varchar(50)
|DEFAULT NULL
|NOT NULL
|How the match is determined eg  equivalent match, near match etc
|
|
|
|-
|-
|Algorithm
|ralf
|varchar(255)
|varchar(255)
|DEFAULT NULL
|NOT NULL
|Which algorithm was used to  match the address to the UPRN
|
|
|-
|match_date
|datetime
|DEFAULT NULL
|The date the match was made
|
|
|-
|-
|abp_address_number
| colspan="5" |CONSTRAINT pk_patient_address_ralf PRIMARY KEY (id, patient_address_id, patient_address_match_uprn_ralf00)
|varchar(255)
|DEFAULT NULL
|The number value of the address  in the ABP dictionary
|
|-
|-
|abp_address_street
| colspan="5" |CONSTRAINT fk_patient_address_ralf_organization_id FOREIGN KEY (organization_id) REFERENCES organization (id)
|varchar(255)
|DEFAULT NULL
|The street value of the address  in the ABP dictionary
|
|-
|-
|abp_address_locality
| colspan="5" |CONSTRAINT fk_patient_address_ralf_patient_id FOREIGN KEY (patient_id) REFERENCES patient (id)
|varchar(255)
|DEFAULT NULL
|The locality value of the  address in the ABP dictionary
|
|-
|-
|abp_address_town
| colspan="5" |CONSTRAINT fk_patient_address_ralf_person_id FOREIGN KEY (person_id) REFERENCES person (id)
|varchar(10)
|DEFAULT NULL
|The town value of the address  in the ABP dictionary
|
|-
|-
|abp_address_postcode
| colspan="5" |CONSTRAINT fk_patient_address_ralf_patient_address_id FOREIGN KEY (patient_address_id) REFERENCES patient_address (id)
|varchar(10)
|}
|DEFAULT NULL
 
|The postcode value of the  address in the ABP dictionary
== Table: patient_contact ==
|
PRIMARY KEY (organization_id,id,patient_id,person_id)
{| class="wikitable sortable mw-collapsible mw-collapsed"
|'''Column name'''
|'''Data type'''
|'''Constraint'''
|'''Comments'''
|'''References'''
|-
|-
|abp_address_organization
|id
|varchar(255)
|bigint
|DEFAULT NULL
|NOT NULL
|The organization value of the  address in the ABP dictionary
|Unique Id of the patient contact
|
|
|-
|-
|match_pattern_postcode
|organization_id
|varchar(255)
|bigint
|DEFAULT NULL
|NOT NULL
|The qualifier used to match the  postcode
|Owning organisation (i.e. publisher)
|
|
|-
|-
|match_pattern_street
|patient_id
|varchar(255)
|bigint
|NOT NULL
|The organisations record for  this person’s registration. Patients may have multiple records across  clinical systems and may have registered at an organisation multiple times
|patient.id
|-
|person_id
|bigint
|DEFAULT NULL
|DEFAULT NULL
|The qualifier used to match the street
|Unique individual across all organisations
|
|person.id
|-
|-
|match_pattern_number
|use_concept_id
|varchar(255)
|int
|DEFAULT NULL
|DEFAULT NULL
|The qualifier used to match the number
|use of contact (e.g. mobile, home,work
|
|
|-
|-
|match_pattern_building
|type_concept_id
|varchar(255)
|int
|DEFAULT NULL
|DEFAULT NULL
|The qualifier used to match the building
|type of contact (e.g. phone, email)
|
|
|-
|-
|match_pattern_flat
|start_date
|varchar(255)
|date
|DEFAULT NULL
|DEFAULT NULL
|The qualifier used to match the  flat
|The start date of the contact being valid
|
|
|-
|-
|algorithm_version
|end_date
|varchar(255)
|date
|DEFAULT NULL
|DEFAULT NULL
|What version of the algorithm was used to make the match
|The end date of the contact being valid
|
|
|-
|-
|Epoc
|value
|varchar(255)
|varchar(255)
|DEFAULT NULL
|DEFAULT NULL
|The version of the ABP files the addresses were matched against
|The value of the contact information eg phone number, email address
|
|
|-
|-
| colspan="5" |CONSTRAINT PRIMARY KEY (id,uprn)
| colspan="5" |CONSTRAINT pk_organization_id_id_patient_id_person_id PRIMARY KEY (`organization_id`,`id`,`patient_id`,`person_id`),
|}
|-
| colspan="5" |CONSTRAINT fk_patient_contact_patient_id_organisation_id FOREIGN KEY (patient_id, organization_id)
|-
| colspan="5" |REFERENCES patient (id, organization_id)
|-
| colspan="5" |COMMENT 'stores contact details (e.g. phone) for patients'
|}


== Table: patient_contact ==
== Table: patient_pseudo_id ==
PRIMARY KEY (organization_id,id,patient_id,person_id)
PRIMARY KEY(organization_id)
{| class="wikitable sortable mw-collapsible mw-collapsed"
{| class="wikitable sortable mw-collapsible mw-collapsed"
|'''Column name'''
|'''Column name'''
Line 2,244: Line 2,293:
|'''References'''
|'''References'''
|-
|-
|id
|Id
|bigint
|bigint(20)
|NOT NULL
|NOT NULL
|Unique Id of the patient  contact
|Unique Id of the patient pseudo id
|
|
|-
|-
|organization_id
|organization_id
|bigint
|bigint(20)
|NOT NULL
|NOT NULL
|Owning organisation (i.e. publisher)
|Owning organisation (i.e. publisher)
|
|
|-
|-
|patient_id
|patient_id
|bigint
|bigint(20)
|NOT NULL
|NOT NULL
|The organisations record for this person’s registration. Patients may have multiple records across  clinical systems and may have registered at an organisation multiple times
|Reference to the patient this registration status history belongs to
|patient.id
|
|-
|-
|person_id
|person_id
|bigint
|bigint(20)
|DEFAULT NULL
|NOT NULL
|Unique individual across all organisations
|Reference to the person this registration status history belongs to
|person.id
|
|-
|-
|use_concept_id
|salt_name
|int
|varchar(50)
|DEFAULT NULL
|NOT NULL
|use of contact (e.g. mobile, home,work
|The name of the salt used to create the pseudo id
|
|
|-
|-
|type_concept_id
|Skid
|int
|varchar(255)
|DEFAULT NULL
|NOT NULL
|type of contact (e.g. phone,  email)
|"Secure Key IDentifier"  - the pseudonymised ID generated for this patient using the salt specified in  the salt_name column. Typically generated from patient NHS number, but is  configurable on a case by case basis (e.g. may include date of birth)
|
|
|-
|-
|start_date date
|is_nhs_number_valid
|date
|boolean
|DEFAULT NULL
|NOT NULL
|The start date of the contact  being valid
|Whether the nhs number is valid
|
|
|-
|-
|end_date date
|is_nhs_number_verified_by_publisher
|date
|boolean
|DEFAULT NULL
|NOT NULL
|The end date of the contact being valid
|Whether the nhs number has been verified by the publisher
|
|
|-
|-
|value
| colspan="5" |CONSTRAINT PRIMARY KEY (organization_id)
|varchar(255)
|DEFAULT NULL
|The value of the contact  information eg phone number, email address
|
|-
|-
| colspan="5" |CONSTRAINT pk_organization_id_id_patient_id_person_id PRIMARY KEY (`organization_id`,`id`,`patient_id`,`person_id`),
| colspan="5" |CONSTRAINT fk_patient_pseudo_id FOREIGN KEY (patient_id, organization_id)
|-
| colspan="5" |CONSTRAINT fk_patient_contact_patient_id_organisation_id FOREIGN KEY (patient_id, organization_id)
|-
|-
| colspan="5" |REFERENCES patient (id, organization_id)
| colspan="5" |REFERENCES patient (id, organization_id)
|-
| colspan="5" |COMMENT 'stores contact details (e.g. phone) for patients'
|}
|}


== Table: patient_gender ==
== Table: patient_uprn ==
PRIMARY KEY(id)
PRIMARY KEY (organization_id,person_id,id)
{| class="wikitable sortable mw-collapsible mw-collapsed"
{| class="wikitable sortable mw-collapsible mw-collapsed"
|'''Column name'''
|'''Column name'''
Line 2,316: Line 2,357:
|'''References'''
|'''References'''
|-
|-
|Id
|patient_id
|smallint(6)
|bigint(20)
|NOT NULL
|NOT NULL
|Unique Id of the gender lookup
|The organisations record for this person’s registration. Patients may have multiple records across clinical systems and may have registered at an organisation multiple times
|
|patient.id
|-
|-
|Value
|organization_id
|varchar(10)
|bigint(20)
|NOT NULL
|NOT NULL
|Value of the gender lookup
|Owning organisation (i.e. publisher)
|
|organisation.id
|-
|-
| colspan="5" |CONSTRAINT PRIMARY KEY (id)
|person_id
|}
 
== Table: patient_pseudo_id ==
PRIMARY KEY(organization_id)
{| class="wikitable sortable mw-collapsible mw-collapsed"
|'''Column name'''
|'''Data type'''
|'''Constraint'''
|'''Comments'''
|'''References'''
|-
|Id
|bigint(20)
|bigint(20)
|NOT NULL
|NOT NULL
|Unique Id of the patient pseudo  id
|Unique individual across all organisations
|
|person.id
|-
|organization_id
|bigint(20)
|NOT NULL
|Owning organisation (i.e.  publisher)
|
|-
|-
|patient_id
|Uprn
|bigint(20)
|bigint
|NOT NULL
|DEFAULT NULL
|Reference to the patient this  registration status history belongs to
|
|
|-
|person_id
|bigint(20)
|NOT NULL
|Reference to the person this  registration status history belongs to
|
|
|-
|-
|salt_name
|qualifier
|varchar(50)
|varchar(50)
|NOT NULL
|DEFAULT NULL
|The name of the salt used to  create the pseudo id
|
|
|
|-
|-
|Skid
|algorithm
|varchar(255)
|varchar(255)
|NOT NULL
|DEFAULT NULL
|"Secure Key IDentifier"  - the pseudonymised ID generated for this patient using the salt specified in  the salt_name column. Typically generated from patient NHS number, but is  configurable on a case by case basis (e.g. may include date of birth)
|
|
|-
|is_nhs_number_valid
|tinyint(1)
|NOT NULL
|Whether the nhs number is valid
|
|
|-
|-
|is_nhs_number_verified_by_publisher
|match
|tinyint(1)
|varchar(255)
|NOT NULL
|DEFAULT NULL
|Whether the nhs number has been  verified by the publisher
|
|
|
|-
|-
| colspan="5" |CONSTRAINT PRIMARY KEY (organization_id)
|no_address
|}
|boolean
 
|DEFAULT NULL
== Table: patient_uprn ==
|
PRIMARY KEY (organization_id,person_id,id)
|
{| class="wikitable sortable mw-collapsible mw-collapsed"
|'''Column name'''
|'''Data type'''
|'''Constraint'''
|'''Comments'''
|'''References'''
|-
|-
|patient_id
|invalid_address
|bigint(20)
|boolean
|NOT NULL
|DEFAULT NULL
|The organisations record for this person’s registration. Patients may have multiple records across clinical systems and may have registered at an organisation multiple times
|
|patient.id
|
|-
|-
|organization_id
|missing_postcode
|bigint(20)
|boolean
|NOT NULL
|Owning organisation (i.e. publisher)
|organisation.id
|-
|person_id
|bigint(20)
|NOT NULL
|Unique individual across all organisations
|person.id
|-
|Uprn
|bigint
|DEFAULT NULL
|DEFAULT NULL
|
|
|
|
|-
|-
|qualifier
|invalid_postcode
|varchar(50)
|boolean
|DEFAULT NULL
|DEFAULT NULL
|
|
|
|
|-
|-
|algorithm
| colspan="5" |CONSTRAINT pk_patient_id_organization_id PRIMARY KEY (`organization_id`,`person_id`,`patient_id`),
|varchar(255)
|DEFAULT NULL
|
|
|-
|-
|match
| colspan="5" |CONSTRAINT fk_patient_uprn_patient_id_organisation_id FOREIGN KEY (patient_id, organization_id)
|varchar(255)
|DEFAULT NULL
|
|
|-
|-
|no_address
| colspan="5" |REFERENCES patient (id, organization_id) MATCH SIMPLE
|tinyint(1)
|DEFAULT NULL
|
|
|-
|-
|invalid_address
| colspan="5" |ON UPDATE NO ACTION ON DELETE NO ACTION
|tinyint(1)
|DEFAULT NULL
|
|
|-
|missing_postcode
|tinyint(1)
|DEFAULT NULL
|
|
|-
|invalid_postcode
|tinyint(1)
|DEFAULT NULL
|
|
|-
| colspan="5" |CONSTRAINT pk_patient_id_organization_id PRIMARY KEY (`organization_id`,`person_id`,`patient_id`),
|-
| colspan="5" |CONSTRAINT fk_patient_uprn_patient_id_organisation_id FOREIGN KEY (patient_id, organization_id)
|-
| colspan="5" |REFERENCES patient (id, organization_id) MATCH SIMPLE
|-
| colspan="5" |ON UPDATE NO ACTION ON DELETE NO ACTION
|}
|}


Line 2,741: Line 2,698:
|}
|}


== Table: procedure_request_status ==
== Table: pseudo_id ==
PRIMARY KEY(id)
PRIMARY KEY (patient_id, salt_key_name)
{| class="wikitable sortable mw-collapsible mw-collapsed"
{| class="wikitable sortable mw-collapsible mw-collapsed"
|'''Column name'''
|'''Column name'''
Line 2,751: Line 2,708:
|-
|-
|Id
|Id
|smallint(6)
|bigint
|NOT NULL
|NOT NULL
|Unique Id of the procedure  request status lookup
|Unique Id of the pseudo Id
|
|
|-
|-
|Value
|patient_id
|varchar(50)
|bigint
|NOT NULL
|NOT NULL
|The value of the procedure request status lookup
|Reference to the patient the  pseudo Id belongs to
|
|
|-
|-
| colspan="5" |CONSTRAINT PRIMARY KEY (id)
|salt_key_name
|}
 
== Table: pseudo_id ==
PRIMARY KEY (patient_id, salt_key_name)
{| class="wikitable sortable mw-collapsible mw-collapsed"
|'''Column name'''
|'''Data type'''
|'''Constraint'''
|'''Comments'''
|'''References'''
|-
|Id
|bigint
|NOT NULL
|Unique Id of the pseudo Id
|
|-
|patient_id
|bigint
|NOT NULL
|Reference to the patient the  pseudo Id belongs to
|
|-
|salt_key_name
|varchar(50)
|varchar(50)
|NOT NULL
|NOT NULL
Line 2,959: Line 2,892:
|}
|}


== Table: referral_request_priority ==
== Table: registration_status_history ==
PRIMARY KEY(id)
PRIMARY KEY(organization_id,id,patient_id,person_id)
{| class="wikitable sortable mw-collapsible mw-collapsed"
{| class="wikitable sortable mw-collapsible mw-collapsed"
|'''Column name'''
|'''Column name'''
Line 2,969: Line 2,902:
|-
|-
|Id
|Id
|smallint(6)
|bigint(20)
|NOT NULL
|NOT NULL
|Unique Id of the referral request priority lookup
|Unique Id of the registration status history
|
|
|-
|-
|Value
|organization_id
|varchar(50)
|bigint(20)
|NOT NULL
|NOT NULL
|The value of the referral request priority lookup
|Owning organisation (i.e. publisher)
|
|
|-
|-
| colspan="5" |CONSTRAINT PRIMARY KEY (id)
|patient_id
|}
|bigint(20)
 
== Table: referral_request_type ==
PRIMARY KEY(id)
{| class="wikitable sortable mw-collapsible mw-collapsed"
|'''Column name'''
|'''Data type'''
|'''Constraint'''
|'''Comments'''
|'''References'''
|-
|Id
|smallint(6)
|NOT NULL
|Unique Id of the referral  request type
|
|-
|Value
|varchar(50)
|NOT NULL
|The value of the referral  request lookup
|
|-
| colspan="5" |CONSTRAINT PRIMARY KEY (id)
|}
 
== Table: registration_status ==
PRIMARY KEY(id)
{| class="wikitable sortable mw-collapsible mw-collapsed"
|'''Column name'''
|'''Data type'''
|'''Constraint'''
|'''Comments'''
|'''References'''
|-
|Id
|smallint(6)
|NOT NULL
|Unique Id of the registration  status
|
|-
|Code
|varchar(10)
|NOT NULL
|The registration status code
|
|-
|Description
|varchar(50)
|NOT NULL
|The description of the  registration status
|
|-
|is_active
|tinyint(1)
|NOT NULL
|Whether the registration status  is active
|
|-
| colspan="5" |CONSTRAINT PRIMARY KEY (id)
|}
 
== Table: registration_status_history ==
PRIMARY KEY(organization_id,id,patient_id,person_id)
{| class="wikitable sortable mw-collapsible mw-collapsed"
|'''Column name'''
|'''Data type'''
|'''Constraint'''
|'''Comments'''
|'''References'''
|-
|Id
|bigint(20)
|NOT NULL
|Unique Id of the registration  status history
|
|-
|organization_id
|bigint(20)
|NOT NULL
|Owning organisation (i.e.  publisher)
|
|-
|patient_id
|bigint(20)
|NOT NULL
|NOT NULL
|Reference to the patient this  registration status history belongs to
|Reference to the patient this  registration status history belongs to
Line 3,100: Line 2,949:
|
|
|-
|-
| colspan="5" |CONSTRAINT PRIMARY KEY (organization_id,id,patient_id,person_id)
| colspan="5" |PRIMARY KEY (organization_id,id,patient_id,person_id)
|-
| colspan="5" |CONSTRAINT fk_registration_status_history_episode_id FOREIGN KEY (episode_of_care_id)
|}
|}
== Table: schedule ==
== Table: schedule ==

Latest revision as of 08:51, 18 May 2021

Table: allergy_intolerance

PRIMARY KEY (organization_id,person_id,id)

Column name Data type Constraint Comments References
id bigint NOT NULL Unique Id of the allergy
organization_id bigint NOT NULL Owning organisation (i.e. publisher) organization.id
patient_id bigint NOT NULL The organisations record for this person’s registration. Patients may have multiple records across clinical systems and may have registered at an organisation multiple times patient.id
person_id bigint NOT NULL Unique individual across all organisations person.id
encounter_id bigint DEFAULT NULL Reference to the encounter this allergy was record in encounter.id
practitioner_id bigint DEFAULT NULL The clinician the activity is recorded against practitioner.id
clinical_effective_date date DEFAULT NULL The date the clinical code is recorded for
date_precision_concept_id Int DEFAULT NULL Identifies the precision of the clinical effectiveness date to either year (1) month (2) day (5) minute (12) second (13) millisecond (14)
is_review boolean NOT NULL Is this instance of the code a review of a previous encounter
core_concept_id Int DEFAULT NULL Reference to the clinical coding of the allergy
non_core_concept_id Int DEFAULT NULL Reference to the clinical coding of the allergy
age_at_event decimal(5,2) DEFAULT NULL The age the patient was at the time of this event
date_recorded datetime NOT NULL The date the allergy was recorded
CONSTRAINT pk_allergy_intolerance_id PRIMARY KEY (`organization_id`,`person_id`,`id`),
CONSTRAINT fk_allergy_intolerance_encounter_id FOREIGN KEY (encounter_id)
REFERENCES encounter (id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION,
CONSTRAINT fk_allergy_intolerance_patient_id_organization_id FOREIGN KEY (patient_id, organization_id)
REFERENCES patient (id, organization_id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION,
CONSTRAINT fk_allergy_intolerance_practitioner_id FOREIGN KEY (practitioner_id)
REFERENCES practitioner (id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION

Table: appointment

PRIMARY KEY (organization_id,person_id,id)

Column name Data type Constraint Comments References
id bigint NOT NULL Unique Id of the appointment
organization_id bigint NOT NULL Owning organisation (i.e. publisher) organization.id
patient_id bigint NOT NULL The organisations record for this person’s registration. Patients may have multiple records across clinical systems and may have registered at an organisation multiple times patient.id
person_id bigint NOT NULL Unique individual across all organisations person.id
practitioner_id bigint DEFAULT NULL The clinician the activity is recorded against practitioner.id
schedule_id bigint DEFAULT NULL The schedule the patient was put on to book multiple appointments. ID unique to the applied schedule schedule.id
start_date date DEFAULT NULL The start date of the appointment
planned_duration int DEFAULT NULL The time allocated for the appointment, not necessarily the actual duration always in minutes
actual_duration int DEFAULT NULL Time between sent in and left always in minutes
appointment_status_concept_id int DEFAULT NULL The status of the appointment e.g. arrived/sent in/left/DNA
patient_wait int DEFAULT NULL How long the patient waited from being marked as arrived to being sent in
patient_delay int DEFAULT NULL How long the patient was delayed for
date_time_sent_in datetime DEFAULT NULL Date and time the patient was sent into the practitioner
date_time_left datetime DEFAULT NULL Date and time the patient left the practitioner
source_id varchar(36) DEFAULT NULL Unique reference to the source of the appointment
cancelled_date datetime DEFAULT NULL The date the appointment was cancelled
CONSTRAINT pk_appointment_id PRIMARY KEY (organization_id,person_id,id),
CONSTRAINT fk_appointment_organization_id FOREIGN KEY (organization_id)
REFERENCES organization (id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION,
CONSTRAINT fk_appointment_practitioner_id FOREIGN KEY (practitioner_id)
REFERENCES practitioner (id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION

Table: concept

PRIMARY KEY (dbid)

Column name Data type Constraint Comments References
dbid int(11) NOT NULL Unique Id of the concept
Document int(11) NOT NULL Concept grouping construct, deprecated
Id varchar(150) NOT NULL Unique concept identifier
Draft tinyint(1) NOT NULL Whether its draft/autocreated or confirmed as a "proper" concept
Name varchar(255) DEFAULT NULL Short name
Description varchar(400) DEFAULT NULL Full name (or term for ontological concepts)
Scheme bigint(20) DEFAULT NULL The coding scheme for the code (Read, CTV3, SNOMED etc)
Code varchar(40) DEFAULT NULL The code (non-unique unless coupled with a scheme)
use_count bigint(20) NOT NULL DEFAULT 0 Rough indicator of number of occurences of the concept
updated datetime NOT NULL The timestamp of the last update to the concept
CONSTRAINT PRIMARY KEY (dbid),

Table: concept_map

PRIMARY KEY (id)

Column name Data type Constraint Comments References
Legacy int(11) NOT NULL the legacy (read 2, ctv3, icd10, opcs4, emis local, etc) concept
Core int(11) NOT NULL the core (snomed, discovery) concept that the legacy concept maps to
Updated datetime NOT NULL Timestamp the map was last updated/added
id int(11)
deleted tinyint(1)
CONSTRAINT PRIMARY KEY (id)

Table: diagnostic_order

PRIMARY KEY (organization_id,person_id,id)

Column name Data type Constraint Comments References
id bigint NOT NULL Unique Id of the diagnostic order
organization_id bigint NOT NULL Owning organisation (i.e. publisher)
patient_id bigint NOT NULL The organisations record for this person’s registration. Patients may have multiple records across clinical systems and may have registered at an organisation multiple times
person_id bigint NOT NULL Unique individual across all organisations
encounter_id bigint DEFAULT NULL Reference to the encounter the observation was recorded at
practitioner_id bigint DEFAULT NULL The clinician the activity is recorded against
clinical_effective_date date DEFAULT NULL The date the diagnostic order was identified by a clinician
date_precision_concept_id int DEFAULT NULL Identifies the precision of the clinical effectiveness date to either year (1) month (2) day (5) minute (12) second (13) millisecond (14)
result_value real DEFAULT NULL The value of the result of the observation
result_value_units varchar(50) DEFAULT NULL The units of the result of the observation
result_date date DEFAULT NULL The date of the result
result_text text DEFAULT NULL Any text associated with the result
result_concept_id int DEFAULT NULL Reference to the clinical coding of the result
is_problem boolean NOT NULL Whether the observation is marked as a problem
is_review boolean NOT NULL Whether the observation is a review of an existing problem
problem_end_date date DEFAULT NULL The end date of the problem
parent_observation_id bigint DEFAULT NULL Reference to the parent observation in a complex observation eg systolic and diastolic blood pressures will have a parent observation of Blood pressure
core_concept_id int DEFAULT NULL Reference to the clinical coding of the observation
non_core_concept_id int DEFAULT NULL Reference to the clinical coding of the observation
age_at_event decimal (5,2) DEFAULT NULL The age of the patient at the time of the observation
episodicity_concept_id int DEFAULT NULL Reference to the episodicity of the problem eg First, review, flare
is_primary boolean DEFAULT NULL Whether the diagnostic order is a primary order
CONSTRAINT pk_diagnostic_order_id PRIMARY KEY (`organization_id`,`person_id`,`id`),
CONSTRAINT fk_diagnostic_order_encounter_id FOREIGN KEY (encounter_id)
REFERENCES encounter (id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION,
CONSTRAINT fk_diagnostic_order_patient_id_organization_id FOREIGN KEY (patient_id, organization_id)
REFERENCES patient (id, organization_id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION,
CONSTRAINT fk_diagnostic_order_practitioner_id FOREIGN KEY (practitioner_id)
REFERENCES practitioner (id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION

Table: encounter

PRIMARY KEY (organization_id,person_id,id)

Column name Data type Constraint Comments References
id bigint NOT NULL Unique Id of the encounter
organization_id bigint NOT NULL Owning organisation (i.e. publisher)
patient_id bigint NOT NULL The organisations record for this person’s registration. Patients may have multiple records across clinical systems and may have registered at an organisation multiple times
person_id bigint NOT NULL Unique individual across all organisations
practitioner_id bigint DEFAULT NULL The clinician the activity is recorded against
appointment_id bigint DEFAULT NULL Reference to the appointment this encounter took part on
clinical_effective_date date DEFAULT NULL The date the clinical code is recorded for

date_precision_concept_id

int DEFAULT NULL Reference to the precision of the date of the encounter
episode_of_care_id bigint DEFAULT NULL Is this instance of the code a review of a previous encounter
service_provider_organization_id bigint DEFAULT NULL Reference to the service provider organisation
core_concept_id int DEFAULT NULL Reference to the type of encounter
non_core_concept_id int DEFAULT NULL Reference to the type of encounter
age_at_event decimal(5,2) DEFAULT NULL The age the patient was when this encounter took place
Type text DEFAULT NULL Unused
sub_type text DEFAULT NULL Unused
admission_method varchar(40) DEFAULT NULL The admission method of the encounter
end_date date DEFAULT NULL The end date of the encounter
institution_location_id text DEFAULT NULL Reference to the institution the encounter took place at
date_recorded datetime DEFAULT NULL The date the encounter was recorded

CONSTRAINT pk_encounter_id PRIMARY KEY (organization_id,person_id,id),

CONSTRAINT fk_encounter_appointment_id FOREIGN KEY (appointment_id)
REFERENCES appointment (id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION
CONSTRAINT fk_encounter_patient_id_organization_id FOREIGN KEY (patient_id, organization_id)
REFERENCES patient (id, organization_id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION,
CONSTRAINT fk_encounter_practitioner_id FOREIGN KEY (practitioner_id)
REFERENCES practitioner (id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION,
CONSTRAINT fk_encounter_episode_of_care_id FOREIGN KEY (episode_of_care_id)
REFERENCES episode_of_care (id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION,
CONSTRAINT fk_encounter_service_provider_organization_id FOREIGN KEY (service_provider_organization_id)
REFERENCES organization (id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION

Table: encounter_additional

PRIMARY KEY (id, property_id, value_id)

Column name Data type Constraint Comments References
id bigint NOT NULL same as the id column on the encounter table
property_id int NOT NULL IM reference (i.e. Admission method)
value_id int NOT NULL IM reference (i.e. Emergency admission)
json_value JSON NULL where there is no mapped value_id, just raw JSON (i.e. birth delivery details)
text_value varchar(255) NULL where there is no mapped value_id, or raw JSON, just a basic text value (i.e. FIN number)
CONSTRAINT pk_encounter_additional_id PRIMARY KEY (id, property_id, value_id)

Table: encounter_event

PRIMARY KEY (organization_id, person_id, id)

Column name Data type Constraint Comments References
id bigint NOT NULL Unique Id of the encounter event
organization_id bigint NOT NULL Owning organisation (i.e. publisher)
patient_id bigint NOT NULL The patient this event belongs to
person_id bigint NOT NULL The person this event belongs to
encounter_id bigint NOT NULL Reference to the parent encounter record
practitioner_id bigint DEFAULT NULL The clinician the activity is recorded against
appointment_id bigint DEFAULT NULL Reference to the appointment this encounter took part on
clinical_effective_date datetime DEFAULT NULL The date the encounter took place
date_precision_concept_id int DEFAULT NULL Reference to the precision of the date of the encounter
episode_of_care_id bigint DEFAULT NULL Reference to the episode of care this encounter belongs to
service_provider_organization_id bigint DEFAULT NULL Reference to the service provider organisation
core_concept_id int DEFAULT NULL Reference to the type of encounter
non_core_concept_id int DEFAULT NULL Reference to the type of encounter
age_at_event decimal(5,2) DEFAULT NULL The age of the patient at the time of the encounter
type text DEFAULT NULL Unused
sub_type text DEFAULT NULL Unused
admission_method varchar(40) DEFAULT NULL The admission method of the encounter
end_date date DEFAULT NULL The end date of the encounter
institution_location_id bigint DEFAULT NULL Reference to the institution the encounter took place at
date_recorded datetime DEFAULT NULL The date the encounter was recorded
finished boolean DEFAULT NULL Whether the encounter is finished
CONSTRAINT pk_encounter_event_id PRIMARY KEY (organization_id, person_id, id),
CONSTRAINT fk_encounter_event_patient_id_organization_id FOREIGN KEY (patient_id, organization_id)
REFERENCES patient (id, organization_id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION,
CONSTRAINT fk_encounter_event_practitioner_id FOREIGN KEY (practitioner_id)
REFERENCES practitioner (id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION,
CONSTRAINT fk_encounter_event_episode_of_care_id FOREIGN KEY (episode_of_care_id)
REFERENCES episode_of_care (id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION,
CONSTRAINT fk_encounter_event_service_provider_organization_id FOREIGN KEY (service_provider_organization_id)
REFERENCES organization (id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION

Table: episode_of_care

PRIMARY KEY (organization_id,person_id,id)

Column name Data type Constraint Comments References
id bigint NOT NULL Unique Id of the episode of care
organization_id bigint NOT NULL Owning organisation (i.e. publisher) organization.id
patient_id bigint NOT NULL The organisations record for this person’s registration. Patients may have multiple records across clinical systems and may have registered at an organisation multiple times patient.id
person_id bigint NOT NULL Unique individual across all organisations person.id
registration_type_concept_id int DEFAULT NULL Reference to the registration type of the patient registration.type.id
registration_status_concept_id int DEFAULT NULL Reference to the registration status of the patient
date_registered date DEFAULT NULL The date the registration was started  for this episode of care
date_registered_end date DEFAULT NULL The date the registration was ended  for this episode of care
usual_gp_practitioner_id bigint DEFAULT NULL Reference to the usual GP for this episode of care Practitioner.id
CONSTRAINT pk_episode_of_care_id PRIMARY KEY (`organization_id`,`person_id`,`id`),
CONSTRAINT fk_episode_of_care_patient_id_organisation_id FOREIGN KEY (patient_id, organization_id)
REFERENCES patient (id, organization_id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION,
CONSTRAINT fk_episode_of_care_practitioner_id FOREIGN KEY (usual_gp_practitioner_id)
REFERENCES practitioner (id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION

Table: event_log

Column name Data type Constraint Comments References
dt_change datetime(3) NOT NULL date time the change was made to this DB
change_type tinyint NOT NULL type of transaction 0=insert, 1=update, 2=delete
table_id tinyint NOT NULL identifier of the table changed
record_id bigint NOT NULL id of the record changed

Table: flag

PRIMARY KEY (organization_id,person_id,id)

Column name Data type Constraint Comments References
id bigint(20) NOT NULL Unique Id of the flag
organization_id bigint(20) NOT NULL Owning organisation (i.e. publisher)
patient_id bigint(20) NOT NULL The organisations record for this person’s registration. Patients may have multiple records across clinical systems and may have registered at an organisation multiple times patient.id
person_id bigint(20) NOT NULL Unique individual across all organisations person.id
effective_date date DEFAULT NULL The date the flag was entered onto the patients record
date_precision_concept_id int DEFAULT NULL Identifies the precision of the clinical effectiveness date to either year (1) month (2) day (5) minute (12) second (13) millisecond (14)
is_active boolean NOT NULL Whether the flag is active or not
flag_text text This is a warning set by the publisher regarding he patient
CONSTRAINT pk_flag_id PRIMARY KEY (`organization_id`,`person_id`,`id`),
CONSTRAINT fk_flag_patient_id_organization_id FOREIGN KEY (patient_id, organization_id)
REFERENCES patient (id, organization_id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION

Table: location

PRIMARY KEY (pk_location_id PRIMARY KEY id)

Column name Data type Constraint Comments References
id bigint NOT NULL Unique Id of the location
name varchar(255) DEFAULT NULL The name of a location set by the publisher. E.g. ward, clinic, domiciliary
type_code, varchar(50) DEFAULT NULL The type of location
type_desc varchar(255) DEFAULT NULL Textual description of the type of location eg GP Practice
postcode varchar10) DEFAULT NULL The postcode of the location
managing_organization_id bigint DEFAULT NULL Reference to the managing organisation of the location
CONSTRAINT pk_location_id PRIMARY KEY (id)
CONSTRAINT fk_location_organisation_id FOREIGN KEY (managing_organization_id)
REFERENCES organization (id)
MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION

Table: medication_order

PRIMARY KEY (organization_id,person_id,id)

Column name Data type Constraint Comments References
id bigint NOT NULL Unique Id of the medication order
organization_id bigint NOT NULL Owning organisation (i.e. publisher) organization.id
patient_id bigint NOT NULL The organisations record for this person’s registration. Patients may have multiple records across clinical systems and may have registered at an organisation multiple times patient.id
person_id bigint NOT NULL Unique individual across all organisations person.id
encounter_id bigint DEFAULT NULL Reference to the encounter the medication order was issued in encounter.id
practitioner_id bigint DEFAULT NULL The clinician the activity is recorded against practitioner.id
clinical_effective_date date DEFAULT NULL The date the medication order was issued
date_precision_concept_id int DEFAULT NULL Identifies the precision of the clinical effectiveness date to either year (1) month (2) day (5) minute (12) second (13) millisecond (14)
dose varchar(1000) DEFAULT NULL Textual description of the dose
quantity_value real DEFAULT NULL The value of the medication that was prescribed eg 50
quantity_unit varchar(255) DEFAULT NULL The unit of the medication that was prescribed eg tablets
duration_days int DEFAULT NULL How many days the medication is prescribed for
estimated_cost real DEFAULT NULL The estimated cost of the medication
medication_statement_id bigint DEFAULT NULL Reference to the medication statement.  A medication statement can have many medication orders medication.statement.id
core_concept_id int DEFAULT NULL Reference to the clinical coding of the medication
non_core_concept_id int DEFAULT NULL Reference to the clinical coding of the medication
bnf_reference varchar(6) DEFAULT NULL A reference to the drug in the BNF dictionary
age_at_event decimal(5,2) DEFAULT NULL The age the patient was at the time of this event
issue_method text DEFAULT NULL The issue method of the medication eg hand written
CONSTRAINT pk_medication_order_id PRIMARY KEY (`organization_id`,`person_id`,`id`),
CONSTRAINT fk_medication_order_encounter_id FOREIGN KEY (encounter_id)
REFERENCES encounter (id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION,
CONSTRAINT fk_medication_order_patient_id_organization_id FOREIGN KEY (patient_id, organization_id)
REFERENCES patient (id, organization_id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION,
CONSTRAINT fk_medication_order_practitioner_id FOREIGN KEY (practitioner_id)
REFERENCES practitioner (id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION

Table: medication_statement

PRIMARY KEY (organization_id,person_id,id)

Column name Data type Constraint Comments References
id bigint(20) NOT NULL Unique Id of the medication
organization_id bigint(20) NOT NULL Owning organisation (i.e. publisher) organization.id
patient_id bigint(20) NOT NULL The organisations record for this person’s registration. Patients may have multiple records across clinical systems and may have registered at an organisation multiple times patient.id
person_id bigint(20) NOT NULL Unique individual across all organisations person.id
encounter_id bigint(20) DEFAULT NULL Reference to the encounter this medication was recorded in encounter.id
practitioner_id bigint(20) DEFAULT NULL The clinician the activity is recorded against practitioner.id
clinical_effective_date date DEFAULT NULL The date the medication was clinical relevant
date_precision_concept_id int DEFAULT NULL Identifies the precision of the clinical effectiveness date to either year (1) month (2) day (5) minute (12) second (13) millisecond (14)
is_active boolean DEFAULT NULL Whether the medication is active or not
cancellation_date date DEFAULT NULL The date the medication was cancelled
dose varchar(1000) DEFAULT NULL Texual description of the dose of the medication
quantity_value real DEFAULT NULL The value of the medication that was prescribed eg 50
quantity_unit varchar(255) DEFAULT NULL The unit of the medication that was prescribed eg tablets
authorisation_type_concept_id int DEFAULT NULL Reference to the authorisation type
core_concept_id int DEFAULT NULL Reference to the clinical coding of the medication
non_core_concept_id int DEFAULT NULL Reference to the clinical coding of the medication
bnf_reference varchar(6) DEFAULT NULL A reference to the drug in the BNF dictionary
age_at_event decimal(5,2) DEFAULT NULL The age the patient was at the time of this event
Issue_method text DEFAULT NULL The issue method of the medication eg hand written
CONSTRAINT pk_medication_statement_id PRIMARY KEY (`organization_id`,`person_id`,`id`),
CONSTRAINT fk_medication_statement_encounter_id FOREIGN KEY (encounter_id)
REFERENCES encounter (id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION,
CONSTRAINT fk_medication_statement_patient_id_organization_id FOREIGN KEY (patient_id, organization_id)
REFERENCES patient (id, organization_id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION,
CONSTRAINT fk_medication_statement_practitioner_id FOREIGN KEY (practitioner_id)
REFERENCES practitioner (id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION

Table: observation

PRIMARY KEY (organization_id,person_id,id)

Column name Data type Constraint Comments References
id bigint(20) NOT NULL Unique Id of the observation
organization_id bigint(20) NOT NULL Owning organisation (i.e. publisher) organization.id
patient_id bigint(20) NOT NULL The organisations record for this person’s registration. Patients may have multiple records across clinical systems and may have registered at an organisation multiple times patient.id
person_id bigint(20) NOT NULL Unique individual across all organisations person.id
encounter_id bigint(20) DEFAULT NULL Reference to the encounter the observation was recorded at encounter.id
practitioner_id bigint(20) DEFAULT NULL The clinician the activity is recorded against practitioner.id
clinical_effective_date date DEFAULT NULL The date the observation was identified by a clinician
date_precision_concept_id int DEFAULT NULL Identifies the precision of the clinical effectiveness date to either year (1) month (2) day (5) minute (12) second (13) millisecond (14)
result_value rea DEFAULT NULL The value of the result of the observation
result_value_units varchar(50) DEFAULT NULL The units of the result of the observation
result_date date DEFAULT NULL The date of the result
result_text text Any text associated with the result
result_concept_id int DEFAULT NULL Reference to the clinical coding of the result
is_problem boolean NOT NULL Whether the observation is marked as a problem
is_review boolean NOT NULL Whether the observation is a review of an existing problem
problem_end_date date DEFAULT NULL The end date of the problem
parent_observation_id bigint(20) DEFAULT NULL Reference to the parent observation in a complex observation eg systolic and diastolic blood pressures will have a parent observation of Blood pressure
core_concept_id int DEFAULT NULL Reference to the clinical coding of the observation
non_core_concept_id int DEFAULT NULL Reference to the clinical coding of the observation
age_at_event decimal (5,2) DEFAULT NULL The age of the patient at the time of the observation
episodicity_concept_id int DEFAULT NULL Reference to the episodicity of the problem eg First, review, flare
is_primary boolean DEFAULT NULL Whether the observation is a primary observation
date_recorded datetime DEFAULT NULL The date the observation was recorded in the system
CONSTRAINT pk_observation_id PRIMARY KEY (`organization_id`,`person_id`,`id`),
CONSTRAINT fk_observation_encounter_id FOREIGN KEY (encounter_id)
REFERENCES encounter (id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION,
CONSTRAINT fk_observation_patient_id_organization_id FOREIGN KEY (patient_id, organization_id)
REFERENCES patient (id, organization_id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION,
CONSTRAINT fk_observation_practitioner_id FOREIGN KEY (practitioner_id)
REFERENCES practitioner (id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION

Table: observation_additional

PRIMARY KEY (id, property_id)

Column name Data type Constraint Comments References
id bigint NOT NULL
property_id int NOT NULL IM reference (i.e. significance)
value_id int NULL IM reference (i.e. minor, significant) person.id
json_value json NULL Where there is no mapped value_id, just raw JSON
text_value varchar(255) NULL Where there is no mapped value_id or raw JSON, just a basic text value
CONSTRAINT pk_observation_additional_id PRIMARY KEY (id, property_id)

Table: organization

PRIMARY KEY (pk_organization_id PRIMARY KEY (id))

Column name Data type Constraint Comments References
id bigint NOT NULL Unique Id of the organisation
ods_code varchar(50) DEFAULT NULL ODS Code of the organisation
Name varchar(255) DEFAULT NULL Name of the organisation
type_code varchar(50) DEFAULT NULL The type of organisation
type_desc varchar(255) DEFAULT NULL Textual description of the type of organisation eg GP Practice
Postcode varchar(10) DEFAULT NULL The postcode of the organisation
parent_organization_id bigint DEFAULT NULL The id of the parent organisation
PRIMARY KEY pk_organization_id PRIMARY KEY (id)

Table: organization_metadata

PRIMARY KEY (id, publishing_software)

Column name Data type Constraint Comments References
id bigint NOT NULL corresponds to same ID in the organizaton table
publishing_software varchar(50) DEFAULT NULL software name of publishing system
last_data_to_dds datetime DEFAULT NULL date time data was last sent to DDS
last_data_cutoff datetime DEFAULT NULL cutoff date time of the last extract from the publishing system
CONSTRAINT pk_organization_metadata PRIMARY KEY (id, publishing_software)

Table: patient

PRIMARY KEY (organization_id,person_id,id)

Column name Data type Constraint Comments References
id bigint NOT NULL Unique Id of the patient
organization_id bigint NOT NULL Owning organisation (i.e. publisher) organization.id
person_id bigint NOT NULL Unique individual across all organisations person.id
title varchar(255) The title of the patient
first_names varchar(255) The first names of the patient
last_name varchar(255) The last name of the patient
gender_concept_id int Reference to the gender of the patient patient.gender.id
nhs_number varchar(255) The NHS number of the patient
date_of_birth date The date of birth of the patient
date_of_death date The date of death of the patient
current_address_id bigint Reference to the current address of the patient
ethnic_code_concept_id int Reference to the ethnicity of the patient
registered_practice_organization_id bigint Reference to the organisation the patient is registered at
birth_year smallint
birth_month tinyint
birth_week tinyint
CONSTRAINT pk_patient_id_organization_id PRIMARY KEY (`organization_id`,`person_id`,`id`),
CONSTRAINT fk_patient_organization_id FOREIGN KEY (organization_id)
REFERENCES organization (id) MATCH SIMPLE

Table: patient_additional

PRIMARY KEY (id, property_id)

Column name Data type Constraint Comments References
id bigint NOT NULL Unique Id of the patient
property_id int NOT NULL IM reference (e.g. cause of death)
value_id int NULL IM reference (e.g. COVID) person.id
json_value json NULL Where there is no mapped value_id, just raw JSON
text_value varchar(255) NULL Where there is no mapped value_id or raw JSON, just a basic text value
CONSTRAINT pk_patient_additional_id PRIMARY KEY (id, property_id)

Table: patient_address

PRIMARY KEY (organization_id,id,patient_id,person_id)

Column name Data type Constraint Comments References
Id bigint NOT NULL Unique Id of the address
organization_id bigint NOT NULL Owning organisation (i.e. publisher) organisation.id
patient_id bigint NOT NULL The organisations record for this person’s registration. Patients may have multiple records across clinical systems and may have registered at an organisation multiple times patient.id
person_id bigint DEFAULT NULL Unique individual across all organisations person.id
address_line_1 varchar(255) DEFAULT NULL The first line of the address
address_line_2 varchar(255) DEFAULT NULL The second line of the address
address_line_3 varchar(255) DEFAULT NULL The third line of the address
address_line_4 varchar(255) DEFAULT NULL The fourth line of the address
city varchar(255) DEFAULT NULL The city
postcode varchar(255) DEFAULT NULL The postcode
use_concept_id int NOT NULL use of address (e.g. home, temporary)
start_date date NOT NULL The start date of this address being relevant
end_date date DEFAULT NULL The end date of this address being relevant
lsoa_2001_code varchar(9) DEFAULT NULL A reference to the LSOA_2001 code
lsoa_2011_code varchar(9) DEFAULT NULL A reference to the LSOA_2011 code
msoa_2001_code varchar(9) DEFAULT NULL A reference to the MSOA_2001 code
msoa_2011_code varchar(9) DEFAULT NULL A reference to the MSOA_2011 code
ward_code varchar(9) DEFAULT NULL The ward the address belongs to
local_authority_code varchar(9) DEFAULT NULL The local authority the address belongs to
CONSTRAINT pk_organization_id_id_patient_id_person_id
PRIMARY KEY (`organization_id`,`id`,`patient_id`,`person_id`)
CONSTRAINT fk_patient_address_patient_id_organization_id
FOREIGN KEY (patient_id, organization_id)
REFERENCES patient (id, organization_id)
COMMENT 'stores address details for patients'

Table: patient_address_match

PRIMARY KEY(id, uprn)

Column name Data type Constraint Comments References
Id bigint(50) NOT NULL Reference to the patient_address table
patient_address_id bigint(20) NOT NULL
Uprn varchar(255) NOT NULL The Unique Propery Reference Number of the address
uprn_ralf00 varchar(255)
Status tinyint(1) DEFAULT NULL Whether the UPRN is active
uprn_property_classification varchar(45) DEFAULT NULL Building type eg flat, pub, house etc
Latitude double DEFAULT NULL The latitude of the UPRN
Longitude double DEFAULT NULL The longitude of the UPRN
uprn_xcoordinate double DEFAULT NULL The x coordinate of the UPRN
uprn_ycoordinate double DEFAULT NULL The y coordinate of the UPRN
qualifier varchar(50) DEFAULT NULL How the match is determined eg equivalent match, near match etc
match_rule varchar(4096) DEFAULT NULL Which algorithm was used to match the address to the UPRN
match_date datetime DEFAULT NULL The date the match was made
abp_address_number varchar(255) DEFAULT NULL The number value of the address in the ABP dictionary
abp_address_street varchar(255) DEFAULT NULL The street value of the address in the ABP dictionary
abp_address_locality varchar(255) DEFAULT NULL The locality value of the address in the ABP dictionary
abp_address_town varchar(255) DEFAULT NULL The town value of the address in the ABP dictionary
abp_address_postcode varchar(10) DEFAULT NULL The postcode value of the address in the ABP dictionary
abp_address_organization varchar(255) DEFAULT NULL The organization value of the address in the ABP dictionary
match_pattern_postcode varchar(255) DEFAULT NULL The qualifier used to match the postcode
match_pattern_street varchar(255) DEFAULT NULL The qualifier used to match the street
match_pattern_number varchar(255) DEFAULT NULL The qualifier used to match the number
match_pattern_building varchar(255) DEFAULT NULL The qualifier used to match the building
match_pattern_flat varchar(255) DEFAULT NULL The qualifier used to match the flat
algorithm_version varchar(255) DEFAULT NULL What version of the algorithm was used to make the match
epoc varchar(255) DEFAULT NULL The version of the ABP files the addresses were matched against
  CONSTRAINT `patient_address_uprn_patient_address_id_fk` FOREIGN KEY (`patient_address_id`) REFERENCES `patient_address` (`id`)

Table: patient_address_ralf

PRIMARY KEY (id, patient_address_id, patient_address_match_uprn_ralf00)

Column name Data type Constraint Comments References
Id bigint NOT NULL
organization_id bigint NOT NULL
patient_id bigint NOT NULL
person_id bigint NOT NULL
patient_address_id bigint NOT NULL
patient_address_match_uprn_ralf00 varchar(255) NOT NULL
salt_name varchar(50) NOT NULL
ralf varchar(255) NOT NULL
CONSTRAINT pk_patient_address_ralf PRIMARY KEY (id, patient_address_id, patient_address_match_uprn_ralf00)
CONSTRAINT fk_patient_address_ralf_organization_id FOREIGN KEY (organization_id) REFERENCES organization (id)
CONSTRAINT fk_patient_address_ralf_patient_id FOREIGN KEY (patient_id) REFERENCES patient (id)
CONSTRAINT fk_patient_address_ralf_person_id FOREIGN KEY (person_id) REFERENCES person (id)
CONSTRAINT fk_patient_address_ralf_patient_address_id FOREIGN KEY (patient_address_id) REFERENCES patient_address (id)

Table: patient_contact

PRIMARY KEY (organization_id,id,patient_id,person_id)

Column name Data type Constraint Comments References
id bigint NOT NULL Unique Id of the patient contact
organization_id bigint NOT NULL Owning organisation (i.e. publisher)
patient_id bigint NOT NULL The organisations record for this person’s registration. Patients may have multiple records across clinical systems and may have registered at an organisation multiple times patient.id
person_id bigint DEFAULT NULL Unique individual across all organisations person.id
use_concept_id int DEFAULT NULL use of contact (e.g. mobile, home,work
type_concept_id int DEFAULT NULL type of contact (e.g. phone, email)
start_date date DEFAULT NULL The start date of the contact being valid
end_date date DEFAULT NULL The end date of the contact being valid
value varchar(255) DEFAULT NULL The value of the contact information eg phone number, email address
CONSTRAINT pk_organization_id_id_patient_id_person_id PRIMARY KEY (`organization_id`,`id`,`patient_id`,`person_id`),
CONSTRAINT fk_patient_contact_patient_id_organisation_id FOREIGN KEY (patient_id, organization_id)
REFERENCES patient (id, organization_id)
COMMENT 'stores contact details (e.g. phone) for patients'

Table: patient_pseudo_id

PRIMARY KEY(organization_id)

Column name Data type Constraint Comments References
Id bigint(20) NOT NULL Unique Id of the patient pseudo id
organization_id bigint(20) NOT NULL Owning organisation (i.e. publisher)
patient_id bigint(20) NOT NULL Reference to the patient this registration status history belongs to
person_id bigint(20) NOT NULL Reference to the person this registration status history belongs to
salt_name varchar(50) NOT NULL The name of the salt used to create the pseudo id
Skid varchar(255) NOT NULL "Secure Key IDentifier" - the pseudonymised ID generated for this patient using the salt specified in the salt_name column. Typically generated from patient NHS number, but is configurable on a case by case basis (e.g. may include date of birth)
is_nhs_number_valid boolean NOT NULL Whether the nhs number is valid
is_nhs_number_verified_by_publisher boolean NOT NULL Whether the nhs number has been verified by the publisher
CONSTRAINT PRIMARY KEY (organization_id)
CONSTRAINT fk_patient_pseudo_id FOREIGN KEY (patient_id, organization_id)
REFERENCES patient (id, organization_id)

Table: patient_uprn

PRIMARY KEY (organization_id,person_id,id)

Column name Data type Constraint Comments References
patient_id bigint(20) NOT NULL The organisations record for this person’s registration. Patients may have multiple records across clinical systems and may have registered at an organisation multiple times patient.id
organization_id bigint(20) NOT NULL Owning organisation (i.e. publisher) organisation.id
person_id bigint(20) NOT NULL Unique individual across all organisations person.id
Uprn bigint DEFAULT NULL
qualifier varchar(50) DEFAULT NULL
algorithm varchar(255) DEFAULT NULL
match varchar(255) DEFAULT NULL
no_address boolean DEFAULT NULL
invalid_address boolean DEFAULT NULL
missing_postcode boolean DEFAULT NULL
invalid_postcode boolean DEFAULT NULL
CONSTRAINT pk_patient_id_organization_id PRIMARY KEY (`organization_id`,`person_id`,`patient_id`),
CONSTRAINT fk_patient_uprn_patient_id_organisation_id FOREIGN KEY (patient_id, organization_id)
REFERENCES patient (id, organization_id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION

Table: person

PRIMARY KEY (id)

Column name Data type Constraint Comments References
id bigint NOT NULL Unique Id of the person
organization_id bigint NOT NULL Owning organisation (i.e. publisher)
title varchar(255) DEFAULT NULL The title of the person
first_names varchar(255) DEFAULT NULL The first names of the person
last_name varchar(255) DEFAULT NULL The last name of the person
gender_concept_id int DEFAULT NULL Reference to the gender of the person
nhs_number varchar(255) DEFAULT NULL The NHS number of the person
date_of_birth date, date DEFAULT NULL The date of birth of the person
date_of_death date, date DEFAULT NULL The date of death of the person
current_address_id, bigint NOT NULL Reference to the current address of the person
ethnic_code_concept_id int DEFAULT NULL Reference to the ethnicity of the person
registered_practice_organization_id bigint DEFAULT NULL Reference to the organisation the person is registered at
birth_year smallint DEFAULT NULL
birth_month tinyint DEFAULT NULL
birth_week tinyint DEFAULT NULL
CONSTRAINT pk_person_id PRIMARY KEY (id)

Table: practitioner

PRIMARY KEY (id)

Column name Data type Constraint Comments References
id bigint NOT NULL Unique Id of the practitioner
organization_id bigint NOT NULL Owning organisation (i.e. publisher) organisation.id
name varchar(1024) DEFAULT NULL Name of the practitioner
role_code varchar(50) DEFAULT NULL The code representing the role of the practitioner
role_desc varchar(255) DEFAULT NULL Textual description of the role of the practitioner eg General Medical Practitioner
gmc_code varchar(50) DEFAULT NULL The GMC code of the practitioner
CONSTRAINT pk_practitioner_id PRIMARY KEY (id),
CONSTRAINT fk_practitioner_organisation_id FOREIGN KEY (organization_id)
REFERENCES organization (id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION

Table: procedure_request

PRIMARY KEY (organization_id,person_id,id)

Column name Data type Constraint Comments References
id bigint(20) NOT NULL Unique Id of the procedure
organization_id bigint(20) NOT NULL Owning organisation (i.e. publisher) organization.id
patient_id bigint(20) NOT NULL The organisations record for this person’s registration. Patients may have multiple records across clinical systems and may have registered at an organisation multiple times patient.id
person_id bigint(20) NOT NULL Unique individual across all organisations person.id
encounter_id bigint(20) DEFAULT NULL Reference to the encounter the procedure was administered at encounter.id
practitioner_id bigint(20) DEFAULT NULL The clinician the activity is recorded against practitioner.id
clinical_effective_date date DEFAULT NULL The date the procedure was administered by a clinician
date_precision_concept_id int DEFAULT NULL Identifies the precision of the clinical effectiveness date to either year (1) month (2) day (5) minute (12) second (13) millisecond (14)
status_concept_id int DEFAULT NULL Reference to the status of the procedure
core_concept_id int DEFAULT NULL Reference to the clinical coding of the procedure
non_core_concept_id int DEFAULT NULL Reference to the clinical coding of the procedure
age_at_event decimal(5,2) DEFAULT NULL The age of the patient at the time of the procedure
date_recorded datetime DEFAULT NULL The date the procedure was recorded in the source system
CONSTRAINT pk_procedure_request_id PRIMARY KEY (`organization_id`,`person_id`,`id`),
/*got an Emis procedure request referring to a confidential encounter, so can't enforce this
CONSTRAINT fk_procedure_request_encounter_id FOREIGN KEY (encounter_id)
REFERENCES encounter (id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION,*/
CONSTRAINT fk_procedure_request_patient_id_organization_id FOREIGN KEY (patient_id, organization_id)
REFERENCES patient (id, organization_id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION,
CONSTRAINT fk_procedure_request_practitioner_id FOREIGN KEY (practitioner_id)
REFERENCES practitioner (id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION

Table: pseudo_id

PRIMARY KEY (patient_id, salt_key_name)

Column name Data type Constraint Comments References
Id bigint NOT NULL Unique Id of the pseudo Id
patient_id bigint NOT NULL Reference to the patient the pseudo Id belongs to
salt_key_name varchar(50) NOT NULL The name of the salt key used to create the pseudo id
pseudo_id varchar(255) DEFAULT NULL The pseudo id
CONSTRAINT pk_pseudo_id PRIMARY KEY (patient_id, salt_key_name)

Table: referral_request

PRIMARY KEY (organization_id,person_id,id)

Column name Data type Constraint Comments References
id bigint(20) NOT NULL Unique Id of the referral
organization_id bigint(20) NOT NULL Owning organisation (i.e. publisher) organization.id
patient_id bigint(20) NOT NULL The organisations record for this person’s registration. Patients may have multiple records across clinical systems and may have registered at an organisation multiple times patient.id
person_id bigint(20) NOT NULL Unique individual across all organisations person.id
encounter_id bigint(20) DEFAULT NULL Reference to the encounter the referral was made in encounter.id
practitioner_id bigint(20) DEFAULT NULL The clinician the activity is recorded against practitioner.id
clinical_effective_date date DEFAULT NULL The date the referral was made
date_precision_concept_id smallint(6) DEFAULT NULL Identifies the precision of the clinical effectiveness date to either year (1) month (2) day (5) minute (12) second (13) millisecond (14)
requester_organization_id bigint(20) DEFAULT NULL Reference to the organisation that made the refereral request
recipient_organization_id bigint(20) DEFAULT NULL Reference to the organization receiving the referral
referral_request_priority_concept_id smallint(6) DEFAULT NULL Reference to the priority of the referral referral.request.priority
referral_request_type_concept_id int DEFAULT NULL Reference to the type of referral request referral.request.type
Mode varchar(50) DEFAULT NULL The mode of the referral
outgoing_referral boolean DEFAULT NULL Whether this is an outgoing referral
is_review boolean DEFAULT NULL Whether this referral is a review
core_concept_id int DEFAULT NULL Reference to the clinical coding of the referral
non_core_concept_id int DEFAULT NULL Reference to the clinical coding of the referral
age_at_event decimal(5,2) DEFAULT NULL The age of the patient at the time of the referral
date_recorded datetime DEFAULT NULL The date the referral request was added to the source system
CONSTRAINT pk_referral_request_id PRIMARY KEY (`organization_id`,`person_id`,`id`),
/*got an Emis referral request referring to a confidential encounter, so can't enforce this
CONSTRAINT fk_referral_request_encounter_id FOREIGN KEY (encounter_id)
REFERENCES encounter (id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION,*/
CONSTRAINT fk_referral_request_patient_id_organization_id FOREIGN KEY (patient_id, organization_id)
REFERENCES patient (id, organization_id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION,
CONSTRAINT fk_referral_request_practitioner_id FOREIGN KEY (practitioner_id)
REFERENCES practitioner (id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION,
CONSTRAINT fk_referral_request_recipient_organization_id FOREIGN KEY (recipient_organization_id)
REFERENCES organization (id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION,
CONSTRAINT fk_referral_request_requester_organization_id FOREIGN KEY (requester_organization_id)
REFERENCES organization (id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION

Table: registration_status_history

PRIMARY KEY(organization_id,id,patient_id,person_id)

Column name Data type Constraint Comments References
Id bigint(20) NOT NULL Unique Id of the registration status history
organization_id bigint(20) NOT NULL Owning organisation (i.e. publisher)
patient_id bigint(20) NOT NULL Reference to the patient this registration status history belongs to
person_id bigint(20) NOT NULL Reference to the person this registration status history belongs to
episode_of_care_id bigint(20) DEFAULT NULL Reference to the episode of care this status history belongs to
registration_status_concept_id int(11) DEFAULT NULL Reference to the registration status
start_date datetime DEFAULT NULL The start date for the period this registration status history was valid
end_date datetime DEFAULT NULL The end date for the period this registration status history was valid
PRIMARY KEY (organization_id,id,patient_id,person_id)
CONSTRAINT fk_registration_status_history_episode_id FOREIGN KEY (episode_of_care_id)

Table: schedule

PRIMARY KEY (organization_id, id)

Column name Data type Constraint Comments References
id bigint NOT NULL Unique Id of the schedule
organization_id bigint NOT NULL Owning organisation (i.e. publisher) organization.id
practitioner_id bigint DEFAULT NULL Reference to the practitioner who owns the schedule practitioner.id
start_date date DEFAULT NULL The start date of the schedule
type varchar(255) DEFAULT NULL The type of schedule eg Timed Appointments
Location varchar(255) DEFAULT NULL Textual description of the location the schedule was held at location.id
Name varchar(150) DEFAULT NULL The name of the schedule
CONSTRAINT pk_schedule_id PRIMARY KEY (organization_id, id),
CONSTRAINT fk_schedule_organization_id FOREIGN KEY (organization_id)
REFERENCES organization (id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION