-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Now dm+d sources are updated separately
- Loading branch information
Timur
committed
Feb 3, 2021
1 parent
f56b3a2
commit 5fba558
Showing
10 changed files
with
335 additions
and
191 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/************************************************************************** | ||
* Copyright 2016 Observational Health Data Sciences and Informatics (OHDSI) | ||
* | ||
* 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. | ||
* | ||
* Authors: Timur Vakhitov | ||
* Date: 2021 | ||
**************************************************************************/ | ||
|
||
DROP TABLE IF EXISTS SOURCES.F_LOOKUP2,SOURCES.F_INGREDIENT2,SOURCES.F_VTM2,SOURCES.F_VMP2,SOURCES.F_AMP2,SOURCES.F_VMPP2,SOURCES.F_AMPP2,SOURCES.DMDBONUS; | ||
CREATE TABLE SOURCES.F_LOOKUP2 (xmlfield XML, vocabulary_date DATE, vocabulary_version VARCHAR (200)); | ||
CREATE TABLE SOURCES.F_INGREDIENT2 (xmlfield XML); | ||
CREATE TABLE SOURCES.F_VTM2 (xmlfield XML); | ||
CREATE TABLE SOURCES.F_VMP2 (xmlfield XML); | ||
CREATE TABLE SOURCES.F_VMPP2 (xmlfield XML); | ||
CREATE TABLE SOURCES.F_AMP2 (xmlfield XML); | ||
CREATE TABLE SOURCES.F_AMPP2 (xmlfield XML); | ||
CREATE TABLE SOURCES.DMDBONUS (xmlfield XML); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
working/packages/vocabulary_download/bash_functions_dmd.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
--DMD part | ||
DO $_$ | ||
DECLARE | ||
z text; | ||
BEGIN | ||
z:=$FUNCTIONBODY$ | ||
CREATE OR REPLACE FUNCTION vocabulary_download.get_dmd_prepare_dmd (iPath text, iFilename text) | ||
RETURNS void AS | ||
$BODY$#!/bin/bash | ||
#set permissions=775 by default | ||
umask 002 && \ | ||
cd "$1/work" && \ | ||
unzip -oqj "$2" "f_ampp2_*.xml" -d . && \ | ||
unzip -oqj "$2" "f_amp2_*.xml" -d . && \ | ||
unzip -oqj "$2" "f_vmpp2_*.xml" -d . && \ | ||
unzip -oqj "$2" "f_vmp2_*.xml" -d . && \ | ||
unzip -oqj "$2" "f_lookup2_*.xml" -d . && \ | ||
unzip -oqj "$2" "f_vtm2_*.xml" -d . && \ | ||
unzip -oqj "$2" "f_ingredient2_*.xml" -d . | ||
|
||
#move result to original folder | ||
cd "$1" | ||
rm -f *.xml | ||
mv work/f_ampp2_*.xml "f_ampp2.xml" && \ | ||
mv work/f_amp2_*.xml "f_amp2.xml" && \ | ||
mv work/f_vmpp2_*.xml "f_vmpp2.xml" && \ | ||
mv work/f_vmp2_*.xml "f_vmp2.xml" && \ | ||
mv work/f_lookup2_*.xml "f_lookup2.xml" && \ | ||
mv work/f_vtm2_*.xml "f_vtm2.xml" && \ | ||
mv work/f_ingredient2_*.xml "f_ingredient2.xml" | ||
$BODY$ | ||
LANGUAGE 'plsh' | ||
SECURITY DEFINER; | ||
$FUNCTIONBODY$; | ||
--convert CRLF to LF for bash | ||
EXECUTE REPLACE(z,E'\r',''); | ||
END $_$; | ||
|
||
--DMD bonus part | ||
DO $_$ | ||
DECLARE | ||
z text; | ||
BEGIN | ||
z:=$FUNCTIONBODY$ | ||
CREATE OR REPLACE FUNCTION vocabulary_download.get_dmd_prepare_dmdbonus (iPath text, iFilename text) | ||
RETURNS void AS | ||
$BODY$#!/bin/bash | ||
#set permissions=775 by default | ||
umask 002 && \ | ||
cd "$1/work" && \ | ||
unzip -oqj "$2" "*.zip" -d . && \ | ||
unzip -oqj "week*BNF.zip" "f_bnf1_*.xml" -d . && \ | ||
rm -f week*BNF.zip | ||
|
||
#move result to original folder | ||
cd "$1" | ||
rm -f dmdbonus.xml | ||
mv work/f_bnf1_*.xml "dmdbonus.xml" | ||
$BODY$ | ||
LANGUAGE 'plsh' | ||
SECURITY DEFINER; | ||
$FUNCTIONBODY$; | ||
--convert CRLF to LF for bash | ||
EXECUTE REPLACE(z,E'\r',''); | ||
END $_$; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.