Expand description
Shared fhir-format output and FHIR-representation content negotiation
for the SQL-on-FHIR run operations (SoF v2 Common Operation Behavior).
Two independent negotiation axes are implemented here so sof-server and
the HFS REST handlers apply identical rules:
- Axis 1 — format selection:
_format=fhir(orAccept: application/fhir+jsonwhen_formatis absent) selects thefhiroutput format: aParametersresource with one repeatingrowparameter per result row (format_view_fhir_parameters). - Axis 2 — representation: when a flat format is selected and the
client sends
Accept: application/fhir+json, the raw payload is wrapped in a serializedBinaryresource envelope with base64data(wrap_in_binary_envelope). The XML envelope form (application/fhir+xml) is not supported and callers should reject it with406 Not Acceptable(seeaccept_requires_unsupported_fhir_xml).
Constants§
- FHIR_
JSON_ MIME - Native media type of the
fhiroutput format. - FHIR_
XML_ MIME - The FHIR XML media type — recognised only to reject it explicitly.
Functions§
- accept_
has_ mime - True when the given
Acceptheader value listsmime(parameters such as;q=are ignored; matching is case-insensitive). - accept_
requires_ unsupported_ fhir_ xml - True when the client asked for a FHIR XML representation without also
accepting FHIR JSON. Per the spec, a server that does not support the
envelope form requested via
AcceptSHALL respond406 Not Acceptablerather than silently returning raw bytes under a FHIR media type; this server does not produce XML. - format_
view_ fhir_ parameters - Renders a
ProcessedResultas a FHIRParametersresource per the SoF v2 spec’sfhiroutput format: one top-levelrowparameter per result row, with onepartper non-NULL column carrying the appropriatevalue[x]. - wrap_
in_ binary_ envelope - Wraps raw payload bytes in a serialized FHIR
Binaryresource envelope (contentType= the payload’s native media type,data= base64). The caller serves the result underapplication/fhir+json.