ID 61: Replace FHIRPath-based bundle reference traversal with core fhir_navigation handling#68
Open
abhinandan2012 wants to merge 1 commit into
Conversation
… use FHIRResourceNavigation and refined request type checks
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
Replaces the FHIRPath-based bundle reference traversal in PAS bundle validation with the shared
FHIRResourceNavigationmodule from Inferno core.This refactor removes the dependency on
evaluate_fhirpath(an external HTTP call to a FHIRPath server) and switches the traversal flow to metadata-driven in-process navigation usingresolve_path. Extension slice references are now resolved automatically through extracted profile metadata, removing the need for manual FHIRPath workarounds.Changes
Navigation Module (
pas_bundle_validation.rb)Adds
ReferenceNavigationContextwrapper class that includesInferno::DSL::FHIRResourceNavigationwithmetadataaccessible.Replaces
evaluate_fhirpathinprocess_reference_elementwithreference_values_for_elementwhich usesresolve_pathfrom the navigation module. The new approach:FHIR::Referenceobjects directly instead of JSON hashesvalue[x]choice types nativelyAdds
profile_metadataparameter toprocess_reference_elementso the navigation context has access tomust_supports[:extensions]for automatic extension URL resolution.Adds supporting navigation methods:
reference_values_for_element— resolves references using the navigation module, filters toFHIR::Referenceobjects with a present reference, and returns their reference strings.navigation_path_for_reference— orchestrates path conversion from metadata format to navigation-compatible format.resource_relative_reference_path— strips resource type prefix from paths (e.g.Claim.patient→patient) sinceresolve_pathstarts from the resource itself.navigation_compatible_reference_path— processes each path segment and converts extension slice notation towhere(url='...')syntax.normalized_reference_path_segment— converts extension slice segments likeextension:encountertoextension.where(url='http://...')by looking up the URL frommust_supports[:extensions]in the profile metadata.extension_url_for_reference_path— looks up extension URL from profile metadatamust_supports[:extensions].extension_url_without_version— strips version suffix from profile URLs before use in navigation paths.reference_navigation_context— factory method forReferenceNavigationContext.Removes manual
Claim.extension:encounterFHIRPath workaround fromhandle_claim_profile. The navigation module now resolves this automatically:handle_claim_profilerequestedService path to usevalue[x]suffix for compatibility with the navigation module's choice type handling:The navigation module normalizes this to:
Operation Type Helpers
Adds
submit_operation?,inquire_operation?, andrequest_operationhelper methods to replace direct string comparisons of
request_type.Fixes a bug where
request_type == 'submit'comparisons weresilently failing because
request_typeis a compound string likesubmit_request— not justsubmit. This caused incorrect validationpath selection and resources falling through to US Core profiles
incorrectly. The new helpers correctly extract the operation type:
Behavior Changes
Before
Claim.extension:encountertraversal required a manual FHIRPath workaround inhandle_claim_profile.request_type == 'submit'comparisons were silently failing for compound request type strings.After
Encounter/SurgicalEncounterExampleis discovered through metadata-driven navigation without any manual workaround.Unit Testing
UI Testing Steps
Use the v2.2 client and server suites run against each other locally.
What To Verify
PAS profile precedence — must NOT fall back to US Core:
Encounter/SurgicalEncounterExample→ validates againstprofile-encounter. No6.1.0reference should appear.ServiceRequest/ReferralRequestExample→ validates againstprofile-servicerequest. Nous-core-servicerequestshould appear.Patient/SubscriberExample→ validates againstprofile-subscriber.US Core via declared meta.profile:
DocumentReference/episode-summary→ validates againstus-core-documentreference|6.1.0.General:
Regression Check
Run the PAS v2.0.1 suite and confirm:
us-core-*profiles appear in validation messages.6.1.0references appear anywhere.Notes
This PR only changes traversal and navigation handling, and operation profile selection logic. The existing validation logic, profile precedence order, US Core fallback behavior, and bundle entry profile map were not modified.