Skip to main content

Blood glucose

Use this category for a numeric blood-glucose reading.

Support in @ovok/core​

  • Category key: bloodGlucose (blood-glucose)
  • Read: Supported through the observation mapping.
  • Save: Supported through the typed measurement save workflow.

The category key selects a measurement shape. It does not determine the patient, time range, or source device. For the shared React query and save behavior, see Measurements and health data.

Data shape​

The base measurement requires measurementTypeKey. Fields marked optional can be omitted when the source did not provide a value.

FieldTypeUnit or meaningRead and save behavior
bloodGlucosenumber (optional)mg/dLMapped to a blood-glucose Observation. Saved to one decimal place.

Value handling​

Supply the value in mg/dL. The SDK does not convert from mmol/L. On save, it rounds to one decimal place; reading maps the Observation quantity back to bloodGlucose.

A missing value is not written as a numeric reading. Validate that the reading exists before offering a save action.

Read this category​

Select MeasurementTypeKey.bloodGlucose in the types array. The mapper returns one measurement for each matching reading group; use the original observations if the screen needs resource metadata or effective time.

Use useObservations() in a client-side component below OvokProvider. It returns mapped measurements, original observations, loading, and error. The hook reference describes its filters and state.

Save this category​

Use bloodGlucose for the value. Set effectiveDateTime on the save request when the reading time is known; otherwise the SDK uses the current time.

Pass the measurement to OvokClient.saveMeasurement() or, in React, the function returned by useSaveMeasurement(). Common request fields such as patientId and device are described in the measurement overview.

Example​

This example uses the configured OvokClient from the get started guide. Supply values in the units listed above.

import { MeasurementTypeKey } from '@ovok/core';

// client is the configured OvokClient for the signed-in user.
async function saveBloodGlucose() {
return client.saveMeasurement({
measurement: {
measurementTypeKey: MeasurementTypeKey.bloodGlucose,
bloodGlucose: 98.6,
},
effectiveDateTime: new Date(),
});
}

When offline queueing is enabled, inspect the returned status. A queued result means the measurement is pending until the queue is flushed; it is not a completed server save.