feat: Support FHIRPath type() reflection function#2578
Open
piotrszul wants to merge 7 commits intorelease/9.6.0from
Open
feat: Support FHIRPath type() reflection function#2578piotrszul wants to merge 7 commits intorelease/9.6.0from
piotrszul wants to merge 7 commits intorelease/9.6.0from
Conversation
Add the type() function per the CI build FHIRPath specification, returning TypeInfo structures with namespace, name, and baseType fields. The function correctly distinguishes System types (literals and operation results) from FHIR types (path-navigated elements), including proper handling of Quantity and Coding which exist in both namespaces. Also fix string concatenation operator (+) on StringCollection to produce System.String rather than preserving the FHIR type context. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Consolidate type reflection data and logic into a dedicated TypeInfo class alongside TypeSpecifier. Moves TYPE_INFO_DEFINITION from Collection, eliminates raw namespace string literals, and simplifies TypeFunctions.type() to a thin delegate. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Replace repeated string concatenations with named constants for base type specifiers. Use Optional.filter() instead of isPresent()/get() to follow project functional style guidelines. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Proposal, design, specs, and tasks for implementing per-row runtime type resolution in the FHIRPath type() function for choice fields. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
The FHIRPath type() function now resolves the concrete type per row for polymorphic choice elements (e.g., Observation.component.value[x]), using a CASE WHEN chain that inspects which field is non-null. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Introduces TypeInfoExpectation marker class enabling single-assertion comparison of type() results instead of checking namespace, name, and baseType individually. Refactors TypeFunctionsDslTest to use the new toTypeInfo() format. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Verifies that backbone elements like Patient.contact return FHIR.BackboneElement as type name, consistent with the reference implementation. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
|
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.



Summary
Implements the FHIRPath
type()reflection function based on the CI build FHIRPath specification, which defines a simplified reflection model usingSimpleTypeInfoandClassInfosubtypes withnamespace,name, andbaseTypefields.TypeInfoclass for bothSimpleTypeInfoandClassInfo, since the CI spec defines identical fields for both (namespace,name,baseType). The spec notes: "Although the SimpleTypeInfo and ClassInfo appear the same here, implementations may have additional information." If a future spec revision adds distinguishing fields, the implementation can be split at that point.System.Any(System primitives),FHIR.Element(FHIR data types and backbone elements), andFHIR.Resource(FHIR resources)type()calls, and composition with other FHIRPath functionsTypeInfoExpectationDSL test helper for concise TypeInfo assertions usingtoTypeInfo("Namespace.Name(BaseType)")formatCloses #2395
Test plan
ofType()/where()FhirViewShareableComplianceTest)🤖 Generated with Claude Code