Repository navigation
Skip search expressions of a type the parameter does not allow - #2953
Merged
Merged
Conversation
A search parameter whose expressions include one of a type its parameter type does not allow, such as the SampledData alternative of value-quantity, failed outright. Such an expression is now skipped, and the search fails only when no expression of the parameter is of an allowed type.
Also name the Range values of context-quantity in the documentation of types that are not matched.
# Conflicts: # fhirpath/src/main/java/au/csiro/pathling/search/SearchColumnBuilder.java # site/docs/libraries/search.md
|
johngrimes
marked this pull request as ready for review
November 23, 2026 06:32
This was referenced Nov 24, 2026
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



This change fixes
Observation?value-quantity=..., which failed withFHIR type 'SampledData' is not valid for search parameter type 'QUANTITY'. The(Observation.value as SampledData)expression of the parameter was rejected, so the whole search failed even though theQuantityexpression is valid.The rule for an expression of a type that the search parameter type does not allow is now:
InvalidSearchParameterException, naming the parameter, the types found and the allowed types.For #2914 this means that a choice alternative of a type the parameter does not allow is skipped in the same way, once each alternative is evaluated as an expression of its own. With that change in place,
Observation.effectiveasTimingwould be skipped while thedateTime,instantandPeriodalternatives are searched. This change does not do that splitting:Observation?date=2020still fails withCannot determine FHIR type for expression: Observation.effective.I built a filter for every parameter in the bundled R4 registry to see what the rule changes. 30 parameters that failed now build a filter:
value-quantity,component-value-quantityandcombo-value-quantityon Observation (skippingSampledData), andcontext-quantityon 27 conformance resources (skippingRange). Onlyvalue-quantityis tested against data here. The other 29 return correct results when a resource has at most one component oruseContext, but fail withExpecting a collection with a single element but it has manywhen it has more. That is a separate defect, whichValueSet?context=...shows too without any skipped type. 147 parameters still fail because none of their expressions is of an allowed type, as they did before: composite and special parameters, reference parameters overcanonicaloruri, and quantity parameters overMoney,Age,DurationandAge | Range.Skipping is not the same as support. R4 defines quantity search against a
Range(https://hl7.org/fhir/R4/search.html#prefix), socontext-quantitynow ignores range values, in the same way that #2914 would ignoreTiming. The documentation for both the library and the server now states that elements of an unsupported type are not matched, naming these two cases.The tests cover
value-quantitythrough the default registry, including aSampledDatawhose origin and data carry the searched value, the order of the expressions, the failure when no expression is of an allowed type, and string search on a filteredHumanNameexpression, since the sub-fields are now evaluated within the collection that the expression selects.Resolves #2913.