Skip to main content

Module reference_collector

Module reference_collector 

Source
Expand description

Reference collection for remote resolve() prefetch (Phase 3).

Gathers the FHIR Reference.reference strings present in an input bundle (and, during chained prefetch, in fetched resources) so the prefetch stage can decide which ones are eligible for remote fetching. This module is pure (no I/O).

References are found by structurally walking the JSON for "reference" string fields, which captures every Reference element regardless of the path it appears at. Candidates are later filtered against the allowlist (crate::remote_resolver::RemoteResolveConfig::fetch_decision), so occasional non-Reference "reference" keys are harmless — they simply won’t match.

Functions§

collect_reference_strings
Collects all unique reference strings found anywhere in the bundle.
collect_reference_strings_from_resources
Collects all unique reference strings across a slice of raw resource JSON values (the streaming/NDJSON chunk shape).
collect_references_from_json
Collects all unique reference strings from an arbitrary resource JSON value (used to discover chained references inside fetched resources).
collect_resource_keys
Collects the "ResourceType/id" keys of every resource already in the bundle, so the prefetch can skip references that resolve locally.
collect_resource_keys_from_resources
Collects the "ResourceType/id" keys of a slice of raw resource JSON values.
reference_type_id
Returns the "Type/id" key implied by a reference string (relative or the trailing Type/id of an absolute URL), used to test local resolvability.
resolves_in_bundle
Whether reference already resolves against a resource present in the bundle.