Skip to content

Only expect multiple-or values from resources matching the search - #1

Open
smunini wants to merge 1 commit into
mainfrom
fix/multiple-or-search-base-params
Open

smunini wants to merge 1 commit into
mainfrom
fix/multiple-or-search-base-params

Conversation

@smunini

@smunini smunini commented Sep 20, 2026

Copy link
Copy Markdown

Summary

Fixes inferno-framework#43.

SearchTest#perform_multiple_or_search_test builds its request from params_list.first, but collects the values it expects back from every scratch resource for the patient. For a fixed value search with several values, the first value may have no data. The request is then constrained to that value while the expected values come from resources of other values, so the test fails against any conformant server.

With the example bundle, the Simple Observation patient + category + status test sends:

GET /Observation?category=sdoh&patient=usqualitycore-patient&status=registered,preliminary,final,amended,corrected,cancelled,entered-in-error,unknown

and expects final and cancelled, which it gathered from the activity Observations. No example Observation has category sdoh, so the correct response is an empty Bundle and the test fails with:

Could not find final,cancelled values from status in any of the resources returned for Patient/usqualitycore-patient

Change

  • Pick the first params in params_list that the patient's scratch resources actually match, ignoring the multiple-or params (they are replaced by the OR'd values) and the patient param.
  • Take the expected values only from those matching resources.
  • If no resources match any of the params, skip that patient, as the method already does for a patient with no multiple-or values.

With the example bundle the request becomes category=functional-status&patient=usqualitycore-patient&status=<all eight codes>, because functional-status is the first fixed category value the example patient has data for. The expected value final comes from Observation/usqualitycore-simple-observation, the one resource with that category, so the multiple-or search is still exercised. cancelled is no longer expected from it, because the cancelled example Observation is activity only.

Matching uses the existing resource_matches_param?, the same check check_resource_against_params applies to every search result.

Testing

Run in the Helios FHIR Server CI, which loads client-example-resources/us_quality_core_bundle_patient.json and runs the us_quality_core_v100_ballot suite with patient_ids = usqualitycore-patient. Results to follow in a comment.

perform_multiple_or_search_test built its request from params_list.first
but collected the values it expected back from every scratch resource
for the patient. For a fixed value search with several values, such as
the Simple Observation category search, the first value may have no
data. The request is then constrained to that value while the expected
values come from resources of other values, so the test fails against
any conformant server.

Against the example bundle the request was category=sdoh with every
status OR'd, and the test expected final and cancelled from the
activity Observations. No example Observation has category sdoh.

Use the first params that the patient's scratch resources match,
ignoring the multiple-or params that get replaced, and only expect
values from those resources.

Fixes inferno-framework#43
@smunini

smunini commented Sep 20, 2026

Copy link
Copy Markdown
Author

CI results

Run in the Helios FHIR Server CI: the server is loaded with client-example-resources/us_quality_core_bundle_patient.json, then the us_quality_core_v100_ballot suite runs with patient_ids = usqualitycore-patient (580 tests).

Test kit Result Run
v0.2.0 (41fc954) 578 pass / 1 skip / 1 fail, identical on 7 storage backends 35525950814
this branch (e8c3306) 579 pass / 1 skip / 0 fail 35529456523

The one failure on v0.2.0 is simple_observation_patient_category_status_search_test, with the message from issue 43. On this branch it passes and still performs the multiple-or search:

GET /Observation?category=functional-status&patient=usqualitycore-patient&status=registered,preliminary,final,amended,corrected,cancelled,entered-in-error,unknown  -> 200

No other test changed result. The remaining skip is the ADI documentation patient + category + date test, a separate example data gap addressed in #2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Simple Observation patient+category+status multiple-OR search test fails against the kit's own example bundle

1 participant