FHIR CI-Build

This is the Continuous Integration Build of FHIR (will be incorrect/inconsistent at times).
See the Directory of published versions

Example OperationDefinition/Patient-merge (Narrative)

Patient Administration Work GroupMaturity Level: N/AStandards Status: InformativeCompartments: Patient, Practitioner, RelatedPerson

This is the narrative for the resource. See also the XML, JSON or Turtle format.

Note that this is the formal definition for the merge operation as an OperationDefinition on Patient. See the Operation documentation


Generated Narrative: OperationDefinition Patient-merge

URL: [base]/Patient/$merge

Parameters

UseNameScopeCardinalityTypeBindingDocumentation
IN source-patient 0..1 Reference (Patient)

A direct resource reference to the source patient resource (this may include an identifier).

IN source-patient-identifier 0..* Identifier

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.

IN target-patient 0..1 Reference (Patient)

A direct resource reference to the target patient resource.

This is the surviving patient resource, the target for the merge.

IN target-patient-identifier 0..* Identifier

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.

IN result-patient 0..1 Patient

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.

This resource MUST have the link property included referencing the source patient resource.

It will be used to perform an update on the target patient resource.

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).

This is often used when properties from the source patient are desired to be included in the target resource.

The receiving system may also apply other internal business rules onto the merge which may make the resource different from what is provided here.

IN preview 0..1 boolean

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.

e.g. Issue.details.text "Preview only Patient merge - no issues detected"

e.g. Issue.diagnostics "Merge would update: 10 years of content or 120 resources"

The resulting target patient resource will also be returned in the result.

OUT return 1..1 Parameters

The status of the response will be one of:

  • 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
  • 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
  • 400 Bad Request - There are errors in the input parameters that need to corrected
  • 422 Unprocessable Entity - Business rules prevent this merge from completing

The Parameters resource will include:

  • The Input parameters to the operation
  • An OperationOutcome containing errors, warnings, and information messages
  • The resulting merged Patient resource (or a patient reference if the patient is not committed)
  • Optionally a Task resource to track any additional processing that was required.

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.

The result-patient.id must be the same as the target patient reference (if the patient reference is provided as an input parameter).

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.

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.


 

 

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.