{
  "resourceType" : "OperationDefinition",
  "id" : "ToOpenEhr",
  "text" : {
    "status" : "generated",
    "div" : "<div xmlns=\"http://www.w3.org/1999/xhtml\"><p class=\"res-header-id\"><b>Generated Narrative: OperationDefinition ToOpenEhr</b></p><a name=\"ToOpenEhr\"> </a><a name=\"hcToOpenEhr\"> </a><p>URL: [base]/$toopenehr</p><h3>Parameters</h3><table class=\"grid\"><tr><td><b>Use</b></td><td><b>Name</b></td><td><b>Scope</b></td><td><b>Cardinality</b></td><td><b>Type</b></td><td><b>Binding</b></td><td><b>Documentation</b></td></tr><tr><td>IN</td><td>bundle</td><td/><td>1..1</td><td><a href=\"http://hl7.org/fhir/R4/bundle.html\">Bundle</a></td><td/><td><div><p>The FHIR Bundle containing the resources to be converted to an openEHR Composition.</p>\n</div></td></tr><tr><td>OUT</td><td>composition</td><td/><td>1..1</td><td><a href=\"http://hl7.org/fhir/R4/datatypes.html#string\">string</a></td><td/><td><div><p>The resulting openEHR Composition serialized as a JSON string.</p>\n</div></td></tr><tr><td>OUT</td><td>outcome</td><td/><td>0..*</td><td><a href=\"http://hl7.org/fhir/R4/operationoutcome.html\">OperationOutcome</a></td><td/><td><div><p>An OperationOutcome conveying warnings or partial mapping failures.</p>\n</div></td></tr></table></div>"
  },
  "url" : "http://fhirconnect.org/fhir/OperationDefinition/ToOpenEhr",
  "version" : "0.1.0",
  "name" : "ToOpenEhr",
  "title" : "$toopenehr — Convert FHIR Bundle to openEHR Composition",
  "status" : "draft",
  "kind" : "operation",
  "date" : "2026-05-27T11:19:57+02:00",
  "publisher" : "FHIRConnect",
  "contact" : [{
    "name" : "FHIRConnect",
    "telecom" : [{
      "system" : "url",
      "value" : "https://github.com/SevKohler/FHIRconnect-spec"
    }]
  }],
  "description" : "Converts a FHIR Bundle to an openEHR Composition using a FHIRConnect mapping.\n\nThe operation accepts a FHIR Bundle as input and returns a FHIR Parameters resource\ncontaining the serialized openEHR Composition as a JSON string.\n\nWhen the mapping is fully successful the response contains only the `composition` parameter.\nWhen mapping issues occur (e.g. a source element could not be mapped, a required field was\nabsent, or a partial result was produced), an additional `outcome` parameter carrying an\n`OperationOutcome` resource SHOULD be included alongside the `composition`. The presence of\nan `OperationOutcome` does not necessarily mean the composition is absent — a partial result\nMAY be returned together with issues describing what could not be mapped.\n\nExample response with OperationOutcome:\n\n```json\n{\n  \"resourceType\": \"Parameters\",\n  \"parameter\": [\n    {\n      \"name\": \"composition\",\n      \"valueString\": \"{\\\"_type\\\": \\\"COMPOSITION\\\", \\\"name\\\": {\\\"_type\\\": \\\"DV_TEXT\\\", \\\"value\\\": \\\"International Patient Summary\\\"}, ...}\"\n    },\n    {\n      \"name\": \"outcome\",\n      \"resource\": {\n        \"resourceType\": \"OperationOutcome\",\n        \"issue\": [\n          {\n            \"severity\": \"warning\",\n            \"code\": \"incomplete\",\n            \"details\": {\n              \"text\": \"Element Observation.effectivePeriod could not be mapped; no corresponding openEHR archetype path found.\"\n            }\n          }\n        ]\n      }\n    }\n  ]\n}\n```",
  "affectsState" : false,
  "code" : "toopenehr",
  "system" : true,
  "type" : false,
  "instance" : false,
  "parameter" : [{
    "name" : "bundle",
    "use" : "in",
    "min" : 1,
    "max" : "1",
    "documentation" : "The FHIR Bundle containing the resources to be converted to an openEHR Composition.",
    "type" : "Bundle"
  },
  {
    "name" : "composition",
    "use" : "out",
    "min" : 1,
    "max" : "1",
    "documentation" : "The resulting openEHR Composition serialized as a JSON string.",
    "type" : "string"
  },
  {
    "name" : "outcome",
    "use" : "out",
    "min" : 0,
    "max" : "*",
    "documentation" : "An OperationOutcome conveying warnings or partial mapping failures.",
    "type" : "OperationOutcome"
  }]
}