Skip to main content

format_view_fhir_parameters

Function format_view_fhir_parameters 

Source
pub fn format_view_fhir_parameters(
    result: &ProcessedResult,
    view_json: &Value,
) -> Result<Vec<u8>, SofError>
Expand description

Renders a ProcessedResult as a FHIR Parameters resource per the SoF v2 spec’s fhir output format: one top-level row parameter per result row, with one part per non-NULL column carrying the appropriate value[x].

The value[x] choice is driven by the ViewDefinition’s declared column.type (collected from view_json, including nested select and unionAll branches); columns without a declared type default to string. NULL cells are omitted. Collection (array) cells repeat the part once per element, matching FHIR’s repeating-element semantics. An empty result emits a bare {"resourceType": "Parameters"} with the parameter key omitted.