         ON (f.id = q.id)
 ;
 
+ALTER TABLE dw_encounter_questions
+    ADD CONSTRAINT dw_encounter_questions_pkey PRIMARY KEY (id);
+CREATE INDEX dw_encounter_questions_form_element_ix
+    ON dw_encounter_questions (form_element_id);
+
 CREATE TABLE dw_place_questions AS
 SELECT
     q.*


ALTER TABLE dw_encounters_treatments
    ADD CONSTRAINT pk_dw_encounters_treatments PRIMARY KEY (id);

CREATE TABLE dw_morbidity_questions AS
SELECT


ALTER TABLE dw_events_hospitals
    ADD CONSTRAINT pk_dw_events_hospitals PRIMARY KEY (id);
CREATE INDEX dw_events_hospitals_morbidity_event_id_ix
    ON dw_events_hospitals (dw_morbidity_events_id);
CREATE INDEX dw_events_hospitals_contact_event_id_ix
    ON dw_events_hospitals (dw_contact_events_id);
CREATE INDEX dw_events_hospitals_admission_date_ix
    ON dw_events_hospitals (admission_date);
CREATE INDEX dw_events_hospitals_discharge_date_ix
    ON dw_events_hospitals (discharge_date);

CREATE TABLE dw_lab_results AS
SELECT
