Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions _publish.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
@ECHO OFF
SET server_url="http://localhost:8080/fhir/"

IF "%1%"=="-h" GOTO printUsage
GOTO publish

:printUsage
ECHO Usage: %0 [-s fhir_base_url] [-u]
ECHO.
ECHO Runs Refresh and loads resources to a FHIR server. Defaults to %server_url%.
ECHO -h Print this help
ECHO -s Use specificed fhir base url like http://localhost:8080/fhir/
ECHO -u Unattended mode. Defaults to false.
GOTO exit0

:publish
SET refresh_script=_refresh.bat
SET unattended=

IF "%1%"=="-u" (
SET unattended=-u
) ELSE IF "%2%"=="-u" (
SET unattended=-u
)

IF "%1%"=="-s" (
SET server_url=%1%
) ELSE IF "%2%"=="-s" (
SET server_url=%2%
)

SET fsoption=-s %server_url%

IF EXIST "%refresh_script%" (
ECHO running: %refresh_script% %fsoption% %unattended%
CALL _refresh.bat %fsoption% %unattended%
) ELSE (
ECHO Refresh script NOT FOUND. Please install _refresh.bat. Aborting...
GOTO exit1
)

:exit0
EXIT /b 0

:exit1
EXIT /b 1
41 changes: 41 additions & 0 deletions _publish.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/bin/bash
#DO NOT EDIT WITH WINDOWS

server_url="http://localhost:8080/fhir/"

usage () {
cat <<HELP_USAGE

$0 [-s <fhir_base_url>] [-u]

Runs Refresh and loads resources to a FHIR server. Defaults to $server_url.

-h Print this help
-s Use specificed fhir base url like http://localhost:8080/fhir/
-u Unattended mode. Defaults to false.
HELP_USAGE
exit 0
}

refresh_script="_refresh.sh"
unattended=""

while getopts hs:u flag
do
case "${flag}" in
h) usage;;
s) server_url=${OPTARG};;
u) unattended="-u";;
esac
done

fsoption="-s $server_url"

set -e

if test -f "$refresh_script"; then
echo "running: ./_refresh.sh $fsoption $unattended"
./_refresh.sh "$fsoption" "$unattended"
else
echo Publish script NOT FOUND. Please install _publish.sh. Aborting...
fi
77 changes: 62 additions & 15 deletions _refresh.bat
Original file line number Diff line number Diff line change
@@ -1,32 +1,79 @@
@ECHO OFF
SET tooling_jar=tooling-1.4.0-jar-with-dependencies.jar
IF "%1%"=="-h" GOTO printUsage
GOTO refresh

:printUsage
ECHO Usage: %0 [-d] [-s fhir_base_url] [-u]
ECHO.
ECHO Refreshes FHIR documents in place. Optionally loads resources to a FHIR server.
ECHO -h Print this help
ECHO -d Use default Alphora FHIR sandbox. Mutually exclusive with -s.
ECHO -s Use specificed fhir base url like http://localhost:8080/fhir/. Mutually exclusive with -d.
ECHO -u Unattended mode. Defaults to false.
GOTO exit0

:refresh
SET tooling_jar=tooling-1.4.1-SNAPSHOT-jar-with-dependencies.jar
SET input_cache_path=%~dp0input-cache
SET ig_resource_path=%~dp0input\ecqm-content-r4.xml
SET unattended=false
SET server_url=

ECHO Checking internet connection...
PING tx.fhir.org -n 1 -w 1000 | FINDSTR TTL && GOTO isonline
ECHO We're offline...
SET fsoption=
GOTO igpublish
IF "%1%"=="-u" (
SET unattended=true
) ELSE IF "%2%"=="-u" (
SET unattended=true
) ELSE IF "%3%"=="-u" (
SET unattended=true
)

IF "%1%"=="-d" (
SET server_url=https://cloud.alphora.com/sandbox/r4/cqm/fhir/
GOTO igpublish
) ELSE IF "%2%"=="-d" (
SET server_url=https://cloud.alphora.com/sandbox/r4/cqm/fhir/
GOTO igpublish
)
IF "%1%"=="-s" (
SET server_url=%2%
GOTO igpublish
) ELSE IF "%2%"=="-s" (
SET server_url=%3%
GOTO igpublish
)

:isonline
ECHO We're online, setting publish to the Connectathon sandbox FHIR server (DISABLED TEMPORARILY)
SET fsoption=
REM Disabled temporarily due to an error in the CQF Tooling upload
REM -fs http://cqm-sandbox.alphora.com/cqf-ruler-r4/fhir/

:igpublish

SET JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF-8

IF NOT "%server_url%"=="" (
SET fsoption=-fs=%server_url%
)

IF "%server_url%"=="" (
ECHO No FHIR server specified. Resources will not be loaded.
) ELSE (
ECHO Resources will be loaded to FHIR server: %server_url%
)

IF EXIST "%input_cache_path%\%tooling_jar%" (
ECHO running: JAVA -jar "%input_cache_path%\%tooling_jar%" -RefreshIG -ini=%~dp0ig.ini -t -d -p
JAVA -jar "%input_cache_path%\%tooling_jar%" -RefreshIG -ini=%~dp0ig.ini -t -d -p %fsoption%
) ELSE If exist "..\%tooling_jar%" (
ECHO running: JAVA -jar "..\%tooling_jar%" -RefreshIG -ini=%~dp0ig.ini -t -d -p
ECHO running: JAVA -jar "%input_cache_path%\%tooling_jar%" -RefreshIG -ini=%~dp0ig.ini -t -d -p %fsoption% -rp input\cql
JAVA -jar "%input_cache_path%\%tooling_jar%" -RefreshIG -ini=%~dp0ig.ini -t -d -p %fsoption% -rp input\cql
) ELSE IF EXIST "..\%tooling_jar%" (
ECHO running: JAVA -jar "..\%tooling_jar%" -RefreshIG -ini=%~dp0ig.ini -t -d -p %fsoption%
JAVA -jar "..\%tooling_jar%" -RefreshIG -ini=%~dp0ig.ini -t -d -p %fsoption%
) ELSE (
ECHO IG Refresh NOT FOUND in input-cache or parent folder. Please run _updateCQFTooling. Aborting...
GOTO exit1
)

IF "%unattended%"=="true" GOTO exit0

PAUSE

:exit0
EXIT /b 0

:exit1
EXIT /b 1
60 changes: 44 additions & 16 deletions _refresh.sh
Original file line number Diff line number Diff line change
@@ -1,36 +1,64 @@
#!/bin/bash
#DO NOT EDIT WITH WINDOWS
tooling_jar=tooling-1.4.0-jar-with-dependencies.jar

usage () {
cat <<HELP_USAGE

$0 [-d] [-s <fhir_base_url>] [-u]

Refreshes FHIR documents in place. Optionally loads resources to a FHIR server.

-h Print this help
-d Use default Alphora FHIR sandbox. Mutually exclusive with -s.
-s Use specificed fhir base url like http://localhost:8080/fhir/. Mutually exclusive with -d.
-u Unattended mode. Defaults to false.
HELP_USAGE
exit 0
}

tooling_jar=tooling-1.4.1-SNAPSHOT-jar-with-dependencies.jar
input_cache_path=./input-cache
ig_resource_path=./input/ecqm-content-r4.xml
unattended=false

while getopts hds:u flag
do
case "${flag}" in
d) server_url="https://cloud.alphora.com/sandbox/r4/cqm/fhir/";;
h) usage;;
s) server_url=${OPTARG};;
u) unattended=true;;
esac
done

fsoption=""
if [ ! -z "${server_url}" ]; then
fsoption="-fs ${server_url}"
fi

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

if [ $? -eq 0 ]; then
echo "Online"
#fsoption=""
#Disabled temporarily due to error in CQF Tooling upload
fsoption="-fs https://cqm-sandbox.alphora.com/cqf-ruler-r4/fhir/"

if [ -z "${server_url}" ]; then
echo "No FHIR server specified. Resources will not be loaded."
else
echo "Offline"
fsoption=""
echo "Resources will be loaded to FHIR server: ${server_url}."
fi

echo "$fsoption"
fsoption=""

tooling=$input_cache_path/$tooling_jar
if test -f "$tooling"; then
echo "running: java -jar $tooling -RefreshIG -ini=$PWD/ig.ini -t -d -p $fsoption"
java -jar $tooling -RefreshIG -ini="$PWD"/ig.ini -t -d -p $fsoption

else
tooling=../$tooling_jar
echo $tooling
if test -f "$tooling"; then
java -jar $tooling -RefreshIG -ini="$PWD"/ig.ini -t -d -p $fsoption
echo "running: java -jar $tooling -RefreshIG -ini=$PWD/ig.ini -t -d -p $fsoption -rp input/cql"
java -jar $tooling -RefreshIG -ini="$PWD"/ig.ini -t -d -p $fsoption -rp input/cql
else
echo IG Refresh NOT FOUND in input-cache or parent folder. Please run _updateCQFTooling. Aborting...
fi
fi

if [ "$unattended" = false ] ; then
read -p "Press any key to resume ..."
fi