Baby sleep
Use this category for coded baby-sleep metrics, such as a device sample or a session summary. The SDK stores the data as FHIR Observation components and preserves the codes supplied by the device adapter.
Support in @ovok/core
- Category key:
babySleep(baby-sleep) - Read: Supported through the observation mapping.
- Save: Supported through the typed measurement save workflow.
The SDK does not assign meaning to sleep states, posture, or device status. Define the code system and value conventions with the producer and consumer of the data. For common query and save behavior, see Measurements and health data.
Data shape
| Field | Type | Required | Meaning |
|---|---|---|---|
components | FHIR ObservationComponent[] | Yes | Coded sleep metrics and their typed values. Must contain at least one component to produce an Observation. |
recordedAt | Date (optional) | No | Time associated with the sample or session summary. |
device | FHIR Reference (optional) | No | Device reference associated with the reading. |
Use a FHIR value type that matches each component, such as valueCodeableConcept for a coded state or valueQuantity for a numeric duration. Do not put unrelated values into one component or rely on the SDK to convert device-specific units.
Save a sleep observation
import { MeasurementTypeKey } from '@ovok/core';
const result = await client.saveMeasurement({
measurement: {
measurementTypeKey: MeasurementTypeKey.babySleep,
recordedAt: new Date(),
components: [
{
code: {
coding: [{
system: 'https://your-device.example/codes',
code: 'sleep-state',
display: 'Sleep state',
}],
},
valueCodeableConcept: {
coding: [{
system: 'https://your-device.example/codes',
code: 'asleep',
display: 'Asleep',
}],
},
},
],
},
});
Replace the code system and values with the conventions used by your integration. Empty components produce no measurement Observation. If offline queueing is enabled, handle queued results as pending until confirmed by a flush; see Offline measurement saves.
Read this category
Select MeasurementTypeKey.babySleep in useObservations() or the client observation query. The mapper groups matching components into a BabySleepMeasurement; your application decides how to interpret those components.