Placeholder IDs and references

Creating references between resources is easy if you know the ID of the reference target (such as in the example above with client-assigned IDs) but it is also possible to have references between resources in a single bundle even if you don't yet know the target resource ID.

For example, if an entry in your bundle is using a normal FHIR create (for example, HTTP POST) then it will assign an ID to the resource and your client will not know this ID until after the transaction has been processed.

FHIR solves this issue by using a feature called Placeholder IDs, which are UUIDs generated by the client to associate with each resource. These UUIDs are temporary and should be randomly generated. They serve only to link resources in the Bundle together, and are thrown away by the server once it has determined the actual resource IDs.

The following example shows a transaction that creates two resources: a Patient and an Observation referring to this patient.

{
  "resourceType": "Bundle",
  "type": "transaction",
  "entry": [ {
  "fullUrl": "urn:uuid:e16eac01-a5ee-4904-b1c8-f4bd56e338d5",   >  Placeholder ID for Patient resource 	   
	    "resource": {
      "resourceType": "Patient",
      "identifier": [ {
        "system": "http://acme.org/mrns",
        "value": "013872"
      } ],
      "name": [ {
        "family": "Simpson",
        "given": [ "Homer" ]
      } ]
    },
    "request": {
      "method": "POST",
      "url": "Patient"
    }
  }, {
    "fullUrl": "urn:uuid:499733fe-7ced-4d15-81ce-8a433a1fb71e",
    "resource": {
      "resourceType": "Observation",
      "status": "final",
      "code": {
        "coding": [ {
          "system": "http://loinc",
          "code": "29463-7",
          "display": "Body Weight"
        } ]
      },
      "subject": {
        "reference": "urn:uuid:e16eac01-a5ee-4904-b1c8-f4bd56e338d5"   > Reference to Patient placeholder ID. This will be automatically replaced with the real resource ID by the server.
	      },
      "effectiveDateTime": "2022-02-23",
      "valueQuantity": {
        "value": 67.1,
        "unit": "kg",
        "system": "http://unitsofmeasure.org",
        "code": "kg"
      }
    },
    "request": {
      "method": "POST",
      "url": "Observation"
    }
  } ]
}