Skip to content

Commit

Permalink
Merge pull request #554 from samply/release-v0.13.4
Browse files Browse the repository at this point in the history
Release v0.13.4
  • Loading branch information
alexanderkiel authored Nov 30, 2021
2 parents fd53506 + 43badb0 commit 18a66eb
Show file tree
Hide file tree
Showing 26 changed files with 191 additions and 64 deletions.
6 changes: 3 additions & 3 deletions .github/scripts/batch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
# This script creates a patient and tries to retrieve it through a batch request.
#

BASE="http://localhost:8080/fhir"
PATIENT_ID=$(curl -sH "Content-Type: application/fhir+json" \
-d '{"resourceType": "Patient"}' \
"http://localhost:8080/fhir/Patient" | jq -r .id)
"$BASE/Patient" | jq -r .id)

bundle() {
cat <<END
Expand All @@ -24,8 +25,7 @@ cat <<END
}
END
}
RESULT=$(curl -sH "Content-Type: application/fhir+json" -d "$(bundle)" \
"http://localhost:8080/fhir")
RESULT=$(curl -sH "Content-Type: application/fhir+json" -d "$(bundle)" "$BASE")

RESOURCE_TYPE="$(echo "$RESULT" | jq -r .resourceType)"
if [ "$RESOURCE_TYPE" = "Bundle" ]; then
Expand Down
51 changes: 51 additions & 0 deletions .github/scripts/conditional-create.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!/bin/bash -e

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

bundle() {
cat <<END
{
"resourceType": "Bundle",
"type": "transaction",
"entry": [
{
"fullUrl": "Organization/foo",
"resource": {
"resourceType": "Organization",
"identifier": [
{
"system": "https://example.com/fhir/NamingSystem/organization",
"value": "190723"
}
]
},
"request": {
"method": "POST",
"url": "Organization",
"ifNoneExist": "identifier=https://example.com/fhir/NamingSystem/organization|190723"
}
}
]
}
END
}

STATUS=$(curl -sH "Content-Type: application/fhir+json" \
-d "$(bundle)" "$BASE" | jq -r '.entry[].response.status')

if [ "$STATUS" = "201" ]; then
echo "OK: first atempt created the Organization"
else
echo "Fail: status was ${STATUS} but should be 201"
exit 1
fi

STATUS=$(curl -sH "Content-Type: application/fhir+json" \
-d "$(bundle)" "$BASE" | jq -r '.entry[].response.status')

if [ "$STATUS" = "200" ]; then
echo "OK: second atempt returned the already created Organization"
else
echo "Fail: status was ${STATUS} but should be 200"
exit 1
fi
9 changes: 5 additions & 4 deletions .github/scripts/delete.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
#!/bin/bash -e

BASE="http://localhost:8080/fhir"
PATIENT_ID=$(uuidgen | tr '[:upper:]' '[:lower:]')
curl -sfXDELETE "http://localhost:8080/fhir/Patient/$PATIENT_ID"
curl -sfXDELETE "$BASE/Patient/$PATIENT_ID"

PATIENT_HISTORY=$(curl -s "http://localhost:8080/fhir/Patient/$PATIENT_ID/_history")
PATIENT_HISTORY=$(curl -s "$BASE/Patient/$PATIENT_ID/_history")

TOTAL=$(echo "$PATIENT_HISTORY" | jq .total)
if [ "$TOTAL" = "1" ]; then
Expand All @@ -29,15 +30,15 @@ else
exit 1
fi

PATIENT_STATUS=$(curl -is "http://localhost:8080/fhir/Patient/$PATIENT_ID" | grep HTTP | tr -d '\r\n')
PATIENT_STATUS=$(curl -is "$BASE/Patient/$PATIENT_ID" | grep HTTP | tr -d '\r\n')
if [ "$PATIENT_STATUS" = "HTTP/1.1 410 Gone" ]; then
echo "OK: patient status is HTTP/1.1 410 Gone"
else
echo "Fail: patient status is $PATIENT_STATUS"
exit 1
fi

PATIENT_OUTCOME=$(curl -s "http://localhost:8080/fhir/Patient/$PATIENT_ID")
PATIENT_OUTCOME=$(curl -s "$BASE/Patient/$PATIENT_ID")

CODE=$(echo "$PATIENT_OUTCOME" | jq -r .issue[].code)
if [ "$CODE" = "deleted" ]; then
Expand Down
2 changes: 1 addition & 1 deletion .github/scripts/download-resources-query.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash -e

BASE=http://localhost:8080/fhir
BASE="http://localhost:8080/fhir"
TYPE=$1
QUERY=$2
EXPECTED_SIZE=$(curl -s "$BASE/$TYPE?$QUERY&_summary=count" | jq -r .total)
Expand Down
4 changes: 2 additions & 2 deletions .github/scripts/download-resources.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/bin/bash -e

BASE=http://localhost:8080/fhir
BASE="http://localhost:8080/fhir"
TYPE=$1
EXPECTED_SIZE=$(curl -s "${BASE}/${TYPE}?_summary=count" | jq -r .total)
EXPECTED_SIZE=$(curl -s "$BASE/${TYPE}?_summary=count" | jq -r .total)

FILE_NAME=$(uuidgen)
blazectl --server $BASE download "$TYPE" -o "$FILE_NAME".ndjson
Expand Down
15 changes: 8 additions & 7 deletions .github/scripts/evaluate-measure-subject-list.sh
Original file line number Diff line number Diff line change
Expand Up @@ -95,28 +95,29 @@ create-measure() {
}

post() {
curl -sH "Content-Type: application/fhir+json" -d @- "http://localhost:8080/fhir/$1"
curl -sH "Content-Type: application/fhir+json" -d @- "$1/$2"
}

evaluate-measure() {
parameters | curl -sH "Content-Type: application/fhir+json" -d @- "http://localhost:8080/fhir/Measure/$1/\$evaluate-measure"
parameters | curl -sH "Content-Type: application/fhir+json" -d @- "$1/Measure/$2/\$evaluate-measure"
}

fetch-patients() {
curl -s "http://localhost:8080/fhir/Patient?_list=$1&_count=100"
curl -s "$1/Patient?_list=$2&_count=100"
}

BASE="http://localhost:8080/fhir"
FILE=$1
EXPECTED_COUNT=$2

DATA=$(base64 "$FILE" | tr -d '\n')
LIBRARY_URI=$(uuidgen | tr '[:upper:]' '[:lower:]')
MEASURE_URI=$(uuidgen | tr '[:upper:]' '[:lower:]')

create-library "$LIBRARY_URI" "$DATA" | post "Library" > /dev/null
create-library "$LIBRARY_URI" "$DATA" | post "$BASE" "Library" > /dev/null

MEASURE_ID=$(create-measure "$MEASURE_URI" "$LIBRARY_URI" | post "Measure" | jq -r .id)
REPORT=$(evaluate-measure "$MEASURE_ID")
MEASURE_ID=$(create-measure "$MEASURE_URI" "$LIBRARY_URI" | post "$BASE" "Measure" | jq -r .id)
REPORT=$(evaluate-measure "$BASE" "$MEASURE_ID")
COUNT=$(echo "$REPORT" | jq -r ".group[0].population[0].count")

if [ "$COUNT" = "$EXPECTED_COUNT" ]; then
Expand All @@ -129,7 +130,7 @@ else
fi

LIST_ID=$(echo "$REPORT" | jq -r '.group[0].population[0].subjectResults.reference | split("/")[1]')
PATIENT_BUNDLE=$(fetch-patients "$LIST_ID")
PATIENT_BUNDLE=$(fetch-patients "$BASE" "$LIST_ID")
ID_COUNT=$(echo "$PATIENT_BUNDLE" | jq -r ".entry[].resource.id" | sort -u | wc -l | xargs | cut -d ' ' -f1)

if [ "$ID_COUNT" = "$EXPECTED_COUNT" ]; then
Expand Down
11 changes: 6 additions & 5 deletions .github/scripts/evaluate-measure.sh
Original file line number Diff line number Diff line change
Expand Up @@ -73,24 +73,25 @@ create-measure() {
}

post() {
curl -sH "Content-Type: application/fhir+json" -d @- "http://localhost:8080/fhir/$1"
curl -sH "Content-Type: application/fhir+json" -d @- "$1/$2"
}

evaluate-measure() {
curl -s "http://localhost:8080/fhir/Measure/$1/\$evaluate-measure?periodStart=2000&periodEnd=2030"
curl -s "$1/Measure/$2/\$evaluate-measure?periodStart=2000&periodEnd=2030"
}

BASE="http://localhost:8080/fhir"
FILE=$1
EXPECTED_COUNT=$2

DATA=$(base64 "$FILE" | tr -d '\n')
LIBRARY_URI=$(uuidgen | tr '[:upper:]' '[:lower:]')
MEASURE_URI=$(uuidgen | tr '[:upper:]' '[:lower:]')

create-library "$LIBRARY_URI" "$DATA" | post "Library" > /dev/null
create-library "$LIBRARY_URI" "$DATA" | post "$BASE" "Library" > /dev/null

MEASURE_ID=$(create-measure "$MEASURE_URI" "$LIBRARY_URI" | post "Measure" | jq -r .id)
REPORT=$(evaluate-measure "$MEASURE_ID")
MEASURE_ID=$(create-measure "$MEASURE_URI" "$LIBRARY_URI" | post "$BASE" "Measure" | jq -r .id)
REPORT=$(evaluate-measure "$BASE" "$MEASURE_ID")
COUNT=$(echo "$REPORT" | jq -r ".group[0].population[0].count")

if [ "$COUNT" = "$EXPECTED_COUNT" ]; then
Expand Down
17 changes: 9 additions & 8 deletions .github/scripts/evaluate-patient-q1-measure.sh
Original file line number Diff line number Diff line change
Expand Up @@ -68,33 +68,34 @@ create-measure() {
}

post() {
curl -sH "Content-Type: application/fhir+json" -d @- "http://localhost:8080/fhir/$1"
curl -sH "Content-Type: application/fhir+json" -d @- "$1/$2"
}

evaluate-measure() {
curl -s "http://localhost:8080/fhir/Measure/$1/\$evaluate-measure?periodStart=2000&periodEnd=2030&subject=$2"
curl -s "$1/Measure/$2/\$evaluate-measure?periodStart=2000&periodEnd=2030&subject=$3"
}

BASE="http://localhost:8080/fhir"
FILE="modules/operation-measure-evaluate-measure/test/blaze/fhir/operation/evaluate_measure/q1-query.cql"
DATA=$(base64 "$FILE" | tr -d '\n')
LIBRARY_URI=$(uuidgen | tr '[:upper:]' '[:lower:]')
MEASURE_URI=$(uuidgen | tr '[:upper:]' '[:lower:]')

create-library "$LIBRARY_URI" "$DATA" | post "Library" > /dev/null
create-library "$LIBRARY_URI" "$DATA" | post "$BASE" "Library" > /dev/null

MEASURE_ID=$(create-measure "$MEASURE_URI" "$LIBRARY_URI" | post "Measure" | jq -r .id)
MEASURE_ID=$(create-measure "$MEASURE_URI" "$LIBRARY_URI" | post "$BASE" "Measure" | jq -r .id)

MALE_PATIENT_ID=$(curl -s 'http://localhost:8080/fhir/Patient?gender=male&_count=1' | jq -r '.entry[].resource.id')
COUNT=$(evaluate-measure "$MEASURE_ID" "$MALE_PATIENT_ID" | jq -r ".group[0].population[0].count")
MALE_PATIENT_ID=$(curl -s "$BASE/Patient?gender=male&_count=1" | jq -r '.entry[].resource.id')
COUNT=$(evaluate-measure "$BASE" "$MEASURE_ID" "$MALE_PATIENT_ID" | jq -r ".group[0].population[0].count")
if [ "$COUNT" = "1" ]; then
echo "Success: count ($COUNT) equals the expected count"
else
echo "Fail: count ($COUNT) != 1"
exit 1
fi

FEMALE_PATIENT_ID=$(curl -s 'http://localhost:8080/fhir/Patient?gender=female&_count=1' | jq -r '.entry[].resource.id')
COUNT=$(evaluate-measure "$MEASURE_ID" "$FEMALE_PATIENT_ID" | jq -r ".group[0].population[0].count")
FEMALE_PATIENT_ID=$(curl -s "$BASE/Patient?gender=female&_count=1" | jq -r ".entry[].resource.id")
COUNT=$(evaluate-measure "$BASE" "$MEASURE_ID" "$FEMALE_PATIENT_ID" | jq -r ".group[0].population[0].count")
if [ "$COUNT" = "0" ]; then
echo "Success: count ($COUNT) equals the expected count"
else
Expand Down
12 changes: 6 additions & 6 deletions .github/scripts/revinclude.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#!/bin/bash -e

BASE=http://localhost:8080/fhir
EXPECTED_NUM_PATIENTS=$(curl -s "${BASE}/Patient?_summary=count" | jq -r .total)
EXPECTED_NUM_OBSERVATIONS=$(curl -s "${BASE}/Observation?_summary=count" | jq -r .total)
EXPECTED_NUM_CONDITIONS=$(curl -s "${BASE}/Condition?_summary=count" | jq -r .total)
EXPECTED_NUM_ENCOUNTERS=$(curl -s "${BASE}/Encounter?_summary=count" | jq -r .total)
EXPECTED_NUM_PROCEDURES=$(curl -s "${BASE}/Procedure?_summary=count" | jq -r .total)
BASE="http://localhost:8080/fhir"
EXPECTED_NUM_PATIENTS=$(curl -s "$BASE/Patient?_summary=count" | jq -r .total)
EXPECTED_NUM_OBSERVATIONS=$(curl -s "$BASE/Observation?_summary=count" | jq -r .total)
EXPECTED_NUM_CONDITIONS=$(curl -s "$BASE/Condition?_summary=count" | jq -r .total)
EXPECTED_NUM_ENCOUNTERS=$(curl -s "$BASE/Encounter?_summary=count" | jq -r .total)
EXPECTED_NUM_PROCEDURES=$(curl -s "$BASE/Procedure?_summary=count" | jq -r .total)

blazectl --server $BASE download Patient -q '_revinclude=Observation:subject&_revinclude=Condition:subject&_revinclude=Procedure:subject&_revinclude=Encounter:subject' -o output.ndjson

Expand Down
2 changes: 1 addition & 1 deletion .github/scripts/search-compartment.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash -e

BASE=http://localhost:8080/fhir
BASE="http://localhost:8080/fhir"
PATIENT_ID=$(curl -s "$BASE/Patient?identifier=http://hl7.org/fhir/sid/us-ssn|999-82-5655" | jq -r '.entry[].resource.id')
OBSERVATION_COUNT=$(curl -s "$BASE/Patient/$PATIENT_ID/Observation?_summary=count" | jq .total)

Expand Down
2 changes: 1 addition & 1 deletion .github/scripts/search-observation-profile.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash -e

BASE=http://localhost:8080/fhir
BASE="http://localhost:8080/fhir"
LAB_COUNT=$(curl -s "$BASE/Observation?_profile=http://hl7.org/fhir/us/core/StructureDefinition/us-core-observation-lab&_summary=count" | jq -r .total)

if [ "$LAB_COUNT" = "27218" ]; then
Expand Down
4 changes: 2 additions & 2 deletions .github/scripts/search-patient-last-updated.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
# The script assumes that Blaze contains at least some patients that were
# imported before this script runs.

BASE=http://localhost:8080/fhir
BASE="http://localhost:8080/fhir"
NOW=$(date +%Y-%m-%dT%H:%M:%S)
PATIENT_COUNT=$(curl -sH 'Prefer: handling=strict' "${BASE}/Patient?_lastUpdated=gt$NOW&_summary=count" | jq -r .total)
PATIENT_COUNT=$(curl -sH 'Prefer: handling=strict' "$BASE/Patient?_lastUpdated=gt$NOW&_summary=count" | jq -r .total)

if [ $PATIENT_COUNT -eq 0 ]; then
echo "Success: no patents are updated after $NOW"
Expand Down
4 changes: 2 additions & 2 deletions .github/scripts/transaction-rw.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
# This script creates and reads a patient in a single transaction.
#

BASE="http://localhost:8080/fhir"
PATIENT_ID="e42a47bb-a371-4cf5-9f17-51e59c1f612a"

bundle() {
Expand Down Expand Up @@ -32,8 +33,7 @@ cat <<END
}
END
}
RESULT=$(curl -sH "Content-Type: application/fhir+json" -d "$(bundle)" \
"http://localhost:8080/fhir")
RESULT=$(curl -sH "Content-Type: application/fhir+json" -d "$(bundle)" "$BASE")

RESOURCE_TYPE="$(echo "$RESULT" | jq -r .resourceType)"
if [ "$RESOURCE_TYPE" = "Bundle" ]; then
Expand Down
7 changes: 3 additions & 4 deletions .github/scripts/transaction.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
# request.
#

BASE="http://localhost:8080/fhir"
PATIENT_ID=$(curl -sH "Content-Type: application/fhir+json" \
-d '{"resourceType": "Patient"}' \
"http://localhost:8080/fhir/Patient" | jq -r .id)
-d '{"resourceType": "Patient"}' "$BASE/Patient" | jq -r .id)

bundle() {
cat <<END
Expand All @@ -25,8 +25,7 @@ cat <<END
}
END
}
RESULT=$(curl -sH "Content-Type: application/fhir+json" -d "$(bundle)" \
"http://localhost:8080/fhir")
RESULT=$(curl -sH "Content-Type: application/fhir+json" -d "$(bundle)" "$BASE")

RESOURCE_TYPE="$(echo "$RESULT" | jq -r .resourceType)"
if [ "$RESOURCE_TYPE" = "Bundle" ]; then
Expand Down
12 changes: 12 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,12 @@ jobs:
- name: OPTIONS
run: curl -f -XOPTIONS http://localhost:8080/fhir/metadata

- name: Health
run: curl -f http://localhost:8080/health

- name: Health - HEAD
run: curl -f --head http://localhost:8080/health

- name: Prometheus Metrics
run: curl -f http://localhost:8081/metrics

Expand Down Expand Up @@ -718,6 +724,12 @@ jobs:
- name: OPTIONS
run: curl -f -XOPTIONS http://localhost:8080/fhir/metadata

- name: Health
run: curl -f http://localhost:8080/health

- name: Health - HEAD
run: curl -f --head http://localhost:8080/health

- name: Prometheus Metrics - Blaze 1
run: curl -f http://localhost:8081/metrics

Expand Down
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## v0.13.4

### Bugfixes

* Fix Health Handler ([#553](https://github.com/samply/blaze/pull/553))

The full changelog can be found [here](https://github.com/samply/blaze/milestone/19?closed=1).

## v0.13.3

### Bugfixes
Expand Down
4 changes: 2 additions & 2 deletions docs/deployment/docker-deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Blaze should log something like this:
2021-06-27T11:02:37.834Z ee086ef908c1 main INFO [blaze.core:64] - JVM version: 16.0.2
2021-06-27T11:02:37.834Z ee086ef908c1 main INFO [blaze.core:65] - Maximum available memory: 1738 MiB
2021-06-27T11:02:37.835Z ee086ef908c1 main INFO [blaze.core:66] - Number of available processors: 8
2021-06-27T11:02:37.836Z ee086ef908c1 main INFO [blaze.core:67] - Successfully started Blaze version 0.13.3 in 8.2 seconds
2021-06-27T11:02:37.836Z ee086ef908c1 main INFO [blaze.core:67] - Successfully started Blaze version 0.13.4 in 8.2 seconds
```

In order to test connectivity, query the health endpoint:
Expand All @@ -47,7 +47,7 @@ that should return:
```json
{
"name": "Blaze",
"version": "0.13.3"
"version": "0.13.4"
}
```

Expand Down
Loading

0 comments on commit 18a66eb

Please sign in to comment.