Cumuluz Translate Implementation Guide
0.1.0 - ci-build

Cumuluz Translate Implementation Guide - Local Development build (v0.1.0) built by the FHIR (HL7® FHIR® Standard) Build Tools. See the Directory of published versions

Transform

Use $transform to translate one registered source resource to one registered target profile. STU3 collections and STU3/R4 NLPS document sources follow Bundle Translation. The EPS Bundle target adds the EPS Document Output contract. A completed form uses QuestionnaireResponse Extraction.

Choose the endpoint

Direction Endpoint HTTP request body HTTP 200 body HTTP 400 body
STU3 to R4 POST /fhir/stu3-r4/$transform R4-style Parameters containing a STU3 source resource R4 Parameters containing an R4 result R4 OperationOutcome
STU3 to STU3 POST /fhir/stu3/$transform STU3 Parameters containing a STU3 source STU3 Parameters containing a STU3 result STU3 OperationOutcome
R4 to STU3 POST /fhir/r4-stu3/$transform R4 Parameters containing an R4 source STU3 Parameters containing a STU3 result STU3 OperationOutcome
R4 to R4 POST /fhir/r4/$transform R4 Parameters containing an R4 source R4 Parameters containing an R4 result R4 OperationOutcome
C-CDA 2.1 CCD to R4 collection POST /fhir/ccda-r4/$transform R4 Parameters with UTF-8 XML Binary and explicit entry targets R4 Parameters containing a collection, coverage and validation evidence R4 OperationOutcome
GLIMS V2 lab to R4 POST /fhir/r4/$transform R4 Parameters containing Binary source with original ER7 bytes R4 Parameters containing an EU Lab document Bundle R4 OperationOutcome

For FHIR sources the endpoint fixes both FHIR versions and the exact profile pair must be registered. Binary laboratory input has a separate explicit ER7 contract, not a generic FHIR profile-pair route.

Wire format

FHIR profile-pair transforms accept one UTF-8 JSON resource in the HTTP request body and return one UTF-8 JSON resource. Use:

Content-Type: application/fhir+json
Accept: application/fhir+json

Place the source FHIR resource directly in Parameters.parameter.resource; FHIR XML and JSON-encoded source strings are unsupported. Only the GLIMS and C-CDA edge contracts additionally accept their documented multipart representations.

{
  "resourceType": "Parameters",
  "parameter": [
    { "name": "source", "resource": { "resourceType": "Patient" } },
    { "name": "sourceProfile", "valueCanonical": "<source canonical>" },
    { "name": "targetProfile", "valueCanonical": "<target canonical>" },
    { "name": "validationMode", "valueCode": "enforce" }
  ]
}

The example above uses the R4-style parameter datatypes used by STU3-to-R4, R4-to-STU3 and R4-to-R4 requests. A STU3-to-STU3 request is a STU3 Parameters resource and uses valueUri for sourceProfile and targetProfile.

For STU3-to-R4, the server reads the outer parameter structure using R4-style fields but parses only the nested source object as STU3. This is why the request uses valueCanonical while the source resource itself follows STU3.

On success, parameter[result].resource contains the target resource directly. For FHIR profile-pair sources, parameter[logical].resource, when requested, is a FHIR Binary whose data follows normal base64 Binary encoding.

Experimental HL7 V2 laboratory input

The same R4 endpoint also accepts the exact GLIMS OUL^R21/2.4 numeric and OUL^R22/2.5 scalar numeric/text/pending contracts. It is not tied to a hospital name; the supplied CWZ case is the representative example. Set the source resource to:

{
  "resourceType": "Binary",
  "contentType": "x-application/hl7-v2+er7",
  "data": "BASE64_OF_ORIGINAL_ER7_BYTES"
}

Use targetProfile http://hl7.eu/fhir/laboratory/StructureDefinition/Bundle-eu-lab|2.1.0, optional sourceProfile matching MSH (urn:cumuluz:hl7v2:GLIMS:OUL-R21:2.4 or urn:cumuluz:hl7v2:GLIMS:OUL-R22:2.5), optional string timeZone (default Europe/Amsterdam), report/enforce validation, and boolean returnLogical. Preserve the original bytes; do not recode ISO-8859-15 text before Base64 encoding. Unknown contracts, unsupported lifecycle events and unsupported value types fail explicitly.

The R4 Parameters response contains result (document Bundle), targetProfile, outcome, echoed source, repeated profileAssessment and repeated mappingEvidence. The latter records source/target maps and technical/logical validation; returnLogical adds edge/logical JSON Binary parts. Unlike FHIR profile-pair responses, this variant has no translationReport. Extra NL Core/GBB profile declarations require successful independent validation and are not copied from an example. Local laboratory terminology still requires confirmed mappings.

GET /fhir/hl7v2-r4/OperationDefinition/glims-lab-transform describes the laboratory-specific parts; POST /fhir/hl7v2-r4/$transform is an alias. Existing FHIR profile-pair behavior remains as described below. The repository's docs/HL7V2_LAB.md contains the executable request-generator, curl and local-run instructions.

Request parameters

Parameter Cardinality Meaning
source 1..1 Source FHIR resource. STU3-to-R4 accepts Bundles; R4-to-R4 accepts collection/document Bundles only for NLPS assembly.
sourceProfile 0..1 Exact source canonical. It may be omitted only when source.meta.profile selects one unique supported profile.
targetProfile usually 1..1 Exact target canonical. Bundle entries can select their own targets.
validationMode 0..1 report (default), enforce, or gated none.
returnLogical 0..1 Include the serialized logical intermediate as Binary; valid only for a single resource.
documentContext 0..1 Caller-authored R4 Composition for EPS assembly on STU3-to-R4, or NLPS assembly on STU3-to-R4/R4-to-R4.

Bundle sources cannot be combined with returnLogical.

For NLPS, set targetProfile to http://ig.nictiz.nl/nlps/StructureDefinition/nl-PatientSummary, omit top-level sourceProfile, and supply either documentContext or one registered R4 Composition entry. See the document contract. Other R4 Bundle targets are unsupported.

canonical|version is accepted only when the installed top-level StructureDefinition has that version. When sourceProfile is omitted, related declarations resolve to their unique most-derived registered profile through baseDefinition; unrelated supported declarations remain ambiguous. Unsupported and ambiguous pairs fail; the service never falls back to another route with the same resource type. The obsolete validate transform parameter is rejected; use validationMode.

Complete synthetic request: Patient transform request.

curl -sS \
  -H 'Accept: application/fhir+json' \
  -H 'Content-Type: application/fhir+json' \
  --data @ig/input/examples/patient-transform-request.json \
  'http://localhost:8080/fhir/stu3-r4/$transform'

Execution and validation modes

source validation -> source-to-logical map -> logical validation
-> governance/loss policy -> logical-to-target map -> target validation
Mode Behavior Conformance status
report Runs all stages and returns materialized output with diagnostics. always non-conformant
enforce Blocks unrelaxed errors, fatal issues and blocked governance decisions. conformant only when all gates pass
none Skips validation; available only when explicitly enabled by the operator. always non-conformant

Terminology translation occurs only when the selected StructureMap invokes a ConceptMap.

Success response

All success envelopes are FHIR Parameters resources in the target FHIR version.

Parameter R4 target STU3 target Client use
result required required translated target resource
targetProfile valueCanonical valueUri confirm selected route
logical optional R4 Binary optional STU3 Binary diagnostics when requested
outcome report/enforce required stage and validation issues
translationReport required for FHIR profile-pair input; lab Binary uses mappingEvidence required for STU3-to-STU3; R4-to-STU3 retains evidence in outcome route, artifacts, stages, payload comparisons and loss decisions

See the complete Patient transform response. A client should accept a result only after checking the expected target profile, conformance mode, blocking issue severities and applicable loss decision.

The report's mapped, changed, added, and deleted groups compare source and target payload values. They are not semantic-loss classifications.

Same-version routes execute the existing source/logical/governance and map guards, then preserve a copy of the original resource if it validates against the requested target and the map requires no conflicting clinical additions or normalizations; otherwise the mapped output is used. The original input is not mutated. Checked target policies define missing-data synthesis and source-profile retention. The complete retained profile set and final target are validated after transport metadata is applied. Existing absence reasons are preserved; explicit EU Core/EPS Patient and Procedure target rules can represent a wholly absent date using the standard Data Absent Reason extension. GBB alpha.2 and derived XIB Patient require supplied birthDate data or an explicit absence reason under the imposed EU profile; the maps do not synthesize it. Other targets retain their exact profile/terminology and transaction-level contracts.

Both STU3-to-STU3 and R4-to-R4 reports include processing, sameVersionPolicy, sourceProfileRetention, missingDataPolicy, repeated outputProfile assessments and repeated missingData records. A missing-data record names its path, representation, reason, source/target-map origin and rule. Original profile claims are kept only after successful output checks; none establishes no additional source claims. Technical validation and transaction/clinical acceptance remain separate. Supply sourceProfile explicitly on a subsequent transform if multiple unrelated declared profiles make inference ambiguous. STU3 report canonicals use native uri values and do not claim conformance to an R4 report profile.

Failure response

Malformed Parameters, unknown parameters, invalid source JSON, missing profiles, unsupported or ambiguous pairs, and blocked enforce stages return HTTP 400 with a version-correct OperationOutcome.

Profile-specific mapping preconditions also fail explicitly. For PZP 2017 TreatmentDirective to PZP 1.0 or nl-core-TreatmentDirective2, supply the verified source version with its latest positive verification, linked parties, and health-professional author. Negative verification history is ignored; missing or ambiguous positive evidence fails. Known coded contact parties become role-only contained RelatedPersons without invented identity. Native R4 directives are not required to repeat legacy verification evidence. The transform never substitutes BeginDatum for the review date.

{
  "resourceType": "OperationOutcome",
  "issue": [
    {
      "severity": "error",
      "code": "not-supported",
      "diagnostics": "Unsupported translation route from '<source>' to '<target>'"
    }
  ]
}

Do not retry the same request against another direction or target automatically. Refresh Discovery, correct the profile pair or route the failure to an operator.

Integration checklist

  • Send and accept application/fhir+json.
  • Use the parser for the endpoint's target FHIR version.
  • Set timeouts and payload limits suitable for profile validation.
  • Log profile canonicals and returned route identity without logging clinical payloads.
  • Preserve the complete FHIR response for auditable stage and loss evidence.
  • Do not persist or forward a report or none result as technically conformant.

The GLIMS laboratory operation also supports multipart/form-data with a source file (x-application/hl7-v2+er7) and the existing named primitive parameters. The R4 endpoint still requires targetProfile; its response remains R4 Parameters with mappingEvidence and profileAssessment. See HL7 V2 Laboratory Input for a complete call, generated report attachment and supported-field boundary.

Experimental C-CDA collection import

The exact source canonical is urn:cumuluz:ccda:CCD:2.1 and the fixed target is http://hl7.org/fhir/StructureDefinition/Bundle. Send a source Binary of type application/xml or text/xml, sourceProfile/targetProfile canonicals and repeated target parts with logicalType (string) and targetProfile (canonical). Available exact R4 entry targets are listed at /fhir/ccda-r4/translation-index; metadata and OperationDefinition/ccda-r4-transform are under the same prefix. returnLogical=true includes inspectable intermediate representations. Report mode shows source-only fields, unrouted entries and target validation; enforce rejects target errors, unresolved references and unrouted entries. Full source C-CDA IG validation and clinical document assembly remain outside this contract. The standalone repository upload-ui/ project handles upload/paste and the UI/source/report views.

C-CDA also accepts multipart upload on that same operation: one source XML file part (application/xml or text/xml) and one parameters file part (application/fhir+json) containing all operation parameters except source. Metadata is limited to 128 KiB; the whole MIME body counts toward the normal request limit. This representation returns the same R4 FHIR response and does not require caller-side base64.