Addressed issues #98, #97 and #96. They were initially problems with Postgresql but similar issues were found in oracle, impala and sql server files.

This commit is contained in:
clairblacketer 2017-08-08 10:31:29 -04:00
parent daf928eb19
commit 322ad1bb9e
10 changed files with 6 additions and 16 deletions

View File

@ -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
)

View File

@ -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);

View File

@ -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
)

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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 ,

View File

@ -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);

View File

@ -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);

View File

@ -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);