Impala, Oracle, and Netezza edits from testers
This commit is contained in:
parent
8c6ebe5f95
commit
eee81f61ad
|
@ -1,6 +1,6 @@
|
|||
LOAD DATA INPATH '${VAR:OMOP_SYNPUF_PATH}/CDM_CARE_SITE.csv' OVERWRITE INTO TABLE care_site;
|
||||
LOAD DATA INPATH '${VAR:OMOP_SYNPUF_PATH}/CDM_CONDITION_OCCURRENCE.csv' OVERWRITE INTO TABLE condition_occurrence;
|
||||
LOAD DATA INPATH '${VAR:OMOP_SYNPUF_PATH}/CDM_DEATH.csv' OVERWRITE INTO TABLE death;
|
||||
--LOAD DATA INPATH '${VAR:OMOP_SYNPUF_PATH}/CDM_DEATH.csv' OVERWRITE INTO TABLE death;
|
||||
LOAD DATA INPATH '${VAR:OMOP_SYNPUF_PATH}/CDM_DRUG_EXPOSURE.csv' OVERWRITE INTO TABLE drug_exposure;
|
||||
LOAD DATA INPATH '${VAR:OMOP_SYNPUF_PATH}/CDM_DEVICE_EXPOSURE.csv' OVERWRITE INTO TABLE device_exposure;
|
||||
LOAD DATA INPATH '${VAR:OMOP_SYNPUF_PATH}/CDM_LOCATION.csv' OVERWRITE INTO TABLE `location`;
|
||||
|
|
|
@ -153,28 +153,6 @@ CREATE TABLE drug_strength (
|
|||
;
|
||||
|
||||
|
||||
CREATE TABLE cohort_definition (
|
||||
cohort_definition_id INTEGER ,
|
||||
cohort_definition_name VARCHAR(255),
|
||||
cohort_definition_description STRING,
|
||||
definition_type_concept_id INTEGER ,
|
||||
cohort_definition_syntax STRING,
|
||||
subject_concept_id INTEGER ,
|
||||
cohort_initiation_date TIMESTAMP
|
||||
)
|
||||
;
|
||||
|
||||
|
||||
CREATE TABLE attribute_definition (
|
||||
attribute_definition_id INTEGER ,
|
||||
attribute_name VARCHAR(255),
|
||||
attribute_description STRING,
|
||||
attribute_type_concept_id INTEGER ,
|
||||
attribute_syntax STRING
|
||||
)
|
||||
;
|
||||
|
||||
|
||||
/**************************
|
||||
|
||||
Standardized meta-data
|
||||
|
@ -210,8 +188,8 @@ CREATE TABLE `metadata`
|
|||
)
|
||||
;
|
||||
|
||||
INSERT INTO metadata (name, value_as_string) --Added cdm version record
|
||||
VALUES ('CDM Version', '6.0')
|
||||
INSERT INTO `metadata` (metadata_concept_id, metadata_type_concept_id, name, value_as_string, value_as_concept_id, metadata_date, metadata_datetime) --Added cdm version record
|
||||
VALUES (0,0,'CDM Version', '6.0',0,NULL,NULL)
|
||||
;
|
||||
|
||||
|
||||
|
@ -233,9 +211,9 @@ CREATE TABLE person
|
|||
birth_datetime TIMESTAMP ,
|
||||
race_concept_id INTEGER ,
|
||||
ethnicity_concept_id INTEGER ,
|
||||
location_id INTEGER ,
|
||||
provider_id INTEGER ,
|
||||
care_site_id INTEGER ,
|
||||
location_id BIGINT ,
|
||||
provider_id BIGINT ,
|
||||
care_site_id BIGINT ,
|
||||
person_source_value VARCHAR(50),
|
||||
gender_source_value VARCHAR(50),
|
||||
gender_source_concept_id INTEGER ,
|
||||
|
@ -281,20 +259,6 @@ CREATE TABLE specimen
|
|||
;
|
||||
|
||||
|
||||
--HINT DISTRIBUTE_ON_KEY(person_id)
|
||||
CREATE TABLE death
|
||||
(
|
||||
person_id BIGINT ,
|
||||
death_date TIMESTAMP ,
|
||||
death_datetime TIMESTAMP ,
|
||||
death_type_concept_id INTEGER ,
|
||||
cause_concept_id INTEGER ,
|
||||
cause_source_value VARCHAR(50),
|
||||
cause_source_concept_id INTEGER
|
||||
)
|
||||
;
|
||||
|
||||
|
||||
--HINT DISTRIBUTE_ON_KEY(person_id)
|
||||
CREATE TABLE visit_occurrence
|
||||
(
|
||||
|
@ -306,8 +270,8 @@ CREATE TABLE visit_occurrence
|
|||
visit_end_date TIMESTAMP ,
|
||||
visit_end_datetime TIMESTAMP ,
|
||||
visit_type_concept_id INTEGER ,
|
||||
provider_id INTEGER ,
|
||||
care_site_id INTEGER ,
|
||||
provider_id BIGINT ,
|
||||
care_site_id BIGINT ,
|
||||
visit_source_value VARCHAR(50),
|
||||
visit_source_concept_id INTEGER ,
|
||||
admitted_from_concept_id INTEGER , /*Changed from admitting_source_* */
|
||||
|
@ -318,7 +282,7 @@ CREATE TABLE visit_occurrence
|
|||
)
|
||||
;
|
||||
|
||||
--todo admitting 'source'
|
||||
|
||||
--HINT DISTRIBUTE_ON_KEY(person_id)
|
||||
CREATE TABLE visit_detail
|
||||
(
|
||||
|
@ -330,8 +294,8 @@ CREATE TABLE visit_detail
|
|||
visit_detail_end_date TIMESTAMP ,
|
||||
visit_detail_end_datetime TIMESTAMP ,
|
||||
visit_detail_type_concept_id INTEGER ,
|
||||
provider_id INTEGER ,
|
||||
care_site_id INTEGER ,
|
||||
provider_id BIGINT ,
|
||||
care_site_id BIGINT ,
|
||||
discharge_to_concept_id INTEGER ,
|
||||
admitted_from_concept_id INTEGER , /*Changed from admitting_source_* */
|
||||
admitted_from_source_value VARCHAR(50) ,
|
||||
|
@ -356,12 +320,12 @@ CREATE TABLE procedure_occurrence
|
|||
procedure_type_concept_id INTEGER ,
|
||||
modifier_concept_id INTEGER ,
|
||||
quantity INTEGER ,
|
||||
provider_id INTEGER ,
|
||||
visit_occurrence_id INTEGER ,
|
||||
visit_detail_id INTEGER ,
|
||||
provider_id BIGINT ,
|
||||
visit_occurrence_id BIGINT ,
|
||||
visit_detail_id BIGINT ,
|
||||
procedure_source_value VARCHAR(50) ,
|
||||
procedure_source_concept_id INTEGER ,
|
||||
modifier_source_value VARCHAR(50) ,
|
||||
modifier_source_value VARCHAR(50)
|
||||
)
|
||||
;
|
||||
|
||||
|
@ -385,9 +349,9 @@ CREATE TABLE drug_exposure
|
|||
sig STRING ,
|
||||
route_concept_id INTEGER ,
|
||||
lot_number VARCHAR(50) ,
|
||||
provider_id INTEGER ,
|
||||
visit_occurrence_id INTEGER ,
|
||||
visit_detail_id INTEGER ,
|
||||
provider_id BIGINT ,
|
||||
visit_occurrence_id BIGINT ,
|
||||
visit_detail_id BIGINT ,
|
||||
drug_source_value VARCHAR(50) ,
|
||||
drug_source_concept_id INTEGER ,
|
||||
route_source_value VARCHAR(50) ,
|
||||
|
@ -409,9 +373,9 @@ CREATE TABLE device_exposure
|
|||
device_type_concept_id INTEGER ,
|
||||
unique_device_id VARCHAR(50) ,
|
||||
quantity INTEGER ,
|
||||
provider_id INTEGER ,
|
||||
visit_occurrence_id INTEGER ,
|
||||
visit_detail_id INTEGER ,
|
||||
provider_id BIGINT ,
|
||||
visit_occurrence_id BIGINT ,
|
||||
visit_detail_id BIGINT ,
|
||||
device_source_value VARCHAR(100) ,
|
||||
device_source_concept_id INTEGER
|
||||
)
|
||||
|
@ -431,9 +395,9 @@ CREATE TABLE condition_occurrence
|
|||
condition_type_concept_id INTEGER ,
|
||||
condition_status_concept_id INTEGER ,
|
||||
stop_reason VARCHAR(20) ,
|
||||
provider_id INTEGER ,
|
||||
visit_occurrence_id INTEGER ,
|
||||
visit_detail_id INTEGER ,
|
||||
provider_id BIGINT ,
|
||||
visit_occurrence_id BIGINT ,
|
||||
visit_detail_id BIGINT ,
|
||||
condition_source_value VARCHAR(50) ,
|
||||
condition_source_concept_id INTEGER ,
|
||||
condition_status_source_value VARCHAR(50)
|
||||
|
@ -457,9 +421,9 @@ CREATE TABLE measurement
|
|||
unit_concept_id INTEGER ,
|
||||
range_low FLOAT ,
|
||||
range_high FLOAT ,
|
||||
provider_id INTEGER ,
|
||||
visit_occurrence_id INTEGER ,
|
||||
visit_detail_id INTEGER ,
|
||||
provider_id BIGINT ,
|
||||
visit_occurrence_id BIGINT ,
|
||||
visit_detail_id BIGINT ,
|
||||
measurement_source_value VARCHAR(50) ,
|
||||
measurement_source_concept_id INTEGER ,
|
||||
unit_source_value VARCHAR(50) ,
|
||||
|
@ -473,9 +437,8 @@ CREATE TABLE note
|
|||
(
|
||||
note_id BIGINT ,
|
||||
person_id BIGINT ,
|
||||
note_event_id BIGINT , --This and the field below added
|
||||
note_domain_id VARCHAR(20) , --This field may be removed in favor of the one below
|
||||
--note_event_table_concept_id INTEGER , --This may be added based on 9/4 meeting
|
||||
note_event_id BIGINT ,
|
||||
note_event_field_concept_id INTEGER ,
|
||||
note_date TIMESTAMP ,
|
||||
note_datetime TIMESTAMP ,
|
||||
note_type_concept_id INTEGER ,
|
||||
|
@ -484,15 +447,14 @@ CREATE TABLE note
|
|||
note_text STRING ,
|
||||
encoding_concept_id INTEGER ,
|
||||
language_concept_id INTEGER ,
|
||||
provider_id INTEGER ,
|
||||
visit_occurrence_id INTEGER ,
|
||||
visit_detail_id INTEGER ,
|
||||
provider_id BIGINT ,
|
||||
visit_occurrence_id BIGINT ,
|
||||
visit_detail_id BIGINT ,
|
||||
note_source_value VARCHAR(50)
|
||||
)
|
||||
;
|
||||
|
||||
|
||||
|
||||
CREATE TABLE note_nlp
|
||||
(
|
||||
note_nlp_id BIGINT ,
|
||||
|
@ -527,7 +489,7 @@ CREATE TABLE observation
|
|||
value_as_concept_id INTEGER ,
|
||||
qualifier_concept_id INTEGER ,
|
||||
unit_concept_id INTEGER ,
|
||||
provider_id INTEGER ,
|
||||
provider_id BIGINT ,
|
||||
visit_occurrence_id BIGINT ,
|
||||
visit_detail_id BIGINT ,
|
||||
observation_source_value VARCHAR(50) ,
|
||||
|
@ -535,8 +497,7 @@ CREATE TABLE observation
|
|||
unit_source_value VARCHAR(50) ,
|
||||
qualifier_source_value VARCHAR(50) ,
|
||||
observation_event_id BIGINT , /* This will link back to the event table (SURVEY) on SURVEY_OCCURRENCE_ID, changed name to comply with COST and NOTE*/
|
||||
observation_event_domain_id VARCHAR(20) ,
|
||||
--obs_event_table_concept_id INTEGER , /* Changed name to comply with COST and NOTE. This should be 'Survey'. Had to use 'obs' for oracle restriction, may be added on 9/4*/
|
||||
obs_event_field_concept_id INTEGER , /* Changed name to comply with COST and NOTE. This should be 'Survey'. Had to use 'obs' for oracle restriction, may be added on 9/4*/
|
||||
value_as_datetime TIMESTAMP
|
||||
)
|
||||
;
|
||||
|
@ -593,7 +554,7 @@ Standardized health system data
|
|||
************************/
|
||||
|
||||
|
||||
CREATE TABLE location
|
||||
CREATE TABLE `location`
|
||||
(
|
||||
location_id BIGINT ,
|
||||
address_1 VARCHAR(50) ,
|
||||
|
@ -693,8 +654,7 @@ CREATE TABLE cost
|
|||
cost_id BIGINT ,
|
||||
person_id BIGINT,
|
||||
cost_event_id BIGINT ,
|
||||
cost_domain_id VARCHAR(20) ,
|
||||
--cost_event_table_concept_id INTEGER , /*This is still in discussion and most likely will replace cost_domain_id at 9/4 meeting*/
|
||||
cost_event_field_concept_id INTEGER , /*This is still in discussion and most likely will replace cost_domain_id at 9/4 meeting*/
|
||||
cost_concept_id INTEGER ,
|
||||
cost_type_concept_id INTEGER ,
|
||||
currency_concept_id INTEGER ,
|
||||
|
@ -720,31 +680,6 @@ Standardized derived elements
|
|||
************************/
|
||||
|
||||
|
||||
--HINT DISTRIBUTE_ON_KEY(subject_id)
|
||||
CREATE TABLE cohort
|
||||
(
|
||||
cohort_definition_id BIGINT ,
|
||||
subject_id BIGINT ,
|
||||
cohort_start_date TIMESTAMP ,
|
||||
cohort_end_date TIMESTAMP
|
||||
)
|
||||
;
|
||||
|
||||
|
||||
--HINT DISTRIBUTE_ON_KEY(subject_id)
|
||||
CREATE TABLE cohort_attribute
|
||||
(
|
||||
cohort_definition_id BIGINT ,
|
||||
subject_id BIGINT ,
|
||||
cohort_start_date TIMESTAMP ,
|
||||
cohort_end_date TIMESTAMP ,
|
||||
attribute_definition_id BIGINT ,
|
||||
value_as_number FLOAT ,
|
||||
value_as_concept_id INTEGER
|
||||
)
|
||||
;
|
||||
|
||||
|
||||
--HINT DISTRIBUTE_ON_KEY(person_id)
|
||||
CREATE TABLE drug_era
|
||||
(
|
||||
|
|
|
@ -11,10 +11,11 @@ In order to create your instantiation of the Common Data Model, we recommend fol
|
|||
impala-shell -q 'CREATE DATABASE omop_cdm'
|
||||
```
|
||||
|
||||
2. Execute the script `OMOP CDM impala ddl.txt` (you will need to convert it to a sql file first) to create the tables and fields.
|
||||
2. Execute the scripts `OMOP CDM impala ddl.txt` and `OMOP CDM Results impala ddl.txt` (you will need to convert them to sql files first) to create the tables and fields.
|
||||
|
||||
```bash
|
||||
impala-shell -d omop_cdm -f OMOP_CDM_impala_ddl.sql
|
||||
impala-shell -d omop_cdm -f OMOP_CDM_Results_impala_ddl.sql
|
||||
```
|
||||
|
||||
3. Load your data into the schema.
|
||||
|
@ -42,6 +43,7 @@ hadoop fs -put synpuf synpuf
|
|||
hadoop fs -chmod +w synpuf
|
||||
impala-shell -d omop_cdm -f DataImport/OMOP_CDM_synpuf_load_Impala.sql --var=OMOP_SYNPUF_PATH=/user/$USER/synpuf
|
||||
```
|
||||
* Note that these tables are in CDM v5.2.2 format
|
||||
|
||||
4. Convert to Parquet format.
|
||||
|
||||
|
|
|
@ -173,32 +173,6 @@ DISTRIBUTE ON RANDOM
|
|||
;
|
||||
|
||||
|
||||
--HINT DISTRIBUTE ON RANDOM
|
||||
CREATE TABLE cohort_definition (
|
||||
cohort_definition_id INTEGER NOT NULL,
|
||||
cohort_definition_name VARCHAR(255) NOT NULL,
|
||||
cohort_definition_description VARCHAR(1000) NULL,
|
||||
definition_type_concept_id INTEGER NOT NULL,
|
||||
cohort_definition_syntax VARCHAR(1000) NULL,
|
||||
subject_concept_id INTEGER NOT NULL,
|
||||
cohort_initiation_date DATE NULL
|
||||
)
|
||||
DISTRIBUTE ON RANDOM
|
||||
;
|
||||
|
||||
|
||||
--HINT DISTRIBUTE ON RANDOM
|
||||
CREATE TABLE attribute_definition (
|
||||
attribute_definition_id INTEGER NOT NULL,
|
||||
attribute_name VARCHAR(255) NOT NULL,
|
||||
attribute_description VARCHAR(1000) NULL,
|
||||
attribute_type_concept_id INTEGER NOT NULL,
|
||||
attribute_syntax VARCHAR(1000) NULL
|
||||
)
|
||||
DISTRIBUTE ON RANDOM
|
||||
;
|
||||
|
||||
|
||||
/**************************
|
||||
|
||||
Standardized meta-data
|
||||
|
@ -238,8 +212,8 @@ CREATE TABLE metadata
|
|||
DISTRIBUTE ON RANDOM
|
||||
;
|
||||
|
||||
INSERT INTO metadata (name, value_as_string) --Added cdm version record
|
||||
VALUES ('CDM Version', '6.0')
|
||||
INSERT INTO metadata (metadata_concept_id, metadata_type_concept_id, name, value_as_string, value_as_concept_id, metadata_date, metadata_datetime) --Added cdm version record
|
||||
VALUES (0,0,'CDM Version', '6.0',0,NULL,NULL)
|
||||
;
|
||||
|
||||
|
||||
|
@ -261,9 +235,9 @@ CREATE TABLE person
|
|||
birth_datetime DATETIME NULL,
|
||||
race_concept_id INTEGER NOT NULL,
|
||||
ethnicity_concept_id INTEGER NOT NULL,
|
||||
location_id INTEGER NULL,
|
||||
provider_id INTEGER NULL,
|
||||
care_site_id INTEGER NULL,
|
||||
location_id BIGINT NULL,
|
||||
provider_id BIGINT NULL,
|
||||
care_site_id BIGINT NULL,
|
||||
person_source_value VARCHAR(50) NULL,
|
||||
gender_source_value VARCHAR(50) NULL,
|
||||
gender_source_concept_id INTEGER NULL,
|
||||
|
@ -273,7 +247,7 @@ CREATE TABLE person
|
|||
ethnicity_source_concept_id INTEGER NULL
|
||||
)
|
||||
|
||||
DISTRUBTE ON (person_id);
|
||||
DISTRIBUTE ON (person_id);
|
||||
|
||||
|
||||
--HINT DISTRIBUTE_ON_KEY(person_id)
|
||||
|
@ -286,7 +260,7 @@ CREATE TABLE observation_period
|
|||
period_type_concept_id INTEGER NOT NULL
|
||||
)
|
||||
|
||||
DISTRUBTE ON (person_id);
|
||||
DISTRIBUTE ON (person_id);
|
||||
|
||||
|
||||
--HINT DISTRIBUTE_ON_KEY(person_id)
|
||||
|
@ -309,22 +283,7 @@ CREATE TABLE specimen
|
|||
disease_status_source_value VARCHAR(50) NULL
|
||||
)
|
||||
|
||||
DISTRUBTE ON (person_id);
|
||||
|
||||
|
||||
--HINT DISTRIBUTE_ON_KEY(person_id)
|
||||
CREATE TABLE death
|
||||
(
|
||||
person_id BIGINT NOT NULL ,
|
||||
death_date DATE NULL ,
|
||||
death_datetime DATETIME NOT NULL ,
|
||||
death_type_concept_id INTEGER NOT NULL ,
|
||||
cause_concept_id INTEGER NULL ,
|
||||
cause_source_value VARCHAR(50) NULL,
|
||||
cause_source_concept_id INTEGER NULL
|
||||
)
|
||||
|
||||
DISTRUBTE ON (person_id);
|
||||
DISTRIBUTE ON (person_id);
|
||||
|
||||
|
||||
--HINT DISTRIBUTE_ON_KEY(person_id)
|
||||
|
@ -338,8 +297,8 @@ CREATE TABLE visit_occurrence
|
|||
visit_end_date DATE NULL ,
|
||||
visit_end_datetime DATETIME NOT NULL ,
|
||||
visit_type_concept_id INTEGER NOT NULL ,
|
||||
provider_id INTEGER NULL,
|
||||
care_site_id INTEGER NULL,
|
||||
provider_id BIGINT NULL,
|
||||
care_site_id BIGINT NULL,
|
||||
visit_source_value VARCHAR(50) NULL,
|
||||
visit_source_concept_id INTEGER NULL ,
|
||||
admitted_from_concept_id INTEGER NULL ,
|
||||
|
@ -349,7 +308,7 @@ CREATE TABLE visit_occurrence
|
|||
preceding_visit_occurrence_id INTEGER NULL
|
||||
)
|
||||
|
||||
DISTRUBTE ON (person_id);
|
||||
DISTRIBUTE ON (person_id);
|
||||
|
||||
|
||||
--HINT DISTRIBUTE_ON_KEY(person_id)
|
||||
|
@ -363,8 +322,8 @@ CREATE TABLE visit_detail
|
|||
visit_detail_end_date DATE NULL ,
|
||||
visit_detail_end_datetime DATETIME NOT NULL ,
|
||||
visit_detail_type_concept_id INTEGER NOT NULL ,
|
||||
provider_id INTEGER NULL ,
|
||||
care_site_id INTEGER NULL ,
|
||||
provider_id BIGINT NULL ,
|
||||
care_site_id BIGINT NULL ,
|
||||
discharge_to_concept_id INTEGER NULL ,
|
||||
admitted_from_concept_id INTEGER NULL ,
|
||||
admitted_from_source_value VARCHAR(50) NULL ,
|
||||
|
@ -376,7 +335,7 @@ CREATE TABLE visit_detail
|
|||
visit_occurrence_id BIGINT NOT NULL
|
||||
)
|
||||
|
||||
DISTRUBTE ON (person_id);
|
||||
DISTRIBUTE ON (person_id);
|
||||
|
||||
|
||||
--HINT DISTRIBUTE_ON_KEY(person_id)
|
||||
|
@ -390,15 +349,15 @@ CREATE TABLE procedure_occurrence
|
|||
procedure_type_concept_id INTEGER NOT NULL ,
|
||||
modifier_concept_id INTEGER NULL ,
|
||||
quantity INTEGER NULL ,
|
||||
provider_id INTEGER NULL ,
|
||||
visit_occurrence_id INTEGER NULL ,
|
||||
visit_detail_id INTEGER NULL ,
|
||||
provider_id BIGINT NULL ,
|
||||
visit_occurrence_id BIGINT NULL ,
|
||||
visit_detail_id BIGINT NULL ,
|
||||
procedure_source_value VARCHAR(50) NULL ,
|
||||
procedure_source_concept_id INTEGER NULL ,
|
||||
modifier_source_value VARCHAR(50) NULL ,
|
||||
modifier_source_value VARCHAR(50) NULL
|
||||
)
|
||||
|
||||
DISTRUBTE ON (person_id);
|
||||
DISTRIBUTE ON (person_id);
|
||||
|
||||
|
||||
--HINT DISTRIBUTE_ON_KEY(person_id)
|
||||
|
@ -420,16 +379,16 @@ CREATE TABLE drug_exposure
|
|||
sig VARCHAR(1000) NULL ,
|
||||
route_concept_id INTEGER NULL ,
|
||||
lot_number VARCHAR(50) NULL ,
|
||||
provider_id INTEGER NULL ,
|
||||
visit_occurrence_id INTEGER NULL ,
|
||||
visit_detail_id INTEGER NULL ,
|
||||
provider_id BIGINT NULL ,
|
||||
visit_occurrence_id BIGINT NULL ,
|
||||
visit_detail_id BIGINT NULL ,
|
||||
drug_source_value VARCHAR(50) NULL ,
|
||||
drug_source_concept_id INTEGER NULL ,
|
||||
route_source_value VARCHAR(50) NULL ,
|
||||
dose_unit_source_value VARCHAR(50) NULL
|
||||
)
|
||||
|
||||
DISTRUBTE ON (person_id);
|
||||
DISTRIBUTE ON (person_id);
|
||||
|
||||
|
||||
--HINT DISTRIBUTE_ON_KEY(person_id)
|
||||
|
@ -445,14 +404,14 @@ CREATE TABLE device_exposure
|
|||
device_type_concept_id INTEGER NOT NULL ,
|
||||
unique_device_id VARCHAR(50) NULL ,
|
||||
quantity INTEGER NULL ,
|
||||
provider_id INTEGER NULL ,
|
||||
visit_occurrence_id INTEGER NULL ,
|
||||
visit_detail_id INTEGER NULL ,
|
||||
provider_id BIGINT NULL ,
|
||||
visit_occurrence_id BIGINT NULL ,
|
||||
visit_detail_id BIGINT NULL ,
|
||||
device_source_value VARCHAR(100) NULL ,
|
||||
device_source_concept_id INTEGER NULL
|
||||
)
|
||||
|
||||
DISTRUBTE ON (person_id);
|
||||
DISTRIBUTE ON (person_id);
|
||||
|
||||
|
||||
--HINT DISTRIBUTE_ON_KEY(person_id)
|
||||
|
@ -468,15 +427,15 @@ CREATE TABLE condition_occurrence
|
|||
condition_type_concept_id INTEGER NOT NULL ,
|
||||
condition_status_concept_id INTEGER NULL ,
|
||||
stop_reason VARCHAR(20) NULL ,
|
||||
provider_id INTEGER NULL ,
|
||||
visit_occurrence_id INTEGER NULL ,
|
||||
visit_detail_id INTEGER NULL ,
|
||||
provider_id BIGINT NULL ,
|
||||
visit_occurrence_id BIGINT NULL ,
|
||||
visit_detail_id BIGINT NULL ,
|
||||
condition_source_value VARCHAR(50) NULL ,
|
||||
condition_source_concept_id INTEGER NULL ,
|
||||
condition_status_source_value VARCHAR(50) NULL
|
||||
)
|
||||
|
||||
DISTRUBTE ON (person_id);
|
||||
DISTRIBUTE ON (person_id);
|
||||
|
||||
|
||||
--HINT DISTRIBUTE_ON_KEY(person_id)
|
||||
|
@ -495,15 +454,15 @@ CREATE TABLE measurement
|
|||
unit_concept_id INTEGER NULL ,
|
||||
range_low REAL NULL ,
|
||||
range_high REAL NULL ,
|
||||
provider_id INTEGER NULL ,
|
||||
visit_occurrence_id INTEGER NULL ,
|
||||
visit_detail_id INTEGER NULL ,
|
||||
provider_id BIGINT NULL ,
|
||||
visit_occurrence_id BIGINT NULL ,
|
||||
visit_detail_id BIGINT NULL ,
|
||||
measurement_source_value VARCHAR(50) NULL ,
|
||||
measurement_source_concept_id INTEGER NULL ,
|
||||
unit_source_value VARCHAR(50) NULL ,
|
||||
value_source_value VARCHAR(50) NULL
|
||||
)
|
||||
DISTRUBTE ON (person_id)
|
||||
DISTRIBUTE ON (person_id)
|
||||
;
|
||||
|
||||
|
||||
|
@ -512,9 +471,8 @@ CREATE TABLE note
|
|||
(
|
||||
note_id BIGINT NOT NULL ,
|
||||
person_id BIGINT NOT NULL ,
|
||||
note_event_id BIGINT NULL , --This and the field below added
|
||||
note_domain_id VARCHAR(20) NULL , --This field may be removed in favor of the one below
|
||||
--note_event_table_concept_id INTEGER NULL , --This may be added based on 9/4 meeting
|
||||
note_event_id BIGINT NULL ,
|
||||
note_event_field_concept_id INTEGER NULL ,
|
||||
note_date DATE NULL ,
|
||||
note_datetime DATETIME NOT NULL ,
|
||||
note_type_concept_id INTEGER NOT NULL ,
|
||||
|
@ -523,12 +481,12 @@ CREATE TABLE note
|
|||
note_text VARCHAR(1000) NULL ,
|
||||
encoding_concept_id INTEGER NOT NULL ,
|
||||
language_concept_id INTEGER NOT NULL ,
|
||||
provider_id INTEGER NULL ,
|
||||
visit_occurrence_id INTEGER NULL ,
|
||||
visit_detail_id INTEGER NULL ,
|
||||
provider_id BIGINT NULL ,
|
||||
visit_occurrence_id BIGINT NULL ,
|
||||
visit_detail_id BIGINT NULL ,
|
||||
note_source_value VARCHAR(50) NULL
|
||||
)
|
||||
DISTRUBTE ON (person_id)
|
||||
DISTRIBUTE ON (person_id)
|
||||
;
|
||||
|
||||
|
||||
|
@ -568,19 +526,18 @@ CREATE TABLE observation
|
|||
value_as_concept_id INTEGER NULL ,
|
||||
qualifier_concept_id INTEGER NULL ,
|
||||
unit_concept_id INTEGER NULL ,
|
||||
provider_id INTEGER NULL ,
|
||||
provider_id BIGINT NULL ,
|
||||
visit_occurrence_id BIGINT NULL ,
|
||||
visit_detail_id BIGINT NULL ,
|
||||
observation_source_value VARCHAR(50) NULL ,
|
||||
observation_source_concept_id INTEGER NULL ,
|
||||
unit_source_value VARCHAR(50) NULL ,
|
||||
qualifier_source_value VARCHAR(50) NULL ,
|
||||
observation_event_id BIGINT NULL , /* This will link back to the event table (SURVEY) on SURVEY_OCCURRENCE_ID, changed name to comply with COST and NOTE*/
|
||||
observation_event_domain_id VARCHAR(20) NULL ,
|
||||
--obs_event_table_concept_id INTEGER NULL , /* Changed name to comply with COST and NOTE. This should be 'Survey'. Had to use 'obs' for oracle restriction, may be added on 9/4*/
|
||||
observation_event_id BIGINT NULL ,
|
||||
obs_event_field_concept_id INTEGER NULL ,
|
||||
value_as_datetime DATETIME NULL
|
||||
)
|
||||
DISTRUBTE ON (person_id)
|
||||
DISTRIBUTE ON (person_id)
|
||||
;
|
||||
|
||||
|
||||
|
@ -630,7 +587,6 @@ DISTRIBUTE ON RANDOM
|
|||
;
|
||||
|
||||
|
||||
|
||||
/************************
|
||||
|
||||
Standardized health system data
|
||||
|
@ -739,7 +695,7 @@ CREATE TABLE payer_plan_period
|
|||
stop_reason_source_value VARCHAR(50) NULL ,
|
||||
stop_reason_source_concept_id INTEGER NULL
|
||||
)
|
||||
DISTRUBTE ON (person_id)
|
||||
DISTRIBUTE ON (person_id)
|
||||
;
|
||||
|
||||
|
||||
|
@ -749,8 +705,7 @@ CREATE TABLE cost
|
|||
cost_id BIGINT NOT NULL ,
|
||||
person_id BIGINT NOT NULL,
|
||||
cost_event_id BIGINT NOT NULL ,
|
||||
cost_domain_id VARCHAR(20) NOT NULL ,
|
||||
--cost_event_table_concept_id INTEGER NOT NULL , /*This is still in discussion and most likely will replace cost_domain_id at 9/4 meeting*/
|
||||
cost_event_field_concept_id INTEGER NOT NULL ,
|
||||
cost_concept_id INTEGER NOT NULL ,
|
||||
cost_type_concept_id INTEGER NOT NULL ,
|
||||
currency_concept_id INTEGER NULL ,
|
||||
|
@ -777,33 +732,6 @@ Standardized derived elements
|
|||
************************/
|
||||
|
||||
|
||||
--HINT DISTRIBUTE_ON_KEY(subject_id)
|
||||
CREATE TABLE cohort
|
||||
(
|
||||
cohort_definition_id BIGINT NOT NULL ,
|
||||
subject_id BIGINT NOT NULL ,
|
||||
cohort_start_date DATE NOT NULL ,
|
||||
cohort_end_date DATE NOT NULL
|
||||
)
|
||||
DISTRUBTE ON (subject_id)
|
||||
;
|
||||
|
||||
|
||||
--HINT DISTRIBUTE_ON_KEY(subject_id)
|
||||
CREATE TABLE cohort_attribute
|
||||
(
|
||||
cohort_definition_id BIGINT NOT NULL ,
|
||||
subject_id BIGINT NOT NULL ,
|
||||
cohort_start_date DATE NOT NULL ,
|
||||
cohort_end_date DATE NOT NULL ,
|
||||
attribute_definition_id BIGINT NOT NULL ,
|
||||
value_as_number REAL NULL ,
|
||||
value_as_concept_id INTEGER NULL
|
||||
)
|
||||
DISTRUBTE ON (subject_id)
|
||||
;
|
||||
|
||||
|
||||
--HINT DISTRIBUTE_ON_KEY(person_id)
|
||||
CREATE TABLE drug_era
|
||||
(
|
||||
|
@ -815,7 +743,7 @@ CREATE TABLE drug_era
|
|||
drug_exposure_count INTEGER NULL ,
|
||||
gap_days INTEGER NULL
|
||||
)
|
||||
DISTRUBTE ON (person_id)
|
||||
DISTRIBUTE ON (person_id)
|
||||
;
|
||||
|
||||
|
||||
|
@ -830,7 +758,7 @@ CREATE TABLE dose_era
|
|||
dose_era_start_date DATE NOT NULL ,
|
||||
dose_era_end_date DATE NOT NULL
|
||||
)
|
||||
DISTRUBTE ON (person_id)
|
||||
DISTRIBUTE ON (person_id)
|
||||
;
|
||||
|
||||
|
||||
|
@ -844,5 +772,5 @@ CREATE TABLE condition_era
|
|||
condition_era_end_date DATE NOT NULL ,
|
||||
condition_occurrence_count INTEGER NULL
|
||||
)
|
||||
DISTRUBTE ON (person_id)
|
||||
DISTRIBUTE ON (person_id)
|
||||
;
|
||||
|
|
|
@ -77,11 +77,6 @@ ALTER TABLE source_to_concept_map ADD CONSTRAINT xpk_source_to_concept_map PRIMA
|
|||
|
||||
ALTER TABLE drug_strength ADD CONSTRAINT xpk_drug_strength PRIMARY KEY (drug_concept_id, ingredient_concept_id);
|
||||
|
||||
ALTER TABLE cohort_definition ADD CONSTRAINT xpk_cohort_definition PRIMARY KEY (cohort_definition_id);
|
||||
|
||||
ALTER TABLE attribute_definition ADD CONSTRAINT xpk_attribute_definition PRIMARY KEY (attribute_definition_id);
|
||||
|
||||
|
||||
/**************************
|
||||
|
||||
Standardized meta-data
|
||||
|
@ -127,7 +122,7 @@ 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 ) ;
|
||||
|
||||
ALTER TABLE survey ADD CONSTRAINT xpk_survey PRIMARY KEY ( survey_occurrence_id ) ;
|
||||
ALTER TABLE survey_conduct ADD CONSTRAINT xpk_survey_conduct PRIMARY KEY ( survey_conduct_id ) ;
|
||||
|
||||
|
||||
/************************
|
||||
|
@ -139,7 +134,7 @@ Standardized health system data
|
|||
|
||||
ALTER TABLE location ADD CONSTRAINT xpk_location PRIMARY KEY ( location_id ) ;
|
||||
|
||||
ALTER TABLE location_history ADD CONSTRAINT xpk_location_history PRIMARY KEY ( location_history_id ) ; -- May need to remove this one
|
||||
ALTER TABLE location_history ADD CONSTRAINT xpk_location_history PRIMARY KEY ( location_history_id ) ;
|
||||
|
||||
ALTER TABLE care_site ADD CONSTRAINT xpk_care_site PRIMARY KEY ( care_site_id ) ;
|
||||
|
||||
|
@ -165,10 +160,6 @@ Standardized derived elements
|
|||
|
||||
************************/
|
||||
|
||||
ALTER TABLE cohort ADD CONSTRAINT xpk_cohort PRIMARY KEY ( cohort_definition_id, subject_id, cohort_start_date, cohort_end_date ) ;
|
||||
|
||||
ALTER TABLE cohort_attribute ADD CONSTRAINT xpk_cohort_attribute PRIMARY KEY ( cohort_definition_id, subject_id, cohort_start_date, cohort_end_date, attribute_definition_id ) ;
|
||||
|
||||
ALTER TABLE drug_era ADD CONSTRAINT xpk_drug_era PRIMARY KEY ( drug_era_id ) ;
|
||||
|
||||
ALTER TABLE dose_era ADD CONSTRAINT xpk_dose_era PRIMARY KEY ( dose_era_id ) ;
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
|
||||
oracle script to create foreign key, unique, and check constraints within the OMOP common data model, version 6.0
|
||||
|
||||
last revised: 30-Augââ€Å’-2018
|
||||
last revised: 30-Aug-2018
|
||||
|
||||
author: Patrick Ryan, Clair Blacketer
|
||||
|
||||
|
@ -86,7 +86,7 @@ ALTER TABLE relationship ADD CONSTRAINT fpk_relationship_reverse FOREIGN KEY (re
|
|||
|
||||
ALTER TABLE concept_synonym ADD CONSTRAINT fpk_concept_synonym_concept FOREIGN KEY (concept_id) REFERENCES concept (concept_id);
|
||||
|
||||
ALTER TABLE concept_synonym ADD CONSTRAINT fpk_concept_synonym_concept FOREIGN KEY (language_concept_id) REFERENCES concept (concept_id);
|
||||
ALTER TABLE concept_synonym ADD CONSTRAINT fpk_synonym_language FOREIGN KEY (language_concept_id) REFERENCES concept (concept_id);
|
||||
|
||||
|
||||
ALTER TABLE concept_ancestor ADD CONSTRAINT fpk_concept_ancestor_concept_1 FOREIGN KEY (ancestor_concept_id) REFERENCES concept (concept_id);
|
||||
|
@ -112,14 +112,6 @@ ALTER TABLE drug_strength ADD CONSTRAINT fpk_drug_strength_unit_2 FOREIGN KEY (n
|
|||
ALTER TABLE drug_strength ADD CONSTRAINT fpk_drug_strength_unit_3 FOREIGN KEY (denominator_unit_concept_id) REFERENCES concept (concept_id);
|
||||
|
||||
|
||||
ALTER TABLE cohort_definition ADD CONSTRAINT fpk_cohort_definition_concept FOREIGN KEY (definition_type_concept_id) REFERENCES concept (concept_id);
|
||||
|
||||
ALTER TABLE cohort_definition ADD CONSTRAINT fpk_subject_concept FOREIGN KEY (subject_concept_id) REFERENCES concept (concept_id);
|
||||
|
||||
|
||||
ALTER TABLE attribute_definition ADD CONSTRAINT fpk_attribute_type_concept FOREIGN KEY (attribute_type_concept_id) REFERENCES concept (concept_id);
|
||||
|
||||
|
||||
/**************************
|
||||
|
||||
Standardized meta-data
|
||||
|
@ -196,7 +188,7 @@ ALTER TABLE visit_occurrence ADD CONSTRAINT fpk_visit_care_site FOREIGN KEY (car
|
|||
|
||||
ALTER TABLE visit_occurrence ADD CONSTRAINT fpk_visit_concept_s FOREIGN KEY (visit_source_concept_id) REFERENCES concept (concept_id);
|
||||
|
||||
ALTER TABLE visit_occurrence ADD CONSTRAINT fpk_visit_admitting_s FOREIGN KEY (admitting_source_concept_id) REFERENCES concept (concept_id);
|
||||
ALTER TABLE visit_occurrence ADD CONSTRAINT fpk_visit_admitting_s FOREIGN KEY (admitted_from_concept_id) REFERENCES concept (concept_id);
|
||||
|
||||
ALTER TABLE visit_occurrence ADD CONSTRAINT fpk_visit_discharge FOREIGN KEY (discharge_to_concept_id) REFERENCES concept (concept_id);
|
||||
|
||||
|
@ -215,7 +207,7 @@ ALTER TABLE visit_detail ADD CONSTRAINT fpk_v_detail_care_site FOREIGN KEY (care
|
|||
|
||||
ALTER TABLE visit_detail ADD CONSTRAINT fpk_v_detail_discharge FOREIGN KEY (discharge_to_concept_id) REFERENCES concept (concept_id);
|
||||
|
||||
ALTER TABLE visit_detail ADD CONSTRAINT fpk_v_detail_admitting_s FOREIGN KEY (admitting_source_concept_id) REFERENCES concept (concept_id);
|
||||
ALTER TABLE visit_detail ADD CONSTRAINT fpk_v_detail_admitting_s FOREIGN KEY (admitted_from_concept_id) REFERENCES concept (concept_id);
|
||||
|
||||
ALTER TABLE visit_detail ADD CONSTRAINT fpk_v_detail_concept_s FOREIGN KEY (visit_detail_source_concept_id) REFERENCES concept (concept_id);
|
||||
|
||||
|
@ -476,16 +468,6 @@ Standardized derived elements
|
|||
************************/
|
||||
|
||||
|
||||
ALTER TABLE cohort ADD CONSTRAINT fpk_cohort_definition FOREIGN KEY (cohort_definition_id) REFERENCES cohort_definition (cohort_definition_id);
|
||||
|
||||
|
||||
ALTER TABLE cohort_attribute ADD CONSTRAINT fpk_ca_cohort_definition FOREIGN KEY (cohort_definition_id) REFERENCES cohort_definition (cohort_definition_id);
|
||||
|
||||
ALTER TABLE cohort_attribute ADD CONSTRAINT fpk_ca_attribute_definition FOREIGN KEY (attribute_definition_id) REFERENCES attribute_definition (attribute_definition_id);
|
||||
|
||||
ALTER TABLE cohort_attribute ADD CONSTRAINT fpk_ca_value FOREIGN KEY (value_as_concept_id) REFERENCES concept (concept_id);
|
||||
|
||||
|
||||
ALTER TABLE drug_era ADD CONSTRAINT fpk_drug_era_person FOREIGN KEY (person_id) REFERENCES person (person_id);
|
||||
|
||||
ALTER TABLE drug_era ADD CONSTRAINT fpk_drug_era_concept FOREIGN KEY (drug_concept_id) REFERENCES concept (concept_id);
|
||||
|
|
|
@ -163,30 +163,6 @@ CREATE TABLE drug_strength (
|
|||
;
|
||||
|
||||
|
||||
--HINT DISTRIBUTE ON RANDOM
|
||||
CREATE TABLE cohort_definition (
|
||||
cohort_definition_id INTEGER NOT NULL,
|
||||
cohort_definition_name VARCHAR(255) NOT NULL,
|
||||
cohort_definition_description CLOB NULL,
|
||||
definition_type_concept_id INTEGER NOT NULL,
|
||||
cohort_definition_syntax CLOB NULL,
|
||||
subject_concept_id INTEGER NOT NULL,
|
||||
cohort_initiation_date DATE NULL
|
||||
)
|
||||
;
|
||||
|
||||
|
||||
--HINT DISTRIBUTE ON RANDOM
|
||||
CREATE TABLE attribute_definition (
|
||||
attribute_definition_id INTEGER NOT NULL,
|
||||
attribute_name VARCHAR(255) NOT NULL,
|
||||
attribute_description CLOB NULL,
|
||||
attribute_type_concept_id INTEGER NOT NULL,
|
||||
attribute_syntax CLOB NULL
|
||||
)
|
||||
;
|
||||
|
||||
|
||||
/**************************
|
||||
|
||||
Standardized meta-data
|
||||
|
@ -220,12 +196,12 @@ CREATE TABLE metadata
|
|||
value_as_string CLOB NULL ,
|
||||
value_as_concept_id INTEGER NULL ,
|
||||
metadata_date DATE NULL ,
|
||||
metadata_datetime DATETIME2 NULL
|
||||
metadata_datetime TIMESTAMP NULL
|
||||
)
|
||||
;
|
||||
|
||||
INSERT INTO metadata (name, value_as_string) --Added cdm version record
|
||||
VALUES ('CDM Version', '6.0')
|
||||
INSERT INTO metadata (metadata_concept_id, metadata_type_concept_id, name, value_as_string, value_as_concept_id, metadata_date, metadata_datetime) --Added cdm version record
|
||||
VALUES (0,0,'CDM Version', '6.0',0,NULL,NULL)
|
||||
;
|
||||
|
||||
|
||||
|
@ -244,12 +220,12 @@ CREATE TABLE person
|
|||
year_of_birth INTEGER NOT NULL ,
|
||||
month_of_birth INTEGER NULL,
|
||||
day_of_birth INTEGER NULL,
|
||||
birth_datetime DATETIME2 NULL,
|
||||
birth_datetime TIMESTAMP NULL,
|
||||
race_concept_id INTEGER NOT NULL,
|
||||
ethnicity_concept_id INTEGER NOT NULL,
|
||||
location_id INTEGER NULL,
|
||||
provider_id INTEGER NULL,
|
||||
care_site_id INTEGER NULL,
|
||||
location_id NUMBER(19) NULL,
|
||||
provider_id NUMBER(19) NULL,
|
||||
care_site_id NUMBER(19) NULL,
|
||||
person_source_value VARCHAR(50) NULL,
|
||||
gender_source_value VARCHAR(50) NULL,
|
||||
gender_source_concept_id INTEGER NULL,
|
||||
|
@ -281,7 +257,7 @@ CREATE TABLE specimen
|
|||
specimen_concept_id INTEGER NOT NULL ,
|
||||
specimen_type_concept_id INTEGER NOT NULL ,
|
||||
specimen_date DATE NULL ,
|
||||
specimen_datetime DATETIME2 NOT NULL ,
|
||||
specimen_datetime TIMESTAMP NOT NULL ,
|
||||
quantity FLOAT NULL ,
|
||||
unit_concept_id INTEGER NULL ,
|
||||
anatomic_site_concept_id INTEGER NULL ,
|
||||
|
@ -295,20 +271,6 @@ CREATE TABLE specimen
|
|||
;
|
||||
|
||||
|
||||
--HINT DISTRIBUTE_ON_KEY(person_id)
|
||||
CREATE TABLE death
|
||||
(
|
||||
person_id NUMBER(19) NOT NULL ,
|
||||
death_date DATE NULL ,
|
||||
death_datetime DATETIME2 NOT NULL ,
|
||||
death_type_concept_id INTEGER NOT NULL ,
|
||||
cause_concept_id INTEGER NULL ,
|
||||
cause_source_value VARCHAR(50) NULL,
|
||||
cause_source_concept_id INTEGER NULL
|
||||
)
|
||||
;
|
||||
|
||||
|
||||
--HINT DISTRIBUTE_ON_KEY(person_id)
|
||||
CREATE TABLE visit_occurrence
|
||||
(
|
||||
|
@ -316,15 +278,15 @@ CREATE TABLE visit_occurrence
|
|||
person_id NUMBER(19) NOT NULL ,
|
||||
visit_concept_id INTEGER NOT NULL ,
|
||||
visit_start_date DATE NULL ,
|
||||
visit_start_datetime DATETIME2 NOT NULL ,
|
||||
visit_start_datetime TIMESTAMP NOT NULL ,
|
||||
visit_end_date DATE NULL ,
|
||||
visit_end_datetime DATETIME2 NOT NULL ,
|
||||
visit_end_datetime TIMESTAMP NOT NULL ,
|
||||
visit_type_concept_id INTEGER NOT NULL ,
|
||||
provider_id INTEGER NULL,
|
||||
care_site_id INTEGER NULL,
|
||||
provider_id NUMBER(19) NULL,
|
||||
care_site_id NUMBER(19) NULL,
|
||||
visit_source_value VARCHAR(50) NULL,
|
||||
visit_source_concept_id INTEGER NULL ,
|
||||
admitted_from_concept_id INTEGER NULL , /*Changed from admitting_source_* */
|
||||
admitted_from_concept_id INTEGER NULL ,
|
||||
admitted_from_source_value VARCHAR(50) NULL ,
|
||||
discharge_to_source_value VARCHAR(50) NULL ,
|
||||
discharge_to_concept_id INTEGER NULL ,
|
||||
|
@ -340,12 +302,12 @@ CREATE TABLE visit_detail
|
|||
person_id NUMBER(19) NOT NULL ,
|
||||
visit_detail_concept_id INTEGER NOT NULL ,
|
||||
visit_detail_start_date DATE NULL ,
|
||||
visit_detail_start_datetime DATETIME2 NOT NULL ,
|
||||
visit_detail_start_datetime TIMESTAMP NOT NULL ,
|
||||
visit_detail_end_date DATE NULL ,
|
||||
visit_detail_end_datetime DATETIME2 NOT NULL ,
|
||||
visit_detail_end_datetime TIMESTAMP NOT NULL ,
|
||||
visit_detail_type_concept_id INTEGER NOT NULL ,
|
||||
provider_id INTEGER NULL ,
|
||||
care_site_id INTEGER NULL ,
|
||||
provider_id NUMBER(19) NULL ,
|
||||
care_site_id NUMBER(19) NULL ,
|
||||
discharge_to_concept_id INTEGER NULL ,
|
||||
admitted_from_concept_id INTEGER NULL , /*Changed from admitting_source_* */
|
||||
admitted_from_source_value VARCHAR(50) NULL ,
|
||||
|
@ -366,16 +328,16 @@ CREATE TABLE procedure_occurrence
|
|||
person_id NUMBER(19) NOT NULL ,
|
||||
procedure_concept_id INTEGER NOT NULL ,
|
||||
procedure_date DATE NULL ,
|
||||
procedure_datetime DATETIME2 NOT NULL ,
|
||||
procedure_datetime TIMESTAMP NOT NULL ,
|
||||
procedure_type_concept_id INTEGER NOT NULL ,
|
||||
modifier_concept_id INTEGER NULL ,
|
||||
quantity INTEGER NULL ,
|
||||
provider_id INTEGER NULL ,
|
||||
visit_occurrence_id INTEGER NULL ,
|
||||
visit_detail_id INTEGER NULL ,
|
||||
provider_id NUMBER(19) NULL ,
|
||||
visit_occurrence_id NUMBER(19) NULL ,
|
||||
visit_detail_id NUMBER(19) NULL ,
|
||||
procedure_source_value VARCHAR(50) NULL ,
|
||||
procedure_source_concept_id INTEGER NULL ,
|
||||
modifier_source_value VARCHAR(50) NULL ,
|
||||
modifier_source_value VARCHAR(50) NULL
|
||||
)
|
||||
;
|
||||
|
||||
|
@ -387,9 +349,9 @@ CREATE TABLE drug_exposure
|
|||
person_id NUMBER(19) NOT NULL ,
|
||||
drug_concept_id INTEGER NOT NULL ,
|
||||
drug_exposure_start_date DATE NULL ,
|
||||
drug_exposure_start_datetime DATETIME2 NOT NULL ,
|
||||
drug_exposure_start_datetime TIMESTAMP NOT NULL ,
|
||||
drug_exposure_end_date DATE NULL ,
|
||||
drug_exposure_end_datetime DATETIME2 NOT NULL ,
|
||||
drug_exposure_end_datetime TIMESTAMP NOT NULL ,
|
||||
verbatim_end_date DATE NULL ,
|
||||
drug_type_concept_id INTEGER NOT NULL ,
|
||||
stop_reason VARCHAR(20) NULL ,
|
||||
|
@ -399,9 +361,9 @@ CREATE TABLE drug_exposure
|
|||
sig CLOB NULL ,
|
||||
route_concept_id INTEGER NULL ,
|
||||
lot_number VARCHAR(50) NULL ,
|
||||
provider_id INTEGER NULL ,
|
||||
visit_occurrence_id INTEGER NULL ,
|
||||
visit_detail_id INTEGER NULL ,
|
||||
provider_id NUMBER(19) NULL ,
|
||||
visit_occurrence_id NUMBER(19) NULL ,
|
||||
visit_detail_id NUMBER(19) NULL ,
|
||||
drug_source_value VARCHAR(50) NULL ,
|
||||
drug_source_concept_id INTEGER NULL ,
|
||||
route_source_value VARCHAR(50) NULL ,
|
||||
|
@ -417,15 +379,15 @@ CREATE TABLE device_exposure
|
|||
person_id NUMBER(19) NOT NULL ,
|
||||
device_concept_id INTEGER NOT NULL ,
|
||||
device_exposure_start_date DATE NULL ,
|
||||
device_exposure_start_datetime DATETIME2 NOT NULL ,
|
||||
device_exposure_start_datetime TIMESTAMP NOT NULL ,
|
||||
device_exposure_end_date DATE NULL ,
|
||||
device_exposure_end_datetime DATETIME2 NULL ,
|
||||
device_exposure_end_datetime TIMESTAMP NULL ,
|
||||
device_type_concept_id INTEGER NOT NULL ,
|
||||
unique_device_id VARCHAR(50) NULL ,
|
||||
quantity INTEGER NULL ,
|
||||
provider_id INTEGER NULL ,
|
||||
visit_occurrence_id INTEGER NULL ,
|
||||
visit_detail_id INTEGER NULL ,
|
||||
provider_id NUMBER(19) NULL ,
|
||||
visit_occurrence_id NUMBER(19) NULL ,
|
||||
visit_detail_id NUMBER(19) NULL ,
|
||||
device_source_value VARCHAR(100) NULL ,
|
||||
device_source_concept_id INTEGER NULL
|
||||
)
|
||||
|
@ -439,15 +401,15 @@ CREATE TABLE condition_occurrence
|
|||
person_id NUMBER(19) NOT NULL ,
|
||||
condition_concept_id INTEGER NOT NULL ,
|
||||
condition_start_date DATE NULL ,
|
||||
condition_start_datetime DATETIME2 NOT NULL ,
|
||||
condition_start_datetime TIMESTAMP NOT NULL ,
|
||||
condition_end_date DATE NULL ,
|
||||
condition_end_datetime DATETIME2 NULL ,
|
||||
condition_end_datetime TIMESTAMP NULL ,
|
||||
condition_type_concept_id INTEGER NOT NULL ,
|
||||
condition_status_concept_id INTEGER NULL ,
|
||||
stop_reason VARCHAR(20) NULL ,
|
||||
provider_id INTEGER NULL ,
|
||||
visit_occurrence_id INTEGER NULL ,
|
||||
visit_detail_id INTEGER NULL ,
|
||||
provider_id NUMBER(19) NULL ,
|
||||
visit_occurrence_id NUMBER(19) NULL ,
|
||||
visit_detail_id NUMBER(19) NULL ,
|
||||
condition_source_value VARCHAR(50) NULL ,
|
||||
condition_source_concept_id INTEGER NULL ,
|
||||
condition_status_source_value VARCHAR(50) NULL
|
||||
|
@ -462,7 +424,7 @@ CREATE TABLE measurement
|
|||
person_id NUMBER(19) NOT NULL ,
|
||||
measurement_concept_id INTEGER NOT NULL ,
|
||||
measurement_date DATE NULL ,
|
||||
measurement_datetime DATETIME2 NOT NULL ,
|
||||
measurement_datetime TIMESTAMP NOT NULL ,
|
||||
measurement_time VARCHAR(10) NULL,
|
||||
measurement_type_concept_id INTEGER NOT NULL ,
|
||||
operator_concept_id INTEGER NULL ,
|
||||
|
@ -471,9 +433,9 @@ CREATE TABLE measurement
|
|||
unit_concept_id INTEGER NULL ,
|
||||
range_low FLOAT NULL ,
|
||||
range_high FLOAT NULL ,
|
||||
provider_id INTEGER NULL ,
|
||||
visit_occurrence_id INTEGER NULL ,
|
||||
visit_detail_id INTEGER NULL ,
|
||||
provider_id NUMBER(19) NULL ,
|
||||
visit_occurrence_id NUMBER(19) NULL ,
|
||||
visit_detail_id NUMBER(19) NULL ,
|
||||
measurement_source_value VARCHAR(50) NULL ,
|
||||
measurement_source_concept_id INTEGER NULL ,
|
||||
unit_source_value VARCHAR(50) NULL ,
|
||||
|
@ -487,20 +449,19 @@ CREATE TABLE note
|
|||
(
|
||||
note_id NUMBER(19) NOT NULL ,
|
||||
person_id NUMBER(19) NOT NULL ,
|
||||
note_event_id NUMBER(19) NULL , --This and the field below added
|
||||
note_domain_id VARCHAR(20) NULL , --This field may be removed in favor of the one below
|
||||
--note_event_table_concept_id INTEGER NULL , --This may be added based on 9/4 meeting
|
||||
note_event_id NUMBER(19) NULL ,
|
||||
note_event_field_concept_id INTEGER NULL ,
|
||||
note_date DATE NULL ,
|
||||
note_datetime DATETIME2 NOT NULL ,
|
||||
note_datetime TIMESTAMP NOT NULL ,
|
||||
note_type_concept_id INTEGER NOT NULL ,
|
||||
note_class_concept_id INTEGER NOT NULL ,
|
||||
note_title VARCHAR(250) NULL ,
|
||||
note_text CLOB NULL ,
|
||||
encoding_concept_id INTEGER NOT NULL ,
|
||||
language_concept_id INTEGER NOT NULL ,
|
||||
provider_id INTEGER NULL ,
|
||||
visit_occurrence_id INTEGER NULL ,
|
||||
visit_detail_id INTEGER NULL ,
|
||||
provider_id NUMBER(19) NULL ,
|
||||
visit_occurrence_id NUMBER(19) NULL ,
|
||||
visit_detail_id NUMBER(19) NULL ,
|
||||
note_source_value VARCHAR(50) NULL
|
||||
)
|
||||
;
|
||||
|
@ -518,7 +479,7 @@ CREATE TABLE note_nlp
|
|||
note_nlp_concept_id INTEGER NULL ,
|
||||
nlp_system VARCHAR(250) NULL ,
|
||||
nlp_date DATE NOT NULL ,
|
||||
nlp_datetime DATETIME2 NULL ,
|
||||
nlp_datetime TIMESTAMP NULL ,
|
||||
term_exists VARCHAR(1) NULL ,
|
||||
term_temporal VARCHAR(50) NULL ,
|
||||
term_modifiers VARCHAR(2000) NULL ,
|
||||
|
@ -534,14 +495,14 @@ CREATE TABLE observation
|
|||
person_id NUMBER(19) NOT NULL ,
|
||||
observation_concept_id INTEGER NOT NULL ,
|
||||
observation_date DATE NULL ,
|
||||
observation_datetime DATETIME2 NOT NULL ,
|
||||
observation_datetime TIMESTAMP NOT NULL ,
|
||||
observation_type_concept_id INTEGER NOT NULL ,
|
||||
value_as_number FLOAT NULL ,
|
||||
value_as_string VARCHAR(60) NULL ,
|
||||
value_as_concept_id INTEGER NULL ,
|
||||
qualifier_concept_id INTEGER NULL ,
|
||||
unit_concept_id INTEGER NULL ,
|
||||
provider_id INTEGER NULL ,
|
||||
provider_id NUMBER(19) NULL ,
|
||||
visit_occurrence_id NUMBER(19) NULL ,
|
||||
visit_detail_id NUMBER(19) NULL ,
|
||||
observation_source_value VARCHAR(50) NULL ,
|
||||
|
@ -549,9 +510,8 @@ CREATE TABLE observation
|
|||
unit_source_value VARCHAR(50) NULL ,
|
||||
qualifier_source_value VARCHAR(50) NULL ,
|
||||
observation_event_id NUMBER(19) NULL , /* This will link back to the event table (SURVEY) on SURVEY_OCCURRENCE_ID, changed name to comply with COST and NOTE*/
|
||||
observation_event_domain_id VARCHAR(20) NULL ,
|
||||
--obs_event_table_concept_id INTEGER NULL , /* Changed name to comply with COST and NOTE. Had to use 'obs' for oracle restriction, may be added on 9/4*/
|
||||
value_as_datetime DATETIME2 NULL
|
||||
obs_event_field_concept_id INTEGER NULL , /* Changed name to comply with COST and NOTE. Had to use 'obs' for oracle restriction, may be added on 9/4*/
|
||||
value_as_datetime TIMESTAMP NULL
|
||||
)
|
||||
;
|
||||
|
||||
|
@ -563,9 +523,9 @@ CREATE TABLE survey_conduct --Table added
|
|||
person_id NUMBER(19) NOT NULL ,
|
||||
survey_concept_id INTEGER NOT NULL ,
|
||||
survey_start_date DATE NULL ,
|
||||
survey_start_datetime DATETIME2 NULL ,
|
||||
survey_start_datetime TIMESTAMP NULL ,
|
||||
survey_end_date DATE NULL ,
|
||||
survey_end_datetime DATETIME2 NOT NULL ,
|
||||
survey_end_datetime TIMESTAMP NOT NULL ,
|
||||
provider_id NUMBER(19) NULL ,
|
||||
assisted_concept_id INTEGER NULL ,
|
||||
respondent_type_concept_id INTEGER NULL ,
|
||||
|
@ -583,7 +543,7 @@ CREATE TABLE survey_conduct --Table added
|
|||
survey_version_number VARCHAR(20) NULL ,
|
||||
visit_occurrence_id NUMBER(19) NULL ,
|
||||
visit_detail_id NUMBER(19) NULL ,
|
||||
response_to_visit_occurrence_id NUMBER(19) NULL
|
||||
response_visit_occurrence_id NUMBER(19) NULL
|
||||
)
|
||||
;
|
||||
|
||||
|
@ -714,8 +674,7 @@ CREATE TABLE cost
|
|||
cost_id NUMBER(19) NOT NULL ,
|
||||
person_id NUMBER(19) NOT NULL,
|
||||
cost_event_id NUMBER(19) NOT NULL ,
|
||||
cost_domain_id VARCHAR(20) NOT NULL ,
|
||||
--cost_event_table_concept_id INTEGER NOT NULL , /*This is still in discussion and most likely will replace cost_domain_id at 9/4 meeting*/
|
||||
cost_event_field_concept_id INTEGER NOT NULL ,
|
||||
cost_concept_id INTEGER NOT NULL ,
|
||||
cost_type_concept_id INTEGER NOT NULL ,
|
||||
currency_concept_id INTEGER NULL ,
|
||||
|
@ -741,31 +700,6 @@ Standardized derived elements
|
|||
************************/
|
||||
|
||||
|
||||
--HINT DISTRIBUTE_ON_KEY(subject_id)
|
||||
CREATE TABLE cohort
|
||||
(
|
||||
cohort_definition_id NUMBER(19) NOT NULL ,
|
||||
subject_id NUMBER(19) NOT NULL ,
|
||||
cohort_start_date DATE NOT NULL ,
|
||||
cohort_end_date DATE NOT NULL
|
||||
)
|
||||
;
|
||||
|
||||
|
||||
--HINT DISTRIBUTE_ON_KEY(subject_id)
|
||||
CREATE TABLE cohort_attribute
|
||||
(
|
||||
cohort_definition_id NUMBER(19) NOT NULL ,
|
||||
subject_id NUMBER(19) NOT NULL ,
|
||||
cohort_start_date DATE NOT NULL ,
|
||||
cohort_end_date DATE NOT NULL ,
|
||||
attribute_definition_id NUMBER(19) NOT NULL ,
|
||||
value_as_number FLOAT NULL ,
|
||||
value_as_concept_id INTEGER NULL
|
||||
)
|
||||
;
|
||||
|
||||
|
||||
--HINT DISTRIBUTE_ON_KEY(person_id)
|
||||
CREATE TABLE drug_era
|
||||
(
|
||||
|
|
|
@ -77,10 +77,6 @@ ALTER TABLE source_to_concept_map ADD CONSTRAINT xpk_source_to_concept_map PRIMA
|
|||
|
||||
ALTER TABLE drug_strength ADD CONSTRAINT xpk_drug_strength PRIMARY KEY (drug_concept_id, ingredient_concept_id);
|
||||
|
||||
ALTER TABLE cohort_definition ADD CONSTRAINT xpk_cohort_definition PRIMARY KEY (cohort_definition_id);
|
||||
|
||||
ALTER TABLE attribute_definition ADD CONSTRAINT xpk_attribute_definition PRIMARY KEY (attribute_definition_id);
|
||||
|
||||
|
||||
/**************************
|
||||
|
||||
|
@ -127,7 +123,7 @@ 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 ) ;
|
||||
|
||||
ALTER TABLE survey ADD CONSTRAINT xpk_survey PRIMARY KEY ( survey_occurrence_id ) ;
|
||||
ALTER TABLE survey_conduct ADD CONSTRAINT xpk_survey_conduct PRIMARY KEY ( survey_conduct_id ) ;
|
||||
|
||||
|
||||
/************************
|
||||
|
@ -139,7 +135,7 @@ Standardized health system data
|
|||
|
||||
ALTER TABLE location ADD CONSTRAINT xpk_location PRIMARY KEY ( location_id ) ;
|
||||
|
||||
ALTER TABLE location_history ADD CONSTRAINT xpk_location_history PRIMARY KEY ( location_history_id ) ; --Assuming this should be added
|
||||
ALTER TABLE location_history ADD CONSTRAINT xpk_location_history PRIMARY KEY ( location_history_id ) ;
|
||||
|
||||
ALTER TABLE care_site ADD CONSTRAINT xpk_care_site PRIMARY KEY ( care_site_id ) ;
|
||||
|
||||
|
@ -165,10 +161,6 @@ Standardized derived elements
|
|||
|
||||
************************/
|
||||
|
||||
ALTER TABLE cohort ADD CONSTRAINT xpk_cohort PRIMARY KEY ( cohort_definition_id, subject_id, cohort_start_date, cohort_end_date ) ;
|
||||
|
||||
ALTER TABLE cohort_attribute ADD CONSTRAINT xpk_cohort_attribute PRIMARY KEY ( cohort_definition_id, subject_id, cohort_start_date, cohort_end_date, attribute_definition_id ) ;
|
||||
|
||||
ALTER TABLE drug_era ADD CONSTRAINT xpk_drug_era PRIMARY KEY ( drug_era_id ) ;
|
||||
|
||||
ALTER TABLE dose_era ADD CONSTRAINT xpk_dose_era PRIMARY KEY ( dose_era_id ) ;
|
||||
|
@ -260,10 +252,6 @@ CREATE INDEX idx_source_to_concept_map_code ON source_to_concept_map (source_cod
|
|||
CREATE INDEX idx_drug_strength_id_1 ON drug_strength (drug_concept_id ASC);
|
||||
CREATE INDEX idx_drug_strength_id_2 ON drug_strength (ingredient_concept_id ASC);
|
||||
|
||||
CREATE INDEX idx_cohort_definition_id ON cohort_definition (cohort_definition_id ASC);
|
||||
|
||||
CREATE INDEX idx_attribute_definition_id ON attribute_definition (attribute_definition_id ASC);
|
||||
|
||||
|
||||
/**************************
|
||||
|
||||
|
@ -370,12 +358,6 @@ Standardized derived elements
|
|||
************************/
|
||||
|
||||
|
||||
CREATE INDEX idx_cohort_subject_id ON cohort (subject_id ASC);
|
||||
CREATE INDEX idx_cohort_c_definition_id ON cohort (cohort_definition_id ASC);
|
||||
|
||||
CREATE INDEX idx_ca_subject_id ON cohort_attribute (subject_id ASC);
|
||||
CREATE INDEX idx_ca_definition_id ON cohort_attribute (cohort_definition_id ASC);
|
||||
|
||||
CREATE INDEX idx_drug_era_person_id ON drug_era (person_id ASC);
|
||||
CREATE INDEX idx_drug_era_concept_id ON drug_era (drug_concept_id ASC);
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ In order to create your instantiation of the Common Data Model, we recommend fol
|
|||
|
||||
1. Create an empty schema.
|
||||
|
||||
2. Execute the script `OMOP CDM oracle ddl.txt` to create the tables and fields.
|
||||
2. Execute the script `OMOP CDM oracle ddl.txt` and `OMOP CDM Results oracle ddl.txt` to create the tables and fields.
|
||||
|
||||
3. Load your data into the schema.
|
||||
|
||||
|
|
Loading…
Reference in New Issue