Skip to content

Commit

Permalink
Merge pull request #115 from cqframework/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
brynrhodes authored May 21, 2020
2 parents f58a690 + a339f4d commit 36b6c32
Show file tree
Hide file tree
Showing 281 changed files with 791,130 additions and 213,438 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,9 @@
/resources/ig-new.xml
/org.hl7.fhir.publisher.jar
template
input-cache/*
!/input-cache/txcache
input/ig-expansion-parameters.json
input/ig-new.json
input/ig-new.xml
input/ig-validation-parameters.json
2 changes: 1 addition & 1 deletion _createValueSetsFromSpreadSheets.bat
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@ECHO OFF
SET tooling_jar=tooling-1.0.4-SNAPSHOT-jar-with-dependencies.jar
SET tooling_jar=tooling-1.1.0-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
Expand Down
27 changes: 27 additions & 0 deletions _genonce.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
@ECHO OFF
SET publisher_jar=org.hl7.fhir.publisher.jar
SET input_cache_path=%CD%\input-cache\

ECHO Checking internet connection...
PING tx.fhir.org -n 1 -w 1000 | FINDSTR TTL && GOTO isonline
ECHO We're offline...
SET txoption=-tx n/a
GOTO igpublish

:isonline
ECHO We're online
SET txoption=

:igpublish

SET JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF-8

IF EXIST "%input_cache_path%\%publisher_jar%" (
JAVA -jar %input_cache_path%\%publisher_jar% -ig ig.json %txoption% %*
) ELSE If exist "..\%publisher_jar%" (
JAVA -jar ..\%publisher_jar% -ig ig.json %txoption% %*
) ELSE (
ECHO IG Publisher NOT FOUND in input-cache or parent folder. Please run _updatePublisher. Aborting...
)

PAUSE
30 changes: 30 additions & 0 deletions _genonce.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash
publisher_jar=org.hl7.fhir.publisher.jar
input_cache_path=./input-cache/
set -e
echo Checking internet connection...
wget -q --spider tx.fhir.org

if [ $? -eq 0 ]; then
echo "Online"
txoption=""
else
echo "Offline"
txoption="-tx n/a"
fi
txoption="-tx n/a"
echo "$txoption"

publisher=$input_cache_path/$publisher_jar
if test -f "$publisher"; then
JAVA -jar $publisher -ig ig.json $txoption $*

else
publisher=../$publisher_jar
echo $publisher
if test -f "$publisher"; then
JAVA -jar $publisher -ig ig.json $txoption $*
else
echo IG Publisher NOT FOUND in input-cache or parent folder. Please run _updatePublisher. Aborting...
fi
fi
31 changes: 31 additions & 0 deletions _refresh.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
@ECHO OFF
SET tooling_jar=tooling-1.1.0-SNAPSHOT-jar-with-dependencies.jar
SET input_cache_path=%~dp0input-cache
SET resources_path=%~dp0/input/resources
SET ig_resource_path=%~dp0/input/opioid-cds.xml

ECHO Checking internet connection...
PING tx.fhir.org -n 1 -w 1000 | FINDSTR TTL && GOTO isonline
ECHO We're offline...
SET fsoption=
GOTO igpublish

:isonline
ECHO We're online, setting publish to the Connectathon sandbox FHIR server
SET fsoption=

:igpublish

SET JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF-8

IF EXIST "%input_cache_path%\%tooling_jar%" (
ECHO running: JAVA -jar "%input_cache_path%\%tooling_jar%" -RefreshIG -ip=%~dp0 -rp="%resources_path%" -igrp="%ig_resource_path%" -iv=fhir3 -t -d -p %fsoption%
JAVA -jar "%input_cache_path%\%tooling_jar%" -RefreshIG -ip=%~dp0 -rp="%resources_path%" -igrp="%ig_resource_path%" -iv=fhir3 -t -d -p %fsoption%
) ELSE If exist "..\%tooling_jar%" (
ECHO running: JAVA -jar "..\%tooling_jar%" -RefreshIG -ip=%~dp0 -rp="%resources_path%" -igrp="%ig_resource_path%" -iv=fhir3 -t -d -p %fsoption%
JAVA -jar "..\%tooling_jar%" -RefreshIG -ip=%~dp0 -rp="%resources_path%" -igrp="%ig_resource_path%" -iv=fhir3 -t -d -p %fsoption%
) ELSE (
ECHO IG Refresh NOT FOUND in input-cache or parent folder. Please run _updateCQFTooling. Aborting...
)

PAUSE
34 changes: 34 additions & 0 deletions _refresh.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/bash
#DO NOT EDIT WITH WINDOWS
tooling_jar=tooling-1.1.0-SNAPSHOT-jar-with-dependencies.jar
input_cache_path=./input-cache
resources_path=$PWD/input/resources
ig_resource_path=./input/opioid-cds.xml

set -e
echo Checking internet connection...
wget -q --spider tx.fhir.org

if [ $? -eq 0 ]; then
echo "Online"
fsoption=""
#"-fs http://cds-sandbox.alphora.com/cqf-ruler-dstu3/fhir/"
else
echo "Offline"
fsoption=""
fi

echo "$fsoption"

tooling=$input_cache_path/$tooling_jar
if test -f "$tooling"; then
JAVA -jar $tooling -RefreshIG -ip="$PWD" -igrp="$ig_resource_path" -rp="$resources_path" -iv=fhir3 -t -d -p $fsoption
else
tooling=../$tooling_jar
echo $tooling
if test -f "$tooling"; then
JAVA -jar $tooling -RefreshIG -ip="$PWD" -igrp="$ig_resource_path" -rp="$resources_path" -iv=fhir3 -t -d -p $fsoption
else
echo IG Refresh NOT FOUND in input-cache or parent folder. Please run _updateCQFTooling. Aborting...
fi
fi
3 changes: 0 additions & 3 deletions _runant.bat

This file was deleted.

4 changes: 2 additions & 2 deletions _updateRefreshIG.bat → _updateCQFTooling.bat
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@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 "dlurl=https://oss.sonatype.org/service/local/artifact/maven/redirect?r=snapshots&g=org.opencds.cqf&a=tooling&v=1.1.0-SNAPSHOT&c=jar-with-dependencies"
SET tooling_jar=tooling-1.1.0-SNAPSHOT-jar-with-dependencies.jar
SET input_cache_path=%~dp0input-cache\

FOR %%x IN ("%CD%") DO SET upper_path=%%~dpx
Expand Down
4 changes: 2 additions & 2 deletions _updateRefreshIG.sh → _updateCQFTooling.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
r=snapshots
g=org.opencds.cqf
a=tooling
v=1.0.2-SNAPSHOT
v=1.1.0-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
tooling_jar=tooling-1.1.0-SNAPSHOT-jar-with-dependencies.jar

set -e
if ! type "curl" > /dev/null; then
Expand Down
131 changes: 131 additions & 0 deletions _updatePublisher.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
@ECHO OFF

SETLOCAL

SET dlurl=https://storage.googleapis.com/ig-build/org.hl7.fhir.publisher.jar
SET publisher_jar=org.hl7.fhir.publisher.jar
SET input_cache_path=%CD%\input-cache\
SET skipPrompts=false

set update_bat_url=https://raw.githubusercontent.com/FHIR/sample-ig/master/_updatePublisher.bat
set gen_bat_url=https://raw.githubusercontent.com/FHIR/sample-ig/master/_genonce.bat
set gencont_bat_url=https://raw.githubusercontent.com/FHIR/sample-ig/master/_gencontinuous.bat
set gencont_sh_url=https://raw.githubusercontent.com/FHIR/sample-ig/master/_gencontinuous.sh
set gen_sh_url=https://raw.githubusercontent.com/FHIR/sample-ig/master/_genonce.sh
set update_sh_url=https://raw.githubusercontent.com/FHIR/sample-ig/master/_updatePublisher.sh

IF "%~1"=="/f" SET skipPrompts=true

ECHO "%skipPrompts%"


:processflags
SET ARG=%1
IF DEFINED ARG (
IF "%ARG%"=="-f" SET FORCE=true
IF "%ARG%"=="--force" SET FORCE=true
SHIFT
GOTO processflags
)

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

IF NOT EXIST "%input_cache_path%%publisher_jar%" (
IF NOT EXIST "%upper_path%%publisher_jar%" (
SET jarlocation="%input_cache_path%%publisher_jar%"
SET jarlocationname=Input Cache
ECHO IG Publisher 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 Publisher FOUND in parent folder
SET jarlocation="%upper_path%%publisher_jar%"
SET jarlocationname=Parent folder
GOTO:upgrade
)
) ELSE (
ECHO IG Publisher FOUND in input-cache
SET jarlocation="%input_cache_path%%publisher_jar%"
SET jarlocationname=Input Cache
GOTO:upgrade
)

:create
IF DEFINED FORCE (
MKDIR "%input_cache_path%" 2> NUL
GOTO:download
)
ECHO Will place publisher jar here: %input_cache_path%%publisher_jar%
IF "%skipPrompts%"=="true" (
SET create="Y"
) ELSE (
SET /p create="Ok? (Y/N) "
)
IF /I %create%=="Y" (
MKDIR "%input_cache_path%" 2> NUL
GOTO:download
)
GOTO:done

:upgrade
IF "%skipPrompts%"=="true" (
SET overwrite="Y"
) ELSE (
SET /p overwrite="Overwrite %jarlocation%? (Y/N) "
)

IF /I %overwrite%=="Y" (
GOTO:download
)
GOTO:done

:download
ECHO Downloading most recent publisher to %jarlocationname% - it's ~100 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
CALL POWERSHELL -command if ('System.Net.WebClient' -as [type]) {(new-object System.Net.WebClient).DownloadFile(\"%dlurl%\",\"%jarlocation%\") } else { Invoke-WebRequest -Uri "%dlurl%" -Outfile "%jarlocation%" }

GOTO done

:win7
CALL bitsadmin /transfer GetPublisher /download /priority normal "%dlurl%" "%jarlocation%"
GOTO done

:win8.1
:win8
:vista
ECHO This script does not yet support Windows %winver%. Please ask for help on http://chat.fhir.org
GOTO done

:done

REM Download all batch files (and this one with a new name)

SETLOCAL DisableDelayedExpansion

REM ==== For getting the sources online...
rem POWERSHELL -command if ('System.Net.WebClient' -as [type]) {(new-object System.Net.WebClient).DownloadFile(\"%update_bat_url%\",\"_updatePublisher.new.bat\") } else { Invoke-WebRequest -Uri "%update_bat_url%" -Outfile "_updatePublisher.new.bat" }
rem POWERSHELL -command if ('System.Net.WebClient' -as [type]) {(new-object System.Net.WebClient).DownloadFile(\"%gen_bat_url%\",\"_genonce.bat\") } else { Invoke-WebRequest -Uri "%gen_bat_url%" -Outfile "_genonce.bat" }
rem POWERSHELL -command if ('System.Net.WebClient' -as [type]) {(new-object System.Net.WebClient).DownloadFile(\"%gencont_bat_url%\",\"_gencontinuous.bat\") } else { Invoke-WebRequest -Uri "%gencont_bat_url%" -Outfile "_gencontinuous.bat" }

rem POWERSHELL -command if ('System.Net.WebClient' -as [type]) {(new-object System.Net.WebClient).DownloadFile(\"%update_sh_url%\",\"_updatePublisher.sh\") } else { Invoke-WebRequest -Uri "%update_sh_url%" -Outfile "_updatePublisher.new.sh" }
rem POWERSHELL -command if ('System.Net.WebClient' -as [type]) {(new-object System.Net.WebClient).DownloadFile(\"%gen_sh_url%\",\"_genonce.sh\") } else { Invoke-WebRequest -Uri "%gen_sh_url%" -Outfile "_genonce.sh" }
rem POWERSHELL -command if ('System.Net.WebClient' -as [type]) {(new-object System.Net.WebClient).DownloadFile(\"%gencont_sh_url%\",\"_gencontinuous.sh\") } else { Invoke-WebRequest -Uri "%gencont_sh_url%" -Outfile "_gencontinuous.sh" }

rem ECHO Updating this file...
rem start copy /y "_updatePublisher.new.bat" "_updatePublisher.bat" ^&^& del "_updatePublisher.new.bat" ^&^& exit
REM ============================

IF "%skipPrompts%"=="true" (
PAUSE
}
45 changes: 30 additions & 15 deletions _updatePublisher.sh
Original file line number Diff line number Diff line change
@@ -1,19 +1,33 @@
#!/bin/bash
dlurl=https://fhir.github.io/latest-ig-publisher/org.hl7.fhir.publisher.jar
dlurl=https://storage.googleapis.com/ig-build/org.hl7.fhir.publisher.jar
publisher_jar=org.hl7.fhir.publisher.jar
root_path=./
input_cache_path=./input-cache/

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

publisher="$root_path$publisher_jar"
FORCE=false

while :; do
case $1 in
-f|--force) FORCE=true ;;
--)
shift
break
;;
*) break
esac
shift
done

publisher="$input_cache_path$publisher_jar"
if test -f "$publisher"; then
echo "IG Publisher FOUND in root"
echo "IG Publisher FOUND in input-cache"
jarlocation="$publisher"
jarlocationname="Root"
jarlocationname="Input Cache"
upgrade=true
else
publisher="../$publisher_jar"
Expand All @@ -25,22 +39,23 @@ else
upgrade=true
else
echo IG Publisher NOT FOUND in input-cache or parent folder...
jarlocation="$root_path$publisher_jar"
jarlocationname="Root"
jarlocation=$input_cache_path$publisher_jar
jarlocationname="Input Cache"
upgrade=false
fi
fi

if $upgrade ; then
message="Overwrite $jarlocation? [Y/N] "
else
#echo Will place publisher jar here: $root_path$publisher_jar
echo Will place publisher jar here: $jarlocation
message="Ok? [Y/N]"
if [[ "$FORCE" != true ]]; then
if "$upgrade"; then
message="Overwrite $jarlocation? (Y/N) "
else
echo Will place publisher jar here: "$jarlocation"
message="Ok (enter 'y' or 'Y' to continue, any other key to cancel)?"
fi
read -r -p "$message" response
fi

read -r -p "$message" response
if [[ "$response" =~ ^([yY])$ ]]; then
if [[ "$FORCE" == true ]] || [[ "$response" =~ ^([yY])$ ]]; then
echo "Downloading most recent publisher to $jarlocationname - it's ~100 MB, so this may take a bit"
# wget "https://fhir.github.io/latest-ig-publisher/org.hl7.fhir.publisher.jar" -O "$jarlocation"
curl $dlurl -o "$jarlocation" --create-dirs
Expand Down
Loading

0 comments on commit 36b6c32

Please sign in to comment.