Stream: implementers
Topic: Implicit Merge
Rahul Somasunderam (Jan 20 2017 at 23:25):
Hi! I've got a question regarding Patient and the correct behavior on POST
Let's say I send a message like this first:
{
"resourceType": "Patient",
"identifier": [
{
"use": "usual",
"type": {"coding": [{"system": "http://hl7.org/fhir/v2/0203", "code": "MR"}]},
"system": "urn:oid:1.2.3.4.5",
"value": "89765a87b"
},
{
"use": "usual",
"type": {"coding": [{"system": "http://hl7.org/fhir/v2/0203", "code": "MR"}]},
"system": "urn:oid:1.2.3.4.6",
"value": "123123123"
}
],
"active": true,
"name": [
{
"family": [ "Doe" ],
"given": [ "John" ]
}
],
"gender": "male",
"birthDate": "1956-05-27",
"address": [
{
"line": [ "100 Main St" ],
"city": "Metropolis",
"state": "Il",
"postalCode": "44130",
"country": "USA"
}
]
}
Then the server creates a resource with identifier 1000
Now I send another POST with this
{
"resourceType": "Patient",
"identifier": [
{
"use": "usual",
"type": {"coding": [{"system": "http://hl7.org/fhir/v2/0203", "code": "MR"}]},
"system": "urn:oid:1.2.3.4.7",
"value": "99999999"
}
],
"active": true,
"name": [
{
"family": [ "Doe" ],
"given": [ "John" ]
}
],
"gender": "male",
"birthDate": "1956-05-27",
"address": [
{
"line": [ "100 Main St" ],
"city": "Metropolis",
"state": "Il",
"postalCode": "44130",
"country": "USA"
}
]
}
Is the server allowed to merge the 2 resources or is it required to create a new resource with id 1001?
Ewout Kramer (Jan 30 2017 at 15:07):
A POST is supposed to create a new resource, so yes. In this example, it looks like there's a matching algorithm on the server side which determines that these are the same patients - based on the address/gender/name. If you'd need, you could have the server refuse the POST and return an error to the caller with an OperationOutcome in the body, which states that a duplicate patient already exists. This is behaviour is not mandated by the spec, but is certainly allowed.
Last updated: Apr 12 2022 at 19:14 UTC