-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
72 changed files
with
2,343 additions
and
683 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
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,22 @@ | ||
#!/bin/bash -e | ||
|
||
SCRIPT_DIR="$(dirname "$(readlink -f "$0")")" | ||
|
||
"$SCRIPT_DIR/compact.sh" index search-param-value-index | ||
"$SCRIPT_DIR/compact.sh" index resource-value-index | ||
"$SCRIPT_DIR/compact.sh" index compartment-search-param-value-index | ||
"$SCRIPT_DIR/compact.sh" index compartment-resource-type-index | ||
"$SCRIPT_DIR/compact.sh" index active-search-params | ||
"$SCRIPT_DIR/compact.sh" index tx-success-index | ||
"$SCRIPT_DIR/compact.sh" index tx-error-index | ||
"$SCRIPT_DIR/compact.sh" index t-by-instant-index | ||
"$SCRIPT_DIR/compact.sh" index resource-as-of-index | ||
"$SCRIPT_DIR/compact.sh" index type-as-of-index | ||
"$SCRIPT_DIR/compact.sh" index system-as-of-index | ||
"$SCRIPT_DIR/compact.sh" index patient-last-change-index | ||
"$SCRIPT_DIR/compact.sh" index type-stats-index | ||
"$SCRIPT_DIR/compact.sh" index system-stats-index | ||
"$SCRIPT_DIR/compact.sh" index cql-bloom-filter | ||
"$SCRIPT_DIR/compact.sh" index cql-bloom-filter-by-t | ||
"$SCRIPT_DIR/compact.sh" transaction default | ||
"$SCRIPT_DIR/compact.sh" resource default |
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,47 @@ | ||
#!/bin/bash -e | ||
|
||
SCRIPT_DIR="$(dirname "$(readlink -f "$0")")" | ||
. "$SCRIPT_DIR/util.sh" | ||
|
||
START_EPOCH="$(date +"%s")" | ||
|
||
eclipsed() { | ||
EPOCH="$(date +"%s")" | ||
echo $((EPOCH - START_EPOCH)) | ||
} | ||
|
||
BASE="http://localhost:8080/fhir" | ||
|
||
parameters() { | ||
cat <<END | ||
{ | ||
"resourceType": "Parameters", | ||
"parameter": [ | ||
{ | ||
"name": "database", | ||
"valueCode": "foo" | ||
}, | ||
{ | ||
"name": "column-family", | ||
"valueCode": "bar" | ||
} | ||
] | ||
} | ||
END | ||
} | ||
|
||
HEADERS="$(curl -sfH 'Accept: application/fhir+json' -H 'Content-Type: application/fhir+json' -d "$(parameters)" -o /dev/null -D - "$BASE/\$compact")" | ||
STATUS_URL=$(echo "$HEADERS" | grep -i content-location | tr -d '\r' | cut -d: -f2- | xargs) | ||
|
||
# wait for response available | ||
while [[ ($(eclipsed) -lt 120) && ("$(curl -s -o /dev/null -w '%{response_code}' "$STATUS_URL")" != "200") ]]; do | ||
sleep 1 | ||
done | ||
|
||
BUNDLE=$(curl -sH 'Accept: application/fhir+json' "$STATUS_URL") | ||
|
||
test "bundle type" "$(echo "$BUNDLE" | jq -r '.type')" "batch-response" | ||
test "response status" "$(echo "$BUNDLE" | jq -r '.entry[0].response.status')" "400" | ||
test "response severity" "$(echo "$BUNDLE" | jq -r '.entry[0].response.outcome.issue[0].severity')" "error" | ||
test "response code" "$(echo "$BUNDLE" | jq -r '.entry[0].response.outcome.issue[0].code')" "invalid" | ||
test "response diagnostics" "$(echo "$BUNDLE" | jq -r '.entry[0].response.outcome.issue[0].diagnostics')" "Unknown database \`foo\`." |
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,93 @@ | ||
#!/bin/bash -e | ||
|
||
SCRIPT_DIR="$(dirname "$(readlink -f "$0")")" | ||
. "$SCRIPT_DIR/util.sh" | ||
|
||
if [[ "$OSTYPE" == "darwin"* ]]; then | ||
DATE_CMD="gdate" | ||
else | ||
DATE_CMD="date" | ||
fi | ||
|
||
START_EPOCH="$(date +"%s")" | ||
|
||
eclipsed() { | ||
EPOCH="$(date +"%s")" | ||
echo $((EPOCH - START_EPOCH)) | ||
} | ||
|
||
BASE="http://localhost:8080/fhir" | ||
|
||
DATABASE="$1" | ||
COLUMN_FAMILY="$2" | ||
|
||
parameters() { | ||
cat <<END | ||
{ | ||
"resourceType": "Parameters", | ||
"parameter": [ | ||
{ | ||
"name": "database", | ||
"valueCode": "$DATABASE" | ||
}, | ||
{ | ||
"name": "column-family", | ||
"valueCode": "$COLUMN_FAMILY" | ||
} | ||
] | ||
} | ||
END | ||
} | ||
|
||
NOW_EPOCH_SECONDS=$($DATE_CMD +%s) | ||
HEADERS="$(curl -sfH 'Accept: application/fhir+json' -H 'Content-Type: application/fhir+json' -d "$(parameters)" -o /dev/null -D - "$BASE/\$compact")" | ||
STATUS_URL=$(echo "$HEADERS" | grep -i content-location | tr -d '\r' | cut -d: -f2- | xargs) | ||
|
||
# wait for response available | ||
while [[ ($(eclipsed) -lt 120) && ("$(curl -s -o /dev/null -w '%{response_code}' "$STATUS_URL")" != "200") ]]; do | ||
sleep 1 | ||
done | ||
|
||
JOB_ID=$(echo "$STATUS_URL" | cut -d '/' -f6) | ||
JOB=$(curl -s -H 'Accept: application/fhir+json' "$BASE/__admin/Task/$JOB_ID") | ||
|
||
test "profile URL" "$(echo "$JOB" | jq -r '.meta.profile[]')" "https://samply.github.io/blaze/fhir/StructureDefinition/CompactJob" | ||
test "status" "$(echo "$JOB" | jq -r '.status')" "completed" | ||
|
||
AUTHORED_ON_ISO=$(echo "$JOB" | jq -r '.authoredOn') | ||
AUTHORED_ON_EPOCH_SECONDS=$($DATE_CMD -d "$AUTHORED_ON_ISO" +%s) | ||
if ((NOW_EPOCH_SECONDS - AUTHORED_ON_EPOCH_SECONDS < 10)); then | ||
echo "✅ the authoredOn dateTime is set and current" | ||
else | ||
echo "🆘 the authoredOn dateTime is $AUTHORED_ON_ISO, but should be a current dateTime" | ||
exit 1 | ||
fi | ||
|
||
PARAMETER_URI="https://samply.github.io/blaze/fhir/CodeSystem/CompactJobParameter" | ||
|
||
input_expr() { | ||
echo ".input[] | select(.type.coding[] | select(.system == \"$PARAMETER_URI\" and .code == \"$1\"))" | ||
} | ||
|
||
test "database" "$(echo "$JOB" | jq -r "$(input_expr "database") | .valueCode")" "$DATABASE" | ||
test "column-family" "$(echo "$JOB" | jq -r "$(input_expr "column-family") | .valueCode")" "$COLUMN_FAMILY" | ||
|
||
OUTPUT_URI="https://samply.github.io/blaze/fhir/CodeSystem/CompactJobOutput" | ||
|
||
output_expr() { | ||
echo ".output[] | select(.type.coding[] | select(.system == \"$OUTPUT_URI\" and .code == \"$1\"))" | ||
} | ||
|
||
PROCESSING_DURATION="$(echo "$JOB" | jq "$(output_expr "processing-duration") | .valueQuantity")" | ||
test "processing-duration unit system" "$(echo "$PROCESSING_DURATION" | jq -r .system)" "http://unitsofmeasure.org" | ||
test "processing-duration unit code" "$(echo "$PROCESSING_DURATION" | jq -r .code)" "s" | ||
|
||
# History | ||
JOB_HISTORY=$(curl -s -H 'Accept: application/fhir+json' "$BASE/__admin/Task/$JOB_ID/_history") | ||
|
||
test "history resource type" "$(echo "$JOB_HISTORY" | jq -r '.resourceType')" "Bundle" | ||
test "history bundle type" "$(echo "$JOB_HISTORY" | jq -r '.type')" "history" | ||
test "history total" "$(echo "$JOB_HISTORY" | jq -r '.total')" "3" | ||
test "history 0 status" "$(echo "$JOB_HISTORY" | jq -r '.entry[0].resource.status')" "completed" | ||
test "history 1 status" "$(echo "$JOB_HISTORY" | jq -r '.entry[1].resource.status')" "in-progress" | ||
test "history 2 status" "$(echo "$JOB_HISTORY" | jq -r '.entry[2].resource.status')" "ready" |
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
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
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,40 @@ | ||
# Operation \$compact | ||
|
||
> [!NOTE] | ||
> The system level \$compact operation is only activated if the [Admin API](./admin.md) is activated. | ||
The system level \$compact operation is used to compact column families of RocksDB databases. RockDB compaction is done automatically but in certain situations manual compaction can be useful. | ||
|
||
``` | ||
POST [base]/$compact | ||
``` | ||
|
||
## Parameters | ||
|
||
| Use | Name | Cardinality | Type | Documentation | | ||
|-----|---------------|-------------|------|------------------------------------------------------------------------| | ||
| IN | database | 1..1 | code | One of three possible databases: `index`, `transaction` and `resource` | | ||
| IN | column-family | 1..1 | code | Name of the column family depending on the database. See below. | | ||
|
||
### Column Families | ||
|
||
| Database | Column Family | | ||
|-------------|--------------------------------------| | ||
| index | search-param-value-index | | ||
| index | resource-value-index | | ||
| index | compartment-search-param-value-index | | ||
| index | compartment-resource-type-index | | ||
| index | active-search-params | | ||
| index | tx-success-index | | ||
| index | tx-error-index | | ||
| index | t-by-instant-index | | ||
| index | resource-as-of-index | | ||
| index | type-as-of-index | | ||
| index | system-as-of-index | | ||
| index | patient-last-change-index | | ||
| index | type-stats-index | | ||
| index | system-stats-index | | ||
| index | cql-bloom-filter | | ||
| index | cql-bloom-filter-by-t | | ||
| transaction | default | | ||
| resource | default | |
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,27 @@ | ||
CodeSystem: ColumnFamily | ||
Id: ColumnFamily | ||
Title: "Column Family" | ||
* ^status = #active | ||
* #default | ||
* #search-param-value-index | ||
* #resource-value-index | ||
* #compartment-search-param-value-index | ||
* #compartment-resource-type-index | ||
* #active-search-params | ||
* #tx-success-index | ||
* #tx-error-index | ||
* #t-by-instant-index | ||
* #resource-as-of-index | ||
* #type-as-of-index | ||
* #system-as-of-index | ||
* #patient-last-change-index | ||
* #type-stats-index | ||
* #system-stats-index | ||
* #cql-bloom-filter | ||
* #cql-bloom-filter-by-t | ||
|
||
ValueSet: ColumnFamily | ||
Id: ColumnFamily | ||
Title: "Column Family Value Set" | ||
* ^status = #active | ||
* include codes from system ColumnFamily |
Oops, something went wrong.