Skip to main content

Step count

Use this category for a step total, optionally scoped to a time interval.

Support in @ovok/core​

  • Category key: stepCount (step-count)
  • 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
stepCountnumber (optional)stepsMapped and saved as a whole-number count.
startDate (optional)Interval startUsed with end to set the saved effective period.
endDate (optional)Interval endUsed with start to set the saved effective period.

Interval behavior​

Pass both start and end to save an interval. If either bound is missing and request-level effectiveDateTime is not supplied, the save uses a single effective date: the supplied bound or the current time. When the source Observation has an effective period, the read mapper returns both bounds as JavaScript Dates.

The step value is a count, not a rate. The SDK does not aggregate multiple observations into a daily total.

Read this category​

Select MeasurementTypeKey.stepCount. The mapper returns the count and any period bounds present on the matching Observation.

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 both interval dates when the step total covers a period. This category's service uses the bounds on the measurement itself to form the Observation effective period.

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';

async function saveStepCount() {
return client.saveMeasurement({
measurement: {
measurementTypeKey: MeasurementTypeKey.stepCount,
stepCount: 8420,
start: new Date('2026-10-07T00:00:00Z'),
end: new Date('2026-10-07T23:59:59Z'),
},
});
}

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.