Skip to main content

ECG

Use this category for an ECG recording, its sampled waveform, and optional associated values.

Support in @ovok/core​

  • Category key: ecg (ecg)
  • 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
diagramPointsnumber[] (optional)mV samplesSaved as sampled data. The SDK creates timestamped segments for long recordings and joins related observations when reading.
heartRatenumber (optional)bpmMapped to and from a separate heart-rate Observation.
diagnosticResultEcgDiagnosticFlag (optional)Source-provided labelSaved as an interpretation label when a waveform is present; read from the recording Observation.
durationnumber (optional)secondsUsed with waveform samples to calculate sample timing and the recorded duration.
recordedAtDate (optional)Recording start timeUsed as the recording timestamp. An invalid or missing date falls back to the current time.

Diagnostic flags​

The enum values and strings are:

Enum valueStored string
REGULARRegular
POOR_WAVEFORMPoor Waveform
LEAD_OFFLead Off
HIGH_HRHigh HR
LOW_HRLow HR
RR_IRREGULARIrregular RR
PVCPVC
CARDIAC_ARRESTCardiac Arrest
ATRIAL_FIBRILLATIONAFIB
QRS_WIDEQRS Wide
QTC_LONGQRS Long
QTC_SHORTQRS Short
ERRORERROR

These are supplied or stored labels, not clinical interpretation by the SDK. Display them as source results and apply your product’s own review workflow.

Waveform behavior​

Provide device-captured waveform values in millivolts and a positive duration in seconds when known. The SDK uses the duration and point count to calculate sample spacing. Without a positive duration, it uses its fallback sample period. A diagnostic label and duration are attached to the waveform recording; a heart-rate-only save does not create a waveform recording.

Read this category​

Select MeasurementTypeKey.ecg to map recording observations back to an EcgMeasurement. Related waveform segments are grouped into one result. The mapped values include waveform points, heart rate, diagnostic label, duration, and recording time where present.

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 diagramPoints for the sampled trace, duration for its length, and recordedAt for when recording started. The SDK may split long recordings into multiple linked observations. It does not analyze the trace or validate a diagnosis.

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 { EcgDiagnosticFlag, MeasurementTypeKey } from '@ovok/core';

async function saveEcgRecording() {
return client.saveMeasurement({
measurement: {
measurementTypeKey: MeasurementTypeKey.ecg,
heartRate: 72,
diagramPoints: [0.01, 0.03, 0.02, -0.01], // Illustrative values only.
diagnosticResult: EcgDiagnosticFlag.REGULAR,
duration: 10,
recordedAt: 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.