Skip to content

Commit

Permalink
added MRSTY
Browse files Browse the repository at this point in the history
  • Loading branch information
Timur committed Aug 10, 2020
1 parent 135b485 commit 44d14ca
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 4 deletions.
12 changes: 12 additions & 0 deletions UMLS/create_source_tables.sql
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,17 @@ CREATE TABLE SOURCES.MRREL
FILLER_COLUMN INT
);

DROP TABLE IF EXISTS SOURCES.MRSTY;
CREATE TABLE SOURCES.MRSTY
(
CUI CHAR(8),
TUI VARCHAR(10),
STN VARCHAR(100),
STY VARCHAR(1000),
ATUI VARCHAR(11),
CVF VARCHAR(50)
);

CREATE INDEX X_MRSAT_CUI ON SOURCES.MRSAT (CUI);
CREATE INDEX X_MRCONSO_CODE ON SOURCES.MRCONSO (CODE);
CREATE INDEX X_MRCONSO_CUI ON SOURCES.MRCONSO (CUI);
Expand All @@ -158,4 +169,5 @@ CREATE INDEX X_MRCONSO_SDUI ON SOURCES.MRCONSO (SDUI);
CREATE INDEX X_MRCONSO_STR ON SOURCES.MRCONSO (STR);
CREATE INDEX X_MRCONSO_SUI ON SOURCES.MRCONSO (SUI);
CREATE INDEX X_MRREL_AUI ON SOURCES.MRREL (AUI1, AUI2);
CREATE INDEX X_MRSTY_CUI ON SOURCES.MRSTY (CUI);
ALTER TABLE SOURCES.MRCONSO ADD CONSTRAINT X_MRCONSO_PK PRIMARY KEY USING INDEX X_MRCONSO_PK;
5 changes: 3 additions & 2 deletions UMLS/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@ Prerequisites:
- Working directory UMLS.

1. Run create_source_tables.sql
2. Download UMLS Metathesaurus Files (for example umls-YYYYAB-metathesaurus.zip) from http://www.nlm.nih.gov/research/umls/licensedcontent/umlsknowledgesources.html
3. Unpack files
2. Download Full UMLS Release Files (for example umls-YYYYAA-full.zip) from http://www.nlm.nih.gov/research/umls/licensedcontent/umlsknowledgesources.html
3. Unpack files
MRCONSO.RRF
MRHIER.RRF
MRMAP.RRF
MRSMAP.RRF
MRSAT.RRF
MRREL.RRF
MRSTY.RRF

4. Run in devv5 (with fresh vocabulary date): SELECT sources.load_input_tables('UMLS',TO_DATE('20180507','YYYYMMDD'),'2018AA');
6 changes: 5 additions & 1 deletion working/packages/load_input_tables/load_input_tables.sql
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ begin
pVocabularyPath=pVocabularyPath||pVocabularyID||'/';
case pVocabularyID
when 'UMLS' THEN
truncate table sources.mrconso, sources.mrhier, sources.mrmap, sources.mrsmap, sources.mrsat, sources.mrrel;
truncate table sources.mrconso, sources.mrhier, sources.mrmap, sources.mrsmap, sources.mrsat, sources.mrrel, sources.mrsty;
alter table sources.mrconso drop constraint x_mrconso_pk;
drop index sources.x_mrsat_cui;
drop index sources.x_mrconso_code;
Expand All @@ -25,6 +25,7 @@ begin
drop index sources.x_mrconso_str;
drop index sources.x_mrconso_sui;
drop index sources.x_mrrel_aui;
drop index sources.x_mrsty_cui;
/*
UMLS can contain characters like single quotes and double quotes, but PG uses them as a service characters
So we specifying a quote character that should never be in the text: E'\b' (backspace)
Expand All @@ -35,6 +36,7 @@ begin
execute 'COPY sources.mrsmap (mapsetcui,mapsetsab,mapid,mapsid,fromexpr,fromtype,rel,rela,toexpr,totype,cvf,vocabulary_date) FROM '''||pVocabularyPath||'MRSMAP.RRF'' delimiter ''|'' csv quote E''\b''';
execute 'COPY sources.mrsat FROM '''||pVocabularyPath||'MRSAT.RRF'' delimiter ''|'' csv quote E''\b''';
execute 'COPY sources.mrrel FROM '''||pVocabularyPath||'MRREL.RRF'' delimiter ''|'' csv quote E''\b''';
execute 'COPY sources.mrsty FROM '''||pVocabularyPath||'MRSTY.RRF'' delimiter ''|'' csv quote E''\b''';
update sources.mrsmap set vocabulary_date=COALESCE(pVocabularyDate,current_date), vocabulary_version=COALESCE(pVocabularyVersion,pVocabularyID||' '||current_date);

CREATE INDEX x_mrsat_cui ON sources.mrsat (cui);
Expand All @@ -48,13 +50,15 @@ begin
CREATE INDEX x_mrconso_str ON sources.mrconso (str);
CREATE INDEX x_mrconso_sui ON sources.mrconso (sui);
CREATE INDEX x_mrrel_aui ON sources.mrrel (aui1, aui2);
CREATE INDEX x_mrsty_cui ON sources.mrsty (cui);
ALTER TABLE sources.mrconso ADD CONSTRAINT x_mrconso_pk PRIMARY KEY USING INDEX x_mrconso_pk;
analyze sources.mrconso;
analyze sources.mrhier;
analyze sources.mrmap;
analyze sources.mrsmap;
analyze sources.mrsat;
analyze sources.mrrel;
analyze sources.mrsty;
when 'CIEL' then
set local datestyle='ISO, DMY'; --set proper date format
truncate table sources.concept_ciel, sources.concept_class_ciel, sources.concept_name, sources.concept_reference_map, sources.concept_reference_term, sources.concept_reference_source;
Expand Down
3 changes: 2 additions & 1 deletion working/packages/vocabulary_download/bash_functions_umls.sql
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ BEGIN
mv "MRMAP.RRF" "$1" && \
mv "MRSMAP.RRF" "$1" && \
mv "MRSAT.RRF" "$1" && \
mv "MRREL.RRF" "$1"
mv "MRREL.RRF" "$1" && \
mv "MRSTY.RRF" "$1"
$BODY$
LANGUAGE 'plsh'
SECURITY DEFINER;
Expand Down

0 comments on commit 44d14ca

Please sign in to comment.