Configuration
You can use the SDK with the default configuration or customize it to your needs.
You can visit the Web Playground at playground.shen.ai (opens in a new tab) to see all configuration options in context (you'll need an Web API key to access the playground).
Initializing the SDK without providing a custom configuration will use the default one - a one-minute strict-precision HR/HRV/BR measurement with full user interface. You can customize the behaviour and appearance of the SDK by providing a custom configuration object at initialization or by changing the configuration properties at runtime.
As we are pursuing medical certification of the SDK, the default configuration is representative of the future medical-grade configuration. It will not be possible to change the configuration in the certified version, but a customizable non-certified version will be available alongside.
Measurement settings
OperatingMode
The SDK can be in one of two operating modes:
Positioning
: the SDK will track the user's face position and give feedback to the user to keep the face in a proper position for starting the measurement. This is the default mode after the SDK is initialized.Measure
: the SDK will start the measurement as soon as the face is in a proper position.
Clicking on the START/STOP button in the embedded user interface will switch between those two modes. You can also switch between those modes programmatically or start the SDK in the Measure
mode by providing a custom configuration object at initialization:
enum OperatingMode {
positioning,
measure,
}
var mode = await ShenaiSdk.getOperatingMode();
ShenaiSdk.setOperatingMode(OperatingMode.measure);
ShenaiSdk.setOperatingMode(OperatingMode.positioning);
PrecisionMode
By default, the SDK will use the strict precision mode, which will only return results if the signal quality is high enough (the threshold is determined by tests on MX Labs' internal datasets with high-quality ECG-based Ground Truth). You may choose to use the relaxed precision mode, which will return results even if the signal quality is low.
Strict
: the SDK will only return results if the signal quality is high enough. This is the default mode after the SDK is initialized.Relaxed
: the SDK will return results on a best-effort basis. The results obtained in this mode should not be relied upon and represent the best guess given the current conditions.
enum PrecisionMode {
strict,
relaxed,
}
var mode = await ShenaiSdk.getPrecisionMode();
ShenaiSdk.setPrecisionMode(PrecisionMode.strict);
ShenaiSdk.setPrecisionMode(PrecisionMode.relaxed);
MeasurementPreset
At this time, the following measurement presets are available:
OneMinuteHrHrvBr
: a one-minute measurement that returns Heart Rate, Heart Rate Variability and Breathing Rate. This is the default preset after the SDK is initialized.OneMinuteBetaMetrics
: a one-minute measurement that includes metrics that are currently in beta - Blood Pressure and Stress IndexInfiniteHr
: an infinite measurement that provides continous Heart Rate without any end condition.
In addition, the following unvalidated presets are available which allow for shorter measurement times:
FourtyFiveSecondsUnvalidated
: a 45 seconds measurement that includes all metricsThirtySecondsUnvalidated
: a 30 seconds measurement that includes all metrics
Please be aware that results from shorter measurement times have not been validated and might result in less accurate or less reliable metrics. This is particularly relevant for Heart Rate Variability (HRV) and Stress Index computations. These metrics depend on the analysis of variations in inter-beat intervals, which requires capturing a sufficient number of heartbeats to provide a reliable picture of autonomic nervous system activity. Shorter measurements might not provide enough data, leading to potential misinterpretations. Additionally, the precision of Blood Pressure computations may also be affected by shorter measurement times. For meaningful and reliable computations of HRV, Stress Index, and Blood Pressure, longer measurement times are strongly recommended.
enum MeasurementPreset {
oneMinuteHrHrvBr,
oneMinuteBetaMetrics,
infiniteHr,
fourtyFiveSecondsUnvalidated,
thirtySecondsUnvalidated,
}
var preset = await ShenaiSdk.getMeasurementPreset();
ShenaiSdk.setMeasurementPreset(MeasurementPreset.oneMinuteHrHrvBr);
ShenaiSdk.setMeasurementPreset(MeasurementPreset.oneMinuteBetaMetrics);
ShenaiSdk.setMeasurementPreset(MeasurementPreset.infiniteHr);
ShenaiSdk.setMeasurementPreset(MeasurementPreset.fourtyFiveSecondsUnvalidated);
ShenaiSdk.setMeasurementPreset(MeasurementPreset.thirtySecondsUnvalidated);
CameraMode
The SDK can be in one of three camera modes:
Off
: the camera is turned off.FacingUser
: the user-facing camera of the device is used (such as the front camera on a phone). This is the default mode after the SDK is initialized.FacingEnvironment
: the outside-facing camera of the device is used (such as the back camera on a phone).
enum CameraMode {
off,
facingUser,
facingEnvironment,
}
var mode = await ShenaiSdk.getCameraMode();
ShenaiSdk.setCameraMode(CameraMode.off);
ShenaiSdk.setCameraMode(CameraMode.facingUser);
ShenaiSdk.setCameraMode(CameraMode.facingEnvironment);
Preview settings
You can customize the user feedback interface by changing the following settings:
ShowUserInterface
controls whether the user feedback interface is shown. If set tofalse
, the SDK will not display any interactive elements such as the START/STOP button.ShowFacePositioningOverlay
controls whether the face positioning overlay is shown. If set tofalse
, the SDK will not display the overlay that guides the user to position their face correctly.ShowVisualWarnings
controls whether visual warnings are shown. If set tofalse
, the SDK will not display any visual warnings such as the red bulb that indicates that the signal quality is low.EnableCameraSwap
controls whether the user can switch between the front and back camera. If set tofalse
, the user will not be able to switch between the front and back camera.ShowFaceMask
controls whether the face mask visualization is shown. If set tofalse
, the SDK will not display the 3d face mask visualization.ShowBloodFlow
controls whether the blood flow visualization is shown. If set tofalse
, the SDK will not display the blood flow visualization as an overlay on the user's face.EnableStartAfterSuccess
controls whether the START button is available after a successful measurement. If set tofalse
, the START button will not be available after a successful measurement until the SDK is reinitialized.
ShenaiSdk.setShowUserInterface(true);
ShenaiSdk.getShowUserInterface();
ShenaiSdk.setShowFacePositioningOverlay(true);
ShenaiSdk.getShowFacePositioningOverlay();
ShenaiSdk.setShowVisualWarnings(true);
ShenaiSdk.getShowVisualWarnings();
ShenaiSdk.setEnableCameraSwap(true);
ShenaiSdk.getEnableCameraSwap();
ShenaiSdk.setShowFaceMask(true);
ShenaiSdk.getShowFaceMask();
ShenaiSdk.setShowBloodFlow(true);
ShenaiSdk.getShowBloodFlow();
ShenaiSdk.setEnableStartAfterSuccess(true);
ShenaiSdk.getEnableStartAfterSuccess();
Developer settings
The following settings are intended to be used by developers and shouldn't be exposed to the end user.
Measurement recording
The SDK can record the measurement video and send it to MX Labs for analysis. This is useful for debugging failure cases and registering edge cases. The recording is not saved on the device and is only available to MX Labs.
Whenever recording mode is active, the SDK will display a red dot in the top right corner of the preview. For debugging, it's also possible to activate recording mode by tapping three times on the Heart Rate tile.
One minute of recorded video is approximately 200 MB in size (lossless compression is used).
Shenaisdk.setRecordingEnabled(true);
Shenaisdk.getRecordingEnabled();