From 22c42de4b762358cf59e7ba51da411ec77762985 Mon Sep 17 00:00:00 2001 From: chejennifer <69875368+chejennifer@users.noreply.github.com> Date: Fri, 24 Feb 2023 12:02:50 -0800 Subject: [PATCH] Add minimum number of entities for svg nodes (#1038) Add field to indicate number of entities that should have data for the stat vars and stat var groups returned for VariableGroupInfo --- internal/proto/event.pb.go | 1 + internal/proto/info.pb.go | 89 ++++++---- internal/proto/stat_var.pb.go | 167 ++++++++++-------- internal/server/statvar/statvar_group.go | 30 ++-- .../bulk_variable_group_info/crime_1.json | 39 ++++ .../bulk_variable_group_info/crime_10.json | 38 ++++ .../golden/bulk_variable_group_info_test.go | 25 ++- internal/server/v1/info/variable_group.go | 11 +- proto/stat_var.proto | 3 + proto/v1/info.proto | 14 +- 10 files changed, 285 insertions(+), 132 deletions(-) create mode 100644 internal/server/v1/info/golden/bulk_variable_group_info/crime_1.json create mode 100644 internal/server/v1/info/golden/bulk_variable_group_info/crime_10.json diff --git a/internal/proto/event.pb.go b/internal/proto/event.pb.go index 00a774277..8fbea5691 100644 --- a/internal/proto/event.pb.go +++ b/internal/proto/event.pb.go @@ -681,6 +681,7 @@ type EventCollection_GeoLocation_Point struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields + // optional is needed here to prevent 0 values from getting dropped. Latitude *float64 `protobuf:"fixed64,1,opt,name=latitude,proto3,oneof" json:"latitude,omitempty"` Longitude *float64 `protobuf:"fixed64,2,opt,name=longitude,proto3,oneof" json:"longitude,omitempty"` } diff --git a/internal/proto/info.pb.go b/internal/proto/info.pb.go index 6085acfae..3a7fda63c 100644 --- a/internal/proto/info.pb.go +++ b/internal/proto/info.pb.go @@ -434,9 +434,12 @@ type VariableGroupInfoRequest struct { // The variable group dcid to query for. Node string `protobuf:"bytes,1,opt,name=node,proto3" json:"node,omitempty"` // The entities that the variable group is associated with. The response should - // only contain the child variable (group) if it has data for at least one - // of the entities. + // only contain the child variable (group) if it has data for at least + // num_entities_existence number of entities. ConstrainedEntities []string `protobuf:"bytes,2,rep,name=constrained_entities,json=constrainedEntities,proto3" json:"constrained_entities,omitempty"` + // Number of passed in entities that should have data for the stat var + // (group)s that are returned + NumEntitiesExistence int32 `protobuf:"varint,4,opt,name=num_entities_existence,json=numEntitiesExistence,proto3" json:"num_entities_existence,omitempty"` } func (x *VariableGroupInfoRequest) Reset() { @@ -485,6 +488,13 @@ func (x *VariableGroupInfoRequest) GetConstrainedEntities() []string { return nil } +func (x *VariableGroupInfoRequest) GetNumEntitiesExistence() int32 { + if x != nil { + return x.NumEntitiesExistence + } + return 0 +} + type VariableGroupInfoResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -548,9 +558,12 @@ type BulkVariableGroupInfoRequest struct { // (optional) The variable group dcids to query for. // If not specified, then return all the variable group info. Nodes []string `protobuf:"bytes,1,rep,name=nodes,proto3" json:"nodes,omitempty"` - // (optional) When specified, only return the variable groups that the entities - // have data for. + // (optional) When specified, only return the variable groups that at least + // num_entities_existence number of entities has data for. ConstrainedEntities []string `protobuf:"bytes,2,rep,name=constrained_entities,json=constrainedEntities,proto3" json:"constrained_entities,omitempty"` + // (optional) Number of passed in entities that should have data for the stat + // var (group)s that are returned. Default to 1 if unspecified. + NumEntitiesExistence int32 `protobuf:"varint,4,opt,name=num_entities_existence,json=numEntitiesExistence,proto3" json:"num_entities_existence,omitempty"` } func (x *BulkVariableGroupInfoRequest) Reset() { @@ -599,6 +612,13 @@ func (x *BulkVariableGroupInfoRequest) GetConstrainedEntities() []string { return nil } +func (x *BulkVariableGroupInfoRequest) GetNumEntitiesExistence() int32 { + if x != nil { + return x.NumEntitiesExistence + } + return 0 +} + type BulkVariableGroupInfoResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -685,33 +705,40 @@ var file_v1_info_proto_rawDesc = []byte{ 0x12, 0x38, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x56, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x61, 0x0a, 0x18, 0x56, 0x61, - 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x49, 0x6e, 0x66, 0x6f, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x6f, 0x64, 0x65, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x6f, 0x64, 0x65, 0x12, 0x31, 0x0a, 0x14, 0x63, 0x6f, - 0x6e, 0x73, 0x74, 0x72, 0x61, 0x69, 0x6e, 0x65, 0x64, 0x5f, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x69, - 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x13, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x72, - 0x61, 0x69, 0x6e, 0x65, 0x64, 0x45, 0x6e, 0x74, 0x69, 0x74, 0x69, 0x65, 0x73, 0x22, 0x62, 0x0a, - 0x19, 0x56, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x49, 0x6e, - 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x6f, - 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x6f, 0x64, 0x65, 0x12, 0x31, - 0x0a, 0x04, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x64, - 0x61, 0x74, 0x61, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x73, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x56, - 0x61, 0x72, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4e, 0x6f, 0x64, 0x65, 0x52, 0x04, 0x69, 0x6e, 0x66, - 0x6f, 0x22, 0x67, 0x0a, 0x1c, 0x42, 0x75, 0x6c, 0x6b, 0x56, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, - 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x12, 0x14, 0x0a, 0x05, 0x6e, 0x6f, 0x64, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, - 0x52, 0x05, 0x6e, 0x6f, 0x64, 0x65, 0x73, 0x12, 0x31, 0x0a, 0x14, 0x63, 0x6f, 0x6e, 0x73, 0x74, - 0x72, 0x61, 0x69, 0x6e, 0x65, 0x64, 0x5f, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x69, 0x65, 0x73, 0x18, - 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x13, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x72, 0x61, 0x69, 0x6e, - 0x65, 0x64, 0x45, 0x6e, 0x74, 0x69, 0x74, 0x69, 0x65, 0x73, 0x22, 0x5e, 0x0a, 0x1d, 0x42, 0x75, - 0x6c, 0x6b, 0x56, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x49, - 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3d, 0x0a, 0x04, 0x64, - 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x64, 0x61, 0x74, 0x61, - 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x56, 0x61, 0x72, 0x69, 0x61, - 0x62, 0x6c, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x42, 0x09, 0x5a, 0x07, 0x2e, 0x2f, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x6f, 0x6e, 0x73, 0x65, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x97, 0x01, 0x0a, 0x18, 0x56, + 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x49, 0x6e, 0x66, 0x6f, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x6f, 0x64, 0x65, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x6f, 0x64, 0x65, 0x12, 0x31, 0x0a, 0x14, 0x63, + 0x6f, 0x6e, 0x73, 0x74, 0x72, 0x61, 0x69, 0x6e, 0x65, 0x64, 0x5f, 0x65, 0x6e, 0x74, 0x69, 0x74, + 0x69, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x13, 0x63, 0x6f, 0x6e, 0x73, 0x74, + 0x72, 0x61, 0x69, 0x6e, 0x65, 0x64, 0x45, 0x6e, 0x74, 0x69, 0x74, 0x69, 0x65, 0x73, 0x12, 0x34, + 0x0a, 0x16, 0x6e, 0x75, 0x6d, 0x5f, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x69, 0x65, 0x73, 0x5f, 0x65, + 0x78, 0x69, 0x73, 0x74, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x14, + 0x6e, 0x75, 0x6d, 0x45, 0x6e, 0x74, 0x69, 0x74, 0x69, 0x65, 0x73, 0x45, 0x78, 0x69, 0x73, 0x74, + 0x65, 0x6e, 0x63, 0x65, 0x22, 0x62, 0x0a, 0x19, 0x56, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65, + 0x47, 0x72, 0x6f, 0x75, 0x70, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x04, 0x6e, 0x6f, 0x64, 0x65, 0x12, 0x31, 0x0a, 0x04, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, + 0x73, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x56, 0x61, 0x72, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4e, 0x6f, + 0x64, 0x65, 0x52, 0x04, 0x69, 0x6e, 0x66, 0x6f, 0x22, 0x9d, 0x01, 0x0a, 0x1c, 0x42, 0x75, 0x6c, + 0x6b, 0x56, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x49, 0x6e, + 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x6e, 0x6f, 0x64, + 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x6e, 0x6f, 0x64, 0x65, 0x73, 0x12, + 0x31, 0x0a, 0x14, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x72, 0x61, 0x69, 0x6e, 0x65, 0x64, 0x5f, 0x65, + 0x6e, 0x74, 0x69, 0x74, 0x69, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x13, 0x63, + 0x6f, 0x6e, 0x73, 0x74, 0x72, 0x61, 0x69, 0x6e, 0x65, 0x64, 0x45, 0x6e, 0x74, 0x69, 0x74, 0x69, + 0x65, 0x73, 0x12, 0x34, 0x0a, 0x16, 0x6e, 0x75, 0x6d, 0x5f, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x69, + 0x65, 0x73, 0x5f, 0x65, 0x78, 0x69, 0x73, 0x74, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x04, 0x20, 0x01, + 0x28, 0x05, 0x52, 0x14, 0x6e, 0x75, 0x6d, 0x45, 0x6e, 0x74, 0x69, 0x74, 0x69, 0x65, 0x73, 0x45, + 0x78, 0x69, 0x73, 0x74, 0x65, 0x6e, 0x63, 0x65, 0x22, 0x5e, 0x0a, 0x1d, 0x42, 0x75, 0x6c, 0x6b, + 0x56, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x49, 0x6e, 0x66, + 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3d, 0x0a, 0x04, 0x64, 0x61, 0x74, + 0x61, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x63, 0x6f, + 0x6d, 0x6d, 0x6f, 0x6e, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x56, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, + 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x42, 0x09, 0x5a, 0x07, 0x2e, 0x2f, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/internal/proto/stat_var.pb.go b/internal/proto/stat_var.pb.go index af711fb52..6ee444feb 100644 --- a/internal/proto/stat_var.pb.go +++ b/internal/proto/stat_var.pb.go @@ -347,6 +347,9 @@ type GetStatVarGroupNodeRequest struct { // should only contain the children stat var (group) if it has data for at // least one of the entities. Entities []string `protobuf:"bytes,2,rep,name=entities,proto3" json:"entities,omitempty"` + // Number of passed in entities that should have data for the stat var + // (group)s that are returned + NumEntitiesExistence int32 `protobuf:"varint,4,opt,name=num_entities_existence,json=numEntitiesExistence,proto3" json:"num_entities_existence,omitempty"` } func (x *GetStatVarGroupNodeRequest) Reset() { @@ -395,6 +398,13 @@ func (x *GetStatVarGroupNodeRequest) GetEntities() []string { return nil } +func (x *GetStatVarGroupNodeRequest) GetNumEntitiesExistence() int32 { + if x != nil { + return x.NumEntitiesExistence + } + return 0 +} + type GetStatVarPathRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -1762,83 +1772,86 @@ var file_stat_var_proto_rawDesc = []byte{ 0x16, 0x47, 0x65, 0x74, 0x53, 0x74, 0x61, 0x74, 0x56, 0x61, 0x72, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x69, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x65, 0x6e, 0x74, 0x69, 0x74, - 0x69, 0x65, 0x73, 0x4a, 0x04, 0x08, 0x01, 0x10, 0x02, 0x22, 0x64, 0x0a, 0x1a, 0x47, 0x65, 0x74, - 0x53, 0x74, 0x61, 0x74, 0x56, 0x61, 0x72, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4e, 0x6f, 0x64, 0x65, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x24, 0x0a, 0x0e, 0x73, 0x74, 0x61, 0x74, 0x5f, - 0x76, 0x61, 0x72, 0x5f, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x0c, 0x73, 0x74, 0x61, 0x74, 0x56, 0x61, 0x72, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x12, 0x1a, 0x0a, - 0x08, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x69, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, - 0x08, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x69, 0x65, 0x73, 0x4a, 0x04, 0x08, 0x03, 0x10, 0x04, 0x22, - 0x27, 0x0a, 0x15, 0x47, 0x65, 0x74, 0x53, 0x74, 0x61, 0x74, 0x56, 0x61, 0x72, 0x50, 0x61, 0x74, - 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, 0x2c, 0x0a, 0x16, 0x47, 0x65, 0x74, 0x53, - 0x74, 0x61, 0x74, 0x56, 0x61, 0x72, 0x50, 0x61, 0x74, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, - 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, 0x22, 0x6f, 0x0a, 0x0f, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, - 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x53, 0x56, 0x47, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x63, 0x69, - 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x64, 0x63, 0x69, 0x64, 0x12, 0x12, 0x0a, - 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, - 0x65, 0x12, 0x34, 0x0a, 0x09, 0x73, 0x74, 0x61, 0x74, 0x5f, 0x76, 0x61, 0x72, 0x73, 0x18, 0x03, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, - 0x6e, 0x73, 0x2e, 0x45, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x08, 0x73, - 0x74, 0x61, 0x74, 0x56, 0x61, 0x72, 0x73, 0x22, 0x5d, 0x0a, 0x14, 0x53, 0x65, 0x61, 0x72, 0x63, - 0x68, 0x53, 0x74, 0x61, 0x74, 0x56, 0x61, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, - 0x14, 0x0a, 0x05, 0x71, 0x75, 0x65, 0x72, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, - 0x71, 0x75, 0x65, 0x72, 0x79, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x73, 0x18, - 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x73, 0x12, 0x17, 0x0a, - 0x07, 0x73, 0x76, 0x5f, 0x6f, 0x6e, 0x6c, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, - 0x73, 0x76, 0x4f, 0x6e, 0x6c, 0x79, 0x22, 0xad, 0x01, 0x0a, 0x15, 0x53, 0x65, 0x61, 0x72, 0x63, - 0x68, 0x53, 0x74, 0x61, 0x74, 0x56, 0x61, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x12, 0x34, 0x0a, 0x09, 0x73, 0x74, 0x61, 0x74, 0x5f, 0x76, 0x61, 0x72, 0x73, 0x18, 0x01, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, - 0x73, 0x2e, 0x45, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x08, 0x73, 0x74, - 0x61, 0x74, 0x56, 0x61, 0x72, 0x73, 0x12, 0x44, 0x0a, 0x0f, 0x73, 0x74, 0x61, 0x74, 0x5f, 0x76, - 0x61, 0x72, 0x5f, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x1c, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x73, 0x2e, 0x53, 0x65, - 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x53, 0x56, 0x47, 0x52, 0x0d, 0x73, - 0x74, 0x61, 0x74, 0x56, 0x61, 0x72, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x12, 0x18, 0x0a, 0x07, - 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x6d, - 0x61, 0x74, 0x63, 0x68, 0x65, 0x73, 0x22, 0x37, 0x0a, 0x18, 0x47, 0x65, 0x74, 0x53, 0x74, 0x61, - 0x74, 0x56, 0x61, 0x72, 0x53, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x73, 0x74, 0x61, 0x74, 0x5f, 0x76, 0x61, 0x72, 0x73, 0x18, - 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x73, 0x74, 0x61, 0x74, 0x56, 0x61, 0x72, 0x73, 0x22, - 0xe1, 0x01, 0x0a, 0x19, 0x47, 0x65, 0x74, 0x53, 0x74, 0x61, 0x74, 0x56, 0x61, 0x72, 0x53, 0x75, - 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x64, 0x0a, - 0x10, 0x73, 0x74, 0x61, 0x74, 0x5f, 0x76, 0x61, 0x72, 0x5f, 0x73, 0x75, 0x6d, 0x6d, 0x61, 0x72, - 0x79, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x3a, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x63, 0x6f, - 0x6d, 0x6d, 0x6f, 0x6e, 0x73, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x74, 0x61, 0x74, 0x56, 0x61, 0x72, - 0x53, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, - 0x53, 0x74, 0x61, 0x74, 0x56, 0x61, 0x72, 0x53, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x45, 0x6e, - 0x74, 0x72, 0x79, 0x52, 0x0e, 0x73, 0x74, 0x61, 0x74, 0x56, 0x61, 0x72, 0x53, 0x75, 0x6d, 0x6d, - 0x61, 0x72, 0x79, 0x1a, 0x5e, 0x0a, 0x13, 0x53, 0x74, 0x61, 0x74, 0x56, 0x61, 0x72, 0x53, 0x75, - 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, - 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x31, 0x0a, 0x05, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x64, 0x61, - 0x74, 0x61, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x73, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x56, 0x61, - 0x72, 0x53, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, - 0x02, 0x38, 0x01, 0x22, 0x5a, 0x0a, 0x16, 0x47, 0x65, 0x74, 0x53, 0x74, 0x61, 0x74, 0x56, 0x61, - 0x72, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, - 0x05, 0x71, 0x75, 0x65, 0x72, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x71, 0x75, - 0x65, 0x72, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x05, 0x52, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x64, 0x65, 0x62, - 0x75, 0x67, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x64, 0x65, 0x62, 0x75, 0x67, 0x22, - 0xed, 0x01, 0x0a, 0x17, 0x47, 0x65, 0x74, 0x53, 0x74, 0x61, 0x74, 0x56, 0x61, 0x72, 0x4d, 0x61, - 0x74, 0x63, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4d, 0x0a, 0x0a, 0x6d, - 0x61, 0x74, 0x63, 0x68, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x2e, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x73, 0x2e, 0x47, 0x65, - 0x74, 0x53, 0x74, 0x61, 0x74, 0x56, 0x61, 0x72, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x49, 0x6e, 0x66, 0x6f, 0x52, - 0x09, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x49, 0x6e, 0x66, 0x6f, 0x1a, 0x82, 0x01, 0x0a, 0x09, 0x4d, - 0x61, 0x74, 0x63, 0x68, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x19, 0x0a, 0x08, 0x73, 0x74, 0x61, 0x74, - 0x5f, 0x76, 0x61, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x74, 0x61, 0x74, - 0x56, 0x61, 0x72, 0x12, 0x22, 0x0a, 0x0d, 0x73, 0x74, 0x61, 0x74, 0x5f, 0x76, 0x61, 0x72, 0x5f, - 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x73, 0x74, 0x61, 0x74, - 0x56, 0x61, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x63, 0x6f, 0x72, 0x65, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x01, 0x52, 0x05, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x12, 0x20, 0x0a, - 0x0b, 0x65, 0x78, 0x70, 0x6c, 0x61, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x0b, 0x65, 0x78, 0x70, 0x6c, 0x61, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, - 0x09, 0x5a, 0x07, 0x2e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x33, + 0x69, 0x65, 0x73, 0x4a, 0x04, 0x08, 0x01, 0x10, 0x02, 0x22, 0x9a, 0x01, 0x0a, 0x1a, 0x47, 0x65, + 0x74, 0x53, 0x74, 0x61, 0x74, 0x56, 0x61, 0x72, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4e, 0x6f, 0x64, + 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x24, 0x0a, 0x0e, 0x73, 0x74, 0x61, 0x74, + 0x5f, 0x76, 0x61, 0x72, 0x5f, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x0c, 0x73, 0x74, 0x61, 0x74, 0x56, 0x61, 0x72, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x12, 0x1a, + 0x0a, 0x08, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x69, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, + 0x52, 0x08, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x69, 0x65, 0x73, 0x12, 0x34, 0x0a, 0x16, 0x6e, 0x75, + 0x6d, 0x5f, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x69, 0x65, 0x73, 0x5f, 0x65, 0x78, 0x69, 0x73, 0x74, + 0x65, 0x6e, 0x63, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x14, 0x6e, 0x75, 0x6d, 0x45, + 0x6e, 0x74, 0x69, 0x74, 0x69, 0x65, 0x73, 0x45, 0x78, 0x69, 0x73, 0x74, 0x65, 0x6e, 0x63, 0x65, + 0x4a, 0x04, 0x08, 0x03, 0x10, 0x04, 0x22, 0x27, 0x0a, 0x15, 0x47, 0x65, 0x74, 0x53, 0x74, 0x61, + 0x74, 0x56, 0x61, 0x72, 0x50, 0x61, 0x74, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, + 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, + 0x2c, 0x0a, 0x16, 0x47, 0x65, 0x74, 0x53, 0x74, 0x61, 0x74, 0x56, 0x61, 0x72, 0x50, 0x61, 0x74, + 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x74, + 0x68, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, 0x22, 0x6f, 0x0a, + 0x0f, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x53, 0x56, 0x47, + 0x12, 0x12, 0x0a, 0x04, 0x64, 0x63, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, + 0x64, 0x63, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x34, 0x0a, 0x09, 0x73, 0x74, 0x61, 0x74, + 0x5f, 0x76, 0x61, 0x72, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x64, 0x61, + 0x74, 0x61, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x73, 0x2e, 0x45, 0x6e, 0x74, 0x69, 0x74, 0x79, + 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x08, 0x73, 0x74, 0x61, 0x74, 0x56, 0x61, 0x72, 0x73, 0x22, 0x5d, + 0x0a, 0x14, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x53, 0x74, 0x61, 0x74, 0x56, 0x61, 0x72, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x71, 0x75, 0x65, 0x72, 0x79, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x71, 0x75, 0x65, 0x72, 0x79, 0x12, 0x16, 0x0a, 0x06, + 0x70, 0x6c, 0x61, 0x63, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x70, 0x6c, + 0x61, 0x63, 0x65, 0x73, 0x12, 0x17, 0x0a, 0x07, 0x73, 0x76, 0x5f, 0x6f, 0x6e, 0x6c, 0x79, 0x18, + 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x73, 0x76, 0x4f, 0x6e, 0x6c, 0x79, 0x22, 0xad, 0x01, + 0x0a, 0x15, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x53, 0x74, 0x61, 0x74, 0x56, 0x61, 0x72, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x34, 0x0a, 0x09, 0x73, 0x74, 0x61, 0x74, 0x5f, + 0x76, 0x61, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x64, 0x61, 0x74, + 0x61, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x73, 0x2e, 0x45, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x49, + 0x6e, 0x66, 0x6f, 0x52, 0x08, 0x73, 0x74, 0x61, 0x74, 0x56, 0x61, 0x72, 0x73, 0x12, 0x44, 0x0a, + 0x0f, 0x73, 0x74, 0x61, 0x74, 0x5f, 0x76, 0x61, 0x72, 0x5f, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x73, + 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x63, 0x6f, 0x6d, + 0x6d, 0x6f, 0x6e, 0x73, 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x73, 0x75, 0x6c, + 0x74, 0x53, 0x56, 0x47, 0x52, 0x0d, 0x73, 0x74, 0x61, 0x74, 0x56, 0x61, 0x72, 0x47, 0x72, 0x6f, + 0x75, 0x70, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x73, 0x18, 0x03, + 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x73, 0x22, 0x37, 0x0a, + 0x18, 0x47, 0x65, 0x74, 0x53, 0x74, 0x61, 0x74, 0x56, 0x61, 0x72, 0x53, 0x75, 0x6d, 0x6d, 0x61, + 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x73, 0x74, 0x61, + 0x74, 0x5f, 0x76, 0x61, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x73, 0x74, + 0x61, 0x74, 0x56, 0x61, 0x72, 0x73, 0x22, 0xe1, 0x01, 0x0a, 0x19, 0x47, 0x65, 0x74, 0x53, 0x74, + 0x61, 0x74, 0x56, 0x61, 0x72, 0x53, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x64, 0x0a, 0x10, 0x73, 0x74, 0x61, 0x74, 0x5f, 0x76, 0x61, 0x72, + 0x5f, 0x73, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x3a, + 0x2e, 0x64, 0x61, 0x74, 0x61, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x73, 0x2e, 0x47, 0x65, 0x74, + 0x53, 0x74, 0x61, 0x74, 0x56, 0x61, 0x72, 0x53, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x56, 0x61, 0x72, 0x53, 0x75, + 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0e, 0x73, 0x74, 0x61, 0x74, + 0x56, 0x61, 0x72, 0x53, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x1a, 0x5e, 0x0a, 0x13, 0x53, 0x74, + 0x61, 0x74, 0x56, 0x61, 0x72, 0x53, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x45, 0x6e, 0x74, 0x72, + 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, + 0x6b, 0x65, 0x79, 0x12, 0x31, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x73, + 0x2e, 0x53, 0x74, 0x61, 0x74, 0x56, 0x61, 0x72, 0x53, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x52, + 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x5a, 0x0a, 0x16, 0x47, 0x65, + 0x74, 0x53, 0x74, 0x61, 0x74, 0x56, 0x61, 0x72, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x71, 0x75, 0x65, 0x72, 0x79, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x05, 0x71, 0x75, 0x65, 0x72, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x69, + 0x6d, 0x69, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, + 0x12, 0x14, 0x0a, 0x05, 0x64, 0x65, 0x62, 0x75, 0x67, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, + 0x05, 0x64, 0x65, 0x62, 0x75, 0x67, 0x22, 0xed, 0x01, 0x0a, 0x17, 0x47, 0x65, 0x74, 0x53, 0x74, + 0x61, 0x74, 0x56, 0x61, 0x72, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x4d, 0x0a, 0x0a, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x5f, 0x69, 0x6e, 0x66, 0x6f, + 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2e, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x63, 0x6f, 0x6d, + 0x6d, 0x6f, 0x6e, 0x73, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x74, 0x61, 0x74, 0x56, 0x61, 0x72, 0x4d, + 0x61, 0x74, 0x63, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x4d, 0x61, 0x74, + 0x63, 0x68, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x09, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x49, 0x6e, 0x66, + 0x6f, 0x1a, 0x82, 0x01, 0x0a, 0x09, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x49, 0x6e, 0x66, 0x6f, 0x12, + 0x19, 0x0a, 0x08, 0x73, 0x74, 0x61, 0x74, 0x5f, 0x76, 0x61, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x07, 0x73, 0x74, 0x61, 0x74, 0x56, 0x61, 0x72, 0x12, 0x22, 0x0a, 0x0d, 0x73, 0x74, + 0x61, 0x74, 0x5f, 0x76, 0x61, 0x72, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x0b, 0x73, 0x74, 0x61, 0x74, 0x56, 0x61, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x14, + 0x0a, 0x05, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x01, 0x52, 0x05, 0x73, + 0x63, 0x6f, 0x72, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x65, 0x78, 0x70, 0x6c, 0x61, 0x6e, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x65, 0x78, 0x70, 0x6c, 0x61, + 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x09, 0x5a, 0x07, 0x2e, 0x2f, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/internal/server/statvar/statvar_group.go b/internal/server/statvar/statvar_group.go index cce748df8..7473aea37 100644 --- a/internal/server/statvar/statvar_group.go +++ b/internal/server/statvar/statvar_group.go @@ -16,6 +16,7 @@ package statvar import ( "context" + "sort" "time" pb "github.com/datacommonsorg/mixer/internal/proto" @@ -234,6 +235,11 @@ func GetStatVarGroupNode( ) (*pb.StatVarGroupNode, error) { entities := in.GetEntities() svg := in.GetStatVarGroup() + numEntitiesExistence := int(in.GetNumEntitiesExistence()) + // We want at least 1 entity to have data. + if numEntitiesExistence == 0 { + numEntitiesExistence = 1 + } if svg == "" { return nil, status.Errorf( @@ -273,29 +279,31 @@ func GetStatVarGroupNode( } // Count for current node. result.DescendentStatVarCount = 0 - if existence, ok := statVarCount[svg]; ok && len(existence) > 0 { + if existence, ok := statVarCount[svg]; ok && len(existence) >= numEntitiesExistence { + counts := []int32{} for _, count := range existence { - // Use the largest count among all entities. - if count > result.GetDescendentStatVarCount() { - result.DescendentStatVarCount = count - } + counts = append(counts, count) } + sort.Slice(counts, func(i, j int) bool { return counts[i] > counts[j] }) + // Use the numEntitiesExistence-th largest count + result.DescendentStatVarCount = counts[numEntitiesExistence-1] } // Filter child stat var groups for _, item := range result.ChildStatVarGroups { item.DescendentStatVarCount = 0 - if existence, ok := statVarCount[item.Id]; ok && len(existence) > 0 { + if existence, ok := statVarCount[item.Id]; ok && len(existence) >= numEntitiesExistence { + counts := []int32{} for _, count := range existence { - // Use the largest count among all entities - if count > item.DescendentStatVarCount { - item.DescendentStatVarCount = count - } + counts = append(counts, count) } + sort.Slice(counts, func(i, j int) bool { return counts[i] > counts[j] }) + // Use the numEntitiesExistence-th largest count + item.DescendentStatVarCount = counts[numEntitiesExistence-1] } } // Filter child stat vars for _, item := range result.ChildStatVars { - if existence, ok := statVarCount[item.Id]; !ok || len(existence) == 0 { + if existence, ok := statVarCount[item.Id]; !ok || len(existence) < numEntitiesExistence { item.HasData = false } } diff --git a/internal/server/v1/info/golden/bulk_variable_group_info/crime_1.json b/internal/server/v1/info/golden/bulk_variable_group_info/crime_1.json new file mode 100644 index 000000000..099f0025d --- /dev/null +++ b/internal/server/v1/info/golden/bulk_variable_group_info/crime_1.json @@ -0,0 +1,39 @@ +{ + "data": [ + { + "node": "dc/g/CriminalActivities", + "info": { + "absoluteName": "Criminal Activities", + "childStatVars": [ + { + "id": "Count_CriminalActivities_CombinedCrime", + "searchNames": [ + "Count of Criminal Activities" + ], + "displayName": "Count of Criminal Activities", + "definition": "mp=count,pt=CriminalActivities", + "hasData": true + } + ], + "childStatVarGroups": [ + { + "id": "dc/g/CriminalActivities_CrimeType", + "specializedEntity": "Crime Type", + "displayName": "Criminal Activities by Crime Type", + "descendentStatVarCount": 9 + }, + { + "id": "dc/g/CriminalActivities_Gender", + "specializedEntity": "Gender", + "displayName": "Criminal Activities by Gender", + "descendentStatVarCount": 2 + } + ], + "descendentStatVarCount": 10, + "parentStatVarGroups": [ + "dc/g/Crime" + ] + } + } + ] +} \ No newline at end of file diff --git a/internal/server/v1/info/golden/bulk_variable_group_info/crime_10.json b/internal/server/v1/info/golden/bulk_variable_group_info/crime_10.json new file mode 100644 index 000000000..15e95fc0d --- /dev/null +++ b/internal/server/v1/info/golden/bulk_variable_group_info/crime_10.json @@ -0,0 +1,38 @@ +{ + "data": [ + { + "node": "dc/g/CriminalActivities", + "info": { + "absoluteName": "Criminal Activities", + "childStatVars": [ + { + "id": "Count_CriminalActivities_CombinedCrime", + "searchNames": [ + "Count of Criminal Activities" + ], + "displayName": "Count of Criminal Activities", + "definition": "mp=count,pt=CriminalActivities" + } + ], + "childStatVarGroups": [ + { + "id": "dc/g/CriminalActivities_CrimeType", + "specializedEntity": "Crime Type", + "displayName": "Criminal Activities by Crime Type", + "descendentStatVarCount": 3 + }, + { + "id": "dc/g/CriminalActivities_Gender", + "specializedEntity": "Gender", + "displayName": "Criminal Activities by Gender", + "descendentStatVarCount": 2 + } + ], + "descendentStatVarCount": 3, + "parentStatVarGroups": [ + "dc/g/Crime" + ] + } + } + ] +} \ No newline at end of file diff --git a/internal/server/v1/info/golden/bulk_variable_group_info_test.go b/internal/server/v1/info/golden/bulk_variable_group_info_test.go index 0067c2428..08bf0c035 100644 --- a/internal/server/v1/info/golden/bulk_variable_group_info_test.go +++ b/internal/server/v1/info/golden/bulk_variable_group_info_test.go @@ -35,19 +35,34 @@ func TestBulkVariableGroupInfo(t *testing.T) { testSuite := func(mixer pb.MixerClient, latencyTest bool) { for _, c := range []struct { - nodes []string - constrainedEntities []string - goldenFile string + nodes []string + constrainedEntities []string + numEntitiesExistence int32 + goldenFile string }{ { []string{"dc/g/Economy", "invalid"}, []string{"country/ASM"}, + 1, "economy.json", }, + { + []string{"dc/g/CriminalActivities"}, + []string{"country/USA", "country/MEX", "country/BRA", "country/DEU", "country/POL", "country/RUS", "country/ZAF", "country/ZWE", "country/CHN", "country/IND", "country/AUS"}, + 10, + "crime_10.json", + }, + { + []string{"dc/g/CriminalActivities"}, + []string{"country/USA", "country/MEX", "country/BRA", "country/DEU", "country/POL", "country/RUS", "country/ZAF", "country/ZWE", "country/CHN", "country/IND", "country/AUS"}, + 1, + "crime_1.json", + }, } { resp, err := mixer.BulkVariableGroupInfo(ctx, &pb.BulkVariableGroupInfoRequest{ - Nodes: c.nodes, - ConstrainedEntities: c.constrainedEntities, + Nodes: c.nodes, + ConstrainedEntities: c.constrainedEntities, + NumEntitiesExistence: c.numEntitiesExistence, }) if err != nil { t.Errorf("VariableGroupInfo() = %s", err) diff --git a/internal/server/v1/info/variable_group.go b/internal/server/v1/info/variable_group.go index f0bba210f..8fcf1b98a 100644 --- a/internal/server/v1/info/variable_group.go +++ b/internal/server/v1/info/variable_group.go @@ -35,8 +35,9 @@ func VariableGroupInfo( data, err := statvar.GetStatVarGroupNode( ctx, &pb.GetStatVarGroupNodeRequest{ - StatVarGroup: in.GetNode(), - Entities: in.GetConstrainedEntities(), + StatVarGroup: in.GetNode(), + Entities: in.GetConstrainedEntities(), + NumEntitiesExistence: in.GetNumEntitiesExistence(), }, store, cache, @@ -61,6 +62,7 @@ func BulkVariableGroupInfo( // should call this API twice, w/o constrained_entities to achieve that. nodes := in.GetNodes() constraindEntities := in.GetConstrainedEntities() + numEntitiesExistence := in.GetNumEntitiesExistence() if len(nodes) == 0 { result := &pb.BulkVariableGroupInfoResponse{ @@ -86,8 +88,9 @@ func BulkVariableGroupInfo( data, err := VariableGroupInfo( errCtx, &pb.VariableGroupInfoRequest{ - Node: node, - ConstrainedEntities: constraindEntities, + Node: node, + ConstrainedEntities: constraindEntities, + NumEntitiesExistence: numEntitiesExistence, }, store, cache, diff --git a/proto/stat_var.proto b/proto/stat_var.proto index fabd95a67..f60bff59a 100644 --- a/proto/stat_var.proto +++ b/proto/stat_var.proto @@ -196,6 +196,9 @@ message GetStatVarGroupNodeRequest { // should only contain the children stat var (group) if it has data for at // least one of the entities. repeated string entities = 2; + // Number of passed in entities that should have data for the stat var + // (group)s that are returned + int32 num_entities_existence = 4; reserved 3; } diff --git a/proto/v1/info.proto b/proto/v1/info.proto index e0265ce59..a80bfff4f 100644 --- a/proto/v1/info.proto +++ b/proto/v1/info.proto @@ -57,9 +57,12 @@ message VariableGroupInfoRequest { // The variable group dcid to query for. string node = 1; // The entities that the variable group is associated with. The response should - // only contain the child variable (group) if it has data for at least one - // of the entities. + // only contain the child variable (group) if it has data for at least + // num_entities_existence number of entities. repeated string constrained_entities = 2; + // Number of passed in entities that should have data for the stat var + // (group)s that are returned + int32 num_entities_existence = 4; } message VariableGroupInfoResponse { @@ -72,9 +75,12 @@ message BulkVariableGroupInfoRequest { // (optional) The variable group dcids to query for. // If not specified, then return all the variable group info. repeated string nodes = 1; - // (optional) When specified, only return the variable groups that the entities - // have data for. + // (optional) When specified, only return the variable groups that at least + // num_entities_existence number of entities has data for. repeated string constrained_entities = 2; + // (optional) Number of passed in entities that should have data for the stat + // var (group)s that are returned. Default to 1 if unspecified. + int32 num_entities_existence = 4; } message BulkVariableGroupInfoResponse {