Skip to content

Commit

Permalink
added sources.amt_crefset_language (AMT, AVOF-3171)
Browse files Browse the repository at this point in the history
  • Loading branch information
Timur committed Jun 16, 2021
1 parent 107c84a commit 3589205
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 3 deletions.
13 changes: 13 additions & 0 deletions AMT/create_source_tables.sql
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,19 @@ CREATE TABLE SOURCES.AMT_RF2_SS_STRENGTH_REFSET
VALUE VARCHAR(255)
);

DROP TABLE IF EXISTS SOURCES.AMT_CREFSET_LANGUAGE;
CREATE TABLE SOURCES.AMT_CREFSET_LANGUAGE
(
ID VARCHAR(255),
EFFECTIVETIME VARCHAR(8),
ACTIVE INT2,
MODULEID BIGINT,
REFSETID BIGINT,
REFERENCEDCOMPONENTID BIGINT,
ACCEPTABILITYID BIGINT
);

CREATE INDEX idx_amt_lang_refid ON SOURCES.AMT_CREFSET_LANGUAGE (REFERENCEDCOMPONENTID);
CREATE INDEX idx_amt_concept_id ON SOURCES.AMT_SCT2_CONCEPT_FULL_AU (ID);
CREATE INDEX idx_amt_descr_id ON SOURCES.AMT_FULL_DESCR_DRUG_ONLY (CONCEPTID);
CREATE INDEX idx_amt_rela_id ON SOURCES.AMT_RF2_FULL_RELATIONSHIPS (ID);
Expand Down
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 @@ -622,28 +622,32 @@ begin
analyze sources.ggr_sam;
when 'AMT' then
truncate table sources.amt_full_descr_drug_only, sources.amt_sct2_concept_full_au, sources.amt_rf2_full_relationships, sources.amt_rf2_ss_strength_refset,
sources.amt_sct2_rela_full_au;
sources.amt_sct2_rela_full_au, sources.amt_crefset_language;
drop index sources.idx_amt_concept_id;
drop index sources.idx_amt_descr_id;
drop index sources.idx_amt_rela_id;
drop index sources.idx_amt_rela2_id;
drop index sources.idx_amt_lang_refid;
execute 'COPY sources.amt_full_descr_drug_only FROM '''||pVocabularyPath||'sct2_Description_Full-en-AU_AU.txt'' delimiter E''\t'' csv quote E''\b'' HEADER';
execute 'COPY sources.amt_sct2_concept_full_au (id,effectivetime,active,moduleid,statusid) FROM '''||pVocabularyPath||'sct2_Concept_Full_AU.txt'' delimiter E''\t'' csv quote E''\b'' HEADER';
execute 'COPY sources.amt_rf2_full_relationships FROM '''||pVocabularyPath||'sct2_Relationship_Full_AU.txt'' delimiter E''\t'' csv quote E''\b'' HEADER';
execute 'COPY sources.amt_rf2_ss_strength_refset FROM '''||pVocabularyPath||'der2_ccsRefset_StrengthFull_AU.txt'' delimiter E''\t'' csv quote E''\b'' HEADER';
execute 'COPY sources.amt_crefset_language FROM '''||pVocabularyPath||'der2_cRefset_LanguageFull-en-AU_AU.txt'' delimiter E''\t'' csv quote E''\b'' HEADER';
--execute 'COPY sources.amt_sct2_rela_full_au FROM '''||pVocabularyPath||'sct2_Relationship_Full_AU36.txt'' delimiter E''\t'' csv quote E''\b'' HEADER';
update sources.amt_sct2_concept_full_au set vocabulary_date=COALESCE(pVocabularyDate,current_date), vocabulary_version=COALESCE(pVocabularyVersion,pVocabularyID||' '||current_date);

create index idx_amt_concept_id on sources.amt_sct2_concept_full_au (id);
create index idx_amt_descr_id on sources.amt_full_descr_drug_only (conceptid);
create index idx_amt_rela_id on sources.amt_rf2_full_relationships (id);
create index idx_amt_rela2_id on sources.amt_sct2_rela_full_au (id);
create index idx_amt_lang_refid on sources.amt_crefset_language (referencedcomponentid);

analyze sources.amt_full_descr_drug_only;
analyze sources.amt_sct2_concept_full_au;
analyze sources.amt_rf2_full_relationships;
analyze sources.amt_rf2_ss_strength_refset;
analyze sources.amt_sct2_rela_full_au;
analyze sources.amt_crefset_language;
when 'ISBT' then
truncate table sources.isbt_product_desc, sources.isbt_classes, sources.isbt_modifiers, sources.isbt_attribute_values, sources.isbt_attribute_groups,
sources.isbt_categories, sources.isbt_modifier_category_map, sources.isbt_version;
Expand Down
6 changes: 4 additions & 2 deletions working/packages/vocabulary_download/bash_functions_amt.sql
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,17 @@ BEGIN
unzip -oqj "$2" "SnomedCT_Release_AU1000036_*/RF2Release/Full/Terminology/sct2_Concept_Full_AU1000036_*.txt" -d . && \
unzip -oqj "$2" "SnomedCT_Release_AU1000036_*/RF2Release/Full/Terminology/sct2_Description_Full-en-AU_AU1000036_*.txt" -d . && \
unzip -oqj "$2" "SnomedCT_Release_AU1000036_*/RF2Release/Full/Terminology/sct2_Relationship_Full_AU1000036_*.txt" -d . && \
unzip -oqj "$2" "SnomedCT_Release_AU1000036_*/RF2Release/Full/Refset/Content/der2_ccsRefset_StrengthFull_AU1000036_*.txt" -d .
unzip -oqj "$2" "SnomedCT_Release_AU1000036_*/RF2Release/Full/Refset/Content/der2_ccsRefset_StrengthFull_AU1000036_*.txt" -d . && \
unzip -oqj "$2" "SnomedCT_Release_AU1000036_*/RF2Release/Full/Refset/Language/der2_cRefset_LanguageFull-en-AU_AU1000036_*.txt" -d .

#move result to original folder
cd "$1"
rm -f *.*
mv work/sct2_Concept_Full_*.txt "sct2_Concept_Full_AU.txt" && \
mv work/sct2_Description_Full-en-AU_*.txt "sct2_Description_Full-en-AU_AU.txt" && \
mv work/sct2_Relationship_Full_*.txt "sct2_Relationship_Full_AU.txt" && \
mv work/der2_ccsRefset_StrengthFull_*.txt "der2_ccsRefset_StrengthFull_AU.txt"
mv work/der2_ccsRefset_StrengthFull_*.txt "der2_ccsRefset_StrengthFull_AU.txt" && \
mv work/der2_cRefset_LanguageFull-en-AU_AU1000036_*.txt "der2_cRefset_LanguageFull-en-AU_AU.txt"
$BODY$
LANGUAGE 'plsh'
SECURITY DEFINER;
Expand Down

0 comments on commit 3589205

Please sign in to comment.