This repository has been archived by the owner on Feb 7, 2025. It is now read-only.
generated from CDCgov/template
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Moved RS hurl scripts into rs/ folder * Added ti hurl scripts * Removed deprecated demographics script * Updated scripts and docs
1 parent
3f25d02
commit bd229ac
Showing
13 changed files
with
269 additions
and
42 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
File renamed without changes.
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,45 @@ | ||
# ReportStream Hurl Script | ||
|
||
## Usage | ||
|
||
``` | ||
Usage: ./hrl <HURL_FILE> [OPTIONS] | ||
Options: | ||
-f <REL_PATH> The path to the hl7/fhir file to submit, relative the root path (Required for waters API) | ||
-r <ROOT_PATH> The root path to the hl7/fhir files (Default: $CDCTI_HOME/examples/Test/) | ||
-e [local | staging] The environment to run the test in (Default: local) | ||
-c <CLIENT_ID> The client id to use (Default: flexion) | ||
-s <CLIENT_SENDER> The client sender to use (Default: simulated-lab) | ||
-x <KEY_PATH> The path to the client private key for the environment | ||
-i <SUBMISSION_ID> The submissionId to call the history API with (Required for history API) | ||
-v Verbose mode | ||
-h Display this help and exit | ||
``` | ||
|
||
## Examples | ||
|
||
Sending an order to local environment | ||
``` | ||
./hrl waters.hurl -f Orders/003_AL_ORM_O01_NBS_Fully_Populated_0_initial_message.hl7 | ||
``` | ||
|
||
Sending a result to local environment | ||
``` | ||
./hrl waters.hurl -f Results/002_AL_ORU_R01_NBS_Fully_Populated_0_initial_message.hl7 | ||
``` | ||
|
||
Sending an order to staging | ||
``` | ||
./hrl waters.hurl -f Orders/003_AL_ORM_O01_NBS_Fully_Populated_0_initial_message.hl7 -e staging -x /path/to/staging/private/key | ||
``` | ||
|
||
Checking the history in local environment for a submision id | ||
``` | ||
./hrl history.hurl -i 100 | ||
``` | ||
|
||
Checking the history in staging for a submision id | ||
``` | ||
./hrl history.hurl -i 100 -e staging -x /path/to/staging/private/key | ||
``` |
File renamed without changes.
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,5 @@ | ||
POST {{url}}/v1/auth/token | ||
Content-Type: application/x-www-form-urlencoded | ||
[FormParams] | ||
scope: {{client}} | ||
client_assertion: {{jwt}} |
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 @@ | ||
GET {{url}}/health |
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,115 @@ | ||
#!/bin/bash | ||
|
||
# Check if $CDCTI_HOME is set | ||
if [ -z "$CDCTI_HOME" ]; then | ||
echo "Error: CDCTI_HOME is not set. Please set this environment variable before running the script." | ||
exit 1 | ||
fi | ||
|
||
# default values | ||
env=local | ||
root=$CDCTI_HOME/examples/Test/ | ||
client=report-stream | ||
verbose="" | ||
|
||
show_help() { | ||
echo "Usage: $(basename $0) <HURL_FILE> [OPTIONS]" | ||
echo | ||
echo "Options:" | ||
echo " -f <REL_PATH> The path to the hl7/fhir file to submit, relative the root path (Required for orders and results APIs)" | ||
echo " -i <SUBMISSION_ID> The submissionId to call the metadata API with (Required for orders, results and metadata API)" | ||
echo " -r <ROOT_PATH> The root path to the hl7/fhir files (Default: $root)" | ||
echo " -e [local | staging] The environment to run the test in (Default: $env)" | ||
echo " -c <CLIENT> The client id to use (Default: $client)" | ||
echo " -j <JWT> The JWT to use for authentication" | ||
echo " -v Verbose mode" | ||
echo " -h Display this help and exit" | ||
} | ||
|
||
# Check if required HURL_FILE is provided | ||
if [ $# -eq 0 ]; then | ||
echo "Error: Missing required argument <HURL_FILE>" | ||
show_help | ||
exit 1 | ||
fi | ||
|
||
# Check if first argument is -h | ||
if [ "$1" = "-h" ]; then | ||
show_help | ||
exit 0 | ||
fi | ||
|
||
hurl_file="$1" # Assign the first argument to hurl_file | ||
shift # Remove the first argument from the list of arguments | ||
|
||
while getopts ':f:r:e:c:j:i:vh' opt; do | ||
case "$opt" in | ||
f) | ||
fpath="$OPTARG" | ||
;; | ||
i) | ||
submission_id="--variable submissionid=$OPTARG" | ||
;; | ||
r) | ||
root="$OPTARG" | ||
;; | ||
e) | ||
env="$OPTARG" | ||
;; | ||
c) | ||
client="$OPTARG" | ||
;; | ||
j) | ||
jwt="$OPTARG" | ||
;; | ||
v) | ||
verbose="--verbose" | ||
;; | ||
h) | ||
show_help | ||
exit 0 | ||
;; | ||
:) | ||
echo -e "Option requires an argument" | ||
show_help | ||
exit 1 | ||
;; | ||
?) | ||
echo -e "Invalid command option" | ||
show_help | ||
exit 1 | ||
;; | ||
esac | ||
done | ||
shift "$(($OPTIND - 1))" | ||
|
||
if [ "$env" = "local" ]; then | ||
host=localhost | ||
url=http://$host:8080 | ||
if [ -z "$jwt" ] && [ "$client" = "report-stream" ]; then | ||
jwt=$(cat "$CDCTI_HOME/mock_credentials/report-stream-valid-token.jwt") | ||
fi | ||
elif [ "$env" = "staging" ]; then | ||
host=cdcti-stg-api.azurewebsites.net | ||
url=https://$host:443 | ||
else | ||
echo "Error: Invalid environment $env" | ||
show_help | ||
exit 1 | ||
fi | ||
|
||
if [ -z "$jwt" ]; then | ||
echo "Error: Please provide the JWT for $client" | ||
exit 1 | ||
fi | ||
|
||
hurl \ | ||
--variable fpath=$fpath \ | ||
--file-root $root \ | ||
--variable url=$url \ | ||
--variable client=$client \ | ||
--variable jwt=$jwt \ | ||
$submission_id \ | ||
$verbose \ | ||
$hurl_file \ | ||
$@ |
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,13 @@ | ||
POST {{url}}/v1/auth/token | ||
Content-Type: application/x-www-form-urlencoded | ||
[FormParams] | ||
scope: {{client}} | ||
client_assertion: {{jwt}} | ||
|
||
HTTP 200 | ||
|
||
[Captures] | ||
token: jsonpath "$['access_token']" | ||
|
||
GET {{url}}/v1/etor/metadata/{{submissionid}} | ||
Authorization: Bearer {{token}} |
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 @@ | ||
GET {{url}}/openapi |
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,15 @@ | ||
POST {{url}}/v1/auth/token | ||
Content-Type: application/x-www-form-urlencoded | ||
[FormParams] | ||
scope: {{client}} | ||
client_assertion: {{jwt}} | ||
|
||
HTTP 200 | ||
|
||
[Captures] | ||
token: jsonpath "$['access_token']" | ||
|
||
POST {{url}}/v1/etor/orders | ||
Authorization: Bearer {{token}} | ||
RecordId: {{submissionid}} | ||
file,{{fpath}}; |
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,55 @@ | ||
# CDC Intermediary Hurl Script | ||
|
||
## Usage | ||
|
||
``` | ||
Usage: hrl <HURL_FILE> [OPTIONS] | ||
Options: | ||
-f <REL_PATH> The path to the hl7/fhir file to submit, relative the root path (Required for orders and results APIs) | ||
-r <ROOT_PATH> The root path to the hl7/fhir files (Default: $CDCTI_HOME/examples/Test/) | ||
-e [local | staging] The environment to run the test in (Default: local) | ||
-c <CLIENT> The client id to use (Default: report-stream) | ||
-j <JWT> The JWT to use for authentication | ||
-i <SUBMISSION_ID> The submissionId to call the metadata API with (Required for metadata API) | ||
-v Verbose mode | ||
-h Display this help and exit | ||
``` | ||
|
||
## Examples | ||
|
||
Submit an order to local environment: | ||
``` | ||
./hrl orders.hurl -f Orders/003_AL_ORM_O01_NBS_Fully_Populated_1_hl7_translation.fhir -i 100 | ||
``` | ||
|
||
Submit an order to staging: | ||
``` | ||
./hrl orders.hurl -f Orders/003_AL_ORM_O01_NBS_Fully_Populated_0_initial_message.hl7 -e staging -j eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ | ||
``` | ||
|
||
Submit a result to local environment: | ||
``` | ||
./hrl results.hurl -f Results/002_AL_ORU_R01_NBS_Fully_Populated_1_hl7_translation.fhir -i 100 | ||
``` | ||
|
||
Get metadata from local environment: | ||
``` | ||
./hrl metadata -i 100 | ||
``` | ||
|
||
Authenticate to local environment: | ||
``` | ||
./hrl auth.hurl | ||
``` | ||
|
||
Get OpenAPI docs from local environment: | ||
``` | ||
./hrl openapi.hurl | ||
``` | ||
|
||
Get Health info from local environment: | ||
``` | ||
./hrl health.hurl | ||
``` |
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,15 @@ | ||
POST {{url}}/v1/auth/token | ||
Content-Type: application/x-www-form-urlencoded | ||
[FormParams] | ||
scope: {{client}} | ||
client_assertion: {{jwt}} | ||
|
||
HTTP 200 | ||
|
||
[Captures] | ||
token: jsonpath "$['access_token']" | ||
|
||
POST {{url}}/v1/etor/results | ||
Authorization: Bearer {{token}} | ||
RecordId: {{submissionid}} | ||
file,{{fpath}}; |