FHIR APIs follow consistent interaction patterns for reading, searching, and exchanging clinical data. This guide explains how to structure requests, use UCUM units in observations, and apply correct syntax for both direct reads and parameterized searches.Representing Quantities with UCUM#
FHIR uses the UCUM (Unified Code for Units of Measure) standard for expressing physical quantities, particularly in clinical observations such as lab results and vital signs.When a valid UCUM unit is known:#
"valueQuantity": {
"value": 98.6,
"unit": "°F",
"system": "http://unitsofmeasure.org",
"code": "°F"
}
When a UCUM code is not available (free text only):#
"valueQuantity": {
"value": 75,
"unit": "bpm"
}
When no units are available:#
"valueQuantity": {
"value": 120
}
US Core profiles (e.g. Vital Signs, Lab Results) expect binding to UCUM codes. If unavailable, fallback to unit
alone is allowed, but discouraged for certified use.
Fetching a Resource (Read Interaction)#
FHIR defines a standard syntax for retrieving individual resources using HTTP GET
. This follows the pattern:GET [base-url]/[Resource-type]/[id]{?parameters}
Syntax Breakdown:#
Component | Description | Example |
---|
GET | The HTTP method used to retrieve data | GET /Patient/12345 |
[base-url] | Root service endpoint for the API (Sandbox) | https://fhir-dev.fhir.edvak.com/fhir |
[Resource-type] | Type of FHIR resource being accessed | Patient |
[id] | Logical ID of the resource | 12345 |
{?parameters} | Optional query parameters to filter/modify the request | ?name=John&birthdate=1980-01-01 |
Example:#
GET https://fhir-dev.fhir.edvak.com/fhir/Patient/12345
To retrieve a set of resources matching specific criteria, use the FHIR search interaction. All searches are executed with HTTP GET
and follow this pattern:GET [base-url]/[Resource-type]?[search-parameters]
Example:#
GET https://fhir-dev.fhir.edvak.com/fhir/Observation?patient=12345&code=29463-7
Search Syntax Components:#
Syntax | Meaning | Example |
---|
parameter=value | Basic key-value pair search | name=John |
param1=val1¶m2=val2 | Multiple parameters joined by AND | gender=male&birthdate=1980-01-01 |
parameter=val1,val2 | Comma-separated values = logical OR | status=active,inactive |
parameter:modifier=value | Modifier to refine the match | name:contains=John |
parameter=comparatorvalue | Use comparators like gt , lt , ge , le | birthdate=ge2000-01-01 |
code=http://loinc.org|29463-7
date={gt|lt|ge|le}[YYYY-MM-DD]
If no comparator is used, eq
(equals) is assumed.SMART on FHIR Search Behavior#
When using SMART on FHIR v2.0.0, especially in patient-scoped access (e.g. patient/Observation.read
), the system automatically applies a filter limiting results to the authorized patient. This means:...implicitly behaves like:This is handled by the authorization layer and does not need to be explicitly added by the client in patient-scoped access contexts.