Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarify that Include Ignores Dead Links #2197

Merged
merged 1 commit into from
Nov 19, 2024
Merged
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
13 changes: 11 additions & 2 deletions .github/scripts/include-without-referential-integrity.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,22 @@
#!/bin/bash -e

# This test creates two observations both referencing different patients where
# only one of the patients exists.
#
# An observation query including the subjects of the observations is executed.
# The expected result contains both observations and the single patient. It's
# important that the dead reference doesn't result in an error. It is just
# ignored.

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

curl -sXPUT -d '{"resourceType": "Observation", "id": "0", "subject": {"reference": "Patient/0"}}' -H 'Content-Type: application/fhir+json' "$BASE/Observation/0" > /dev/null
curl -sXPUT -d '{"resourceType": "Observation", "id": "1", "subject": {"reference": "Patient/1"}}' -H 'Content-Type: application/fhir+json' "$BASE/Observation/1" > /dev/null
curl -sXPUT -d '{"resourceType" : "Patient", "id": "0"}' -H 'Content-Type: application/fhir+json' "$BASE/Patient/0" > /dev/null

RESULT=$(curl -s "$BASE/Observation?_include=Observation:subject" | jq -r '.entry[].search.mode' | tr '\n' '|')
RESULT=$(curl -s "$BASE/Observation?_include=Observation:subject" | jq -r '[.entry[].search.mode] | join(",")')

if [ "$RESULT" = "match|include|" ]; then
if [ "$RESULT" = "match,match,include" ]; then
echo "✅ include works"
else
echo "🆘 include doesn't work"
Expand Down