Explore documentation

Observation

Learn about the Observation resource for clinical measurements and results.

Set up the SDK server client to run the examples using esus. The REST examples use a session token. To run them with the SDK’s API key, send X-API-Key instead of Authorization.

The Observation resource is one of the most widely used in FHIR. It records vital signs, lab results, imaging findings, and other clinical measurements.

API convention: the patient and encounter references are sent as flat string fields (subjectId, encounterId). All ids are raw UUIDs (v4).

Types of Observations

The kind is set in category (system http://terminology.hl7.org/CodeSystem/observation-category):

  • vital-signs — blood pressure, heart rate, temperature, weight
  • laboratory — blood tests, urinalysis, pathology
  • imaging — imaging findings
  • social-history — smoking, alcohol use
  • exam — physical exam findings

Creating an Observation

REST
curl -X POST https://api.esus.health/fhir/Observation \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/fhir+json" \
  -d '{
    "status": "final",
    "subjectId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "encounterId": "c1a2e3d4-5b6f-7890-abcd-ef1234567890",
    "category": [{
      "coding": [{
        "system": "http://terminology.hl7.org/CodeSystem/observation-category",
        "code": "vital-signs",
        "display": "Vital Signs"
      }]
    }],
    "code": {
      "coding": [{
        "system": "http://loinc.org",
        "code": "8867-4",
        "display": "Heart rate"
      }]
    },
    "effectiveDateTime": "2026-04-21T10:30:00Z",
    "valueQuantity": {
      "value": 72,
      "unit": "beats/minute",
      "system": "http://unitsofmeasure.org",
      "code": "/min"
    }
  }'
SDK
const created = await esus.fhir.create("Observation", {
  "status": "final",
  "subjectId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "encounterId": "c1a2e3d4-5b6f-7890-abcd-ef1234567890",
  "category": [
    {
      "coding": [
        {
          "system": "http://terminology.hl7.org/CodeSystem/observation-category",
          "code": "vital-signs",
          "display": "Vital Signs"
        }
      ]
    }
  ],
  "code": {
    "coding": [
      {
        "system": "http://loinc.org",
        "code": "8867-4",
        "display": "Heart rate"
      }
    ]
  },
  "effectiveDateTime": "2026-04-21T10:30:00Z",
  "valueQuantity": {
    "value": 72,
    "unit": "beats/minute",
    "system": "http://unitsofmeasure.org",
    "code": "/min"
  }
});

Required: subjectId and code. If you omit status, it is stored as final. The patient and encounter must exist in your organization; otherwise the API answers 400.

Value Types

FieldExample
valueQuantity72 beats/minute (value, unit, system, code)
valueCodeableConceptCoded value (e.g. “positive”)
valueStringFree-text observation

Multi-part observations, such as blood pressure, use component[], where each component has its own code and valueQuantity:

{
  "status": "final",
  "subjectId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "category": [{ "coding": [{ "system": "http://terminology.hl7.org/CodeSystem/observation-category", "code": "vital-signs" }] }],
  "code": { "coding": [{ "system": "http://loinc.org", "code": "85354-9", "display": "Blood pressure" }] },
  "component": [
    {
      "code": { "coding": [{ "system": "http://loinc.org", "code": "8480-6", "display": "Systolic" }] },
      "valueQuantity": { "value": 120, "unit": "mmHg" }
    },
    {
      "code": { "coding": [{ "system": "http://loinc.org", "code": "8462-4", "display": "Diastolic" }] },
      "valueQuantity": { "value": 80, "unit": "mmHg" }
    }
  ]
}

Other optional fields: performer[] (references, e.g. { "reference": "Practitioner/<uuid>" }), interpretation, referenceRange, bodySite, method, note, and identifier (identifier can only be sent on create).

Observation Statuses

StatusMeaning
registeredRegistered, no result yet
preliminaryPreliminary result, not yet confirmed
finalComplete and verified
amendedChanged after being final
correctedCorrected after being final (data error)
cancelledOrdered but not performed
entered-in-errorError, should be ignored
unknownStatus cannot be determined

Searching Observations

ParameterBehavior
_idExact id
patient / subjectPatient id (<uuid> or Patient/<uuid>)
encounterEncounter id
statusExact
code, categoryExact system|code, or partial text
dateDate of effectiveDateTime, with optional prefix eq, gt, lt, ge, or le; repeat it for a range (date=ge2026-01-01&date=lt2026-02-01)
value-quantityNumeric value of valueQuantity.value, with optional prefix eq (default), gt, lt, ge, or le (e.g. value-quantity=gt100)
identifierPartial text

Page with _count and _offset, and sort with _sort by _lastUpdated, date, or status.

REST
curl "https://api.esus.health/fhir/Observation?patient=3fa85f64-5717-4562-b3fc-2c963f66afa6&code=http://loinc.org|8867-4&_sort=-date" \
  -H "Authorization: Bearer YOUR_TOKEN"
SDK
const { resources, total } = await esus.fhir.search("Observation", {
  "patient": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "code": "http://loinc.org|8867-4",
  "_sort": "-date"
});

Read, update (PUT/PATCH), delete, and _history work the same as for Patient: see CRUD Operations.