Implement hasValue - #113
Open
FikriMilano wants to merge 5 commits into
Open
Conversation
LZRS
reviewed
Aug 7, 2026
| // primitive" - two items fail that, they do not error. | ||
| assertEquals( | ||
| listOf(false), | ||
| fhirPathEngine.evaluateExpression("(1 | 2).hasValue()", observation).toList(), |
Contributor
There was a problem hiding this comment.
Could it be that they evaluate to false since the 1 and 2 are treated as FhirPath literals? That would make this test vague, I think
Contributor
There was a problem hiding this comment.
Could you also add a test for a primitive with id and extension but no value?
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.
In FHIR, a primitive field can be present but empty: the element carries only an
idor anextensionand no actual value, e.g. agivenname whose content comes only from_given.hasValue()answers whether a single primitive element actually contains its value. (https://hl7.org/fhir/R4/fhirpath.html#functions)Everything else is false: an extension-only element, a complex type (the function only applies to primitives), and empty or multi-item input, following the spec wording "contains a single value which is a FHIR primitive".
Fixes testPeriodInvariantOld and testPrimitiveExtensions
Enable the conformance runner's input lookup to answer both xml and json, instead of just xml, testPrimitiveExtensions (and even other test cases) inputFile carries json instead of xml
Adds missing
patient-name-extensions.jsoninput fileSkips
testStartsWithNonString1,testEndsWithNonString1andtestContainsNonString1with reason: their input resource is also missing from the vendored copy, so they only passed because the missing-input crash satisfied their expected-error assertion. With the input present they need the engine to throw a singleton evaluation error for the non-string input (in their case, complex type), which it currently returns empty list.