Skip to main content

Updating an Observation

A scenario where a newer reading or value needs to replace an existing one update the existing resource utilizing the PUT / PATCH endpoints. You can either save off the id of the resource which is returned on creation or utilize the search endpoint.

Search example

Here is an example utilizing the ACCESSION, MRN and CODE inorder to fetch the resource(s).

curl --request GET \
--url '${BASE_URL}/fhir/R4/Observation?part-of%3Aidentifier=ACCESSION&subject%3Aidentifier=MRN&code=US_CAROTID_RT_INT_DISTAL_PSV' \
--header 'Authorization: Bearer ${access_token}' \

Put example

warning

The meta.account.reference must be set with a valid ORGANIZATION_ID or the request will error out

curl --request PUT \
--url ${BASE_URL}/fhir/R4/Observation/111-1111-1111-1111-111111111111 \
--header 'Authorization: Bearer ${access_token}' \
--header 'Content-Type: application/fhir+json' \
--data '{
"resourceType": "Observation",
"status": "final",
"issued": "2024-07-30T21:52:11.4812528Z",
"subject": {
"type": "Patient",
"identifier": {
"value": "1234",
"type": {
"coding": [
{
"code": "MR",
"system": "http://terminology.hl7.org/CodeSystem/v2-0203"
}
]
}
}
},
"partOf": [
{
"type": "ImagingStudy",
"identifier": {
"value": "123",
"type": {
"coding": [
{
"code": "ACSN",
"system": "http://terminology.hl7.org/CodeSystem/v2-0203"
}
]
}
}
}
],
"meta": {
"account":
{
"reference": "Organization/${ORGANIZATION_ID}"
}

},
"code": {
"coding": [
{
"code": "US_CAROTID_LT_CCA_PROXIMAL_PSV"
}
]
},
"valueQuantity": {
"value": 11.5,
"unit": "cm/s",
"system": "UCUM",
"code": "cm/s"
},
"text": {
"status": "generated",
"div": "<div xmlns\"http://www.w3.org/1999/xhtml\">11.5</div>"
},
"id": "111-1111-1111-1111-111111111111"
}'

Patch example

curl --request PATCH \
--url ${BASE_URL}/fhir/R4/Observation/111-1111-1111-1111-111111111111 \
--header 'Authorization: Bearer ${access_token}' \
--header 'Content-Type: application/fhir+json' \
--data '[
{
"op": "replace",
"path": "/valueQuantity/value",
"value": 13.5
},
{
"op": "replace",
"path": "/text/div",
"value": "<div xmlns=\"http://www.w3.org/1999/xhtml\">13.5</div>"
}
]'
info

The server expects a JSON Patch (RFC 6902)