Statistics of one quantity type per hour or per local day
Count, sum, mean, min and max of the samples whose start falls in each interval. With
view=merged (the default) each interval holds one row, from the best ranked source
that recorded something in it (see source-priorities), so nothing counts twice; the
choice is made per interval, not per record. With view=all there is one series per
provider, source and unit: a phone and a watch counting the same steps stay apart.
Not paged.
Served from a continuous aggregate when the database has one and tz has a whole-hour
offset over the range, else computed from the samples (same answer). Data written for a
past hour (an imported history, a provider deletion) shows within about 5 minutes.
tenantKeyAuthorizationBearer <token>Tenant API key, ohs_sk_ + 43 base62 characters.
id*stringuuidtype*stringCanonical quantity type, as for listSamples.
interval?stringWidth of the intervals.
"day""hour""day"tz?stringIANA time zone of the intervals; a day runs from local midnight to local midnight.
"UTC"start*|Inclusive lower bound, RFC 3339 or YYYY-MM-DD (midnight in tz). Widened to a whole interval.
end*|Exclusive upper bound, RFC 3339 or YYYY-MM-DD (midnight in tz). Widened to a whole interval; at most 10000 intervals after start.
provider?stringKeep one provider.
view?stringmerged (the default): when several sources recorded the same thing (a ring and a
watch the same night, a phone and a watch the same steps, one sample directly and
through an aggregator), only the best ranked source's record is listed, so nothing
counts twice. The order of sources is the user's (see source-priorities). all:
every stored record of every source.
"merged""merged""all"The intervals that hold samples, by start, provider, source and unit.
application/json- response
type*stringinterval*string"hour""day"tz*stringview*string"merged""all"start*stringStart of the range after widening, with the offset of tz.
date-timeend*stringdate-timetruncated*booleanTrue when more than 50000 rows matched; buckets holds the earliest.
buckets*array<>curl -X GET 'http://localhost:8080/v1/users/497f6eca-6276-4993-bfeb-53cbbbba6f08/samples/stats?type=string&start=2019-08-24T14%3A15%3A22Z&end=2019-08-24T14%3A15%3A22Z' \ -H 'Authorization: Bearer ohs_sk_...'{ "type": "string", "interval": "hour", "tz": "string", "view": "merged", "start": "2019-08-24T14:15:22Z", "end": "2019-08-24T14:15:22Z", "truncated": true, "buckets": [ { "start": "2019-08-24T14:15:22Z", "provider": "string", "source": "string", "unit": "string", "count": 0, "sum": 0, "avg": 0, "min": 0, "max": 0 } ]}