1/*
2 * Copyright (C) 2022 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16syntax = "proto2";
17
18package androidx.health.platform.client.proto;
19
20option java_package = "androidx.health.platform.client.proto";
21option java_outer_classname = "DataProto";
22
23// Unknown data type names will be ignored.
24message DataType {
25  optional string name = 1;
26}
27
28message Value {
29  oneof value {
30    int64 long_val = 1;
31    double double_val = 2;
32    string string_val = 3;
33    string enum_val = 4;
34    bool boolean_val = 5;
35  }
36}
37
38message Device {
39  optional string identifier = 1;
40  optional string manufacturer = 2;
41  optional string model = 3;
42  optional string type = 4;
43}
44
45message DataOrigin {
46  optional string application_id = 1;
47}
48
49message SeriesValue {
50  map<string, Value> values = 1;
51  optional int64 instant_time_millis = 2;
52}
53
54message SubTypeDataValue {
55  map<string, Value> values = 1;
56  optional int64 start_time_millis = 2;
57  optional int64 end_time_millis = 3;
58}
59
60// Next Id: 23
61message DataPoint {
62  optional DataType data_type = 1;
63  map<string, Value> values = 2;
64
65  optional string uid = 3;
66  optional string origin_series_uid = 4;
67  optional DataOrigin data_origin = 5;
68
69  // Unset if it is interval or series data, use start_zone_offset_seconds and
70  // end_zone_offset_seconds instead.
71  optional int32 zone_offset_seconds = 6;
72
73  optional int64 update_time_millis = 7;
74
75  // Unset if interval start/end millis are used.
76  optional int64 instant_time_millis = 8;
77
78  optional int64 start_time_millis = 9;
79  optional int64 end_time_millis = 10;
80
81  optional string client_id = 11;
82  optional int64 client_version = 12;
83  optional Device device = 13;
84
85  optional string origin_sample_uid = 14;
86  repeated SeriesValue series_values = 15;
87  optional AggregatedValue min = 16;
88  optional AggregatedValue max = 17;
89  optional AggregatedValue avg = 18;
90
91  optional int32 start_zone_offset_seconds = 19;
92  optional int32 end_zone_offset_seconds = 20;
93
94  reserved 21; // sub_type_data_values
95
96  map<string, SubTypeDataList> sub_type_data_lists = 22;
97
98  message SubTypeDataList {
99    repeated SubTypeDataValue values = 1;
100  }
101
102  optional int32 recording_method = 23;
103}
104
105message AggregatedValue {
106  map<string, Value> values = 1;
107}
108
109message AggregateDataRow {
110  optional int64 start_time_epoch_ms = 1;
111  optional int64 end_time_epoch_ms = 2;
112  optional string start_local_date_time = 3;
113  optional string end_local_date_time = 4;
114  optional int32 zone_offset_seconds = 5;
115
116  // Key by metric spec {type}_{field}_{agg}
117  map<string, double> double_values = 6;
118  map<string, int64> long_values = 7;
119  repeated DataOrigin data_origins = 8;
120}