From 322ad1bb9eaafeb1d5cda6e90c80067df9f2fa4f Mon Sep 17 00:00:00 2001 From: clairblacketer Date: Tue, 8 Aug 2017 10:31:29 -0400 Subject: [PATCH] Addressed issues #98, #97 and #96. They were initially problems with Postgresql but similar issues were found in oracle, impala and sql server files. --- Impala/OMOP_CDM_ddl_Impala.sql | 2 +- Oracle/OMOP CDM constraints - Oracle.sql | 2 -- Oracle/OMOP CDM ddl - Oracle.sql | 2 +- .../OMOP CDM indexes required - Oracle - With constraints.sql | 1 - ...OP CDM indexes required - Oracle - Without constraints.sql | 1 - PostgreSQL/OMOP CDM constraints - PostgreSQL.sql | 4 +--- PostgreSQL/OMOP CDM ddl - PostgreSQL.sql | 2 +- PostgreSQL/OMOP CDM indexes required - PostgreSQL.sql | 3 +-- Sql Server/OMOP CDM constraints - SQL Server.sql | 2 -- Sql Server/OMOP CDM indexes required - SQL Server.sql | 3 +-- 10 files changed, 6 insertions(+), 16 deletions(-) diff --git a/Impala/OMOP_CDM_ddl_Impala.sql b/Impala/OMOP_CDM_ddl_Impala.sql index fe12260..d1ade63 100644 --- a/Impala/OMOP_CDM_ddl_Impala.sql +++ b/Impala/OMOP_CDM_ddl_Impala.sql @@ -333,7 +333,7 @@ CREATE TABLE visit_occurrence ( visit_source_concept_id INTEGER, admitting_source_concept_id INTEGER, admitting_source_value VARCHAR(50), - discharge_to_concept_id INTEGER(50), + discharge_to_concept_id INTEGER, discharge_to_source_value VARCHAR(50), preceding_visit_occurrence_id INTEGER ) diff --git a/Oracle/OMOP CDM constraints - Oracle.sql b/Oracle/OMOP CDM constraints - Oracle.sql index 69ca56f..884473c 100644 --- a/Oracle/OMOP CDM constraints - Oracle.sql +++ b/Oracle/OMOP CDM constraints - Oracle.sql @@ -353,8 +353,6 @@ ALTER TABLE drug_exposure ADD CONSTRAINT fpk_drug_type_concept FOREIGN KEY (drug ALTER TABLE drug_exposure ADD CONSTRAINT fpk_drug_route_concept FOREIGN KEY (route_concept_id) REFERENCES concept (concept_id); -ALTER TABLE drug_exposure ADD CONSTRAINT fpk_drug_dose_unit_concept FOREIGN KEY (dose_unit_concept_id) REFERENCES concept (concept_id); - ALTER TABLE drug_exposure ADD CONSTRAINT fpk_drug_provider FOREIGN KEY (provider_id) REFERENCES provider (provider_id); ALTER TABLE drug_exposure ADD CONSTRAINT fpk_drug_visit FOREIGN KEY (visit_occurrence_id) REFERENCES visit_occurrence (visit_occurrence_id); diff --git a/Oracle/OMOP CDM ddl - Oracle.sql b/Oracle/OMOP CDM ddl - Oracle.sql index cdfaf16..76011cc 100644 --- a/Oracle/OMOP CDM ddl - Oracle.sql +++ b/Oracle/OMOP CDM ddl - Oracle.sql @@ -315,7 +315,7 @@ CREATE TABLE visit_occurrence visit_source_concept_id INTEGER NULL, admitting_source_concept_id INTEGER NULL , admitting_source_value VARCHAR(50) NULL , - discharge_to_concept_id INTEGER(50) NULL , + discharge_to_concept_id INTEGER NULL , discharge_to_source_value VARCHAR(50) NULL , preceding_visit_occurrence_id INTEGER NULL ) diff --git a/Oracle/OMOP CDM indexes required - Oracle - With constraints.sql b/Oracle/OMOP CDM indexes required - Oracle - With constraints.sql index f0a013c..e6739f5 100644 --- a/Oracle/OMOP CDM indexes required - Oracle - With constraints.sql +++ b/Oracle/OMOP CDM indexes required - Oracle - With constraints.sql @@ -113,7 +113,6 @@ CREATE INDEX idx_note_person_id ON note (person_id ASC); CREATE INDEX idx_note_concept_id ON note (note_type_concept_id ASC); CREATE INDEX idx_note_visit_id ON note (visit_occurrence_id ASC); -CREATE INDEX idx_note_nlp_person_id ON note_nlp (person_id ASC); CREATE INDEX idx_note_nlp_note_id ON note_nlp (note_id ASC); CREATE INDEX idx_note_nlp_concept_id ON note_nlp (note_nlp_concept_id ASC); diff --git a/Oracle/OMOP CDM indexes required - Oracle - Without constraints.sql b/Oracle/OMOP CDM indexes required - Oracle - Without constraints.sql index c28f05d..8d646d4 100644 --- a/Oracle/OMOP CDM indexes required - Oracle - Without constraints.sql +++ b/Oracle/OMOP CDM indexes required - Oracle - Without constraints.sql @@ -132,7 +132,6 @@ CREATE INDEX idx_note_person_id ON note (person_id ASC); CREATE INDEX idx_note_concept_id ON note (note_type_concept_id ASC); CREATE INDEX idx_note_visit_id ON note (visit_occurrence_id ASC); -CREATE INDEX idx_note_nlp_person_id ON note_nlp (person_id ASC); CREATE INDEX idx_note_nlp_note_id ON note_nlp (note_id ASC); CREATE INDEX idx_note_nlp_concept_id ON note_nlp (note_nlp_concept_id ASC); diff --git a/PostgreSQL/OMOP CDM constraints - PostgreSQL.sql b/PostgreSQL/OMOP CDM constraints - PostgreSQL.sql index 161bc50..8315147 100644 --- a/PostgreSQL/OMOP CDM constraints - PostgreSQL.sql +++ b/PostgreSQL/OMOP CDM constraints - PostgreSQL.sql @@ -126,7 +126,7 @@ ALTER TABLE measurement ADD CONSTRAINT xpk_measurement PRIMARY KEY ( measurement ALTER TABLE note ADD CONSTRAINT xpk_note PRIMARY KEY ( note_id ) ; -ALTER TABLE note_nlp ADD CONSTRAINT xpk_note_nlp PRIMARY KEY NONCLUSTERED ( note_nlp_id ) ; +ALTER TABLE note_nlp ADD CONSTRAINT xpk_note_nlp PRIMARY KEY ( note_nlp_id ) ; ALTER TABLE observation ADD CONSTRAINT xpk_observation PRIMARY KEY ( observation_id ) ; @@ -352,8 +352,6 @@ ALTER TABLE drug_exposure ADD CONSTRAINT fpk_drug_type_concept FOREIGN KEY (drug ALTER TABLE drug_exposure ADD CONSTRAINT fpk_drug_route_concept FOREIGN KEY (route_concept_id) REFERENCES concept (concept_id); -ALTER TABLE drug_exposure ADD CONSTRAINT fpk_drug_dose_unit_concept FOREIGN KEY (dose_unit_concept_id) REFERENCES concept (concept_id); - ALTER TABLE drug_exposure ADD CONSTRAINT fpk_drug_provider FOREIGN KEY (provider_id) REFERENCES provider (provider_id); ALTER TABLE drug_exposure ADD CONSTRAINT fpk_drug_visit FOREIGN KEY (visit_occurrence_id) REFERENCES visit_occurrence (visit_occurrence_id); diff --git a/PostgreSQL/OMOP CDM ddl - PostgreSQL.sql b/PostgreSQL/OMOP CDM ddl - PostgreSQL.sql index cdae76e..acc06c6 100644 --- a/PostgreSQL/OMOP CDM ddl - PostgreSQL.sql +++ b/PostgreSQL/OMOP CDM ddl - PostgreSQL.sql @@ -465,7 +465,7 @@ CREATE TABLE note_nlp note_id INTEGER NOT NULL , section_concept_id INTEGER NULL , snippet VARCHAR(250) NULL , - offset VARCHAR(250) NULL , + "offset" VARCHAR(250) NULL , lexical_variant VARCHAR(250) NOT NULL , note_nlp_concept_id INTEGER NULL , note_nlp_source_concept_id INTEGER NULL , diff --git a/PostgreSQL/OMOP CDM indexes required - PostgreSQL.sql b/PostgreSQL/OMOP CDM indexes required - PostgreSQL.sql index fb7aeaf..5192f01 100644 --- a/PostgreSQL/OMOP CDM indexes required - PostgreSQL.sql +++ b/PostgreSQL/OMOP CDM indexes required - PostgreSQL.sql @@ -153,9 +153,8 @@ CLUSTER note USING idx_note_person_id ; CREATE INDEX idx_note_concept_id ON note (note_type_concept_id ASC); CREATE INDEX idx_note_visit_id ON note (visit_occurrence_id ASC); -CREATE INDEX idx_note_nlp_person_id ON note_nlp (person_id ASC); -CLUSTER note_nlp USING idx_note_nlp_person_id ; CREATE INDEX idx_note_nlp_note_id ON note_nlp (note_id ASC); +CLUSTER note_nlp USING idx_note_nlp_note_id ; CREATE INDEX idx_note_nlp_concept_id ON note_nlp (note_nlp_concept_id ASC); CREATE INDEX idx_observation_person_id ON observation (person_id ASC); diff --git a/Sql Server/OMOP CDM constraints - SQL Server.sql b/Sql Server/OMOP CDM constraints - SQL Server.sql index 484ea06..1448fb6 100644 --- a/Sql Server/OMOP CDM constraints - SQL Server.sql +++ b/Sql Server/OMOP CDM constraints - SQL Server.sql @@ -352,8 +352,6 @@ ALTER TABLE drug_exposure ADD CONSTRAINT fpk_drug_type_concept FOREIGN KEY (drug ALTER TABLE drug_exposure ADD CONSTRAINT fpk_drug_route_concept FOREIGN KEY (route_concept_id) REFERENCES concept (concept_id); -ALTER TABLE drug_exposure ADD CONSTRAINT fpk_drug_dose_unit_concept FOREIGN KEY (dose_unit_concept_id) REFERENCES concept (concept_id); - ALTER TABLE drug_exposure ADD CONSTRAINT fpk_drug_provider FOREIGN KEY (provider_id) REFERENCES provider (provider_id); ALTER TABLE drug_exposure ADD CONSTRAINT fpk_drug_visit FOREIGN KEY (visit_occurrence_id) REFERENCES visit_occurrence (visit_occurrence_id); diff --git a/Sql Server/OMOP CDM indexes required - SQL Server.sql b/Sql Server/OMOP CDM indexes required - SQL Server.sql index 60b24d0..ea526d3 100644 --- a/Sql Server/OMOP CDM indexes required - SQL Server.sql +++ b/Sql Server/OMOP CDM indexes required - SQL Server.sql @@ -131,8 +131,7 @@ CREATE CLUSTERED INDEX idx_note_person_id ON note (person_id ASC); CREATE INDEX idx_note_concept_id ON note (note_type_concept_id ASC); CREATE INDEX idx_note_visit_id ON note (visit_occurrence_id ASC); -CREATE CLUSTERED INDEX idx_note_nlp_person_id ON note_nlp (person_id ASC); -CREATE INDEX idx_note_nlp_note_id ON note_nlp (note_id ASC); +CREATE CLUSTERED INDEX idx_note_nlp_note_id ON note_nlp (note_id ASC); CREATE INDEX idx_note_nlp_concept_id ON note_nlp (note_nlp_concept_id ASC); CREATE CLUSTERED INDEX idx_observation_person_id ON observation (person_id ASC);