Skip to content

Commit

Permalink
feat: Add protos for MC API Phase II.
Browse files Browse the repository at this point in the history
  • Loading branch information
kungfucraig committed Jan 8, 2025
1 parent f58404e commit e0f1e3b
Show file tree
Hide file tree
Showing 4 changed files with 207 additions and 5 deletions.
20 changes: 15 additions & 5 deletions src/main/proto/wfa/measurement/reporting/v2alpha/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -216,11 +216,6 @@ kt_jvm_proto_library(
deps = [":report_schedule_iteration_proto"],
)

kt_jvm_proto_library(
name = "reporting_impression_qualification_filter_kt_jvm_proto",
deps = [":reporting_impression_qualification_filter_proto"],
)

proto_library(
name = "reporting_impression_qualification_filter_proto",
srcs = ["reporting_impression_qualification_filter.proto"],
Expand All @@ -232,6 +227,11 @@ proto_library(
],
)

kt_jvm_proto_library(
name = "reporting_impression_qualification_filter_kt_jvm_proto",
deps = [":reporting_impression_qualification_filter_proto"],
)

proto_library(
name = "reporting_interval_proto",
srcs = ["reporting_interval.proto"],
Expand Down Expand Up @@ -335,6 +335,7 @@ proto_library(
"@com_google_googleapis//google/api:client_proto",
"@com_google_googleapis//google/api:field_behavior_proto",
"@com_google_googleapis//google/api:resource_proto",
"@com_google_googleapis//google/longrunning:operations_proto",
"@com_google_protobuf//:timestamp_proto",
],
)
Expand Down Expand Up @@ -419,6 +420,15 @@ kt_jvm_grpc_proto_library(
deps = [":metric_calculation_specs_service_proto"],
)

# TODO(@kungfucraig): Figure out how to have a build rule for the operations service.
# proto_library(
# name = "operations_service_proto",
# srcs = ["???"],
# strip_import_prefix = IMPORT_PREFIX,
# deps = [
# ],
# )

proto_library(
name = "reports_service_proto",
srcs = ["reports_service.proto"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,12 @@ message BasicReport {
(google.api.field_behavior) = IMMUTABLE
];

// Specifies the Pages to create
repeated PageSpec page_specs = 8 [
(google.api.field_behavior) = IMMUTABLE,
(google.api.field_behavior) = REQUIRED
];

// The report results
repeated Page pages = 6 [
(google.api.field_behavior) = IMMUTABLE,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import "google/api/annotations.proto";
import "google/api/client.proto";
import "google/api/field_behavior.proto";
import "google/api/resource.proto";
import "google/longrunning/operations.proto";
import "google/protobuf/timestamp.proto";
import "wfa/measurement/reporting/v2alpha/basic_report.proto";

Expand All @@ -29,6 +30,16 @@ option java_outer_classname = "BasicReportsServiceProto";

// Service for managing `BasicReport` resources.
service BasicReports {
// Creates a `BasicReport`
rpc CreateBasicReport(CreateBasicReportRequest)
returns (google.longrunning.Operation) {
option (google.api.http) = {
post: "/v2alpha/{parent=measurementConsumers/*}/basicReports"
body: "basicReport"
};
option (google.api.method_signature) = "parent,basicReport";
}

// Returns the `BasicReport` with the given resource key.
rpc GetBasicReport(GetBasicReportRequest) returns (BasicReport) {
option (google.api.http) = {
Expand Down Expand Up @@ -111,3 +122,29 @@ message ListBasicReportsResponse {
// If this field is omitted, there are no subsequent pages.
string next_page_token = 2 [(google.api.field_behavior) = OPTIONAL];
}

// Request message for `CreateBasicReport` method
message CreateBasicReportRequest {
// The parent Measurement Consumer
string parent = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
child_type: "reporting.halo-cmm.org/BasicReport"
}
];

// The ID to use for the Basic Report, which will become the final component
// of the Basic Report's resource name.
//
// This must conform to RFC 1034, with the additional restriction that all
// letters must be lower-case.
string page_template_id = 2 [(google.api.field_behavior) = REQUIRED];

// The Basic Report to create.
BasicReport basic_report = 3;

// A unique identifier for this request. Restricted to 36 ASCII characters.
// A random UUID is recommended.
// This request is only idempotent if a `request_id` is provided.
string request_id = 4;
}
149 changes: 149 additions & 0 deletions src/main/proto/wfa/measurement/reporting/v2alpha/page.proto
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,155 @@ message DimensionSpec {
repeated EventFilter filters = 4 [(google.api.field_behavior) = IMMUTABLE];
}

// Specifies a set of metrics to be computed
message PageMetricSpec {
// If specified the total population for the specified groupings and
// filters that are associated with calculation spec is reported.
bool population_size = 1 [(google.api.field_behavior) = IMMUTABLE];

// The set of basic metrics that can be computed for any aspect of the
// reporting_unit (e.g. the whole thing, a single component, intersections,
// etc.)
message BasicMetricSetSpec {
// The reach
bool reach = 1 [(google.api.field_behavior) = IMMUTABLE];

// The reach divided by the population
bool percent_reach = 2 [(google.api.field_behavior) = IMMUTABLE];

// The k plus reach up to the frequency specified. Value must be
// positive.
int32 k_plus_reach = 3 [(google.api.field_behavior) = IMMUTABLE];

// This option requires that a positive value be given for
// k_plus_reach, in which case if specified the percent k+
// reach values are also computed.
bool percent_k_plus_reach = 4 [(google.api.field_behavior) = IMMUTABLE];

// The average frequency
bool average_frequency = 5 [(google.api.field_behavior) = IMMUTABLE];

// The impression count
bool impressions = 6 [(google.api.field_behavior) = IMMUTABLE];

// Gross ratings points
bool grps = 7 [(google.api.field_behavior) = IMMUTABLE];
}

// Metrics to be computed over the entire reporting_unit
message ReportingUnitMetricSetSpec {
// Metrics for the union of the items in the reporting)unit
BasicMetricSetSpec basic = 1 [(google.api.field_behavior) = IMMUTABLE];

// Compute a stacked incremental reach result for the reporting_unit
//
// For example if the order of the items in the reporting_unit.units
// field is "rs1, rs2, rs3" then the following are reported:
// 1. The reach of rs1
// 2. The incremental reach of (rs1+rs2) over rs1
// (i.e. the unique contribution of rs2 with respect to rs2)
// 3. The incremental reach of (rs1+rs2+rs3) over (rs1+rs2)
// (i.e. the unique contribution of rs3 with respect to rs1 and rs2.
//
// In the case a output for a category of components is desired, this
// can be achieved by first grouping the components by category. Then
// once the output is provided the reach values for the components in the
// category can be summed.
//
// For example, assume we have components EDP1, EDP2, EDP3 and EDP1
// is linear TV and EDP2 and EDP3 are digital, and suppose we want an
// incremental reach report of linear TV over digital. Then we can specify
// the reporting_unit components as [EDP2, EDP3, EDP1] and when the
// output is recieved sum the values for EDP2 and EDP3. This results
// in a vector where the first element is the combined reach of EDP2
// and EDP3 and the second element is the incremental reach of EDP1
// with respect to them. Note that it would also be okay to specify
// the components as [EDP3, EDP2, EDP1].
bool stacked_incremental_reach = 2;
}
// The set of metrics to compute for the entire reporting_unit
ReportingUnitMetricSetSpec reporting_unit = 2;

// Compute metrics that apply to each unit of the reporting_unit_spec
// with respect to all others.
message ComponentMetricSetSpec {
// The basic metrics for each ReportingUnit.unit
BasicMetricSetSpec basic = 1 [(google.api.field_behavior) = IMMUTABLE];

// Compute the unique reach of each reporting unit in the
// reporting_unit_spec with respect to all other reporting units.
//
// For example if reporting_sets=[RS1, RS2, RS3] the unique reach of
// RS1, RS2, and RS3 are computed.
//
// It is an error to specify this if only a single reporting unit is
// specified since it is the same thing as requesting union.reach.
bool unique_reach = 2 [(google.api.field_behavior) = IMMUTABLE];
}
// If reporting_unit.component is of size 1 the metrics computed for the
// component are identical to those computed for the union. Specifying this
// value is not recommended in this case.
ComponentMetricSetSpec component = 3
[(google.api.field_behavior) = IMMUTABLE];

// Request overlaps (i.e. intersections) of the various combinations
// of reporting_unit components
message ComponentIntersectionMetricSetSpec {
// The number of components that contribute to the intersection.
//
// For example, a value of 2 will provide all 2-way intersections of
// the reporting_unit_spec. A value of 2 and 3 will provide both the
// 2 and 3 way intersections.
//
// The max value is the number of distrinct reporting
// units in the reporting_unit
repeated int32 contributor_count = 1 [
(google.api.field_behavior) = IMMUTABLE,
(google.api.field_behavior) = REQUIRED
];

// The set of metrics to be computed for each intersection
BasicMetricSetSpec basic = 2 [
(google.api.field_behavior) = IMMUTABLE,
(google.api.field_behavior) = REQUIRED
];
}
// Compute n-way intersections
ComponentIntersectionMetricSetSpec component_intersection = 4
[(google.api.field_behavior) = IMMUTABLE];
}

// Specification for a Page of results.
message PageSpec {
// The title of the page
string title = 1 [(google.api.field_behavior) = IMMUTABLE];

// The unit to compute metrics for
ReportingUnit reporting_unit = 2 [
(google.api.field_behavior) = REQUIRED,
(google.api.field_behavior) = IMMUTABLE
];

// Specifies the window over which metrics are computed
// and whether they are cumulative or not.
WindowingSpec windowing_spec = 3 [
(google.api.field_behavior) = REQUIRED,
(google.api.field_behavior) = IMMUTABLE
];

// Specfies the dimensions over which the report is filtered and grouped.
DimensionSpec dimension_spec = 4 [
(google.api.field_behavior) = REQUIRED,
(google.api.field_behavior) = IMMUTABLE
];

// Specifies the Metrics to compute.
PageMetricSpec page_metric_spec = 5 [
(google.api.field_behavior) = REQUIRED,
(google.api.field_behavior) = IMMUTABLE
];
}

// A page of results.
message Page {
// The title of the page.
Expand Down

0 comments on commit e0f1e3b

Please sign in to comment.