TEST: OHIE-CR-08-FHIR
Patient Merges
Last updated
Patient Merges
Last updated
This test ensures that the client registry properly handles merge requests sent by patient identity sources using the PMIR merge mechanism described in IHE Patient Mater Identity Registry.
The PMIR profile makes the assumption that the client is controlling the process of merge by instructing the server to link/de-activate a victim. Since merging is an event which triggers several business rules in the Master Data Management layer, the SanteDB PMIR handler detects this condition (a client attempting to control linking of patients, which is an internal matter) and mimics the equivalent behaviors of ADT^A40
from HL7v2.
Furthermore, the SanteDB implementation of merging behaves as described in Chapter 3 - Patient Administration
in HL7 Version 2 (see: 3.6.2.1.2
). For example, if two patients from HOSPITAL_A
are registered as illustrated below (patient 1 with two identifiers and patient 2 with one):
Then a merge requests where Patient 1 is replaced by Patient 2 would result in a merge such that:
Subsequent requests to query for a patient using GREEN_TRIANGLE
would result in Patient 2
being resolved. This behavior differs from the prescribed behavior of PMIR whereby the victim (in this case Patient 2) is not returned, or continues to be resolved with an inactive flag.
Prior to running this test ensure that the pre-conditions from TEST: OHIE-CR-04 and TEST: OHIE-CR-06 have been run.
The test harness authenticates against the SanteMPI IdP using a client_credentials grant for the test-harness-a account.
The test harness sends an authenticated request to create a new patient with a new identifier in TEST domain. Patient details:
Identifier FHR-080
in http://ohie.org/test/test
Identifier NID080
in http://ohie.org/test/nid
Name: MERGY SMITH
Gender: Male
DOB: 1986-05-25
Requirement | Option | Description |
MUST | PMIR Only | Return MessageHeader with response.code = ok |
MUST | Return HTTP code of 201 Created | |
SHOULD | PMIR Only | Include an OperationOutcome entry in the response |
SHOULD | Include a Patient entry in response containing created patient | |
SHOULD | Include a link to the master identity with code refer |
The test harness sends an IHE PIXm query for a patient with identifier FHR-080 to the receiver.
Requirement | Option | Description |
MUST | Return HTTP code of 200 OK | |
MUST | Include a Parameters resource in the response | |
MUST | Have two parameters carrying the identifier in TEST and NID with parameter name of targetIdentifier and values FHR-080 and NID080 | |
MUST | Include a parameter with name targetId which has a resource link to the created resource from the previous step. |
The test harness sends an authenticated request to create a new patient with a new identifier in TEST domain. Patient details:
Identifier FHR-081
in http://ohie.org/test/test
Name: MERGY SMYTHE
Gender: Male
DOB: 1986-05-25
Requirement | Option | Description |
MUST | PMIR Only | Return MessageHeader with response.code = ok |
MUST | Return HTTP code of 201 Created | |
SHOULD | PMIR Only | Include an OperationOutcome entry in the response |
SHOULD | Include a Patient entry in response containing created patient | |
SHOULD | Include a link to the master identity with code refer |
The test harness sends an IHE PIXm query for a patient with identifier FHIR-081 to the receiver.
Requirement | Option | Description |
MUST | Return HTTP code of 200 OK | |
MUST | Include a Parameters resource in the response | |
MUST | Have one parameter carrying the identifier in TEST with parameter name of targetIdentifier and value FHR-081. | |
MUST | Include a parameter with name targetId which has a resource link to the created resource from the previous step. |
In this step the test harness sends a PIMR request to instruct the Client Registry that FHR-081
has been replaced by FHR-080
.
You will notice that the link
element in the above message uses the business identifier reference rather than an absolute reference by URL. This is considered best practice when merging on SanteDB server as it abstracts the logical identifier (which changes as the resource moves between servers). See: http://hl7.org/fhir/resource.html#identifiers
Requirement | Option | Description |
MUST | Return HTTP code of 200 OK | |
MUST | Return MessageHeader with response.code = ok |
Alternately, the test harness may fetch/obtain the logical ID of the resource and may indicate the merge using the logical identifier of the resource. For example, if the SanteDB MPI registered a patient with logical identifier 5d0e583f-1fda-4a25-8fbe-f4fb3e876f3c
, the sender may issue a link request such as:
Requirement | Option | Description |
MUST | Return MessageHeader with response.code = ok | |
MUST | Return HTTP code of 200 OK | |
SHOULD | Include an OperationOutcome entry in the response |
This test ensures that the client registry returns the new record (with identifier FHR-080) when the old record (FHR-081) is queried. This resolution ensures that the merge occurred successfully and any attempts to reference an old record results in the new being returned.
This test uses the business identifiers to ensure the cross referencing is updated, and is the recommended manner for handling record merges. Alternates (such as returning the old record with active of false would place a burden on the client to intelligently handle merges by following, potentially, dozens of "replaced-by" links)
Requirement | Option | Description |
MUST | Return a bundle with an entry carrying a the FHR-080 identifier (i.e. the resource returned should be the survivor of the merge operation) | |
MUST | Return HTTP code of 200 OK | |
MAY | Return an additional | |
SHOULD | Carry a link with type |
This test ensures compliance with the IHE PMIR profile by explicitly querying for a resource by logical identifier (rather than business identifier). IHE PMIR provides several options for handling a READ
or SEARCH
operation for merged records. All of these options are expressed as alternates in the expected behaviors table.
This test requires that the logical resource identifier assigned by the iCDR / MPI instance is known by the SUT.
Requirement | Option | Description |
MUST | Return an HTTP 200 OK with the replaced/merged record carrying | |
MUST | ALTERNATE | Return HTTP code of 404 NOT FOUND |
This test ensures compliance with the IHE PMIR profile by explicitly searching for a resource by logical identifier (rather than business identifier). IHE PMIR provides several options for handling a SEARCH
operation for merged records. All of these options are expressed as alternates in the expected behaviors table.
This test requires that the logical resource identifier assigned by the iCDR / MPI instance is known by the SUT.
Requirement | Option | Description |
MUST | Return an HTTP 200 OK and a | |
MUST | ALTERNATE | Return an HTTP 200 OK and a with |
MUST | ALTERNATE | Return an HTTP 200 OK and a representing the survivor record (with representing the merged record (with |
This test ensures that the updates applied via the PMIR merge are reflected in the PIXm cross-referencing query request. The test harness issues a cross-referencing request to obtain the national health identifier for FHRA-081 (a patient, when registered, did not have a NID however by virtue FHRA-081 was merged into FHR-080 which carries a NID, FHRA-081 should carry a NID).
Requirement | Option | Description |
MUST | Return an HTTP 200 OK and a | |
MUST | Return one | |
MUST | Return one |