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.
The test harness authenticates against the SanteMPI IdP using a client_credentials grant for the test-harness-a account.
POST http://localhost:8080/auth/oauth2_token HTTP/1.1Accept-Encoding:gzip,deflateContent-Type:application/x-www-form-urlencoded;charset=UTF-8Content-Length:87Host:localhost:8080Connection:Keep-AliveUser-Agent:Apache-HttpClient/4.5.5 (Java/12.0.1)grant_type=client_credentials&scope=*&client_secret=TEST_HARNESS&client_id=TEST_HARNESS
Register First Patient Identity in TEST
The test harness sends an authenticated request to create a new patient with a new identifier in TEST domain. Patient details:
Execute PIXm Query To Validate The First Patient in TEST
The test harness sends an IHE PIXm query for a patient with identifier FHR-080 to the receiver.
GET http://localhost:8080/fhir/Patient/$ihe-pix?sourceIdentifier=http%3A%2F%2Fohie.org%2Ftest%2Ftest%7CFHR-080 HTTP/1.1Accept-Encoding:gzip,deflateAuthorization:BEARER XXXXXXAccept:application/fhir+jsonHost:localhost:8080Connection:Keep-AliveUser-Agent:Apache-HttpClient/4.5.5 (Java/12.0.1)
Expected Behaviour
Register Second Patient Identity in TEST
The test harness sends an authenticated request to create a new patient with a new identifier in TEST domain. Patient details:
Execute PIXm Query To Validate The Second Patient in TEST
The test harness sends an IHE PIXm query for a patient with identifier FHIR-081 to the receiver.
GET http://localhost:8080/fhir/Patient/$ihe-pix?sourceIdentifier=http%3A%2F%2Fohie.org%2Ftest%2Ftest%7CFHR-081 HTTP/1.1Accept-Encoding:gzip,deflateAuthorization:BEARER XXXXXXXAccept:application/fhir+jsonHost:localhost:8080Connection:Keep-AliveUser-Agent:Apache-HttpClient/4.5.5 (Java/12.0.1)
Expected Behaviour
Merge FHR-081 (Patient 2) into FHR-080 (Patient 1)
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
Alternate Merge Request
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:
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)
GET http://localhost:8080/fhir/Patient?identifier=http%3A%2F%2Fohie.org%2Ftest%2Ftest%7CFHR-081 HTTP/1.1Accept-Encoding:gzip,deflateAuthorization:BEARER XXXXXXXXAccept:application/fhir+jsonHost:localhost:8080Connection:Keep-AliveUser-Agent:Apache-HttpClient/4.5.5 (Java/12.0.1)
Expected Behavior
Fetch Merged Record
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.
GET http://localhost:8080/fhir/Patient/bd9ab237-ee43-4f69-b363-5e016deb690d HTTP/1.1Accept-Encoding:gzip,deflateAuthorization:BEARER XXXXXXXAccept:application/fhir+jsonHost:localhost:8080Connection:Keep-AliveUser-Agent:Apache-HttpClient/4.5.5 (Java/12.0.1)
Expected Behavior
Search Merged Record
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.
GET http://sut:8080/fhir/Patient?_id=5d0e583f-1fda-4a25-8fbe-f4fb3e876f3c HTTP/1.1Auhthorization:Bearer XXXXXXAccept:application/fhir+json
Expected Behavior
Execute PIXm Query To Validate Merged Record
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).
GET http://localhost:8080/fhir/Patient/$ihe-pix?sourceIdentifier=http%3A%2F%2Fohie.org%2Ftest%2Ftest%7CFHR-081&targetSystem=http%3A%2F%2Fohie.org%2Ftest%2Fnid HTTP/1.1
Accept-Encoding:gzip,deflateAuthorization:BEARER XXXXXXXAccept:application/fhir+jsonHost:localhost:8080Connection:Keep-AliveUser-Agent:Apache-HttpClient/4.5.5 (Java/12.0.1)