Search Observation (BG & Carbs) by parameters
A client can search for Blood Glucose (BG) and Carbohydrate intake Observations by using the GET
method on the
server's Observation
endpoint with the following query parameters.
The Continuous Glucose Monitoring (CGM) search is documented separately because CGM readings are aggregated into compound Observations using SampledData. CGM searches MUST NOT be combined with BG or Carbohydrate searches. For CGM guidance see: CGM Observation Search.
Supported codes
The search supports the following LOINC codes:
32016-8
Glucose [Mass/volume] in Capillary blood9059-7
Carbohydrate intake Estimated
Query Parameters
Parameter | Description | Required |
---|---|---|
subject | Patient Record ID (FHIR Patient logical id) | true |
code | One of the supported codes listed above | true |
date | Effective date/time range (Observation.effective[x]) (see validation below) | either date or _lastUpdated |
_lastUpdated | Last updated timestamp range (Resource.meta.lastUpdated) (see validation below) | either date or _lastUpdated |
page | Opaque page identifier for retrieving subsequent result pages | false |
_sort | Sort by effective date: date (ascending) or -date (descending, default) |
false |
Date / _lastUpdated validation
The following rules apply independently to each supplied time-range parameter (date
and _lastUpdated
):
- Provide exactly two repeated parameters: first with
ge
, second withle
(e.g.date=ge...&date=le...
). - Format:
[ge|le]yyyy-MM-ddTHH:MM:SS[+|-]HH:MM
. - The start instant must be earlier than the end instant.
- Maximum supported search duration is 90 days.
Either date
or _lastUpdated
MUST be present; both MAY be present.
_sort parameter
Accepted values: date
(ascending) or -date
(descending). Default is descending by effective date.
Examples
Search BG Observations
curl -sS "https://${server}/fhir/r5/api/Observation?subject=${patient_id}&code=32016-8&date=ge2024-09-01T00%3A00%3A00Z&date=le2024-09-14T00%3A00%3A00Z&_sort=-date" \
-H "client_id: ${client_id}" \
-H "client_secret: ${client_secret}" \
-H "org_id: ${org_id}" \
-H "certificate: ${certificate}" | jq
Search Carbohydrate Observations
curl -sS "https://${server}/fhir/r5/api/Observation?subject=${patient_id}&code=9059-7&_lastUpdated=ge2025-09-01T00%3A00%3A00Z&_lastUpdated=le2025-09-02T00%3A00%3A00Z&_sort=date" \
-H "client_id: ${client_id}" \
-H "client_secret: ${client_secret}" \
-H "org_id: ${org_id}" \
-H "certificate: ${certificate}" | jq
Response
The server responds with a FHIR Bundle
of type searchset
containing matching Observation
resources. Each BG or
Carbohydrate Observation represents a single measurement (no aggregation). Pagination is indicated through Bundle.link
entries with relation next
when additional pages exist.
Error Handling
On error, an OperationOutcome
is returned describing the issue (e.g., invalid date format or unsupported code).