将特定数据类型或数据采集器的数据按一定规则分组。
POST https://health-api.cloud.huawei.com/hihealth/v1/sampleSet:polymerize
NA
参数名称 | 参数类型 | 参数描述 | 可选/必选 | 约束说明 |
|---|---|---|---|---|
startTime | long | 期望被聚合的数据开始时间,单位:毫秒,未配置表示从0开始 | 可选 | 13位整数的时间戳 |
endTime | long | 期望被聚合的数据结束时间,单位:毫秒 | 必选 | 13位整数的时间戳。 endTime需大于startTime。 endTime与startTime时间间隔不能超过90天 |
polymerizeWith | list<PolymerizeWith> | 聚合数据的标准。 至少提供一个聚合标准。每个聚合标准产生一个汇总采样数据集 | 必选 | List最大容量:20 |
groupByTime | GroupByTime | 指定数据由时间间隔聚合数据 | 参数互斥,同时只能一个生效 | |
groupByActivityRecord | GroupByActivityRecord | 按用户活动记录聚合数据 | ||
groupByActivityType | GroupByActivityType | 按活动类型聚合数据 | ||
groupByActivityFragment | GroupByActivityFragment | 按活动片段聚合数据 |
PolymerizeWith结构:
参数名称 | 参数类型 | 参数描述 | 可选/必选 | 约束说明 |
|---|---|---|---|---|
dataTypeName | string | 要聚合的数据类型。属于此类型的数据都会被聚合到一起 | 参数互斥,必须且只能配置其中之一 | 长度范围:1~300 |
dataCollectorId | string | 要聚合的数据采集器ID。 | 需满足如下拼接规则:collectorType:collectorDataType.name: appInfo.appPackageName:deviceInfo.manufacturer: deviceInfo.modelNum:deviceInfo.uniqueId:collectorName。参考dataCollectors: create中collectorId的约束 |
GroupByTime结构:
参数名称 | 参数类型 | 参数描述 | 可选/必选 | 约束说明 |
|---|---|---|---|---|
duration | long | 按时间间隔分组数据,单位:毫秒 | 参数互斥,至多配置其中之一 | 配置时必须大于0 |
groupPeriod | GroupByTimeGroupPeriod | 时间周期 | 配置时必须大于0 |
GroupByTimeGroupPeriod结构:
参数名称 | 参数类型 | 参数描述 | 可选/必选 | 约束说明 |
|---|---|---|---|---|
unit | string | 时间类型 | 必选 | 可支持的取值如下: "day" "month" "week" |
value | integer | 聚合周期值,需要和unit组合使用 | 必选 | |
timeZone | string | 时区 | 必选 | 参考org.joda.timezone.DateTimeZone,不支持"HST", "MST", "EST" |
GroupByActivityRecord结构:
参数名称 | 参数类型 | 参数描述 | 可选/必选 | 约束说明 |
|---|---|---|---|---|
minDuration | long | 指定参与聚合的活动记录的最短持续时间,单位:毫秒 | 可选 |
GroupByActivityType结构:
参数名称 | 参数类型 | 参数描述 | 可选/必选 | 约束说明 |
|---|---|---|---|---|
minDuration | long | 指定参与聚合的活动片段的最短持续时间,单位:毫秒 | 可选 | |
activityDataCollectorId | string | 数据采集器ID,如未指定使用默认值 | 可选 | 需满足如下拼接规则:collectorType:collectorDataType.name: appInfo.appPackageName:deviceInfo.manufacturer: deviceInfo.modelNum:deviceInfo.uniqueId:collectorName。参考dataCollectors: create中collectorId的约束。 其中,collectorDataType.name必须为com.huawei.continuous.activity.fragment |
GroupByActivityFragment结构:
参数名称 | 参数类型 | 参数描述 | 可选/必选 | 约束说明 |
|---|---|---|---|---|
minDuration | long | 指定参与聚合的活动片段的最短持续时间,单位:毫秒 | 可选 | |
activityDataCollectorId | string | 数据采集器ID,如未指定使用默认值 | 可选 | 需满足如下拼接规则:collectorType:collectorDataType.name: appInfo.appPackageName:deviceInfo.manufacturer: deviceInfo.modelNum:deviceInfo.uniqueId:collectorName。参考dataCollectors: create中collectorId的约束。 其中,collectorDataType.name必须为com.huawei.continuous.activity.fragment |
参数名称 | 参数类型 | 参数描述 | 可选/必选 |
|---|---|---|---|
group | list<Group> | 包含汇总数据的组列表 | 必选 |
Group结构:
参数名称 | 参数类型 | 参数描述 | 可选/必选 |
|---|---|---|---|
startTime | long | 聚合数据组的开始时间,单位:毫秒 | 必选 |
endTime | long | 聚合数据组的结束时间,单位:毫秒 | 必选 |
sampleSet | list<SampleSet> | 该请求中每个PolymerizeWith将有一个采样数据集 | 必选 |
activityRecord | ActivityRecord | 聚合数据组关联的活动记录 | 可选 |
activityType | integer | 聚合数据组关联的活动类型 | 可选 |
成功:http 200
失败:其他
POST
https://health-api.cloud.huawei.com/hihealth/v1/sampleSet:polymerize
Content-Type: application/json
Authorization: Bearer ***
{
"polymerizeWith": [
{
"dataCollectorId": "derived:com.huawei.continuous.height.statistics:com.huawei.hms.hihealth.service:polymerized",
"dataTypeName": "com.huawei.instantaneous.height"
}
],
"endTime": 1563157870001,
"startTime": 1563157860000,
"groupByTime": {
"duration": 3600
}
} HTTP 200 OK
{
"group": [
{
"startTime": "1563157860000",
"endTime": "1563157863600",
"sampleSet": [
{
"dataCollectorId": "derived:com.huawei.continuous.height.statistics:com.huawei.hms.hihealth.service:polymerized",
"samplePoints": [
{
"startTime": "1563157860000000000",
"endTime": "1563157860000000000",
"dataTypeName": "com.huawei.continuous.height.statistics",
"originalDataCollectorId": "raw:com.huawei.instantaneous.height:300013103:google:mp:123456789011",
"value": [
{
"floatValue": 0.8,
"mapValue": []
},
{
"floatValue": 0.8,
"mapValue": []
},
{
"floatValue": 0.8,
"mapValue": []
}
]
}
]
}
]
},
{
"startTime": "1563157863600",
"endTime": "1563157867200",
"sampleSet": [
{
"dataCollectorId": "derived:com.huawei.continuous.height.statistics:com.huawei.hms.hihealth.service:polymerized",
"samplePoints": []
}
]
},
{
"startTime": "1563157867200",
"endTime": "1563157870001",
"sampleSet": [
{
"dataCollectorId": "derived:com.huawei.continuous.height.statistics:com.huawei.hms.hihealth.service:polymerized",
"samplePoints": []
}
]
}
]
}