diff --git a/PostgreSQL/OMOP CDM ddl - PostgreSQL.sql b/PostgreSQL/OMOP CDM ddl - PostgreSQL.sql index 9f40559..3d4e292 100644 --- a/PostgreSQL/OMOP CDM ddl - PostgreSQL.sql +++ b/PostgreSQL/OMOP CDM ddl - PostgreSQL.sql @@ -229,7 +229,7 @@ CREATE TABLE person year_of_birth INTEGER NOT NULL , month_of_birth INTEGER NULL, day_of_birth INTEGER NULL, - time_of_birth VARCHAR(10) NULL, + datetime_of_birth TIMESTAMP NULL, race_concept_id INTEGER NOT NULL, ethnicity_concept_id INTEGER NOT NULL, location_id INTEGER NULL, @@ -254,7 +254,9 @@ CREATE TABLE observation_period observation_period_id INTEGER NOT NULL , person_id INTEGER NOT NULL , observation_period_start_date DATE NOT NULL , + observation_period_start_datetime TIMESTAMP NOT NULL , observation_period_end_date DATE NOT NULL , + observation_period_end_datetime TIMESTAMP NOT NULL , period_type_concept_id INTEGER NOT NULL ) ; @@ -268,7 +270,7 @@ CREATE TABLE specimen specimen_concept_id INTEGER NOT NULL , specimen_type_concept_id INTEGER NOT NULL , specimen_date DATE NOT NULL , - specimen_time VARCHAR(10) NULL , + specimen_datetime TIMESTAMP NULL , quantity NUMERIC NULL , unit_concept_id INTEGER NULL , anatomic_site_concept_id INTEGER NULL , @@ -302,9 +304,9 @@ CREATE TABLE visit_occurrence person_id INTEGER NOT NULL , visit_concept_id INTEGER NOT NULL , visit_start_date DATE NOT NULL , - visit_start_time VARCHAR(10) NULL , + visit_start_datetime TIMESTAMP NULL , visit_end_date DATE NOT NULL , - visit_end_time VARCHAR(10) NULL , + visit_end_datetime TIMESTAMP NULL , visit_type_concept_id INTEGER NOT NULL , provider_id INTEGER NULL, care_site_id INTEGER NULL, @@ -321,6 +323,7 @@ CREATE TABLE procedure_occurrence person_id INTEGER NOT NULL , procedure_concept_id INTEGER NOT NULL , procedure_date DATE NOT NULL , + procedure_datetime TIMESTAMP NOT NULL , procedure_type_concept_id INTEGER NOT NULL , modifier_concept_id INTEGER NULL , quantity INTEGER NULL , @@ -340,8 +343,10 @@ CREATE TABLE drug_exposure person_id INTEGER NOT NULL , drug_concept_id INTEGER NOT NULL , drug_exposure_start_date DATE NOT NULL , - drug_exposure_end_date DATE NULL , - drug_type_concept_id INTEGER NOT NULL , + drug_exposure_start_datetime TIMESTAMP NOT NULL , + drug_exposure_end_date DATE NULL , + drug_exposure_end_datetime TIMESTAMP NULL , + drug_type_concept_id INTEGER NOT NULL , stop_reason VARCHAR(20) NULL , refills INTEGER NULL , quantity NUMERIC NULL , @@ -367,8 +372,10 @@ CREATE TABLE device_exposure person_id INTEGER NOT NULL , device_concept_id INTEGER NOT NULL , device_exposure_start_date DATE NOT NULL , - device_exposure_end_date DATE NULL , - device_type_concept_id INTEGER NOT NULL , + device_exposure_start_datetime TIMESTAMP NOT NULL , + device_exposure_end_date DATE 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 , @@ -385,8 +392,10 @@ CREATE TABLE condition_occurrence person_id INTEGER NOT NULL , condition_concept_id INTEGER NOT NULL , condition_start_date DATE NOT NULL , - condition_end_date DATE NULL , - condition_type_concept_id INTEGER NOT NULL , + condition_start_datetime TIMESTAMP NOT NULL , + condition_end_date DATE NULL , + condition_end_datetime TIMESTAMP NULL , + condition_type_concept_id INTEGER NOT NULL , stop_reason VARCHAR(20) NULL , provider_id INTEGER NULL , visit_occurrence_id INTEGER NULL , @@ -403,7 +412,7 @@ CREATE TABLE measurement person_id INTEGER NOT NULL , measurement_concept_id INTEGER NOT NULL , measurement_date DATE NOT NULL , - measurement_time VARCHAR(10) NULL , + measurement_datetime TIMESTAMP NULL , measurement_type_concept_id INTEGER NOT NULL , operator_concept_id INTEGER NULL , value_as_number NUMERIC NULL , @@ -427,7 +436,7 @@ CREATE TABLE note note_id INTEGER NOT NULL , person_id INTEGER NOT NULL , note_date DATE NOT NULL , - note_time VARCHAR(10) NULL , + note_datetime TIMESTAMP NULL , note_type_concept_id INTEGER NOT NULL , note_text TEXT NOT NULL , provider_id INTEGER NULL , @@ -444,7 +453,7 @@ CREATE TABLE observation person_id INTEGER NOT NULL , observation_concept_id INTEGER NOT NULL , observation_date DATE NOT NULL , - observation_time VARCHAR(10) NULL , + observation_datetime TIMESTAMP NULL , observation_type_concept_id INTEGER NOT NULL , value_as_number NUMERIC NULL , value_as_string VARCHAR(60) NULL ,