Import files added

This commit is contained in:
Christian Reich 2015-03-13 18:36:36 -04:00
parent affe817632
commit 112d5599db
12 changed files with 388 additions and 0 deletions

View File

@ -0,0 +1,52 @@
REM *********************************************************************************
REM Copyright 2014 Observational Health Data Sciences and Informatics
REM
REM
REM Licensed under the Apache License, Version 2.0 (the "License");
REM you may not use this file except in compliance with the License.
REM You may obtain a copy of the License at
REM
REM http://www.apache.org/licenses/LICENSE-2.0
REM
REM Unless required by applicable law or agreed to in writing, software
REM distributed under the License is distributed on an "AS IS" BASIS,
REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
REM See the License for the specific language governing permissions and
REM limitations under the License.
REM *******************************************************************************/
REM ************************
REM
REM ####### # # ####### ###### ##### ###### # # #######
REM # # ## ## # # # # # # # # ## ## # # #
REM # # # # # # # # # # # # # # # # # # # #
REM # # # # # # # ###### # # # # # # # # ######
REM # # # # # # # # # # # # # # #
REM # # # # # # # # # # # # # # # # #
REM ####### # # ####### # ##### ###### # # ## #####
REM
REM
REM Script to load the common data model, version 5.0 vocabulary tables for PostgreSQL database on Windows (MS-DOS style file paths)
REM
REM Notes
REM
REM 1) There is no data file load for the SOURCE_TO_CONCEPT_MAP table because that table is deprecated in CDM version 5.0
REM 2) This script assumes the CDM version 5 vocabulary zip file has been unzipped into the "C:\CDMV5VOCAB" directory.
REM 3) If you unzipped your CDM version 5 vocabulary files into a different directory then replace all file paths below, with your directory path.
REM
REM last revised: 26 Nov 2014
REM
REM author: Lee Evans
REM
REM
REM *************************/
sqlldr CDMV5/<password> CONTROL=CONCEPT.ctl LOG=C:\CDMV5VOCAB\CONCEPT.log BAD=C:\CDMV5VOCAB\CONCEPT.bad
sqlldr CDMV5/<password> CONTROL=CONCEPT_ANCESTOR.ctl LOG=C:\CDMV5VOCAB\CONCEPT_ANCESTOR.log BAD=C:\CDMV5VOCAB\CONCEPT_ANCESTOR.bad
sqlldr CDMV5/<password> CONTROL=CONCEPT_CLASS.ctl LOG=C:\CDMV5VOCAB\CONCEPT_CLASS.log BAD=C:\CDMV5VOCAB\CONCEPT_CLASS.bad
sqlldr CDMV5/<password> CONTROL=CONCEPT_RELATIONSHIP.ctl LOG=C:\CDMV5VOCAB\CONCEPT_RELATIONSHIP.log BAD=C:\CDMV5VOCAB\CONCEPT_RELATIONSHIP.bad
sqlldr CDMV5/<password> CONTROL=CONCEPT_SYNONYM.ctl LOG=C:\CDMV5VOCAB\CONCEPT_SYNONYM.log BAD=C:\CDMV5VOCAB\CONCEPT_SYNONYM.bad
sqlldr CDMV5/<password> CONTROL=DOMAIN.ctl LOG=C:\CDMV5VOCAB\DOMAIN.log BAD=C:\CDMV5VOCAB\DOMAIN.bad
sqlldr CDMV5/<password> CONTROL=DRUG_STRENGTH.ctl LOG=C:\CDMV5VOCAB\DRUG_STRENGTH.log BAD=C:\CDMV5VOCAB\DRUG_STRENGTH.bad
sqlldr CDMV5/<password> CONTROL=RELATIONSHIP.ctl LOG=C:\CDMV5VOCAB\RELATIONSHIP.log BAD=C:\CDMV5VOCAB\RELATIONSHIP.bad
sqlldr CDMV5/<password> CONTROL=VOCABULARY.ctl LOG=C:\CDMV5VOCAB\VOCABULARY.log BAD=C:\CDMV5VOCAB\VOCABULARY.bad

View File

@ -0,0 +1,19 @@
options (skip=1)
load data
infile concept.csv
into table concept
replace
fields terminated by '\t'
trailing nullcols
(
concept_id,
concept_name,
domain_id,
vocabulary_id,
concept_class_id,
standard_concept,
concept_code,
valid_start_date DATE 'YYYYMMDD',
valid_end_date DATE 'YYYYMMDD',
invalid_reason
)

View File

@ -0,0 +1,13 @@
options (skip=1)
load data
infile concept_ancestor.csv
into table concept_ancestor
replace
fields terminated by '\t'
trailing nullcols
(
ancestor_concept_id,
descendant_concept_id,
min_levels_of_separation,
max_levels_of_separation
)

View File

@ -0,0 +1,12 @@
options (skip=1)
load data
infile concept_class.csv
into table concept_class
replace
fields terminated by '\t'
trailing nullcols
(
concept_class_id,
concept_class_name,
concept_class_concept_id
)

View File

@ -0,0 +1,15 @@
options (skip=1)
load data
infile concept_relationship.csv
into table concept_relationship
replace
fields terminated by '\t'
trailing nullcols
(
concept_id_1,
concept_id_2,
relationship_id,
valid_start_date DATE 'YYYYMMDD',
valid_end_date DATE 'YYYYMMDD',
invalid_reason
)

View File

@ -0,0 +1,12 @@
options (skip=1)
load data
infile concept_synonym.csv
into table concept_synonym
replace
fields terminated by '\t'
trailing nullcols
(
concept_id,
concept_synonym_name CHAR(1000),
language_concept_id
)

View File

@ -0,0 +1,12 @@
options (skip=1)
load data
infile domain.csv
into table domain
replace
fields terminated by '\t'
trailing nullcols
(
domain_id,
domain_name,
domain_concept_id
)

View File

@ -0,0 +1,19 @@
options (skip=1)
load data
infile drug_strength.csv
into table drug_strength
replace
fields terminated by '\t'
trailing nullcols
(
drug_concept_id,
ingredient_concept_id,
amount_value,
amount_unit_concept_id,
numerator_value,
numerator_unit_concept_id,
denominator_unit_concept_id,
valid_start_date DATE 'YYYYMMDD',
valid_end_date DATE 'YYYYMMDD',
invalid_reason
)

View File

@ -0,0 +1,15 @@
options (skip=1)
load data
infile relationship.csv
into table relationship
replace
fields terminated by '\t'
trailing nullcols
(
relationship_id,
relationship_name,
is_hierarchical,
defines_ancestry,
reverse_relationship_id,
relationship_concept_id
)

View File

@ -0,0 +1,14 @@
options (skip=1)
load data
infile vocabulary.csv
into table vocabulary
replace
fields terminated by '\t'
trailing nullcols
(
vocabulary_id,
vocabulary_name,
vocabulary_reference,
vocabulary_version,
vocabulary_concept_id
)

View File

@ -0,0 +1,63 @@
/*********************************************************************************
# 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
*************************/
COPY DRUG_STRENGTH FROM 'C:\CDMV5VOCAB\DRUG_STRENGTH.csv' WITH DELIMITER E'\t' CSV HEADER QUOTE E'\b' ;
COPY CONCEPT FROM 'C:\CDMV5VOCAB\CONCEPT.csv' WITH DELIMITER E'\t' CSV HEADER QUOTE E'\b' ;
COPY CONCEPT_RELATIONSHIP FROM 'C:\CDMV5VOCAB\CONCEPT_RELATIONSHIP.csv' WITH DELIMITER E'\t' CSV HEADER QUOTE E'\b' ;
COPY CONCEPT_ANCESTOR FROM 'C:\CDMV5VOCAB\CONCEPT_ANCESTOR.csv' WITH DELIMITER E'\t' CSV HEADER QUOTE E'\b' ;
COPY CONCEPT_SYNONYM FROM 'C:\CDMV5VOCAB\CONCEPT_SYNONYM.csv' WITH DELIMITER E'\t' CSV HEADER QUOTE E'\b' ;
COPY VOCABULARY FROM 'C:\CDMV5VOCAB\VOCABULARY.csv' WITH DELIMITER E'\t' CSV HEADER QUOTE E'\b' ;
COPY RELATIONSHIP FROM 'C:\CDMV5VOCAB\RELATIONSHIP.csv' WITH DELIMITER E'\t' CSV HEADER QUOTE E'\b' ;
COPY CONCEPT_CLASS FROM 'C:\CDMV5VOCAB\CONCEPT_CLASS.csv' WITH DELIMITER E'\t' CSV HEADER QUOTE E'\b' ;
COPY DOMAIN FROM 'C:\CDMV5VOCAB\DOMAIN.csv' WITH DELIMITER E'\t' CSV HEADER QUOTE E'\b' ;

View File

@ -0,0 +1,142 @@
/*********************************************************************************
# 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 SQL Server 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:\CDMV5Vocabulary" 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) Run this SQL query script in the database where you created your CDM Version 5 tables
last revised: 26 Nov 2014
author: Lee Evans
*************************/
TRUNCATE TABLE DRUG_STRENGTH;
BULK INSERT DRUG_STRENGTH
FROM 'C:\CDMV5VOCAB\DRUG_STRENGTH.csv'
WITH (
FIRSTROW = 2,
FIELDTERMINATOR = '\t',
ROWTERMINATOR = '0x0a',
ERRORFILE = 'C:\CDMV5VOCAB\DRUG_STRENGTH.bad',
TABLOCK
);
TRUNCATE TABLE CONCEPT;
BULK INSERT CONCEPT
FROM 'C:\CDMV5VOCAB\CONCEPT.csv'
WITH (
FIRSTROW = 2,
FIELDTERMINATOR = '\t',
ROWTERMINATOR = '0x0a',
ERRORFILE = 'C:\CDMV5VOCAB\CONCEPT.bad',
TABLOCK
);
TRUNCATE TABLE CONCEPT_RELATIONSHIP;
BULK INSERT CONCEPT_RELATIONSHIP
FROM 'C:\CDMV5VOCAB\CONCEPT_RELATIONSHIP.csv'
WITH (
FIRSTROW = 2,
FIELDTERMINATOR = '\t',
ROWTERMINATOR = '0x0a',
ERRORFILE = 'C:\CDMV5VOCAB\CONCEPT_RELATIONSHIP.bad',
TABLOCK
);
TRUNCATE TABLE CONCEPT_ANCESTOR;
BULK INSERT CONCEPT_ANCESTOR
FROM 'C:\CDMV5VOCAB\CONCEPT_ANCESTOR.csv'
WITH (
FIRSTROW = 2,
FIELDTERMINATOR = '\t',
ROWTERMINATOR = '0x0a',
ERRORFILE = 'C:\CDMV5VOCAB\CONCEPT_ANCESTOR.bad',
TABLOCK
);
TRUNCATE TABLE CONCEPT_SYNONYM;
BULK INSERT CONCEPT_SYNONYM
FROM 'C:\CDMV5VOCAB\CONCEPT_SYNONYM.csv'
WITH (
FIRSTROW = 2,
FIELDTERMINATOR = '\t',
ROWTERMINATOR = '0x0a',
ERRORFILE = 'C:\CDMV5VOCAB\CONCEPT_SYNONYM.bad',
TABLOCK
);
TRUNCATE TABLE VOCABULARY;
BULK INSERT VOCABULARY
FROM 'C:\CDMV5VOCAB\VOCABULARY.csv'
WITH (
FIRSTROW = 2,
FIELDTERMINATOR = '\t',
ROWTERMINATOR = '0x0a',
ERRORFILE = 'C:\CDMV5VOCAB\VOCABULARY.bad',
TABLOCK
);
TRUNCATE TABLE RELATIONSHIP;
BULK INSERT RELATIONSHIP
FROM 'C:\CDMV5VOCAB\RELATIONSHIP.csv'
WITH (
FIRSTROW = 2,
FIELDTERMINATOR = '\t',
ROWTERMINATOR = '0x0a',
ERRORFILE = 'C:\CDMV5VOCAB\RELATIONSHIP.bad',
TABLOCK
);
TRUNCATE TABLE CONCEPT_CLASS;
BULK INSERT CONCEPT_CLASS
FROM 'C:\CDMV5VOCAB\CONCEPT_CLASS.csv'
WITH (
FIRSTROW = 2,
FIELDTERMINATOR = '\t',
ROWTERMINATOR = '0x0a',
ERRORFILE = 'C:\CDMV5VOCAB\CONCEPT_CLASS.bad',
TABLOCK
);
TRUNCATE TABLE DOMAIN;
BULK INSERT DOMAIN
FROM 'C:\CDMV5VOCAB\DOMAIN.csv'
WITH (
FIRSTROW = 2,
FIELDTERMINATOR = '\t',
ROWTERMINATOR = '0x0a',
ERRORFILE = 'C:\CDMV5VOCAB\DOMAIN.bad',
TABLOCK
);