Remote Subscriber Database (RSD) Schema (Compass 2): Difference between revisions
No edit summary |
|||
(9 intermediate revisions by the same user not shown) | |||
Line 45: | Line 45: | ||
|- | |- | ||
|clinical_effective_date | |clinical_effective_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 | ||
| | |bigint | ||
|NOT NULL | |NOT NULL | ||
|Owning organisation (i.e. publisher) | |Owning organisation (i.e. publisher) | ||
Line 129: | Line 129: | ||
|- | |- | ||
|patient_id | |patient_id | ||
| | |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 | ||
|} | |} | ||
Line 260: | Line 236: | ||
|'''References''' | |'''References''' | ||
|- | |- | ||
| | |dbid | ||
|int(11) | |int(11) | ||
|NOT NULL | |NOT NULL | ||
Line 314: | Line 290: | ||
| | | | ||
|- | |- | ||
|updated | |updated | ||
|datetime | |datetime | ||
|NOT NULL | |NOT NULL | ||
Line 324: | Line 300: | ||
== Table: concept_map == | == Table: concept_map == | ||
PRIMARY KEY ( | 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: | ||
| | | | ||
|- | |- | ||
| | |id | ||
|int(11) | |||
| | |||
| | |||
|int(11) | |||
| | |||
| | |||
| | | | ||
|- | |- | ||
| | |deleted | ||
| | |tinyint(1) | ||
| | | | ||
| | | | ||
| | | | ||
|- | |- | ||
| | | colspan="5" |CONSTRAINT PRIMARY KEY (id) | ||
| | |||
|} | |} | ||
== Table: | == Table: diagnostic_order == | ||
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 400: | Line 350: | ||
|'''References''' | |'''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 | |DEFAULT NULL | ||
| | |Reference to the encounter the observation was recorded at | ||
| | | | ||
|- | |- | ||
| | |practitioner_id | ||
| | |bigint | ||
|DEFAULT NULL | |DEFAULT NULL | ||
|The | |The clinician the activity is recorded against | ||
| | | | ||
|- | |- | ||
| | |clinical_effective_date | ||
| | |date | ||
|DEFAULT NULL | |DEFAULT NULL | ||
| | |The date the diagnostic order was identified by a clinician | ||
| | | | ||
|- | |- | ||
| | |date_precision_concept_id | ||
| | |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) | ||
| | | | ||
|- | |||
|result_value | |||
|real | |||
|- | |||
| | |||
| | |||
|DEFAULT NULL | |DEFAULT NULL | ||
| | |The value of the result of the observation | ||
| | | | ||
|- | |- | ||
| | |result_value_units | ||
|varchar( | |varchar(50) | ||
|DEFAULT NULL | |DEFAULT NULL | ||
| | |The units of the result of the observation | ||
| | | | ||
|- | |- | ||
| | |result_date | ||
| | |date | ||
|DEFAULT NULL | |DEFAULT NULL | ||
|The | |The date of the result | ||
| | | | ||
|- | |- | ||
| | |result_text | ||
| | |text | ||
|DEFAULT NULL | |DEFAULT NULL | ||
| | |Any text associated with the result | ||
| | | | ||
|- | |- | ||
| | |result_concept_id | ||
| | |int | ||
|DEFAULT NULL | |DEFAULT NULL | ||
| | |Reference to the clinical coding of the result | ||
| | | | ||
|- | |- | ||
| | |is_problem | ||
| | |boolean | ||
|NOT NULL | |NOT NULL | ||
| | |Whether the observation is marked as a problem | ||
| | | | ||
|- | |- | ||
| | |is_review | ||
| | |boolean | ||
|NOT NULL | |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 | |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 | |DEFAULT NULL | ||
|Reference to the | |Reference to the clinical coding of the observation | ||
| | | | ||
|- | |- | ||
| | |age_at_event | ||
| | |decimal (5,2) | ||
|DEFAULT NULL | |DEFAULT NULL | ||
|The | |The age of the patient at the time of the observation | ||
| | | | ||
|- | |- | ||
| | |episodicity_concept_id | ||
| | |int | ||
|DEFAULT NULL | |DEFAULT NULL | ||
| | |Reference to the episodicity of the problem eg First, review, flare | ||
| | | | ||
|- | |- | ||
| | |is_primary | ||
| | |boolean | ||
|DEFAULT NULL | |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" |CONSTRAINT fk_diagnostic_order_encounter_id FOREIGN KEY (encounter_id) | ||
| | |||
| | |||
|- | |- | ||
| | | 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) | |||
{| class="wikitable sortable mw-collapsible mw-collapsed" | |||
|'''Column name''' | |||
|'''Data type''' | |||
|'''Constraint''' | |||
|'''Comments''' | |||
|'''References''' | |||
|- | |||
|id | |||
|bigint | |||
|NOT NULL | |NOT NULL | ||
| | |Unique Id of the encounter | ||
| | | | ||
|- | |- | ||
| | |organization_id | ||
| | |bigint | ||
|NOT NULL | |NOT NULL | ||
| | |Owning organisation (i.e. publisher) | ||
| | | | ||
|- | |- | ||
| | |patient_id | ||
| | |bigint | ||
| | |NOT NULL | ||
|The | |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 | |bigint | ||
| | |NOT NULL | ||
| | |Unique individual across all organisations | ||
| | | | ||
|- | |- | ||
| | |practitioner_id | ||
| | |bigint | ||
|DEFAULT NULL | |DEFAULT NULL | ||
| | |The clinician the activity is recorded against | ||
| | | | ||
|- | |- | ||
| | |appointment_id | ||
| | |bigint | ||
|DEFAULT NULL | |DEFAULT NULL | ||
|Reference to the | |Reference to the appointment this encounter took part on | ||
| | | | ||
|- | |- | ||
| | |clinical_effective_date | ||
| | |date | ||
|DEFAULT NULL | |DEFAULT NULL | ||
|The | |The date the clinical code is recorded for | ||
| | | | ||
|- | |- | ||
| | | | ||
date_precision_concept_id | |||
|int | |int | ||
|DEFAULT NULL | |DEFAULT NULL | ||
|Reference to the | |Reference to the precision of the date of the encounter | ||
| | | | ||
|- | |- | ||
| | |episode_of_care_id | ||
| | |bigint | ||
|DEFAULT NULL | |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 | ||
| | | | ||
|- | |- | ||
| | | colspan="5" | | ||
CONSTRAINT pk_encounter_id PRIMARY KEY (organization_id,person_id,id), | |||
| | |||
|- | |- | ||
| | | colspan="5" |CONSTRAINT fk_encounter_appointment_id FOREIGN KEY (appointment_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" |ON UPDATE NO ACTION ON DELETE NO ACTION, | ||
| | |||
|- | |- | ||
| | | colspan="5" |CONSTRAINT fk_encounter_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_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_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_additional == | ||
PRIMARY KEY (id, property_id, value_id) | |||
{| class="wikitable sortable mw-collapsible mw-collapsed" | |||
|'''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) | ||
| | | | ||
|- | |- | ||
| colspan="5" | | |text_value | ||
|varchar(255) | |||
|NULL | |||
|where there is no mapped value_id, or raw JSON, just a basic text value (i.e. FIN number) | |||
| | |||
|- | |||
| 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 | |||
|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 | |bigint | ||
| | |DEFAULT NULL | ||
| | |Reference to the episode of care this encounter belongs to | ||
| | | | ||
|- | |- | ||
| | |service_provider_organization_id | ||
|bigint | |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 | |DEFAULT NULL | ||
|The | |The end date of the encounter | ||
| | | | ||
|- | |- | ||
| | |institution_location_id | ||
|bigint | |bigint | ||
|DEFAULT NULL | |DEFAULT NULL | ||
|Reference to the | |Reference to the institution the encounter took place at | ||
| | | | ||
|- | |- | ||
| | |date_recorded | ||
|datetime | |datetime | ||
|DEFAULT NULL | |DEFAULT NULL | ||
|The date the encounter | |The date the encounter was recorded | ||
| | | | ||
|- | |- | ||
| | |finished | ||
| | |boolean | ||
|DEFAULT NULL | |DEFAULT NULL | ||
| | |Whether the encounter is finished | ||
| | | | ||
|- | |- | ||
| | | colspan="5" |CONSTRAINT pk_encounter_event_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" |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" |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 | ||
Line 1,067: | Line 910: | ||
| | | | ||
|- | |- | ||
|date_registered | |date_registered | ||
|date | |date | ||
|DEFAULT NULL | |DEFAULT NULL | ||
Line 1,073: | Line 916: | ||
| | | | ||
|- | |- | ||
|date_registered_end | |date_registered_end | ||
|date | |date | ||
|DEFAULT NULL | |DEFAULT NULL | ||
Line 1,098: | Line 941: | ||
|- | |- | ||
| colspan="5" |ON UPDATE NO ACTION ON DELETE NO ACTION | | colspan="5" |ON UPDATE NO ACTION ON DELETE NO ACTION | ||
|} | |} | ||
Line 1,197: | Line 1,016: | ||
|- | |- | ||
|date_precision_concept_id | |date_precision_concept_id | ||
| | |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) | ||
Line 1,203: | Line 1,022: | ||
|- | |- | ||
|is_active | |is_active | ||
| | |boolean | ||
|NOT NULL | |NOT NULL | ||
|Whether the flag is active or not | |Whether the flag is active or not | ||
Line 1,475: | Line 1,294: | ||
|- | |- | ||
|date_precision_concept_id | |date_precision_concept_id | ||
| | |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) | ||
Line 1,481: | Line 1,300: | ||
|- | |- | ||
|is_active | |is_active | ||
| | |boolean | ||
|DEFAULT NULL | |DEFAULT NULL | ||
|Whether the medication is active or not | |Whether the medication is active or not | ||
Line 1,499: | Line 1,318: | ||
|- | |- | ||
|quantity_value | |quantity_value | ||
| | |real | ||
|DEFAULT NULL | |DEFAULT NULL | ||
|The value of the medication that was prescribed eg 50 | |The value of the medication that was prescribed eg 50 | ||
Line 1,619: | Line 1,438: | ||
|- | |- | ||
|date_precision_concept_id | |date_precision_concept_id | ||
| | |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) | ||
Line 1,625: | Line 1,444: | ||
|- | |- | ||
|result_value | |result_value | ||
| | |rea | ||
|DEFAULT NULL | |DEFAULT NULL | ||
|The value of the result of the observation | |The value of the result of the observation | ||
Line 1,649: | Line 1,468: | ||
|- | |- | ||
|result_concept_id | |result_concept_id | ||
| | |int | ||
|DEFAULT NULL | |DEFAULT NULL | ||
|Reference to the clinical coding of the result | |Reference to the clinical coding of the result | ||
Line 1,655: | Line 1,474: | ||
|- | |- | ||
|is_problem | |is_problem | ||
| | |boolean | ||
|NOT NULL | |NOT NULL | ||
|Whether the observation is marked as a problem | |Whether the observation is marked as a problem | ||
Line 1,661: | Line 1,480: | ||
|- | |- | ||
|is_review | |is_review | ||
| | |boolean | ||
|NOT NULL | |NOT NULL | ||
|Whether the observation is a review of an existing problem | |Whether the observation is a review of an existing problem | ||
Line 1,735: | Line 1,554: | ||
|} | |} | ||
== Table: organization == | == Table: observation_additional == | ||
PRIMARY KEY (pk_organization_id PRIMARY KEY (id)) | PRIMARY KEY (id, property_id) | ||
{| class="wikitable sortable mw-collapsible mw-collapsed" | |||
|'''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 | |||
| | |||
|- | |||
| 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" | {| class="wikitable sortable mw-collapsible mw-collapsed" | ||
|'''Column name''' | |'''Column name''' | ||
Line 1,789: | Line 1,650: | ||
|} | |} | ||
== Table: | == Table: organization_metadata == | ||
PRIMARY KEY ( | PRIMARY KEY (id, publishing_software) | ||
{| class="wikitable sortable mw-collapsible mw-collapsed" | {| class="wikitable sortable mw-collapsible mw-collapsed" | ||
|'''Column name''' | |'''Column name''' | ||
Line 1,801: | Line 1,662: | ||
|bigint | |bigint | ||
|NOT NULL | |NOT NULL | ||
|Unique Id of the patient | |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 | |||
| | |||
|- | |||
| colspan="5" |CONSTRAINT pk_organization_metadata PRIMARY KEY (id, publishing_software) | |||
|} | |||
== Table: patient == | |||
PRIMARY KEY (organization_id,person_id,id) | |||
{| class="wikitable sortable mw-collapsible mw-collapsed" | |||
|'''Column name''' | |||
|'''Data type''' | |||
|'''Constraint''' | |||
|'''Comments''' | |||
|'''References''' | |||
|- | |||
|id | |||
|bigint | |||
|NOT NULL | |||
|Unique Id of the patient | |||
| | | | ||
|- | |- | ||
Line 1,817: | Line 1,714: | ||
|- | |- | ||
|title | |title | ||
|varchar( | |varchar(255) | ||
| | | | ||
|The title of the patient | |The title of the patient | ||
Line 1,876: | Line 1,773: | ||
| | | | ||
|- | |- | ||
| colspan="5" |CONSTRAINT pk_patient_id_organization_id PRIMARY KEY (`organization_id`,`person_id`,`id`), | |birth_year | ||
|- | |smallint | ||
| | |||
| | |||
| | |||
|- | |||
|birth_month | |||
|tinyint | |||
| | |||
| | |||
| | |||
|- | |||
|birth_week | |||
|tinyint | |||
| | |||
| | |||
| | |||
|- | |||
| 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" |CONSTRAINT fk_patient_organization_id FOREIGN KEY (organization_id) | ||
|- | |- | ||
Line 1,883: | Line 1,798: | ||
|} | |} | ||
== Table: | == Table: patient_additional == | ||
PRIMARY KEY ( | 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,892: | Line 1,807: | ||
|'''References''' | |'''References''' | ||
|- | |- | ||
| | |id | ||
|bigint | |bigint | ||
|NOT NULL | |NOT NULL | ||
|Unique Id of the | |Unique Id of the patient | ||
| | | | ||
|- | |- | ||
| | |property_id | ||
| | |int | ||
|NOT NULL | |NOT NULL | ||
| | |IM reference (e.g. cause of death) | ||
| | | | ||
|- | |- | ||
|patient_id | |value_id | ||
|bigint | |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 | |||
| | |||
|- | |||
| colspan="5" |CONSTRAINT pk_patient_additional_id PRIMARY KEY (id, property_id) | |||
|} | |||
== 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''' | |||
|- | |||
|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 | |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,959: | Line 1,916: | ||
|- | |- | ||
|start_date | |start_date | ||
| | |date | ||
|NOT NULL | |NOT NULL | ||
|The start date of this address being relevant | |The start date of this address being relevant | ||
Line 1,965: | Line 1,922: | ||
|- | |- | ||
|end_date | |end_date | ||
| | |date | ||
|DEFAULT NULL | |DEFAULT NULL | ||
|The end date of this address being relevant | |The end date of this address being relevant | ||
Line 2,029: | Line 1,986: | ||
|- | |- | ||
|Id | |Id | ||
|bigint( | |bigint(50) | ||
|NOT NULL | |NOT NULL | ||
|Reference to the patient_address table | |Reference to the patient_address table | ||
| | |||
|- | |||
|patient_address_id | |||
|bigint(20) | |||
|NOT NULL | |||
| | |||
| | | | ||
|- | |- | ||
Line 2,038: | Line 2,001: | ||
|NOT NULL | |NOT NULL | ||
|The Unique Propery Reference Number of the address | |The Unique Propery Reference Number of the address | ||
| | |||
|- | |||
|uprn_ralf00 | |||
|varchar(255) | |||
| | |||
| | |||
| | | | ||
|- | |- | ||
|Status | |Status | ||
| | |tinyint(1) | ||
|DEFAULT NULL | |DEFAULT NULL | ||
|Whether the UPRN is active | |Whether the UPRN is active | ||
| | | | ||
|- | |- | ||
| | |uprn_property_classification | ||
|varchar(45) | |varchar(45) | ||
|DEFAULT NULL | |DEFAULT NULL | ||
Line 2,064: | Line 2,033: | ||
| | | | ||
|- | |- | ||
| | |uprn_xcoordinate | ||
|double | |double | ||
|DEFAULT NULL | |DEFAULT NULL | ||
Line 2,070: | Line 2,039: | ||
| | | | ||
|- | |- | ||
| | |uprn_ycoordinate | ||
|double | |double | ||
|DEFAULT NULL | |DEFAULT NULL | ||
Line 2,076: | Line 2,045: | ||
| | | | ||
|- | |- | ||
| | |qualifier | ||
|varchar(50) | |varchar(50) | ||
|DEFAULT NULL | |DEFAULT NULL | ||
Line 2,082: | Line 2,051: | ||
| | | | ||
|- | |- | ||
| | |match_rule | ||
|varchar( | |varchar(4096) | ||
|DEFAULT NULL | |DEFAULT NULL | ||
|Which algorithm was used to match the address to the UPRN | |Which algorithm was used to match the address to the UPRN | ||
Line 2,113: | Line 2,082: | ||
|- | |- | ||
|abp_address_town | |abp_address_town | ||
|varchar( | |varchar(255) | ||
|DEFAULT NULL | |DEFAULT NULL | ||
|The town value of the address in the ABP dictionary | |The town value of the address in the ABP dictionary | ||
Line 2,166: | Line 2,135: | ||
| | | | ||
|- | |- | ||
| | |epoc | ||
|varchar(255) | |varchar(255) | ||
|DEFAULT NULL | |DEFAULT NULL | ||
Line 2,172: | Line 2,141: | ||
| | | | ||
|- | |- | ||
| colspan="5" |CONSTRAINT | | colspan="5" | CONSTRAINT `patient_address_uprn_patient_address_id_fk` FOREIGN KEY (`patient_address_id`) REFERENCES `patient_address` (`id`) | ||
|} | |} | ||
== Table: | == Table: patient_address_ralf == | ||
PRIMARY KEY ( | 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,184: | Line 2,153: | ||
|'''References''' | |'''References''' | ||
|- | |- | ||
| | |Id | ||
|bigint | |bigint | ||
|NOT NULL | |NOT NULL | ||
| | | | ||
| | | | ||
|- | |- | ||
Line 2,193: | Line 2,162: | ||
|bigint | |bigint | ||
|NOT NULL | |NOT NULL | ||
| | | | ||
| | | | ||
|- | |- | ||
Line 2,199: | Line 2,168: | ||
|bigint | |bigint | ||
|NOT NULL | |NOT NULL | ||
| | | | ||
| | | | ||
|- | |- | ||
|person_id | |person_id | ||
|bigint | |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) | |varchar(255) | ||
| | |NOT NULL | ||
| | | | ||
| | | | ||
|- | |- | ||
| colspan="5" |CONSTRAINT | | colspan="5" |CONSTRAINT pk_patient_address_ralf PRIMARY KEY (id, patient_address_id, patient_address_match_uprn_ralf00) | ||
|- | |||
| colspan="5" |CONSTRAINT fk_patient_address_ralf_organization_id FOREIGN KEY (organization_id) REFERENCES organization (id) | |||
|- | |- | ||
| colspan="5" |CONSTRAINT | | colspan="5" |CONSTRAINT fk_patient_address_ralf_patient_id FOREIGN KEY (patient_id) REFERENCES patient (id) | ||
|- | |- | ||
| colspan="5" |REFERENCES | | colspan="5" |CONSTRAINT fk_patient_address_ralf_person_id FOREIGN KEY (person_id) REFERENCES person (id) | ||
|- | |- | ||
| colspan="5" | | | colspan="5" |CONSTRAINT fk_patient_address_ralf_patient_address_id FOREIGN KEY (patient_address_id) REFERENCES patient_address (id) | ||
|} | |} | ||
== Table: | == Table: patient_contact == | ||
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,256: | Line 2,221: | ||
|'''References''' | |'''References''' | ||
|- | |- | ||
| | |id | ||
| | |bigint | ||
|NOT NULL | |NOT NULL | ||
|Unique Id of the patient contact | |||
|Unique Id of the patient | |||
| | | | ||
|- | |- | ||
|organization_id | |organization_id | ||
|bigint | |bigint | ||
|NOT NULL | |NOT NULL | ||
|Owning organisation (i.e. | |Owning organisation (i.e. publisher) | ||
| | | | ||
|- | |- | ||
|patient_id | |patient_id | ||
|bigint | |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 | ||
| | |patient.id | ||
|- | |- | ||
|person_id | |person_id | ||
|bigint | |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 | |||
| | | | ||
|- | |- | ||
| colspan="5" |CONSTRAINT PRIMARY KEY (organization_id) | | 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: | == Table: patient_pseudo_id == | ||
PRIMARY KEY (organization_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,340: | Line 2,293: | ||
|'''References''' | |'''References''' | ||
|- | |- | ||
| | |Id | ||
|bigint(20) | |bigint(20) | ||
|NOT NULL | |NOT NULL | ||
| | |Unique Id of the patient pseudo id | ||
| | | | ||
|- | |- | ||
|organization_id | |organization_id | ||
|bigint(20) | |bigint(20) | ||
|NOT NULL | |NOT NULL | ||
|Owning organisation (i.e. publisher) | |Owning organisation (i.e. publisher) | ||
| | | | ||
|- | |||
|patient_id | |||
|bigint(20) | |||
|NOT NULL | |||
|Reference to the patient this registration status history belongs to | |||
| | |||
|- | |- | ||
|person_id | |person_id | ||
|bigint(20) | |bigint(20) | ||
|NOT NULL | |NOT NULL | ||
| | |Reference to the person this registration status history belongs to | ||
| | | | ||
|- | |- | ||
| | |salt_name | ||
|varchar(50) | |varchar(50) | ||
| | |NOT NULL | ||
| | |The name of the salt used to create the pseudo id | ||
| | | | ||
|- | |- | ||
| | |Skid | ||
|varchar(255) | |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 | ||
| | | | ||
|- | |- | ||
| | | colspan="5" |CONSTRAINT PRIMARY KEY (organization_id) | ||
| | |||
|- | |- | ||
| | | colspan="5" |CONSTRAINT fk_patient_pseudo_id FOREIGN KEY (patient_id, organization_id) | ||
| | |||
|- | |- | ||
| colspan="5" |REFERENCES patient (id, organization_id) | |||
| colspan="5" |REFERENCES patient (id, organization_id) | |||
|} | |} | ||
== Table: | == 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,424: | Line 2,357: | ||
|'''References''' | |'''References''' | ||
|- | |- | ||
| | |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 | ||
| | |patient.id | ||
|- | |- | ||
|organization_id | |organization_id | ||
|bigint | |bigint(20) | ||
|NOT NULL | |||
|Owning organisation (i.e. publisher) | |||
|organisation.id | |||
|- | |||
|person_id | |||
|bigint(20) | |||
|NOT NULL | |NOT NULL | ||
| | |Unique individual across all organisations | ||
| | |person.id | ||
|- | |- | ||
| | |Uprn | ||
| | |bigint | ||
|DEFAULT NULL | |DEFAULT NULL | ||
| | | | ||
| | | | ||
|- | |- | ||
| | |qualifier | ||
|varchar( | |varchar(50) | ||
|DEFAULT NULL | |DEFAULT NULL | ||
| | | | ||
| | | | ||
|- | |- | ||
| | |algorithm | ||
|varchar(255) | |varchar(255) | ||
|DEFAULT NULL | |DEFAULT NULL | ||
| | | | ||
| | | | ||
|- | |- | ||
| | |match | ||
|varchar(255) | |varchar(255) | ||
|DEFAULT NULL | |DEFAULT NULL | ||
| | | | ||
| | | | ||
|- | |- | ||
| | |no_address | ||
| | |boolean | ||
|DEFAULT NULL | |DEFAULT NULL | ||
| | | | ||
| | | | ||
|- | |- | ||
| | |invalid_address | ||
| | |boolean | ||
|DEFAULT NULL | |DEFAULT NULL | ||
| | | | ||
| | | | ||
|- | |- | ||
| | |missing_postcode | ||
| | |boolean | ||
|DEFAULT NULL | |DEFAULT NULL | ||
| | | | ||
| | | | ||
|- | |- | ||
| | |invalid_postcode | ||
| | |boolean | ||
|DEFAULT NULL | |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" | | | colspan="5" |ON UPDATE NO ACTION ON DELETE NO ACTION | ||
|} | |} | ||
== Table: | == Table: person == | ||
PRIMARY KEY (id) | PRIMARY KEY (id) | ||
{| class="wikitable sortable mw-collapsible mw-collapsed" | {| class="wikitable sortable mw-collapsible mw-collapsed" | ||
Line 2,529: | Line 2,444: | ||
|bigint | |bigint | ||
|NOT NULL | |NOT NULL | ||
|Unique Id of the | |Unique Id of the person | ||
| | | | ||
|- | |- | ||
Line 2,536: | Line 2,451: | ||
|NOT NULL | |NOT NULL | ||
|Owning organisation (i.e. publisher) | |Owning organisation (i.e. publisher) | ||
| | | | ||
|- | |- | ||
| | |title | ||
|varchar( | |varchar(255) | ||
|DEFAULT NULL | |DEFAULT NULL | ||
| | |The title of the person | ||
| | | | ||
|- | |- | ||
| | |first_names | ||
|varchar( | |varchar(255) | ||
|DEFAULT NULL | |DEFAULT NULL | ||
|The | |The first names of the person | ||
| | | | ||
|- | |- | ||
| | |last_name | ||
|varchar(255) | |varchar(255) | ||
|DEFAULT NULL | |DEFAULT NULL | ||
| | |The last name of the person | ||
| | | | ||
|- | |- | ||
| | |gender_concept_id | ||
| | |int | ||
|DEFAULT NULL | |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 | |||
|bigint | |||
|NOT NULL | |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 | |bigint | ||
| | |DEFAULT NULL | ||
| | |Reference to the organisation the person is registered at | ||
| | | | ||
|- | |- | ||
| | |birth_year | ||
| | |smallint | ||
|DEFAULT NULL | |DEFAULT NULL | ||
| | | | ||
| | | | ||
|- | |- | ||
| | |birth_month | ||
| | |tinyint | ||
|DEFAULT NULL | |DEFAULT NULL | ||
| | | | ||
| | | | ||
|- | |- | ||
| | |birth_week | ||
| | |tinyint | ||
|DEFAULT NULL | |DEFAULT NULL | ||
| | | | ||
| | | | ||
|- | |- | ||
| | | colspan="5" |CONSTRAINT pk_person_id PRIMARY KEY (id) | ||
| | |} | ||
| | |||
| | == Table: practitioner == | ||
PRIMARY KEY (id) | |||
{| class="wikitable sortable mw-collapsible mw-collapsed" | |||
|'''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 | |DEFAULT NULL | ||
| | |Name of the practitioner | ||
| | | | ||
|- | |- | ||
| | |role_code | ||
| | |varchar(50) | ||
|DEFAULT NULL | |DEFAULT NULL | ||
| | |The code representing the role of the practitioner | ||
| | | | ||
|- | |- | ||
| | |role_desc | ||
| | |varchar(255) | ||
|DEFAULT NULL | |DEFAULT NULL | ||
| | |Textual description of the role of the practitioner eg General Medical Practitioner | ||
| | | | ||
|- | |- | ||
| | |gmc_code | ||
| | |varchar(50) | ||
|DEFAULT NULL | |DEFAULT NULL | ||
|The | |The GMC code of the practitioner | ||
| | | | ||
|- | |- | ||
| colspan="5" |CONSTRAINT | | colspan="5" |CONSTRAINT pk_practitioner_id PRIMARY KEY (id), | ||
|- | |- | ||
| colspan="5" | | | colspan="5" |CONSTRAINT fk_practitioner_organisation_id FOREIGN KEY (organization_id) | ||
|- | |- | ||
| colspan="5" |REFERENCES organization (id) MATCH SIMPLE | |||
| colspan="5" |REFERENCES | |||
|- | |- | ||
| colspan="5" |ON UPDATE NO ACTION ON DELETE NO ACTION | | colspan="5" |ON UPDATE NO ACTION ON DELETE NO ACTION | ||
|} | |} | ||
== Table: | == Table: procedure_request == | ||
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,690: | Line 2,597: | ||
|'''References''' | |'''References''' | ||
|- | |- | ||
| | |id | ||
| | |bigint(20) | ||
|NOT NULL | |NOT NULL | ||
|Unique Id of the procedure | |Unique Id of the procedure | ||
| | | | ||
|- | |- | ||
| | |organization_id | ||
| | |bigint(20) | ||
|NOT NULL | |NOT NULL | ||
| | |Owning organisation (i.e. publisher) | ||
| | |organization.id | ||
|- | |- | ||
| | |patient_id | ||
| | |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 | ||
| | |patient.id | ||
|- | |- | ||
| | |person_id | ||
|bigint | |bigint(20) | ||
|NOT NULL | |NOT NULL | ||
|Reference to the | |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 | |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 | |The date the procedure was recorded in the source system | ||
| | | | ||
|- | |||
| colspan="5" |CONSTRAINT pk_procedure_request_id PRIMARY KEY (`organization_id`,`person_id`,`id`), | |||
|- | |- | ||
| | | colspan="5" |/*got an Emis procedure request referring to a confidential encounter, so can't enforce this | ||
| | |||
|- | |- | ||
| | | colspan="5" |CONSTRAINT fk_procedure_request_encounter_id FOREIGN KEY (encounter_id) | ||
| | |||
|- | |- | ||
| | | colspan="5" |REFERENCES encounter (id) MATCH SIMPLE | ||
| | |||
|- | |- | ||
| | | colspan="5" |ON UPDATE NO ACTION ON DELETE NO ACTION,*/ | ||
| | |||
|- | |- | ||
| | | colspan="5" |CONSTRAINT fk_procedure_request_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_procedure_request_practitioner_id FOREIGN KEY (practitioner_id) | ||
| | |||
|- | |- | ||
| | | colspan="5" |REFERENCES practitioner (id) MATCH SIMPLE | ||
| | |||
|- | |- | ||
| | | colspan="5" |ON UPDATE NO ACTION ON DELETE NO ACTION | ||
| | |} | ||
| | |||
| | == 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) | ||
| | |NOT NULL | ||
| | |The name of the salt key used to create the pseudo id | ||
| | | | ||
|- | |- | ||
| | |pseudo_id | ||
| | |varchar(255) | ||
|DEFAULT NULL | |DEFAULT NULL | ||
| | |The pseudo id | ||
| | | | ||
|- | |- | ||
| | | colspan="5" |CONSTRAINT pk_pseudo_id PRIMARY KEY (patient_id, salt_key_name) | ||
| | |} | ||
| | |||
| | == Table: referral_request == | ||
| | PRIMARY KEY (organization_id,person_id,id) | ||
{| class="wikitable sortable mw-collapsible mw-collapsed" | |||
|'''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 | |The date the referral request was added to the source system | ||
| | | | ||
|- | |- | ||
| colspan="5" |CONSTRAINT PRIMARY KEY (id) | | colspan="5" |CONSTRAINT pk_referral_request_id PRIMARY KEY (`organization_id`,`person_id`,`id`), | ||
|- | |- | ||
| | | colspan="5" |/*got an Emis referral request referring to a confidential encounter, so can't enforce this | ||
| | |- | ||
| | | colspan="5" |CONSTRAINT fk_referral_request_encounter_id FOREIGN KEY (encounter_id) | ||
| | |- | ||
| | | colspan="5" |REFERENCES encounter (id) MATCH SIMPLE | ||
|- | |||
| colspan="5" |ON UPDATE NO ACTION ON DELETE NO ACTION,*/ | |||
|- | |||
| colspan="5" |CONSTRAINT fk_referral_request_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_referral_request_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_referral_request_recipient_organization_id FOREIGN KEY (recipient_organization_id) | |||
|- | |||
| colspan="5" |REFERENCES organization (id) MATCH SIMPLE | |||
|- | |- | ||
| | | colspan="5" |ON UPDATE NO ACTION ON DELETE NO ACTION, | ||
| | |||
|- | |- | ||
| | | colspan="5" |CONSTRAINT fk_referral_request_requester_organization_id FOREIGN KEY (requester_organization_id) | ||
| | |||
|- | |- | ||
| | | colspan="5" |REFERENCES organization (id) MATCH SIMPLE | ||
| | |||
|- | |- | ||
| colspan="5" | | | colspan="5" |ON UPDATE NO ACTION ON DELETE NO ACTION | ||
|} | |} | ||
Line 3,040: | Line 2,949: | ||
| | | | ||
|- | |- | ||
| colspan="5" | | | 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 | ExpandReferences |
Table: appointment
PRIMARY KEY (organization_id,person_id,id)
Column name | Data type | Constraint | Comments | ExpandReferences |
Table: concept
PRIMARY KEY (dbid)
Column name | Data type | Constraint | Comments | ExpandReferences |
Table: concept_map
PRIMARY KEY (id)
Column name | Data type | Constraint | Comments | ExpandReferences |
Table: diagnostic_order
PRIMARY KEY (organization_id,person_id,id)
Column name | Data type | Constraint | Comments | ExpandReferences |
Table: encounter
PRIMARY KEY (organization_id,person_id,id)
Column name | Data type | Constraint | Comments | ExpandReferences |
Table: encounter_additional
PRIMARY KEY (id, property_id, value_id)
Column name | Data type | Constraint | Comments | ExpandReferences |
Table: encounter_event
PRIMARY KEY (organization_id, person_id, id)
Column name | Data type | Constraint | Comments | ExpandReferences |
Table: episode_of_care
PRIMARY KEY (organization_id,person_id,id)
Column name | Data type | Constraint | Comments | ExpandReferences |
Table: event_log
Column name | Data type | Constraint | Comments | ExpandReferences |
Table: flag
PRIMARY KEY (organization_id,person_id,id)
Column name | Data type | Constraint | Comments | ExpandReferences |
Table: location
PRIMARY KEY (pk_location_id PRIMARY KEY id)
Column name | Data type | Constraint | Comments | ExpandReferences |
Table: medication_order
PRIMARY KEY (organization_id,person_id,id)
Column name | Data type | Constraint | Comments | ExpandReferences |
Table: medication_statement
PRIMARY KEY (organization_id,person_id,id)
Column name | Data type | Constraint | Comments | ExpandReferences |
Table: observation
PRIMARY KEY (organization_id,person_id,id)
Column name | Data type | Constraint | Comments | ExpandReferences |
Table: observation_additional
PRIMARY KEY (id, property_id)
Column name | Data type | Constraint | Comments | ExpandReferences |
Table: organization
PRIMARY KEY (pk_organization_id PRIMARY KEY (id))
Column name | Data type | Constraint | Comments | ExpandReferences |
Table: organization_metadata
PRIMARY KEY (id, publishing_software)
Column name | Data type | Constraint | Comments | ExpandReferences |
Table: patient
PRIMARY KEY (organization_id,person_id,id)
Column name | Data type | Constraint | Comments | ExpandReferences |
Table: patient_additional
PRIMARY KEY (id, property_id)
Column name | Data type | Constraint | Comments | ExpandReferences |
Table: patient_address
PRIMARY KEY (organization_id,id,patient_id,person_id)
Column name | Data type | Constraint | Comments | ExpandReferences |
Table: patient_address_match
PRIMARY KEY(id, uprn)
Column name | Data type | Constraint | Comments | ExpandReferences |
Table: patient_address_ralf
PRIMARY KEY (id, patient_address_id, patient_address_match_uprn_ralf00)
Column name | Data type | Constraint | Comments | ExpandReferences |
Table: patient_contact
PRIMARY KEY (organization_id,id,patient_id,person_id)
Column name | Data type | Constraint | Comments | ExpandReferences |
Table: patient_pseudo_id
PRIMARY KEY(organization_id)
Column name | Data type | Constraint | Comments | ExpandReferences |
Table: patient_uprn
PRIMARY KEY (organization_id,person_id,id)
Column name | Data type | Constraint | Comments | ExpandReferences |
Table: person
PRIMARY KEY (id)
Column name | Data type | Constraint | Comments | ExpandReferences |
Table: practitioner
PRIMARY KEY (id)
Column name | Data type | Constraint | Comments | ExpandReferences |
Table: procedure_request
PRIMARY KEY (organization_id,person_id,id)
Column name | Data type | Constraint | Comments | ExpandReferences |
Table: pseudo_id
PRIMARY KEY (patient_id, salt_key_name)
Column name | Data type | Constraint | Comments | ExpandReferences |
Table: referral_request
PRIMARY KEY (organization_id,person_id,id)
Column name | Data type | Constraint | Comments | ExpandReferences |
Table: registration_status_history
PRIMARY KEY(organization_id,id,patient_id,person_id)
Column name | Data type | Constraint | Comments | ExpandReferences |
Table: schedule
PRIMARY KEY (organization_id, id)
Column name | Data type | Constraint | Comments | ExpandReferences |