This repository was archived by the owner on Apr 28, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathanalysis.proto
248 lines (224 loc) · 5.34 KB
/
analysis.proto
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
syntax = "proto3";
package apipb;
import "datasetmodels.proto";
option go_package = "otsimopb";
option java_package = "com.otsimo.grpc";
option java_multiple_files = true;
message TimeRange {
// From is the unix seconds time
int64 from = 1;
// To is the unix seconds time
int64 to = 2;
}
message ChildAndProfileIds {
// ChildId
string child_id = 1;
// ProfileId
string profile_id = 2;
}
message ChildAndTimeRange {
// ChildId
string child_id = 1;
// ProfileId
string profile_id = 2;
// Range is the time range
TimeRange range = 3;
}
message GameWithVersions {
// GameId
string game_id = 1;
// Versions
repeated string versions = 2;
}
message PlayedGamesList {
repeated GameWithVersions games = 1;
// ChildId
string child_id = 2;
// Range is the time range
TimeRange range = 3;
}
message QuerySort {
enum SortOrder {
ASC = 0;
DSC = 1;
}
string field_name = 1;
SortOrder order = 2;
}
message Aggregation {
enum Accumulator {
NONE = 0;
COUNT = 1;
SUM = 2;
MAX = 3;
MIN = 4;
AVG = 5;
STD_SAMP = 6;
STD_POP = 7;
}
string field_name = 1;
string output_field = 2;
Accumulator accumulator = 3;
}
message GroupInterval {
// For ContinuesInterval
int32 int = 1;
// For ContinuesInterval
float real = 2;
// For Datetime
int32 days = 3;
// For Datetime
int32 hours = 4;
// For TimeOfDay
bool minutes = 5;
// For TimeOfDay
bool seconds = 6;
}
message QueryGroup {
enum GroupType {
// Date gives rows each day of given timeRange
Date = 0;
// Datetime gives rows on given interval
Datetime = 1;
// TimeofDay gives rows on time of day. minutes and seconds on interval
// value determines interval. ex: if minutes and seconds are false then rows
// will be 0,1,2,3,4 ex: if minutes is true then rows will be
// 00:00,00:01,00:02,... when seconds is true than minutes is always true
TimeOfDay = 2;
// Discrete should be used for String values
Discrete = 3;
// ContinuesInterval is for number values
ContinuesInterval = 4;
}
string field_name = 1;
GroupType type = 2;
// Interval is optional for Date and Discrete type
GroupInterval interval = 3;
string output_field = 4;
// Timezone Offset in seconds
int32 timezone_seconds = 5;
}
message Query {
repeated string events = 1;
TimeRange range = 2;
repeated QuerySort sort = 3;
int32 limit = 4;
int32 offset = 5;
QueryGroup group_by = 6;
repeated Aggregation aggregations = 7;
repeated bytes raw_queries = 8;
}
message AnalyzeRequest {
// ChildId
string child_id = 1;
// ProfileId
string profile_id = 2;
// UseAppData changes data source
bool use_app_data = 3;
// Query is calculation query
Query query = 6;
// Games are the compute this request on
repeated GameWithVersions games = 7;
}
message AnalyzeResult {
// Request
AnalyzeRequest request = 1;
// Data
DataSet data = 2;
// Created At
int64 created_at = 3;
}
// Active Users
message ActiveUsersRequest {
enum Type {
MONTLY = 0;
DAILY = 1;
NEW = 2;
TOTAL = 3;
}
Type type = 1;
repeated int64 dates = 2;
string app_id = 3;
}
message ActiveUsersResult {
// Request
ActiveUsersRequest request = 1;
// Data
DataSet data = 2;
// Created At
int64 created_at = 3;
}
// Retention
message RetentionRequest {
enum Type {
ONE = 0;
SEVEN = 1;
THIRTY = 2;
}
Type type = 1;
repeated int64 dates = 2;
string app_id = 3;
}
message RetentionResult {
// Request
RetentionRequest request = 1;
// Data
DataSet data = 2;
// Created At
int64 created_at = 3;
}
message InactiveUsersRequest {
string app_id = 1;
TimeRange inactive_during = 2;
TimeRange active_during = 3;
}
message GetActiveUsersRequest {
string app_id = 1;
TimeRange period = 2;
}
message ActiveOnRangeRequest {
TimeRange range = 1;
repeated string country_codes = 2;
repeated string app_ids = 3;
}
message GameInfoResponse {
enum FieldType {
UNKNOWN = 0;
STRING = 1;
INTEGER = 2;
FLOAT = 3;
BOOL = 4;
}
message FieldInfo {
string name = 1;
FieldType type = 2;
}
message EventInfo {
string name = 1;
repeated FieldInfo fields = 2;
}
string game_id = 1;
repeated EventInfo events = 2;
}
message AppDataInfoReq {}
service AnalysisService {
// ActiveOnRange returns child ids who active given time range
rpc ActiveOnRange(ActiveOnRangeRequest) returns (stream ChildAndProfileIds);
// Inactive calculates inactive users who was active given period but not
// after at given app
rpc Inactive(InactiveUsersRequest) returns (stream ChildAndProfileIds);
// Active streams active user on given period
rpc Active(GetActiveUsersRequest) returns (stream ChildAndProfileIds);
// PlayedGames returns games played during given time range
rpc PlayedGames(ChildAndTimeRange) returns (PlayedGamesList);
// Analyze calculates given request
rpc Analyze(AnalyzeRequest) returns (AnalyzeResult);
// ActiveUsers calculates MAU, DAU
rpc ActiveUsers(ActiveUsersRequest) returns (ActiveUsersResult);
// Retention returns retentation
rpc Retention(RetentionRequest) returns (RetentionResult);
// GameInfo returns available events of a game
rpc GameInfo(GameWithVersions) returns (GameInfoResponse);
// AppDataInfo returns available events and their fields
rpc AppDataInfo(AppDataInfoReq) returns (GameInfoResponse);
}