What is the proper way of using FHIR Patch against contained resources?
Lets say I have DocumentReference with few contained Organizations and Practitioners as DocumentReference.author property and I want to use FHIR Patch to Replace/Add/Remove Organization.name of certain contained resource. What is the proper way to define these patches?
First, make sure you’re using ‘contained’ properly - i.e. that the Organizations and Practitioners have no independent existence and aren’t appropriate to be stand-alone resources. “contained” isn’t for use as a simple way to return multiple resources at once, it’s used when the referenced resource doesn’t have enough identifying information to allow it to exist as a stand-alone resource.
Other than that, FHIR Patch would work the same way with .contained as with any other property. Simply specify the path navigating the .contained element. Note that the type of the .contained element is the resource itself, so you would navigate to .contained[0].name, not .contained[0].Organization.name. Also, if you delete a contained resource your patch would also need to delete the references to it in order to remain a valid instance.