Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Sign in
Toggle navigation
C
CDM-OMOP
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Eladais
CDM-OMOP
Commits
c881fd0f
Commit
c881fd0f
authored
Sep 13, 2023
by
Pepe Marquez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
omop postgresql revisado
parent
c59c96f4
Changes
9
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
348 additions
and
213 deletions
+348
-213
.gitignore
.gitignore
+2
-0
instancia_omop_postgresql/Makefile
instancia_omop_postgresql/Makefile
+1
-1
instancia_omop_postgresql/docker-compose.yml
instancia_omop_postgresql/docker-compose.yml
+18
-0
instancia_omop_postgresql/omop_pk_postgres.sql
instancia_omop_postgresql/omop_pk_postgres.sql
+0
-59
instancia_omop_postgresql/postgresql/OMOPCDM_postgresql_5.4_constraints.sql
...tgresql/postgresql/OMOPCDM_postgresql_5.4_constraints.sql
+177
-0
instancia_omop_postgresql/postgresql/OMOPCDM_postgresql_5.4_ddl.sql
...omop_postgresql/postgresql/OMOPCDM_postgresql_5.4_ddl.sql
+55
-92
instancia_omop_postgresql/postgresql/OMOPCDM_postgresql_5.4_indices.sql
..._postgresql/postgresql/OMOPCDM_postgresql_5.4_indices.sql
+0
-61
instancia_omop_postgresql/postgresql/OMOPCDM_postgresql_5.4_primary_keys.sql
...gresql/postgresql/OMOPCDM_postgresql_5.4_primary_keys.sql
+29
-0
instancia_omop_postgresql/vocab_load.sql
instancia_omop_postgresql/vocab_load.sql
+66
-0
No files found.
.gitignore
0 → 100644
View file @
c881fd0f
vocabulary/
instancia_omop_postgresql/vocabulary_download_v5.zip
instancia_omop_postgresql/Makefile
View file @
c881fd0f
...
@@ -3,7 +3,7 @@ db:
...
@@ -3,7 +3,7 @@ db:
-e
POSTGRES_DB
=
omop
\
-e
POSTGRES_DB
=
omop
\
-e
POSTGRES_USER
=
postgres
\
-e
POSTGRES_USER
=
postgres
\
-e
POSTGRES_PASSWORD
=
postgres
\
-e
POSTGRES_PASSWORD
=
postgres
\
postgres:
latest
postgres:
15.4
stop
:
stop
:
docker
kill
postgres
docker
kill
postgres
instancia_omop_postgresql/docker-compose.yml
0 → 100644
View file @
c881fd0f
volumes
:
db-data
:
name
:
db-data
services
:
db
:
image
:
postgres:15.2-alpine
env_file
:
.env
ports
:
-
5432:5432
volumes
:
-
./db-data:/var/lib/postgres/data
healthcheck
:
test
:
[
"
CMD-SHELL"
,
"
pg_isready
-U
postgres"
]
interval
:
5s
timeout
:
5s
retries
:
10
instancia_omop_postgresql/omop_pk_postgres.sql
deleted
100644 → 0
View file @
c59c96f4
--postgresql CDM Primary Key Constraints for OMOP Common Data Model 5.4
ALTER
TABLE
omop
.
PERSON
ADD
CONSTRAINT
xpk_PERSON
PRIMARY
KEY
(
person_id
);
ALTER
TABLE
omop
.
OBSERVATION_PERIOD
ADD
CONSTRAINT
xpk_OBSERVATION_PERIOD
PRIMARY
KEY
(
observation_period_id
);
ALTER
TABLE
omop
.
VISIT_OCCURRENCE
ADD
CONSTRAINT
xpk_VISIT_OCCURRENCE
PRIMARY
KEY
(
visit_occurrence_id
);
ALTER
TABLE
omop
.
VISIT_DETAIL
ADD
CONSTRAINT
xpk_VISIT_DETAIL
PRIMARY
KEY
(
visit_detail_id
);
ALTER
TABLE
omop
.
CONDITION_OCCURRENCE
ADD
CONSTRAINT
xpk_CONDITION_OCCURRENCE
PRIMARY
KEY
(
condition_occurrence_id
);
ALTER
TABLE
omop
.
DRUG_EXPOSURE
ADD
CONSTRAINT
xpk_DRUG_EXPOSURE
PRIMARY
KEY
(
drug_exposure_id
);
ALTER
TABLE
omop
.
PROCEDURE_OCCURRENCE
ADD
CONSTRAINT
xpk_PROCEDURE_OCCURRENCE
PRIMARY
KEY
(
procedure_occurrence_id
);
ALTER
TABLE
omop
.
DEVICE_EXPOSURE
ADD
CONSTRAINT
xpk_DEVICE_EXPOSURE
PRIMARY
KEY
(
device_exposure_id
);
ALTER
TABLE
omop
.
MEASUREMENT
ADD
CONSTRAINT
xpk_MEASUREMENT
PRIMARY
KEY
(
measurement_id
);
ALTER
TABLE
omop
.
OBSERVATION
ADD
CONSTRAINT
xpk_OBSERVATION
PRIMARY
KEY
(
observation_id
);
ALTER
TABLE
omop
.
NOTE
ADD
CONSTRAINT
xpk_NOTE
PRIMARY
KEY
(
note_id
);
ALTER
TABLE
omop
.
NOTE_NLP
ADD
CONSTRAINT
xpk_NOTE_NLP
PRIMARY
KEY
(
note_nlp_id
);
ALTER
TABLE
omop
.
SPECIMEN
ADD
CONSTRAINT
xpk_SPECIMEN
PRIMARY
KEY
(
specimen_id
);
ALTER
TABLE
omop
.
LOCATION
ADD
CONSTRAINT
xpk_LOCATION
PRIMARY
KEY
(
location_id
);
ALTER
TABLE
omop
.
CARE_SITE
ADD
CONSTRAINT
xpk_CARE_SITE
PRIMARY
KEY
(
care_site_id
);
ALTER
TABLE
omop
.
PROVIDER
ADD
CONSTRAINT
xpk_PROVIDER
PRIMARY
KEY
(
provider_id
);
ALTER
TABLE
omop
.
PAYER_PLAN_PERIOD
ADD
CONSTRAINT
xpk_PAYER_PLAN_PERIOD
PRIMARY
KEY
(
payer_plan_period_id
);
ALTER
TABLE
omop
.
COST
ADD
CONSTRAINT
xpk_COST
PRIMARY
KEY
(
cost_id
);
ALTER
TABLE
omop
.
DRUG_ERA
ADD
CONSTRAINT
xpk_DRUG_ERA
PRIMARY
KEY
(
drug_era_id
);
ALTER
TABLE
omop
.
DOSE_ERA
ADD
CONSTRAINT
xpk_DOSE_ERA
PRIMARY
KEY
(
dose_era_id
);
ALTER
TABLE
omop
.
CONDITION_ERA
ADD
CONSTRAINT
xpk_CONDITION_ERA
PRIMARY
KEY
(
condition_era_id
);
ALTER
TABLE
omop
.
EPISODE
ADD
CONSTRAINT
xpk_EPISODE
PRIMARY
KEY
(
episode_id
);
ALTER
TABLE
omop
.
METADATA
ADD
CONSTRAINT
xpk_METADATA
PRIMARY
KEY
(
metadata_id
);
ALTER
TABLE
omop
.
CONCEPT
ADD
CONSTRAINT
xpk_CONCEPT
PRIMARY
KEY
(
concept_id
);
ALTER
TABLE
omop
.
VOCABULARY
ADD
CONSTRAINT
xpk_VOCABULARY
PRIMARY
KEY
(
vocabulary_id
);
ALTER
TABLE
omop
.
DOMAIN
ADD
CONSTRAINT
xpk_DOMAIN
PRIMARY
KEY
(
domain_id
);
ALTER
TABLE
omop
.
CONCEPT_CLASS
ADD
CONSTRAINT
xpk_CONCEPT_CLASS
PRIMARY
KEY
(
concept_class_id
);
ALTER
TABLE
omop
.
RELATIONSHIP
ADD
CONSTRAINT
xpk_RELATIONSHIP
PRIMARY
KEY
(
relationship_id
);
ALTER
TABLE
omop
.
COHORT_DEFINITION
ADD
CONSTRAINT
xpk_COHORT_DEFINITION
PRIMARY
KEY
(
cohort_definition_id
);
instancia_omop_postgresql/
omop_constraints_postgre
s.sql
→
instancia_omop_postgresql/
postgresql/OMOPCDM_postgresql_5.4_constraint
s.sql
View file @
c881fd0f
This diff is collapsed.
Click to expand it.
instancia_omop_postgresql/
omop_ddl_postgres
.sql
→
instancia_omop_postgresql/
postgresql/OMOPCDM_postgresql_5.4_ddl
.sql
View file @
c881fd0f
This diff is collapsed.
Click to expand it.
instancia_omop_postgresql/
omop_indexes_postgr
es.sql
→
instancia_omop_postgresql/
postgresql/OMOPCDM_postgresql_5.4_indic
es.sql
View file @
c881fd0f
/*postgresql OMOP CDM Indices
/*postgresql OMOP CDM Indices
There are no unique indices created because it is assumed that the primary key constraints have been run prior to
There are no unique indices created because it is assumed that the primary key constraints have been run prior to
implementing indices.
implementing indices.
*/
*/
/************************
/************************
Standardized clinical data
Standardized clinical data
************************/
************************/
CREATE
INDEX
idx_person_id
ON
omop
.
person
(
person_id
ASC
);
CREATE
INDEX
idx_person_id
ON
omop
.
person
(
person_id
ASC
);
CLUSTER
omop
.
person
USING
idx_person_id
;
CLUSTER
omop
.
person
USING
idx_person_id
;
CREATE
INDEX
idx_gender
ON
omop
.
person
(
gender_concept_id
ASC
);
CREATE
INDEX
idx_gender
ON
omop
.
person
(
gender_concept_id
ASC
);
CREATE
INDEX
idx_observation_period_id_1
ON
omop
.
observation_period
(
person_id
ASC
);
CREATE
INDEX
idx_observation_period_id_1
ON
omop
.
observation_period
(
person_id
ASC
);
CLUSTER
omop
.
observation_period
USING
idx_observation_period_id_1
;
CLUSTER
omop
.
observation_period
USING
idx_observation_period_id_1
;
CREATE
INDEX
idx_visit_person_id_1
ON
omop
.
visit_occurrence
(
person_id
ASC
);
CREATE
INDEX
idx_visit_person_id_1
ON
omop
.
visit_occurrence
(
person_id
ASC
);
CLUSTER
omop
.
visit_occurrence
USING
idx_visit_person_id_1
;
CLUSTER
omop
.
visit_occurrence
USING
idx_visit_person_id_1
;
CREATE
INDEX
idx_visit_concept_id_1
ON
omop
.
visit_occurrence
(
visit_concept_id
ASC
);
CREATE
INDEX
idx_visit_concept_id_1
ON
omop
.
visit_occurrence
(
visit_concept_id
ASC
);
CREATE
INDEX
idx_visit_det_person_id_1
ON
omop
.
visit_detail
(
person_id
ASC
);
CREATE
INDEX
idx_visit_det_person_id_1
ON
omop
.
visit_detail
(
person_id
ASC
);
CLUSTER
omop
.
visit_detail
USING
idx_visit_det_person_id_1
;
CLUSTER
omop
.
visit_detail
USING
idx_visit_det_person_id_1
;
CREATE
INDEX
idx_visit_det_concept_id_1
ON
omop
.
visit_detail
(
visit_detail_concept_id
ASC
);
CREATE
INDEX
idx_visit_det_concept_id_1
ON
omop
.
visit_detail
(
visit_detail_concept_id
ASC
);
CREATE
INDEX
idx_visit_det_occ_id
ON
omop
.
visit_detail
(
visit_occurrence_id
ASC
);
CREATE
INDEX
idx_visit_det_occ_id
ON
omop
.
visit_detail
(
visit_occurrence_id
ASC
);
CREATE
INDEX
idx_condition_person_id_1
ON
omop
.
condition_occurrence
(
person_id
ASC
);
CREATE
INDEX
idx_condition_person_id_1
ON
omop
.
condition_occurrence
(
person_id
ASC
);
CLUSTER
omop
.
condition_occurrence
USING
idx_condition_person_id_1
;
CLUSTER
omop
.
condition_occurrence
USING
idx_condition_person_id_1
;
CREATE
INDEX
idx_condition_concept_id_1
ON
omop
.
condition_occurrence
(
condition_concept_id
ASC
);
CREATE
INDEX
idx_condition_concept_id_1
ON
omop
.
condition_occurrence
(
condition_concept_id
ASC
);
CREATE
INDEX
idx_condition_visit_id_1
ON
omop
.
condition_occurrence
(
visit_occurrence_id
ASC
);
CREATE
INDEX
idx_condition_visit_id_1
ON
omop
.
condition_occurrence
(
visit_occurrence_id
ASC
);
CREATE
INDEX
idx_drug_person_id_1
ON
omop
.
drug_exposure
(
person_id
ASC
);
CREATE
INDEX
idx_drug_person_id_1
ON
omop
.
drug_exposure
(
person_id
ASC
);
CLUSTER
omop
.
drug_exposure
USING
idx_drug_person_id_1
;
CLUSTER
omop
.
drug_exposure
USING
idx_drug_person_id_1
;
CREATE
INDEX
idx_drug_concept_id_1
ON
omop
.
drug_exposure
(
drug_concept_id
ASC
);
CREATE
INDEX
idx_drug_concept_id_1
ON
omop
.
drug_exposure
(
drug_concept_id
ASC
);
CREATE
INDEX
idx_drug_visit_id_1
ON
omop
.
drug_exposure
(
visit_occurrence_id
ASC
);
CREATE
INDEX
idx_drug_visit_id_1
ON
omop
.
drug_exposure
(
visit_occurrence_id
ASC
);
CREATE
INDEX
idx_procedure_person_id_1
ON
omop
.
procedure_occurrence
(
person_id
ASC
);
CREATE
INDEX
idx_procedure_person_id_1
ON
omop
.
procedure_occurrence
(
person_id
ASC
);
CLUSTER
omop
.
procedure_occurrence
USING
idx_procedure_person_id_1
;
CLUSTER
omop
.
procedure_occurrence
USING
idx_procedure_person_id_1
;
CREATE
INDEX
idx_procedure_concept_id_1
ON
omop
.
procedure_occurrence
(
procedure_concept_id
ASC
);
CREATE
INDEX
idx_procedure_concept_id_1
ON
omop
.
procedure_occurrence
(
procedure_concept_id
ASC
);
CREATE
INDEX
idx_procedure_visit_id_1
ON
omop
.
procedure_occurrence
(
visit_occurrence_id
ASC
);
CREATE
INDEX
idx_procedure_visit_id_1
ON
omop
.
procedure_occurrence
(
visit_occurrence_id
ASC
);
CREATE
INDEX
idx_device_person_id_1
ON
omop
.
device_exposure
(
person_id
ASC
);
CREATE
INDEX
idx_device_person_id_1
ON
omop
.
device_exposure
(
person_id
ASC
);
CLUSTER
omop
.
device_exposure
USING
idx_device_person_id_1
;
CLUSTER
omop
.
device_exposure
USING
idx_device_person_id_1
;
CREATE
INDEX
idx_device_concept_id_1
ON
omop
.
device_exposure
(
device_concept_id
ASC
);
CREATE
INDEX
idx_device_concept_id_1
ON
omop
.
device_exposure
(
device_concept_id
ASC
);
CREATE
INDEX
idx_device_visit_id_1
ON
omop
.
device_exposure
(
visit_occurrence_id
ASC
);
CREATE
INDEX
idx_device_visit_id_1
ON
omop
.
device_exposure
(
visit_occurrence_id
ASC
);
CREATE
INDEX
idx_measurement_person_id_1
ON
omop
.
measurement
(
person_id
ASC
);
CREATE
INDEX
idx_measurement_person_id_1
ON
omop
.
measurement
(
person_id
ASC
);
CLUSTER
omop
.
measurement
USING
idx_measurement_person_id_1
;
CLUSTER
omop
.
measurement
USING
idx_measurement_person_id_1
;
CREATE
INDEX
idx_measurement_concept_id_1
ON
omop
.
measurement
(
measurement_concept_id
ASC
);
CREATE
INDEX
idx_measurement_concept_id_1
ON
omop
.
measurement
(
measurement_concept_id
ASC
);
CREATE
INDEX
idx_measurement_visit_id_1
ON
omop
.
measurement
(
visit_occurrence_id
ASC
);
CREATE
INDEX
idx_measurement_visit_id_1
ON
omop
.
measurement
(
visit_occurrence_id
ASC
);
CREATE
INDEX
idx_observation_person_id_1
ON
omop
.
observation
(
person_id
ASC
);
CREATE
INDEX
idx_observation_person_id_1
ON
omop
.
observation
(
person_id
ASC
);
CLUSTER
omop
.
observation
USING
idx_observation_person_id_1
;
CLUSTER
omop
.
observation
USING
idx_observation_person_id_1
;
CREATE
INDEX
idx_observation_concept_id_1
ON
omop
.
observation
(
observation_concept_id
ASC
);
CREATE
INDEX
idx_observation_concept_id_1
ON
omop
.
observation
(
observation_concept_id
ASC
);
CREATE
INDEX
idx_observation_visit_id_1
ON
omop
.
observation
(
visit_occurrence_id
ASC
);
CREATE
INDEX
idx_observation_visit_id_1
ON
omop
.
observation
(
visit_occurrence_id
ASC
);
CREATE
INDEX
idx_death_person_id_1
ON
omop
.
death
(
person_id
ASC
);
CREATE
INDEX
idx_death_person_id_1
ON
omop
.
death
(
person_id
ASC
);
CLUSTER
omop
.
death
USING
idx_death_person_id_1
;
CLUSTER
omop
.
death
USING
idx_death_person_id_1
;
CREATE
INDEX
idx_note_person_id_1
ON
omop
.
note
(
person_id
ASC
);
CREATE
INDEX
idx_note_person_id_1
ON
omop
.
note
(
person_id
ASC
);
CLUSTER
omop
.
note
USING
idx_note_person_id_1
;
CLUSTER
omop
.
note
USING
idx_note_person_id_1
;
CREATE
INDEX
idx_note_concept_id_1
ON
omop
.
note
(
note_type_concept_id
ASC
);
CREATE
INDEX
idx_note_concept_id_1
ON
omop
.
note
(
note_type_concept_id
ASC
);
CREATE
INDEX
idx_note_visit_id_1
ON
omop
.
note
(
visit_occurrence_id
ASC
);
CREATE
INDEX
idx_note_visit_id_1
ON
omop
.
note
(
visit_occurrence_id
ASC
);
CREATE
INDEX
idx_note_nlp_note_id_1
ON
omop
.
note_nlp
(
note_id
ASC
);
CREATE
INDEX
idx_note_nlp_note_id_1
ON
omop
.
note_nlp
(
note_id
ASC
);
CLUSTER
omop
.
note_nlp
USING
idx_note_nlp_note_id_1
;
CLUSTER
omop
.
note_nlp
USING
idx_note_nlp_note_id_1
;
CREATE
INDEX
idx_note_nlp_concept_id_1
ON
omop
.
note_nlp
(
note_nlp_concept_id
ASC
);
CREATE
INDEX
idx_note_nlp_concept_id_1
ON
omop
.
note_nlp
(
note_nlp_concept_id
ASC
);
CREATE
INDEX
idx_specimen_person_id_1
ON
omop
.
specimen
(
person_id
ASC
);
CREATE
INDEX
idx_specimen_person_id_1
ON
omop
.
specimen
(
person_id
ASC
);
CLUSTER
omop
.
specimen
USING
idx_specimen_person_id_1
;
CLUSTER
omop
.
specimen
USING
idx_specimen_person_id_1
;
CREATE
INDEX
idx_specimen_concept_id_1
ON
omop
.
specimen
(
specimen_concept_id
ASC
);
CREATE
INDEX
idx_specimen_concept_id_1
ON
omop
.
specimen
(
specimen_concept_id
ASC
);
CREATE
INDEX
idx_fact_relationship_id1
ON
omop
.
fact_relationship
(
domain_concept_id_1
ASC
);
CREATE
INDEX
idx_fact_relationship_id1
ON
omop
.
fact_relationship
(
domain_concept_id_1
ASC
);
CREATE
INDEX
idx_fact_relationship_id2
ON
omop
.
fact_relationship
(
domain_concept_id_2
ASC
);
CREATE
INDEX
idx_fact_relationship_id2
ON
omop
.
fact_relationship
(
domain_concept_id_2
ASC
);
CREATE
INDEX
idx_fact_relationship_id3
ON
omop
.
fact_relationship
(
relationship_concept_id
ASC
);
CREATE
INDEX
idx_fact_relationship_id3
ON
omop
.
fact_relationship
(
relationship_concept_id
ASC
);
/************************
/************************
Standardized health system data
Standardized health system data
************************/
************************/
CREATE
INDEX
idx_location_id_1
ON
omop
.
location
(
location_id
ASC
);
CREATE
INDEX
idx_location_id_1
ON
omop
.
location
(
location_id
ASC
);
CLUSTER
omop
.
location
USING
idx_location_id_1
;
CLUSTER
omop
.
location
USING
idx_location_id_1
;
CREATE
INDEX
idx_care_site_id_1
ON
omop
.
care_site
(
care_site_id
ASC
);
CREATE
INDEX
idx_care_site_id_1
ON
omop
.
care_site
(
care_site_id
ASC
);
CLUSTER
omop
.
care_site
USING
idx_care_site_id_1
;
CLUSTER
omop
.
care_site
USING
idx_care_site_id_1
;
CREATE
INDEX
idx_provider_id_1
ON
omop
.
provider
(
provider_id
ASC
);
CREATE
INDEX
idx_provider_id_1
ON
omop
.
provider
(
provider_id
ASC
);
CLUSTER
omop
.
provider
USING
idx_provider_id_1
;
CLUSTER
omop
.
provider
USING
idx_provider_id_1
;
/************************
/************************
Standardized health economics
Standardized health economics
************************/
************************/
CREATE
INDEX
idx_period_person_id_1
ON
omop
.
payer_plan_period
(
person_id
ASC
);
CREATE
INDEX
idx_period_person_id_1
ON
omop
.
payer_plan_period
(
person_id
ASC
);
CLUSTER
omop
.
payer_plan_period
USING
idx_period_person_id_1
;
CLUSTER
omop
.
payer_plan_period
USING
idx_period_person_id_1
;
CREATE
INDEX
idx_cost_event_id
ON
omop
.
cost
(
cost_event_id
ASC
);
CREATE
INDEX
idx_cost_event_id
ON
omop
.
cost
(
cost_event_id
ASC
);
/************************
/************************
Standardized derived elements
Standardized derived elements
************************/
************************/
CREATE
INDEX
idx_drug_era_person_id_1
ON
omop
.
drug_era
(
person_id
ASC
);
CREATE
INDEX
idx_drug_era_person_id_1
ON
omop
.
drug_era
(
person_id
ASC
);
CLUSTER
omop
.
drug_era
USING
idx_drug_era_person_id_1
;
CLUSTER
omop
.
drug_era
USING
idx_drug_era_person_id_1
;
CREATE
INDEX
idx_drug_era_concept_id_1
ON
omop
.
drug_era
(
drug_concept_id
ASC
);
CREATE
INDEX
idx_drug_era_concept_id_1
ON
omop
.
drug_era
(
drug_concept_id
ASC
);
CREATE
INDEX
idx_dose_era_person_id_1
ON
omop
.
dose_era
(
person_id
ASC
);
CREATE
INDEX
idx_dose_era_person_id_1
ON
omop
.
dose_era
(
person_id
ASC
);
CLUSTER
omop
.
dose_era
USING
idx_dose_era_person_id_1
;
CLUSTER
omop
.
dose_era
USING
idx_dose_era_person_id_1
;
CREATE
INDEX
idx_dose_era_concept_id_1
ON
omop
.
dose_era
(
drug_concept_id
ASC
);
CREATE
INDEX
idx_dose_era_concept_id_1
ON
omop
.
dose_era
(
drug_concept_id
ASC
);
CREATE
INDEX
idx_condition_era_person_id_1
ON
omop
.
condition_era
(
person_id
ASC
);
CREATE
INDEX
idx_condition_era_person_id_1
ON
omop
.
condition_era
(
person_id
ASC
);
CLUSTER
omop
.
condition_era
USING
idx_condition_era_person_id_1
;
CLUSTER
omop
.
condition_era
USING
idx_condition_era_person_id_1
;
CREATE
INDEX
idx_condition_era_concept_id_1
ON
omop
.
condition_era
(
condition_concept_id
ASC
);
CREATE
INDEX
idx_condition_era_concept_id_1
ON
omop
.
condition_era
(
condition_concept_id
ASC
);
/**************************
/**************************
Standardized meta-data
Standardized meta-data
***************************/
***************************/
CREATE
INDEX
idx_metadata_concept_id_1
ON
omop
.
metadata
(
metadata_concept_id
ASC
);
CREATE
INDEX
idx_metadata_concept_id_1
ON
omop
.
metadata
(
metadata_concept_id
ASC
);
CLUSTER
omop
.
metadata
USING
idx_metadata_concept_id_1
;
CLUSTER
omop
.
metadata
USING
idx_metadata_concept_id_1
;
/**************************
/**************************
Standardized vocabularies
Standardized vocabularies
***************************/
***************************/
CREATE
INDEX
idx_concept_concept_id
ON
omop
.
concept
(
concept_id
ASC
);
CREATE
INDEX
idx_concept_concept_id
ON
omop
.
concept
(
concept_id
ASC
);
CLUSTER
omop
.
concept
USING
idx_concept_concept_id
;
CLUSTER
omop
.
concept
USING
idx_concept_concept_id
;
CREATE
INDEX
idx_concept_code
ON
omop
.
concept
(
concept_code
ASC
);
CREATE
INDEX
idx_concept_code
ON
omop
.
concept
(
concept_code
ASC
);
CREATE
INDEX
idx_concept_vocabluary_id
ON
omop
.
concept
(
vocabulary_id
ASC
);
CREATE
INDEX
idx_concept_vocabluary_id
ON
omop
.
concept
(
vocabulary_id
ASC
);
CREATE
INDEX
idx_concept_domain_id
ON
omop
.
concept
(
domain_id
ASC
);
CREATE
INDEX
idx_concept_domain_id
ON
omop
.
concept
(
domain_id
ASC
);
CREATE
INDEX
idx_concept_class_id
ON
omop
.
concept
(
concept_class_id
ASC
);
CREATE
INDEX
idx_concept_class_id
ON
omop
.
concept
(
concept_class_id
ASC
);
CREATE
INDEX
idx_vocabulary_vocabulary_id
ON
omop
.
vocabulary
(
vocabulary_id
ASC
);
CREATE
INDEX
idx_vocabulary_vocabulary_id
ON
omop
.
vocabulary
(
vocabulary_id
ASC
);
CLUSTER
omop
.
vocabulary
USING
idx_vocabulary_vocabulary_id
;
CLUSTER
omop
.
vocabulary
USING
idx_vocabulary_vocabulary_id
;
CREATE
INDEX
idx_domain_domain_id
ON
omop
.
domain
(
domain_id
ASC
);
CREATE
INDEX
idx_domain_domain_id
ON
omop
.
domain
(
domain_id
ASC
);
CLUSTER
omop
.
domain
USING
idx_domain_domain_id
;
CLUSTER
omop
.
domain
USING
idx_domain_domain_id
;
CREATE
INDEX
idx_concept_class_class_id
ON
omop
.
concept_class
(
concept_class_id
ASC
);
CREATE
INDEX
idx_concept_class_class_id
ON
omop
.
concept_class
(
concept_class_id
ASC
);
CLUSTER
omop
.
concept_class
USING
idx_concept_class_class_id
;
CLUSTER
omop
.
concept_class
USING
idx_concept_class_class_id
;
CREATE
INDEX
idx_concept_relationship_id_1
ON
omop
.
concept_relationship
(
concept_id_1
ASC
);
CREATE
INDEX
idx_concept_relationship_id_1
ON
omop
.
concept_relationship
(
concept_id_1
ASC
);
CLUSTER
omop
.
concept_relationship
USING
idx_concept_relationship_id_1
;
CLUSTER
omop
.
concept_relationship
USING
idx_concept_relationship_id_1
;
CREATE
INDEX
idx_concept_relationship_id_2
ON
omop
.
concept_relationship
(
concept_id_2
ASC
);
CREATE
INDEX
idx_concept_relationship_id_2
ON
omop
.
concept_relationship
(
concept_id_2
ASC
);
CREATE
INDEX
idx_concept_relationship_id_3
ON
omop
.
concept_relationship
(
relationship_id
ASC
);
CREATE
INDEX
idx_concept_relationship_id_3
ON
omop
.
concept_relationship
(
relationship_id
ASC
);
CREATE
INDEX
idx_relationship_rel_id
ON
omop
.
relationship
(
relationship_id
ASC
);
CREATE
INDEX
idx_relationship_rel_id
ON
omop
.
relationship
(
relationship_id
ASC
);
CLUSTER
omop
.
relationship
USING
idx_relationship_rel_id
;
CLUSTER
omop
.
relationship
USING
idx_relationship_rel_id
;
CREATE
INDEX
idx_concept_synonym_id
ON
omop
.
concept_synonym
(
concept_id
ASC
);
CREATE
INDEX
idx_concept_synonym_id
ON
omop
.
concept_synonym
(
concept_id
ASC
);
CLUSTER
omop
.
concept_synonym
USING
idx_concept_synonym_id
;
CLUSTER
omop
.
concept_synonym
USING
idx_concept_synonym_id
;
CREATE
INDEX
idx_concept_ancestor_id_1
ON
omop
.
concept_ancestor
(
ancestor_concept_id
ASC
);
CREATE
INDEX
idx_concept_ancestor_id_1
ON
omop
.
concept_ancestor
(
ancestor_concept_id
ASC
);
CLUSTER
omop
.
concept_ancestor
USING
idx_concept_ancestor_id_1
;
CLUSTER
omop
.
concept_ancestor
USING
idx_concept_ancestor_id_1
;
CREATE
INDEX
idx_concept_ancestor_id_2
ON
omop
.
concept_ancestor
(
descendant_concept_id
ASC
);
CREATE
INDEX
idx_concept_ancestor_id_2
ON
omop
.
concept_ancestor
(
descendant_concept_id
ASC
);
CREATE
INDEX
idx_source_to_concept_map_3
ON
omop
.
source_to_concept_map
(
target_concept_id
ASC
);
CREATE
INDEX
idx_source_to_concept_map_3
ON
omop
.
source_to_concept_map
(
target_concept_id
ASC
);
CLUSTER
omop
.
source_to_concept_map
USING
idx_source_to_concept_map_3
;
CLUSTER
omop
.
source_to_concept_map
USING
idx_source_to_concept_map_3
;
CREATE
INDEX
idx_source_to_concept_map_1
ON
omop
.
source_to_concept_map
(
source_vocabulary_id
ASC
);
CREATE
INDEX
idx_source_to_concept_map_1
ON
omop
.
source_to_concept_map
(
source_vocabulary_id
ASC
);
CREATE
INDEX
idx_source_to_concept_map_2
ON
omop
.
source_to_concept_map
(
target_vocabulary_id
ASC
);
CREATE
INDEX
idx_source_to_concept_map_2
ON
omop
.
source_to_concept_map
(
target_vocabulary_id
ASC
);
CREATE
INDEX
idx_source_to_concept_map_c
ON
omop
.
source_to_concept_map
(
source_code
ASC
);
CREATE
INDEX
idx_source_to_concept_map_c
ON
omop
.
source_to_concept_map
(
source_code
ASC
);
CREATE
INDEX
idx_drug_strength_id_1
ON
omop
.
drug_strength
(
drug_concept_id
ASC
);
CREATE
INDEX
idx_drug_strength_id_1
ON
omop
.
drug_strength
(
drug_concept_id
ASC
);
CLUSTER
omop
.
drug_strength
USING
idx_drug_strength_id_1
;
CLUSTER
omop
.
drug_strength
USING
idx_drug_strength_id_1
;
CREATE
INDEX
idx_drug_strength_id_2
ON
omop
.
drug_strength
(
ingredient_concept_id
ASC
);
CREATE
INDEX
idx_drug_strength_id_2
ON
omop
.
drug_strength
(
ingredient_concept_id
ASC
);
--Additional v6.0 indices
--Additional v6.0 indices
--CREATE CLUSTERED INDEX idx_survey_person_id_1 ON omop.survey_conduct (person_id ASC);
--CREATE CLUSTERED INDEX idx_survey_person_id_1 ON omop.survey_conduct (person_id ASC);
--CREATE CLUSTERED INDEX idx_episode_person_id_1 ON omop.episode (person_id ASC);
--CREATE CLUSTERED INDEX idx_episode_person_id_1 ON omop.episode (person_id ASC);
--CREATE INDEX idx_episode_concept_id_1 ON omop.episode (episode_concept_id ASC);
--CREATE INDEX idx_episode_concept_id_1 ON omop.episode (episode_concept_id ASC);
--CREATE CLUSTERED INDEX idx_episode_event_id_1 ON omop.episode_event (episode_id ASC);
--CREATE CLUSTERED INDEX idx_episode_event_id_1 ON omop.episode_event (episode_id ASC);
--CREATE INDEX idx_ee_field_concept_id_1 ON omop.episode_event (event_field_concept_id ASC);
--CREATE INDEX idx_ee_field_concept_id_1 ON omop.episode_event (event_field_concept_id ASC);
instancia_omop_postgresql/postgresql/OMOPCDM_postgresql_5.4_primary_keys.sql
0 → 100644
View file @
c881fd0f
--postgresql CDM Primary Key Constraints for OMOP Common Data Model 5.4
ALTER
TABLE
omop
.
person
ADD
CONSTRAINT
xpk_person
PRIMARY
KEY
(
person_id
);
ALTER
TABLE
omop
.
observation_period
ADD
CONSTRAINT
xpk_observation_period
PRIMARY
KEY
(
observation_period_id
);
ALTER
TABLE
omop
.
visit_occurrence
ADD
CONSTRAINT
xpk_visit_occurrence
PRIMARY
KEY
(
visit_occurrence_id
);
ALTER
TABLE
omop
.
visit_detail
ADD
CONSTRAINT
xpk_visit_detail
PRIMARY
KEY
(
visit_detail_id
);
ALTER
TABLE
omop
.
condition_occurrence
ADD
CONSTRAINT
xpk_condition_occurrence
PRIMARY
KEY
(
condition_occurrence_id
);
ALTER
TABLE
omop
.
drug_exposure
ADD
CONSTRAINT
xpk_drug_exposure
PRIMARY
KEY
(
drug_exposure_id
);
ALTER
TABLE
omop
.
procedure_occurrence
ADD
CONSTRAINT
xpk_procedure_occurrence
PRIMARY
KEY
(
procedure_occurrence_id
);
ALTER
TABLE
omop
.
device_exposure
ADD
CONSTRAINT
xpk_device_exposure
PRIMARY
KEY
(
device_exposure_id
);
ALTER
TABLE
omop
.
measurement
ADD
CONSTRAINT
xpk_measurement
PRIMARY
KEY
(
measurement_id
);
ALTER
TABLE
omop
.
observation
ADD
CONSTRAINT
xpk_observation
PRIMARY
KEY
(
observation_id
);
ALTER
TABLE
omop
.
note
ADD
CONSTRAINT
xpk_note
PRIMARY
KEY
(
note_id
);
ALTER
TABLE
omop
.
note_nlp
ADD
CONSTRAINT
xpk_note_nlp
PRIMARY
KEY
(
note_nlp_id
);
ALTER
TABLE
omop
.
specimen
ADD
CONSTRAINT
xpk_specimen
PRIMARY
KEY
(
specimen_id
);
ALTER
TABLE
omop
.
location
ADD
CONSTRAINT
xpk_location
PRIMARY
KEY
(
location_id
);
ALTER
TABLE
omop
.
care_site
ADD
CONSTRAINT
xpk_care_site
PRIMARY
KEY
(
care_site_id
);
ALTER
TABLE
omop
.
provider
ADD
CONSTRAINT
xpk_provider
PRIMARY
KEY
(
provider_id
);
ALTER
TABLE
omop
.
payer_plan_period
ADD
CONSTRAINT
xpk_payer_plan_period
PRIMARY
KEY
(
payer_plan_period_id
);
ALTER
TABLE
omop
.
cost
ADD
CONSTRAINT
xpk_cost
PRIMARY
KEY
(
cost_id
);
ALTER
TABLE
omop
.
drug_era
ADD
CONSTRAINT
xpk_drug_era
PRIMARY
KEY
(
drug_era_id
);
ALTER
TABLE
omop
.
dose_era
ADD
CONSTRAINT
xpk_dose_era
PRIMARY
KEY
(
dose_era_id
);
ALTER
TABLE
omop
.
condition_era
ADD
CONSTRAINT
xpk_condition_era
PRIMARY
KEY
(
condition_era_id
);
ALTER
TABLE
omop
.
episode
ADD
CONSTRAINT
xpk_episode
PRIMARY
KEY
(
episode_id
);
ALTER
TABLE
omop
.
metadata
ADD
CONSTRAINT
xpk_metadata
PRIMARY
KEY
(
metadata_id
);
ALTER
TABLE
omop
.
concept
ADD
CONSTRAINT
xpk_concept
PRIMARY
KEY
(
concept_id
);
ALTER
TABLE
omop
.
vocabulary
ADD
CONSTRAINT
xpk_vocabulary
PRIMARY
KEY
(
vocabulary_id
);
ALTER
TABLE
omop
.
domain
ADD
CONSTRAINT
xpk_domain
PRIMARY
KEY
(
domain_id
);
ALTER
TABLE
omop
.
concept_class
ADD
CONSTRAINT
xpk_concept_class
PRIMARY
KEY
(
concept_class_id
);
ALTER
TABLE
omop
.
relationship
ADD
CONSTRAINT
xpk_relationship
PRIMARY
KEY
(
relationship_id
);
instancia_omop_postgresql/vocab_load.sql
0 → 100644
View file @
c881fd0f
/*********************************************************************************
# Copyright 2014 Observational Health Data Sciences and Informatics
#
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
********************************************************************************/
/************************
####### # # ####### ###### ##### ###### # # #######
# # ## ## # # # # # # # # ## ## # # #
# # # # # # # # # # # # # # # # # # # #
# # # # # # # ###### # # # # # # # # ######
# # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # #
####### # # ####### # ##### ###### # # ## #####
Script to load the common data model, version 5.0 vocabulary tables for PostgreSQL database on Windows (MS-DOS style file paths)
The database account running this script must have the "superuser" permission in the database.
Notes
1) There is no data file load for the SOURCE_TO_CONCEPT_MAP table because that table is deprecated in CDM version 5.0
2) This script assumes the CDM version 5 vocabulary zip file has been unzipped into the "C:\CDMV5VOCAB" directory.
3) If you unzipped your CDM version 5 vocabulary files into a different directory then replace all file paths below, with your directory path.
4) Truncate each table that will be lodaed below, before running this script.
last revised: 5 Dec 2014
author: Lee Evans
*************************/
SET
session_replication_role
=
'replica'
;
\
copy
omop
.
DRUG_STRENGTH
FROM
'./vocabulary/DRUG_STRENGTH.csv'
WITH
DELIMITER
E
'
\t
'
CSV
HEADER
QUOTE
E
'
\b
'
;
\
copy
omop
.
CONCEPT
FROM
'./vocabulary/CONCEPT.csv'
WITH
DELIMITER
E
'
\t
'
CSV
HEADER
QUOTE
E
'
\b
'
;
\
copy
omop
.
CONCEPT_RELATIONSHIP
FROM
'./vocabulary/CONCEPT_RELATIONSHIP.csv'
WITH
DELIMITER
E
'
\t
'
CSV
HEADER
QUOTE
E
'
\b
'
;
\
copy
omop
.
CONCEPT_ANCESTOR
FROM
'./vocabulary/CONCEPT_ANCESTOR.csv'
WITH
DELIMITER
E
'
\t
'
CSV
HEADER
QUOTE
E
'
\b
'
;
\
copy
omop
.
CONCEPT_SYNONYM
FROM
'./vocabulary/CONCEPT_SYNONYM.csv'
WITH
DELIMITER
E
'
\t
'
CSV
HEADER
QUOTE
E
'
\b
'
;
\
copy
omop
.
VOCABULARY
FROM
'./vocabulary/VOCABULARY.csv'
WITH
DELIMITER
E
'
\t
'
CSV
HEADER
QUOTE
E
'
\b
'
;
\
copy
omop
.
RELATIONSHIP
FROM
'./vocabulary/RELATIONSHIP.csv'
WITH
DELIMITER
E
'
\t
'
CSV
HEADER
QUOTE
E
'
\b
'
;
\
copy
omop
.
CONCEPT_CLASS
FROM
'./vocabulary/CONCEPT_CLASS.csv'
WITH
DELIMITER
E
'
\t
'
CSV
HEADER
QUOTE
E
'
\b
'
;
\
copy
omop
.
DOMAIN
FROM
'./vocabulary/DOMAIN.csv'
WITH
DELIMITER
E
'
\t
'
CSV
HEADER
QUOTE
E
'
\b
'
;
SET
session_replication_role
=
'origin'
;
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment