Data Integration
Biomarkers
Overview
Sahha analyzes user data such as sleep, steps and more to create daily biomarkers which you can display to your users.
Use the the getBiomarkers
method to return a variety of Sahha Digital Biomarkers .
Consider exploring our design principles for best practices around displaying Sahha data.
Biomarker Categories and Types
Every biomarker has both a category and type.
To use getBiomarkers
you must include both the category and type of that biomarker.
A complete list of biomarker categories and types can be found here .
Get biomarkers for today
Get the most recent biomarkers for the current day in the user's local timezone.
// Get biomarkers for last 24 hours
Sahha.getBiomarkers( categories: [.activity, .sleep, .vitals], types: [.steps, .sleep_duration, .heart_rate], startDateTime: .now, endDateTime: .now) { error, json in if let error = error { print(error) } else if let json = json { print(json) }}
Get biomarkers for the last week
You can provide a data range if you would like to receive multiple biomarkers over a specific time period. The response will include an array of biomarkers for each 24 hour segment in that time period.
// Get biomarkers for last 7 days// Add a date range
let today = Date()let sevenDaysAgo = Calendar.current.date(byAdding: .day, value: -7, to: today) ?? Date()
Sahha.getBiomarkers( categories: [.activity, .sleep, .vitals], types: [.steps, .sleep_duration, .heart_rate], startDateTime: sevenDaysAgo, endDateTime: today) { error, json in if let error = error { print(error) } else if let json = json { print(json) }}
Biomarker response
Biomarkers are generated via the Sahha API.
Biomarkers are returned as an array of objects in JSON format.
- Parameters :
-
id
: UUID for the sample -
category
: The category of the biomarker (activity
,sleep
, etc.) -
type
: The type of the biomarker (steps
,sleep_start_time
, etc.) -
startDateTime
: Start date-time in"yyyy-MM-dd'T'HH:mm:ss.SSZZZZZ"
format ("2021-10-27T16:34:06-06:00"
) -
endDateTime
: End date-time in"yyyy-MM-dd'T'HH:mm:ss.SSZZZZZ"
format ("2021-10-27T16:44:06-06:00"
) -
periodicity
: The periodicity of the biomarker (hourly
,daily
,weekly
, etc.)aggregation
: The aggregation of the biomarker (total
,average
, etc.) -
value
: Value of the biomarker (100
,200
, etc.) -
valueType
: The type of value of the biomarker (long
,double
,datetime
, etc.) -
unit
: The unit for measuring the value (count
,minute
,kg
,bpm
, etc.)
-
Array response
The response will be in JSON format. An example response includes these fields:
[ { "id": "ca4f0f27-b972-55e6-b401-617dbd0030ba", "category": "activity", "type": "active_hours", "periodicity": "daily", "aggregation": "total", "value": "1", "unit": "hour", "valueType": "long", "startDateTime": "2024-12-16T15:00:00+00:00", "endDateTime": "2024-12-17T14:59:59+00:00" }, { "id": "73f15c2d-fae6-5239-a040-80f7429d2d1c", "category": "sleep", "type": "sleep_duration", "periodicity": "daily", "aggregation": "total", "value": "439", "unit": "minute", "valueType": "long", "startDateTime": "2024-12-16T09:00:00+00:00", "endDateTime": "2024-12-17T08:59:59+00:00" }, { "id": "82cbebfd-0452-577e-b1dc-e076541bad70", "category": "sleep", "type": "sleep_end_time", "periodicity": "daily", "aggregation": "none", "value": "2024-12-17T07:58:56+09:00", "unit": "datetime", "valueType": "datetime", "startDateTime": "2024-12-16T09:00:00+00:00", "endDateTime": "2024-12-17T08:59:59+00:00" }, { "id": "089a57fb-11bc-5c08-9180-cebd090e5771", "category": "sleep", "type": "sleep_efficiency", "periodicity": "daily", "aggregation": "none", "value": "0.988", "unit": "percentage", "valueType": "double", "startDateTime": "2024-12-16T09:00:00+00:00", "endDateTime": "2024-12-17T08:59:59+00:00" }, { "id": "4ba012c7-9a31-5368-83f9-c22d12a13f15", "category": "sleep", "type": "sleep_latency", "periodicity": "daily", "aggregation": "none", "value": "0", "unit": "minute", "valueType": "long", "startDateTime": "2024-12-16T09:00:00+00:00", "endDateTime": "2024-12-17T08:59:59+00:00" }, { "id": "84d31d96-abbe-5e19-a664-7728a86aee33", "category": "vitals", "type": "oxygen_saturation", "periodicity": "daily", "aggregation": "average", "value": "0.976666666666667", "unit": "percentage", "valueType": "double", "startDateTime": "2024-12-17T15:00:00+00:00", "endDateTime": "2024-12-18T14:59:59+00:00" }, { "id": "4676bfee-0ca1-5616-a711-0d75e07ba58d", "category": "vitals", "type": "heart_rate_sleep", "periodicity": "daily", "aggregation": "average", "value": "72", "unit": "bpm", "valueType": "long", "startDateTime": "2024-12-17T15:00:00+00:00", "endDateTime": "2024-12-18T14:59:59+00:00" }, { "id": "4e46a8a2-9d4f-53cd-9e15-e84f80e21e43", "category": "vitals", "type": "skin_temperature_sleep", "periodicity": "daily", "aggregation": "average", "value": "36.5630722045898", "unit": "celsius", "valueType": "double", "startDateTime": "2024-12-18T15:00:00+00:00", "endDateTime": "2024-12-19T14:59:59+00:00" }, { "id": "8727cd3b-2890-56b3-8586-048982182b9f", "category": "vitals", "type": "oxygen_saturation", "periodicity": "daily", "aggregation": "average", "value": "0.967857142857143", "unit": "percentage", "valueType": "double", "startDateTime": "2024-12-18T15:00:00+00:00", "endDateTime": "2024-12-19T14:59:59+00:00" }, { "id": "376797f4-2068-5b42-90e2-53b575c40bc6", "category": "vitals", "type": "oxygen_saturation_sleep", "periodicity": "daily", "aggregation": "average", "value": "0.965", "unit": "percentage", "valueType": "double", "startDateTime": "2024-12-18T15:00:00+00:00", "endDateTime": "2024-12-19T14:59:59+00:00" }, { "id": "b9076521-a09d-5624-9784-2f51a85d4c89", "category": "vitals", "type": "heart_rate_variability_sdnn", "periodicity": "daily", "aggregation": "average", "value": "47.8524671307249", "unit": "millisecond", "valueType": "double", "startDateTime": "2024-12-18T15:00:00+00:00", "endDateTime": "2024-12-19T14:59:59+00:00" }, { "id": "93b34b6f-8a5e-5edd-ac0d-b6a5107a39c2", "category": "vitals", "type": "heart_rate_sleep", "periodicity": "daily", "aggregation": "average", "value": "66", "unit": "bpm", "valueType": "long", "startDateTime": "2024-12-18T15:00:00+00:00", "endDateTime": "2024-12-19T14:59:59+00:00" }]
Empty response
An empty JSON but successful response.
MINIMUM DATA REQUIREMENTS
The analysis engine requires a minimum amount of device sensor data to be uploaded and processed before an analysis can be determined.
If you call getBiomarkers
for a new user profile or a user that has been inactive lately, it's possible for the response to be 204 No Content
. This is not an error.
You will need to wait and try again every few hours until a biomarker is available.
// A biomarker is not ready yet// Try again in a few hours// Empty JSON{}
Data sources
Data sources are required to generate a biomarker.
The biomarker is created from various data sources
To receive a biomarker, a minimum of one data source must be configured by the SDK.
The more data sources that you configure via the SDK, the better the biomarker that will be generated.
Some data sources are not yet available on all platforms. Sahha continues to improve its analysis engine by bringing feature parity between platforms as well as adding new data sources.
Data Source | Description | Android | iOS |
---|---|---|---|
sleep | User sleep patterns | ✓ | ✓ |
steps | User walking patterns | ✓ | ✓ |
screen | User device screen time | ✓ | X |
heart | User heart patterns | ✓ | ✓ |
blood | User blood patterns | ✓ | ✓ |
age | User age | ✓ | ✓ |
gender | User gender | ✓ | ✓ |
Device sensors
Use Sensors as a Data Source
Learn how to configure device sensors to collect data.
Demographics
Use Demographics as a Data Source
Learn how to configure demographics as a data source.