Skip to content

Commit

Permalink
added _createValueSetsFromSpreadSheets.bat
Browse files Browse the repository at this point in the history
  • Loading branch information
jreyno77 committed Mar 27, 2020
1 parent 4ba28aa commit f58a690
Show file tree
Hide file tree
Showing 4 changed files with 157 additions and 0 deletions.
19 changes: 19 additions & 0 deletions _createValueSetsFromSpreadSheets.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
@ECHO OFF
SET tooling_jar=tooling-1.0.4-SNAPSHOT-jar-with-dependencies.jar
SET input_cache_path=%~dp0input-cache
SET spreadsheet_directory_path=%~dp0input\vocabulary\valueset\spreadsheets
SET output_path=%~dp0input\vocabulary\valueset

SET JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF-8

IF EXIST "%input_cache_path%\%tooling_jar%" (
ECHO running: JAVA -jar "%input_cache_path%\%tooling_jar%" -VsacXlsxToValueSetBatch -ptsd=spreadsheet_directory_path -vssrc=vsac -op=output_path
JAVA -jar "%input_cache_path%\%tooling_jar%" -VsacXlsxToValueSetBatch -ptsd=%spreadsheet_directory_path% -vssrc=vsac -op=%output_path%
) ELSE If exist "..\%tooling_jar%" (
ECHO running: JAVA -jar "..\%tooling_jar%" -VsacXlsxToValueSetBatch -ptsd=spreadsheet_directory_path -vssrc=vsac -op=output_path
JAVA -jar "..\%tooling_jar%" -VsacXlsxToValueSetBatch -ptsd=spreadsheet_directory_path -vssrc=vsac -op=output_path
) ELSE (
ECHO IG Tooling NOT FOUND in input-cache or parent folder. Please run _updateRefreshIG. Aborting...
)

PAUSE
75 changes: 75 additions & 0 deletions _updateRefreshIG.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
@ECHO OFF

SET "dlurl=https://oss.sonatype.org/service/local/artifact/maven/redirect?r=snapshots&g=org.opencds.cqf&a=tooling&v=1.0.4-SNAPSHOT&c=jar-with-dependencies"
SET tooling_jar=tooling-1.0.4-SNAPSHOT-jar-with-dependencies.jar
SET input_cache_path=%~dp0input-cache\

FOR %%x IN ("%CD%") DO SET upper_path=%%~dpx

IF NOT EXIST "%input_cache_path%%tooling_jar%" (
IF NOT EXIST "%upper_path%%tooling_jar%" (
SET jarlocation=%input_cache_path%%tooling_jar%
SET jarlocationname=Input Cache
ECHO IG Refresh is not yet in input-cache or parent folder.
REM we don't use jarlocation below because it will be empty because we're in a bracketed if statement
GOTO create
) ELSE (
ECHO IG RefreshFOUND in parent folder
SET jarlocation=%upper_path%%tooling_jar%
SET jarlocationname=Parent folder
GOTO:upgrade
)
) ELSE (
ECHO IG Refresh FOUND in input-cache
SET jarlocation=%input_cache_path%%tooling_jar%
SET jarlocationname=Input Cache
GOTO:upgrade
)

:create
ECHO Will place refresh jar here: %input_cache_path%%tooling_jar%
SET /p create="Ok? (Y/N)"
IF /I "%create%"=="Y" (
MKDIR "%input_cache_path%" 2> NUL
GOTO:download
)
GOTO:done

:upgrade
SET /p overwrite="Overwrite %jarlocation%? (Y/N)"
IF /I "%overwrite%"=="Y" (
GOTO:download
)
GOTO:done

:download
ECHO Downloading most recent refresh to %jarlocationname% - it's ~70 MB, so this may take a bit

FOR /f "tokens=4-5 delims=. " %%i IN ('ver') DO SET VERSION=%%i.%%j
IF "%version%" == "10.0" GOTO win10
IF "%version%" == "6.3" GOTO win8.1
IF "%version%" == "6.2" GOTO win8
IF "%version%" == "6.1" GOTO win7
IF "%version%" == "6.0" GOTO vista

ECHO Unrecognized version: %version%
GOTO done

:win10
POWERSHELL -command "if ('System.Net.WebClient' -as [type]) {(new-object System.Net.WebClient).DownloadFile('%dlurl%','%jarlocation%') } else { Invoke-WebRequest -Uri '%dlurl%' -Outfile '%jarlocation%' }"
ECHO Download complete.
GOTO done

:win7
bitsadmin /transfer GetRefresh /download /priority normal "%dlurl%" "%jarlocation%"
ECHO Download complete.
GOTO done

:win8.1
:win8
:vista
ECHO This script does not yet support Windows %winver%. Please ask for help on https://chat.fhir.org/#narrow/stream/179207-connectathon-mgmt/topic/Clinical.20Reasoning.20Track
GOTO done

:done
PAUSE
62 changes: 62 additions & 0 deletions _updateRefreshIG.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
#!/bin/bash
#DO NOT EDIT WITH WINDOWS
#exit 1

r=snapshots
g=org.opencds.cqf
a=tooling
v=1.0.2-SNAPSHOT
c=jar-with-dependencies

dlurl='https://oss.sonatype.org/service/local/artifact/maven/redirect?r='${r}'&g='${g}'&a='${a}'&v='${v}'&c='${c}''

echo ${dlurl}

input_cache_path=./input-cache/
tooling_jar=tooling-1.0.2-SNAPSHOT-jar-with-dependencies.jar

set -e
if ! type "curl" > /dev/null; then
echo "ERROR: Script needs curl to download latest IG Tooling. Please install curl."
exit 1
fi

tooling="$input_cache_path$tooling_jar"
if test -f "$tooling"; then
echo "IG Tooling FOUND in input-cache"
jarlocation="$tooling"
jarlocationname="Input Cache"
upgrade=true
else
tooling="../$tooling_jar"
upgrade=true
if test -f "$tooling"; then
echo "IG Tooling FOUND in parent folder"
jarlocation="$tooling"
jarlocationname="Parent Folder"
upgrade=true
else
echo IG Tooling NOT FOUND in input-cache or parent folder...
jarlocation="$input_cache_path$tooling_jar"
jarlocationname="Input Cache"
upgrade=false
fi
fi

if $upgrade ; then
message="Overwrite $jarlocation? [Y/N] "
else
#echo Will place tooling jar here: $input_cache_path$tooling_jar
echo Will place tooling jar here: $jarlocation
message="Ok? [Y/N]"
fi

read -r -p "$message" response
if [[ "$response" =~ ^([yY])$ ]]; then
echo "Downloading most recent tooling to $jarlocationname - it's ~170 MB, so this may take a bit"
# wget "https://oss.sonatype.org/service/local/repositories/snapshots/content/org/opencds/cqf/tooling/1.0-SNAPSHOT/tooling-1.0-20200107.163002-6-jar-with-dependencies.jar" -O "$jarlocation"
curl $dlurl -L -o "$jarlocation" --create-dirs
echo "Download complete."
else
echo cancel...
fi
1 change: 1 addition & 0 deletions input/vocabulary/valueset/spreadsheets/ReadMe.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This directory is for VSAC ValueSet SpreadSheets that need to be converted into FHIR Resources

0 comments on commit f58a690

Please sign in to comment.