Skip to main content

Module compartment

Module compartment 

Source
Expand description

Compartment-aware membership checks for $viewdefinition-run filtering.

Backs filter_resources_by_patient_and_group with a real CompartmentDefinition-driven scan (audit item #3). The lookup tables are compiled in via helios_fhir::compartment_expressions — no runtime data-file dependency, so the filter works identically whether the server is invoked from the workspace root, from a Docker container, or from a release tarball.

For each resource and each requested patient reference, the algorithm is:

  1. Look up the spec-defined (search-param-name, FHIRPath-expression) pairs that link the resource to the Patient compartment via helios_fhir::compartment_expressions::{r4,r4b,r5,r6}::get_compartment_param_expressions (joined at code-gen time from CompartmentDefinition-patient.json and search-parameters.json).
  2. Evaluate each FHIRPath expression against the resource JSON.
  3. Inspect the result for a Reference whose reference string matches any requested patient.

Functions§

resolve_group_members_to_patient_refs
Resolves a set of group references to their member patient references.
resource_in_patient_compartment
Returns true if resource is in the Patient compartment of any of the given patient_refs, using the FHIR CompartmentDefinition-patient spec data joined with the corresponding SearchParameter FHIRPath expressions at code-gen time.