-
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.
Ensure History Changes only if Resource Changes
This change introduces a new transaction command called "keep" that just means: "Keep the resource of it is not changed in between." Unlike "put", "keep" will not introduce a new history entry. The command "keep" is always conditional because the detection of no changes will be done outside of the transaction. Closes: #777
- Loading branch information
1 parent
d5e17ff
commit ceac9d2
Showing
73 changed files
with
2,077 additions
and
679 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#!/bin/bash -e | ||
|
||
# | ||
# This script tests that an update without changes of the resource content | ||
# doesn't create a new history entry. | ||
# | ||
|
||
SCRIPT_DIR="$(dirname "$(readlink -f "$0")")" | ||
. "$SCRIPT_DIR/util.sh" | ||
|
||
bundle() { | ||
cat <<END | ||
{ | ||
"resourceType": "Bundle", | ||
"type": "transaction", | ||
"entry": [ | ||
{ | ||
"resource": $1, | ||
"request": { | ||
"method": "PUT", | ||
"url": "Patient/$2" | ||
} | ||
} | ||
] | ||
} | ||
END | ||
} | ||
|
||
BASE="http://localhost:8080/fhir" | ||
PATIENT_IDENTIFIER="X79746011X" | ||
PATIENT=$(curl -sH "Accept: application/fhir+json" "$BASE/Patient?identifier=$PATIENT_IDENTIFIER" | jq -cM '.entry[0].resource') | ||
ID="$(echo "$PATIENT" | jq -r .id)" | ||
VERSION_ID="$(echo "$PATIENT" | jq -r .meta.versionId)" | ||
|
||
# Update Interaction | ||
RESULT=$(curl -sXPUT -H "Content-Type: application/fhir+json" -d "$PATIENT" "$BASE/Patient/$ID") | ||
RESULT_VERSION_ID="$(echo "$RESULT" | jq -r .meta.versionId)" | ||
|
||
test "update versionId" "$RESULT_VERSION_ID" "$VERSION_ID" | ||
|
||
# Transaction Interaction | ||
RESULT=$(curl -sH "Content-Type: application/fhir+json" -H "Prefer: return=representation" -d "$(bundle "$PATIENT" "$ID")" "$BASE") | ||
RESULT_VERSION_ID="$(echo "$RESULT" | jq -r '.entry[0].resource.meta.versionId')" | ||
|
||
test "transaction versionId" "$RESULT_VERSION_ID" "$VERSION_ID" | ||
|
||
HISTORY_TOTAL=$(curl -sH "Accept: application/fhir+json" "$BASE/Patient/$ID/_history" | jq -r '.total') | ||
|
||
test "history total" "$HISTORY_TOTAL" "1" |
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 |
---|---|---|
|
@@ -2,5 +2,4 @@ target | |
classes | ||
.cpcache | ||
.cache | ||
blaze-load-tests/node_modules | ||
.nrepl-port |
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
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
Oops, something went wrong.