Skip to main content

Creating Observations

To create Observation resources, you can either send a POST request to the /fhir/R4/Observation endpoint or submit a Bundle to the base /fhir/R4 endpoint.

Creating a single Observation via POST

curl --request POST \
--url ${BASE_URL}/fhir/R4/Observation \
--header 'Authorization: Bearer ${access_token}' \
--header 'Content-Type: application/json' \
--data '{
"resourceType": "Observation",
"status": "final",
"subject": {
"type": "Patient",
"identifier": {
"system": "http://example.org/patient-ids",
"value": "123456",
"type": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/v2-0203",
"code": "MR"
}
]
}
}
},
"partOf": [
{
"type": "ImagingStudy",
"identifier": {
"system": "http://example.org/filler-order-number",
"value": "1234",
"type": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/v2-0203",
"code": "ACSN"
}
]
}
}
}
],
"code": {
"coding": [
{
"system": "http://loinc.org",
"code": "10231-9",
"display": "Right ventricular Ejection fraction"
}
]
},
"valueQuantity": {
"value": 29,
"unit": "%",
"system": "http://unitsofmeasure.org",
"code": "%"
},
"text": {
"status": "generated",
"div": "<div xmlns=\"http://www.w3.org/1999/xhtml\">Right ventricular Ejection fraction: 29%</div>"
}
}'

Batch POST using a Bundle

curl --request POST \
--url ${BASE_URL}/fhir/R4 \
--header 'Authorization: Bearer ${access_token}' \
--header 'Content-Type: application/json' \
--data '{
"resourceType": "Bundle",
"type": "batch",
"entry": [
{
"resource": {
"resourceType": "Observation",
"status": "final",
"subject": {
"type": "Patient",
"identifier": {
"system": "http://example.org/patient-ids",
"value": "123456",
"type": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/v2-0203",
"code": "MR"
}
]
}
}
},
"partOf": [
{
"type": "ImagingStudy",
"identifier": {
"system": "http://example.org/filler-order-number",
"value": "1234",
"type": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/v2-0203",
"code": "ACSN"
}
]
}
}
}
],
"code": {
"coding": [
{
"system": "http://loinc.org",
"code": "10231-9",
"display": "Right ventricular Ejection fraction"
}
]
},
"valueQuantity": {
"value": 29,
"unit": "%",
"system": "http://unitsofmeasure.org",
"code": "%"
}
},
"request": {
"method": "POST",
"url": "Observation"
}
},
{
"resource": {
"resourceType": "Observation",
"status": "final",
"subject": {
"type": "Patient",
"identifier": {
"system": "http://example.org/patient-ids",
"value": "123456",
"type": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/v2-0203",
"code": "MR"
}
]
}
}
},
"partOf": [
{
"type": "ImagingStudy",
"identifier": {
"system": "http://example.org/filler-order-number",
"value": "1234",
"type": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/v2-0203",
"code": "ACSN"
}
]
}
}
}
],
"code": {
"coding": [
{
"system": "http://loinc.org",
"code": "10230-1",
"display": "Left ventricular Ejection fraction"
}
]
},
"valueQuantity": {
"value": 35,
"unit": "%",
"system": "http://unitsofmeasure.org",
"code": "%"
}
},
"request": {
"method": "POST",
"url": "Observation"
}
}
]
}'