Search CGM Observation by parameters
A client can search for CGM Observations by using the GET
method on the server's Observation
endpoint with the following query parameters:
Parameter | Description | Required |
---|---|---|
subject | Patient Record ID for the EMR | true |
code | Code to be searched. In case of CGM code is 434910001 |
true |
date | Time range (see details below). | true |
page | ID of the next page if searching for subsequent pages | false |
_sort | Sort the response observation by order | false |
Date Validation
- There must be exactly 2 dates separated by a comma. Start date should be less than the end date.
- Start date should have prefix
ge
- End date should have prefix
le
- Date format should be
[ge|le]yyyy-MM-ddTHH:MM:SS[+|-]HH:MM
- Currently supported search is for a MAX duration of
90Days
Example
curl -sS "https://${server}/fhir/r5/api/Observation?subject=EA3yxWmZP58GR8vansmBVpdx2URdsJM&date=ge2024-09-01T00%3A00%3A00Z&date=le2024-09-14T00%3A00%3A00Z&code=434910001&_sort=date" \
-H "client_id: ${client_id}" \
-H "client_secret: ${client_secret}" \
-H "org_id: ${org_id}" \
-H "certificate: ${certificate}" | jq
This request searches for CGM Observations (code 434910001
) for the patient with the ID EA3yxWmZP58GR8vansmBVpdx2URdsJM
whose effective date time is greater than 2024-09-01T00:00:00
and less than 2024-09-14T00:00:00
.
The Response observations are sorted in ascending order of date.
The current supported values for parameter _sort
are date
for ascending order of date and -date
for descending order.
Response
The server responds with a Bundle
of type searchset
resource containing the matching Observation
resources.
The response is paginated and contains a link
field with the URL to the next page of results, if any.
Example
This is a Sample CGM search result for a Patient. The search result contains 4 CGM Observations collected between time period 02/10/2023 02:00:00 and 02/10/2023 02:15:00 at an interval of 5 minutes apart.
The response contains a single Observation
resource with the ID 1
that represents a CGM Observation for the patient with the ID EA3yxWmZP58GR8vansmBVpdx2URdsJM
between 2024-09-01
and 2024-09-14
.
The Observation
resource is described by the CGM_OBSERVATION Profile
Description of the Sample
Field | Description | Sample |
---|---|---|
resourceType | The response is a FHIR R5 Bundle | "resourceType": "Bundle" |
id | The ID of the bundle will be an UUID (since this is an example it is not uuid), but this ID is non traceable, that is this ID does not exist in the database and cannot be retrieved later. | "id": "rdc-Bundle-R5-CGM-Observation-Search-Result" |
type | The type of the Bundle is “searchset” since this is a response to a search query | "type": "searchset" |
link | The “link” is an Array containing links to multiple pages of the search result→ “self” which is the link to the current page of search results → “next” is the link to the next page in the search results and will only come if there is a next page available. The links are RelativeURL to the domain of the API. These links are transient and are not available for a long time since the pages are cached temporarily. |
"link": [ { "relation": "self", "url": "/fhir/r5/api/Observation?date=ge2023-02-10T00:00:00Z&date=le2023-02-17T00:00:00Z&subject=af51cd07-bd62-4335-9ce0-eeefb52c20d6&code=434910001" }, { "relation": "next", "url": "/fhir/r5/api/Observation?date=ge2023-02-10T00:00:00Z&date=le2023-02-17T00:00:00Z&subject=af51cd07-bd62-4335-9ce0-eeefb52c20d6&code=434910001&page=49ceea13-19d5-4d55-ba3d-cb4733830162" } ] |
entry | The list of observation resources. | |
entry.resource | Each resource is an aggregation of multiple CGM Observations. Each Resource contains a max of 280 individual observations (roughly a day worth of CGM observations captured at 5min interval) |
|
entry.resource.meta | "versionId": version of the resource; "lastUpdated": resource last updated timestamp; “profile": profile describing the resource | "meta": { "versionId": "1676241936447", "lastUpdated": "02/12/2023 22:45:36", "profile": [ "https://roche.com/fhir/iop/StructureDefinition/rdc-Observation-CGM" ] } |
entry.resource.code | The standard code that defines the type of data in the resource | "code": { "coding": [ { "system": "http://snomed.info/sct", "code": "434910001", "display": "Interstitial fluid glucose concentration (observable entity)" } ] } |
entry.resource.subject | The subject is the reference of the patient for which the observations are fetched - should be a UUID in real scenario | "subject": { "reference": "Patient/af51cd07-bd62-4335-9ce0-eeefb52c20d6" } |
entry.resource.effectivePeriod | Effective period of the data contained in this entry of observation - doesn’t necessarily need to match the period of the search request because data may be split depending on the number of results | "effectivePeriod": { "start": "02/10/2023 02:00:00", "end": "02/10/2023 02:15:00" } |
entry.resource.valueSampledData | ValueSampledData is the actual readings (or datapoints) for the observation. It is a Sampled Data type since multiple data points are aggregated as one Observation. |
|
entry.resource.valueSampledData.origin | Contains the Unit of measurement of the data values | "origin": { "value": 0, "unit": "mg/dL", "system": "http://unitsofmeasure.org", "code": "mg/dL" } |
entry.resource.valueSampledData.intervalUnit | The unit in which the Offsets are measured in. (“s” - seconds) | "intervalUnit": "s" |
entry.resource.valueSampledData.dimensions | The number of sample points at each time point: it will always be 1 | "dimensions": 1 |
entry.resource.valueSampledData.offsets | The time-difference of the datapoints starting from the first datapoint, separated by a single space | "offsets": "0 300.0 600.0 900.0" |
entry.resource.valueSampledData.data | The CGM values separated by a single space matching the timestamps and offsets | "data": "163 158 100 98" |
entry.resource.valueSampledData.extension (ext-CGMFlags) |
CGM flags associated with the values. One CGM value may have multiple flags, being “;” the delimiter of the groups of flags. Then, each flag within the group is separated by a single space. Available flags:
|
{ "url": "https://roche.com/fhir/iop/StructureDefinition/ext-CGMFlags", "valueString": "HI; NULL; CalibrationRequired SensorRateDecreaseExceeded; BatteryEmpty SessionStopped" } |
entry.resource.valueSampledData.extension (ext-SampledDataTimestamps) |
The sequence of timestamps that correspond to the capture of each data value separated by a single space | { "url": "https://roche.com/fhir/iop/StructureDefinition/ext-SampledDataTimestamps", "valueString": "2023-02-10T02:00:00+00:00 2023-02-10T02:05:00+00:00 2023-02-10T02:10:00+00:00 2023-02-10T02:15:00+00:00 " } |
entry.resource.device | Reference for the Device Component from which the readings have been taken. | "device": { "reference": "Device/44e641da-6dc7-44e5-befd-2b34c8e865bc" } |
In case of an Error, the server responds with an OperationOutcome
resource with the appropriate error message.
Example
{ "resourceType": "OperationOutcome", "issue": [ { "severity": "error", "code": "value", "diagnostics": "Invalid date format. Expected format: [ge|le]yyyy-MM-ddTHH:MM:SS[+|-]HH:MM" } ] }
Other Use Cases
This section collects a series of scenarios where some variation may happen with respect to the default sample presented previously.
Response for missing data
Situations like failure of the sensor, or momentary loss of network connection from the patch, would cause the amount of values inside entry.resource.valueSampledData.data
to decrease from what would be there in a normal scenario.
Furthermore, both the timestamps and offsets found in entry.resource.valueSampledData.extension (ext-SampledDataTimestamps)
and entry.resource.valueSampledData.offsets
would reflect this gap in transmitted data. The relationship between these and the actual data would still be 1 to 1, but the difference between one offset/timestamp item and the next would be higher than the regular period, showing the mentioned transmission gap.
{ "valueSampledData": { "extension": [ { "url": "https://roche.com/fhir/iop/StructureDefinition/ext-CGMFlags", "valueString": "HI; NULL; LO; LO" }, { "url": "https://roche.com/fhir/iop/StructureDefinition/ext-SampledDataTimestamps", "valueString": "2023-02-10T02:00:00+00:00 2023-02-10T02:05:00+00:00 2023-02-10T02:15:00+00:00 2023-02-10T02:20:00+00:00" } ], "origin": { "value": 0, "unit": "mg/dL", "system": "http://unitsofmeasure.org", "code": "mg/dL" }, "intervalUnit": "s", "dimensions": 1, "offsets": "0 300.0 900.0 1200.0", "data": "163 158 98 98" } }