An Inferno test kit that checks
how a FHIR R4 server evaluates _include and _revinclude, with and without
:iterate, when a _revinclude already added other resources to the result.
It uses only base FHIR R4 resources and search parameters: Task code,
Task part-of, Task focus and Consent data. It does not use a
profile, an extension or an IG.
The Docker Compose file also starts HAPI FHIR and Aidbox, and the test kit has a preset for each.
lib/include_order_test_kit/fixtures/bundle.json is a transaction Bundle.
Each entry uses PUT with a fixed id, so the suite can load it again without
duplicates.
| Resource | id | Notes |
|---|---|---|
| Patient | repro-patient |
Synthetic |
| Organization | repro-lab |
Synthetic |
| ServiceRequest | repro-sr-1, repro-sr-2 |
One order with two tests |
| Task | repro-group |
code = urn:repro:task-kind#order-group. It has no focus |
| Task | repro-item-1, repro-item-2 |
code = urn:repro:task-kind#order-item. partOf = repro-group. focus = repro-sr-1 / repro-sr-2 |
| Consent | repro-consent |
provision.data.reference = ServiceRequest/repro-sr-1 |
The chain is: group Task ← item Task (partOf) → ServiceRequest (focus) ← Consent (provision.data).
| Group | Query | Expected | Required |
|---|---|---|---|
| 1. Test data | POST [base] with the transaction, then read each resource |
200 | yes |
| 2. Control | C: Task?part-of=Task/repro-group&_include=Task:part-of&_include=Task:focus&_revinclude:iterate=Consent:data:ServiceRequest |
6 resources, with the Consent | yes |
3. Without :iterate |
A: Task?code=…order-group&_revinclude=Task:part-of&_include=Task:focus&_revinclude:iterate=Consent:data:ServiceRequest |
3 resources: group Task, 2 item Tasks | yes |
E: Task?code=…order-group&_revinclude=Task:part-of&_include:iterate=Task:focus&_revinclude=Consent:data:ServiceRequest |
5 resources, no Consent | yes | |
4. Several :iterate |
B: Task?code=…order-group&_revinclude=Task:part-of&_include:iterate=Task:focus&_revinclude:iterate=Consent:data:ServiceRequest |
6 resources, with the Consent | yes |
D: B + _include:iterate=Consent:patient |
7 resources, with the Patient | yes |
- Group 2 does not depend on the evaluation order. If it fails, the server does not support a search parameter that the other groups need, and the other results do not mean anything.
- Group 3 checks the FHIR rule:
_includeand_revincludewithout:iterateapply only to the matched resources. Query A checks_includeafter_revinclude. Query E checks_revincludeafter_include:iterate. - Group 4 checks that the server repeats all
:iterateparameters together until it finds nothing new. FHIR does not define the order in which a server evaluates several:iterateparameters; this test kit requires it, because otherwise a client cannot get the whole chain in one search.
Run with this test kit on 2026-12-01.
| Server | C | A | E | B | D |
|---|---|---|---|---|---|
HAPI FHIR 8.6.0 (v8.6.0-1) |
pass (6) | fail (6) | pass (5) | fail (5, no Consent) | fail (5) |
HAPI FHIR 9.0.0 (v9.0.0-1) |
pass (6) | pass (3) | pass (5) | fail (5, no Consent) | fail (5) |
Aidbox 2609.5, BOX_FHIR_SEARCH_INCLUDE_CONFORMANT=true |
pass (6) | pass (3) | pass (5) | pass (6) | pass (7) |
- HAPI FHIR 8.6.0 applies
_includeto the resources that_revincludeadded (query A). HAPI FHIR 9.0.0 follows the FHIR rule. - On every HAPI version tested,
_revinclude:iterateruns before_include:iterate, one time each, so queries B and D lose the Consent. - Aidbox repeats all
:iterateparameters until it finds nothing new, so query B is enough to fix query A there. A query that must work on both servers should match the item Tasks directly, like query C.
./setup.sh # pull images, build Inferno, migrate the database
docker compose up -d # Inferno, HAPI FHIR, Aidbox| Service | From the host | From Inferno (inside compose) |
|---|---|---|
| Inferno | http://localhost | |
| HAPI FHIR | http://localhost:8090/fhir | http://hapi:8080/fhir |
| Aidbox | http://localhost:8888/fhir (root:secret) |
http://aidbox:8080/fhir |
Open http://localhost, choose the test suite, then choose the HAPI FHIR (docker compose) or Aidbox (docker compose) preset and run it.
Aidbox needs a license. Use one of these:
- Copy
.env.aidbox.exampleto.env.aidboxand setAIDBOX_LICENSE..env.aidboxis in.gitignore. - Or open http://localhost:8888 once and activate Aidbox in the browser.
| Variable | Default | Use |
|---|---|---|
HAPI_TAG |
v9.0.0-1 |
hapiproject/hapi image tag, for example HAPI_TAG=v8.6.0-1 |
AIDBOX_TAG |
stable |
healthsamurai/aidboxone image tag |
AIDBOX_INCLUDE_CONFORMANT |
true |
Aidbox BOX_FHIR_SEARCH_INCLUDE_CONFORMANT |
HAPI_TAG=v8.6.0-1 docker compose up -d hapiHAPI uses an in-memory database, so it loses the data when it restarts. The suite loads the data again on each run.
Start only the background services and the servers, then run Inferno from
source. The presets then use localhost URLs from .env.development.
bundle install
bundle exec inferno services start
docker compose -f docker-compose.servers.yml up -d
bundle exec inferno migrate
bundle exec inferno start # http://localhost:4567Create a session without a preset and enter:
- FHIR Server Base URL
- Authorization header (optional), for example
Basic cm9vdDpzZWNyZXQ=orBearer <token> - Load test data: No if the data is already on the server
for r in Consent/repro-consent Task/repro-item-1 Task/repro-item-2 Task/repro-group \
ServiceRequest/repro-sr-1 ServiceRequest/repro-sr-2 Organization/repro-lab Patient/repro-patient; do
curl -s -X DELETE "$BASE/$r"; donebundle exec rspec
bundle exec rubocopApache 2.0. See LICENSE.