See which app or device every value came from

Introduction

A profile usually has more than one source of health data: a phone, a watch, a ring, a connected cloud account. Sahha tells you which of them is behind each value, so you can tell a night of sleep recorded by a watch from one estimated from phone use, or Garmin data read through Apple Health from Garmin data fetched from Garmin’s cloud.

Every record carries a sources list. Each entry is the same source object wherever it appears.

WhereWhat sources holds
BiomarkerEvery source whose data fed the value. The source the value is stored under comes first.
Score factorThe sources of the biomarker behind the factor.
ScoreEvery source behind its factors, each once.
TagThe one source that sent the tag.
ProfileEvery source the profile has received data from, in the order first seen.

sources is returned by the API for all five, and in webhooks for biomarkers, scores and score factors.


The source object

Object

Source

Each entry in a sources list follows this structure:

id UUID

Stable id of this source within the profile

identifier string

The source exactly as it reached Sahha: a bundle id, package name, provider key, sensor name, or the string your backend sent

channel string nullable

How the data reached Sahha. See Channels below

provider string nullable

Whose app or device recorded the data, such as apple, google, samsung, garmin, oura, whoop, fitbit, polar, withings or sahha

deviceType string nullable

Kind of device that recorded the data. See Device types below

deviceModel string nullable

Exact model of the recording device, such as Watch7,19. Null when not reported

Example Source
JSON
{
	"id": "5b1c2f4e-8d3a-5e71-9c0b-2a6f4d8e1b37",
	"identifier": "com.apple.health.38DCF2B6-9397-45C6-A993-0F2D1CD19AF9",
	"channel": "apple_health",
	"provider": "apple",
	"deviceType": "watch",
	"deviceModel": "Watch7,19"
}

id and identifier are always set. The other four fields are null when Sahha does not know the answer. They are never a guess.

Channels

channel says how the data reached Sahha.

ValueMeaning
apple_healthRead from Apple Health by the Sahha SDK
health_connectRead from Health Connect by the Sahha SDK
samsung_healthRead from Samsung Health by the Sahha SDK
phone_sensorsRead by the Sahha SDK from the phone’s own sensors, with no health app involved
provider_cloudFetched from the provider’s cloud through a Sahha integration
api_uploadPosted straight to the Sahha API by you, outside the SDK and the integrations
sahha_estimateEstimated by Sahha where no device measured the value
sahha_sampleDemo data on a sandbox sample profile

The channel is the route the data took, not the device that recorded it. Steps an iPhone counts are stored in Apple Health, so they arrive as apple_health. phone_sensors covers only what the Sahha SDK reads from the sensors itself.

Not returned yet

samsung_health and api_upload are part of the contract but are not returned yet. Until they are, data read from Samsung Health and data you post to the API has a null channel, or the channel Sahha infers from the device model sent with it. Those sources will change to the right channel when support ships.

Device types

deviceType is one of phone, tablet, watch, ring, band, scale, chest_strap, cgm, bp_monitor, earbuds, exercise_equipment or other. It is null when unknown, or when one source records from more than one kind of device.

deviceModel is only set when the source reports an exact model. Apple devices do. Android and cloud sources report a kind of device and no model, so expect null there.

Recording method

Biomarkers and score factors also carry recordingMethod, which says how the data behind the value was captured:

ValueMeaning
automaticRecorded by a device or app without the user typing it in. Sessions the user starts, such as a workout, count as automatic
manualEntered by hand, for example steps or weight typed into Apple Health
mixedBuilt from both automatic and manual data
nullUnknown: the source did not say, or the biomarker does not report it yet

Values Sahha computes take the method of the data they were computed from. Sleep debt from automatically recorded nights is automatic, and so is an active energy estimate made from automatically counted steps. A score factor has the same method as the biomarker it reads.

Not filled everywhere yet

Oxygen saturation, blood glucose, blood pressure, respiratory rate, VO2 max, body and skin temperature, and the app session biomarkers return null for now. Records stored before this release also stay null until they are recalculated.


Sahha’s own sources

Some values are produced by Sahha, not measured by a device. They are listed as sources like any other, with provider set to sahha and an identifier under ai.sahha.

IdentifierChannelWhat it is
ai.sahha.estimate.sleepsahha_estimateSleep estimated from phone use, for nights with no device sleep data
ai.sahha.estimate.active_energysahha_estimateActive energy estimated for days no device reported it
ai.sahha.estimate.resting_energysahha_estimateResting energy estimated for days no device reported it
ai.sahha.samplesahha_sampleDemo data on a sandbox sample profile

A value Sahha combined or estimated lists every source it used, the estimator included. Filter on channel to separate measured values from estimated ones.

ai.sahha is reserved

You cannot upload data under a source that begins with ai.sahha. A data log upload that uses one is rejected with a 400. A tag that uses one is skipped and listed in the response Warnings with code reserved_source.


Building on sources

A few rules keep an integration working as Sahha adds sources and improves how it recognises them.

  • Accept values you have not seen. New channel, provider and deviceType values will be added. Treat an unknown one as you would other.
  • Expect details to be filled in later. Sahha recognises more apps and devices over time, and re-checks sources it already holds. A source’s channel, provider, deviceType or deviceModel can go from null to a value, or be corrected. Its id and identifier never change.
  • Group by provider and device type, not by identifier. Apple Health and Health Connect give each installation its own identifier, so a user who moves to a new phone gets new sources. provider and deviceType stay the same across installs.
  • Older records can have an empty list. Biomarkers and score factors stored before sources were recorded return "sources": [].

Deprecated fields

These fields are still returned, so existing integrations keep working. New work should use sources.

FieldUse instead
source on a tagsources[0].identifier
dataSources on a profilesources

dataSources on a score is a different field and is not deprecated. It lists the biomarker categories the score used, such as sleep or activity.

Support

Need help? Contact support@sahha.ai or join the Slack Community.

Docs