Release 5

Publish-box (todo)

Example OperationDefinition/Patient-merge (JSON)

Patient Administration Work GroupMaturity Level: N/AStandards Status: Informative

Raw JSON (canonical form + also see JSON Format Specification)

Operation Definition

{
  "resourceType" : "OperationDefinition",
  "id" : "Patient-merge",
  "text" : {
    "status" : "extensions",
    "div" : "<div xmlns=\"http://www.w3.org/1999/xhtml\"><p>URL: [base]/Patient/$merge</p><p>Parameters</p><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>source-patient</td><td/><td>0..1</td><td><a href=\"references.html#Reference\">Reference</a></td><td/><td><div><p>A direct resource reference to the <strong>source</strong> patient resource (this may include an identifier).</p>\n</div></td></tr><tr><td>IN</td><td>source-patient-identifier</td><td/><td>0..*</td><td><a href=\"datatypes.html#Identifier\">Identifier</a></td><td/><td><div><p>When source-patient-identifiers are provided, the server is expected to perform an internal lookup to identify the source patient record. The server SHALL reject the request if the provided identifiers do not resolve to a single patient record. This resolution MAY occur asynchronously, for example, as part of a review by a user.</p>\n</div></td></tr><tr><td>IN</td><td>target-patient</td><td/><td>0..1</td><td><a href=\"references.html#Reference\">Reference</a></td><td/><td><div><p>A direct resource reference to the <strong>target</strong> patient resource.</p>\n<p>This is the surviving patient resource, the target for the merge.</p>\n</div></td></tr><tr><td>IN</td><td>target-patient-identifier</td><td/><td>0..*</td><td><a href=\"datatypes.html#Identifier\">Identifier</a></td><td/><td><div><p>When target-patient-identifiers are provided, the server is expected to perform an internal lookup to identify the target patient record. The server SHALL reject the request if the provided identifiers do not resolve to a single patient record. This resolution MAY occur asynchronously, for example, as part of a review by a user.</p>\n</div></td></tr><tr><td>IN</td><td>result-patient</td><td/><td>0..1</td><td><a href=\"patient.html\">Patient</a></td><td/><td><div><p>The details of the Patient resource that is expected to be updated to complete with and must have the same patient.id and provided identifiers included.</p>\n<p>This resource MUST have the link property included referencing the source patient resource.</p>\n<p>It will be used to perform an update on the target patient resource.</p>\n<p>In the absence of this parameter the servers should copy all identifiers from the source patient into the target patient, and include the link property (as shown in the example below).</p>\n<p>This is often used when properties from the source patient are desired to be included in the target resource.</p>\n<p>The receiving system may also apply other internal business rules onto the merge which may make the resource different from what is provided here.</p>\n</div></td></tr><tr><td>IN</td><td>preview</td><td/><td>0..1</td><td><a href=\"datatypes.html#boolean\">boolean</a></td><td/><td><div><p>If this is set to true then the merge will not be actually performed; an OperationOutcome will be returned in the Parameters response that will indicate that no merge has occurred and may include other diagnostic info if desired, such as the scale of the merge.</p>\n<p>e.g. Issue.details.text &quot;Preview only Patient merge - no issues detected&quot;</p>\n<p>e.g. Issue.diagnostics &quot;Merge would update: 10 years of content or 120 resources&quot;</p>\n<p>The resulting target patient resource will also be returned in the result.</p>\n</div></td></tr><tr><td>OUT</td><td>return</td><td/><td>1..1</td><td><a href=\"parameters.html\">Parameters</a></td><td/><td><div><p>The status of the response will be one of:</p>\n<ul>\n<li>200 OK - If the merge request doesn't expect any issues (although warning may be present) for a preview, or was completed without issues if not a preview</li>\n<li>202 Accepted - The merge request has been accepted and does not expect any issues and will continue processing the merge in the background, and you can monitor the Task for completion</li>\n<li>400 Bad Request - There are errors in the input parameters that need to corrected</li>\n<li>422 Unprocessable Entity - Business rules prevent this merge from completing</li>\n</ul>\n<p>The Parameters resource will include:</p>\n<ul>\n<li>The Input parameters to the operation</li>\n<li>An OperationOutcome containing errors, warnings, and information messages</li>\n<li>The resulting merged Patient resource (or a patient reference if the patient is not committed)</li>\n<li>Optionally a Task resource to track any additional processing that was required.</li>\n</ul>\n</div></td></tr></table><div><p>There must be exactly 1 source patient, which may  be identified by either the source-patient or source-patient-identifier parameters. Similarly, there must be exactly 1 target patient, identified by either the target-patient or target-patient-identifier parameters. In both cases, either a reference to the patient or a list of identifiers that can be used to identify the patient may be provided, but not both.</p>\n<p>The result-patient.id must be the same as the target patient reference (if the patient reference is provided as an input parameter).</p>\n<p>If a client needs the server to create a new patient merged from the 2 patient resources, the client should create a new patient record and then call the merge operation to merge each source patient resource into the newly created patient resource.</p>\n<p>A server may decide to delete the source record, but this is not defined by the standard merge operation, and if this occurs then the target patient's link property will remain unchanged.</p>\n</div></div>"
  },
  "extension" : [{
    "url" : "http://hl7.org/fhir/StructureDefinition/structuredefinition-fmm",
    "valueInteger" : 0
  },
  {
    "url" : "http://hl7.org/fhir/StructureDefinition/structuredefinition-standards-status",
    "valueCode" : "trial-use"
  }],
  "url" : "http://hl7.org/fhir/OperationDefinition/Patient-merge",
  "version" : "5.0.0",
  "name" : "Merge",
  "title" : "Patient Merge",
  "status" : "draft",
  "kind" : "operation",
  "experimental" : false,
  "date" : "2023-03-26T15:21:02+11:00",
  "publisher" : "HL7 (FHIR Project)",
  "contact" : [{
    "telecom" : [{
      "system" : "url",
      "value" : "http://hl7.org/fhir"
    },
    {
      "system" : "email",
      "value" : "fhir@lists.hl7.org"
    }]
  }],
  "description" : "The merge operation is used to request two patient resources be merged. One of the two patients is identified as the source and one as the target. The data from the source patient will be merged with the data of the target patient.\r\rThe source Patient resource will be updated to add a new Patient.link reference to the target Patient resource with a link-type of replaced-by. The source Patient will also be updated to have a status of inactive, unless the source Patient resource was deleted.\r\rThe target Patient resource will be updated to add a new Patient.link reference to the source Patient resource with a link-type of replaces unless the source Patient resource is deleted. The target Patient resource must be included in the result-patient parameter if used.",
  "jurisdiction" : [{
    "coding" : [{
      "system" : "http://unstats.un.org/unsd/methods/m49/m49.htm",
      "code" : "001",
      "display" : "World"
    }]
  }],
  "affectsState" : true,
  "code" : "merge",
  "comment" : "There must be exactly 1 source patient, which may  be identified by either the source-patient or source-patient-identifier parameters. Similarly, there must be exactly 1 target patient, identified by either the target-patient or target-patient-identifier parameters. In both cases, either a reference to the patient or a list of identifiers that can be used to identify the patient may be provided, but not both.\r\rThe result-patient.id must be the same as the target patient reference (if the patient reference is provided as an input parameter).\r\rIf a client needs the server to create a new patient merged from the 2 patient resources, the client should create a new patient record and then call the merge operation to merge each source patient resource into the newly created patient resource.\r\rA server may decide to delete the source record, but this is not defined by the standard merge operation, and if this occurs then the target patient's link property will remain unchanged.\r",
  "resource" : ["Patient"],
  "system" : false,
  "type" : true,
  "instance" : false,
  "parameter" : [{
    "name" : "source-patient",
    "use" : "in",
    "min" : 0,
    "max" : "1",
    "documentation" : "A direct resource reference to the **source** patient resource (this may include an identifier).",
    "type" : "Reference",
    "targetProfile" : ["http://hl7.org/fhir/StructureDefinition/Patient"]
  },
  {
    "name" : "source-patient-identifier",
    "use" : "in",
    "min" : 0,
    "max" : "*",
    "documentation" : "When source-patient-identifiers are provided, the server is expected to perform an internal lookup to identify the source patient record. The server SHALL reject the request if the provided identifiers do not resolve to a single patient record. This resolution MAY occur asynchronously, for example, as part of a review by a user.",
    "type" : "Identifier"
  },
  {
    "name" : "target-patient",
    "use" : "in",
    "min" : 0,
    "max" : "1",
    "documentation" : "A direct resource reference to the **target** patient resource.\r\rThis is the surviving patient resource, the target for the merge.",
    "type" : "Reference",
    "targetProfile" : ["http://hl7.org/fhir/StructureDefinition/Patient"]
  },
  {
    "name" : "target-patient-identifier",
    "use" : "in",
    "min" : 0,
    "max" : "*",
    "documentation" : "When target-patient-identifiers are provided, the server is expected to perform an internal lookup to identify the target patient record. The server SHALL reject the request if the provided identifiers do not resolve to a single patient record. This resolution MAY occur asynchronously, for example, as part of a review by a user.",
    "type" : "Identifier"
  },
  {
    "name" : "result-patient",
    "use" : "in",
    "min" : 0,
    "max" : "1",
    "documentation" : "The details of the Patient resource that is expected to be updated to complete with and must have the same patient.id and provided identifiers included.\r\rThis resource MUST have the link property included referencing the source patient resource.\r\rIt will be used to perform an update on the target patient resource.\r\rIn the absence of this parameter the servers should copy all identifiers from the source patient into the target patient, and include the link property (as shown in the example below).\r\rThis is often used when properties from the source patient are desired to be included in the target resource.\r\rThe receiving system may also apply other internal business rules onto the merge which may make the resource different from what is provided here.",
    "type" : "Patient"
  },
  {
    "name" : "preview",
    "use" : "in",
    "min" : 0,
    "max" : "1",
    "documentation" : "If this is set to true then the merge will not be actually performed; an OperationOutcome will be returned in the Parameters response that will indicate that no merge has occurred and may include other diagnostic info if desired, such as the scale of the merge.\r\re.g. Issue.details.text \"Preview only Patient merge - no issues detected\"\r\re.g. Issue.diagnostics \"Merge would update: 10 years of content or 120 resources\"\r\rThe resulting target patient resource will also be returned in the result.",
    "type" : "boolean"
  },
  {
    "name" : "return",
    "use" : "out",
    "min" : 1,
    "max" : "1",
    "documentation" : "The status of the response will be one of:\r\r* 200 OK - If the merge request doesn't expect any issues (although warning may be present) for a preview, or was completed without issues if not a preview\r* 202 Accepted - The merge request has been accepted and does not expect any issues and will continue processing the merge in the background, and you can monitor the Task for completion\r* 400 Bad Request - There are errors in the input parameters that need to corrected\r* 422 Unprocessable Entity - Business rules prevent this merge from completing\r\rThe Parameters resource will include:\r\r* The Input parameters to the operation\r* An OperationOutcome containing errors, warnings, and information messages\r* The resulting merged Patient resource (or a patient reference if the patient is not committed)\r* Optionally a Task resource to track any additional processing that was required.",
    "type" : "Parameters"
  }]
}

Usage note: every effort has been made to ensure that the examples are correct and useful, but they are not a normative part of the specification.