-
Notifications
You must be signed in to change notification settings - Fork 104
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DS-3272 - Review checker data model for mobile (#4498)
* Add mobile shopping data * Remove the ff desktop from sql_generator * Fix build issue * Incorporate feedback from Bruce * Add clients table for mobile * FIX CI issue * Incorporate Bruce's feedback * Incorporate Curtis' feedback
- Loading branch information
1 parent
77560c0
commit abef158
Showing
31 changed files
with
902 additions
and
144 deletions.
There are no files selected for viewing
7 changes: 7 additions & 0 deletions
7
sql/moz-fx-data-shared-prod/firefox_desktop/review_checker_clients/view.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
CREATE OR REPLACE VIEW | ||
`moz-fx-data-shared-prod.firefox_desktop.review_checker_clients` | ||
AS | ||
SELECT | ||
* | ||
FROM | ||
`moz-fx-data-shared-prod.firefox_desktop_derived.review_checker_clients_v1` |
7 changes: 7 additions & 0 deletions
7
sql/moz-fx-data-shared-prod/firefox_desktop/review_checker_events/view.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
CREATE OR REPLACE VIEW | ||
`moz-fx-data-shared-prod.firefox_desktop.review_checker_events` | ||
AS | ||
SELECT | ||
* | ||
FROM | ||
`moz-fx-data-shared-prod.firefox_desktop_derived.review_checker_events_v1` |
7 changes: 7 additions & 0 deletions
7
sql/moz-fx-data-shared-prod/firefox_desktop/review_checker_microsurvey/view.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
CREATE OR REPLACE VIEW | ||
`moz-fx-data-shared-prod.firefox_desktop.review_checker_microsurvey` | ||
AS | ||
SELECT | ||
* | ||
FROM | ||
`moz-fx-data-shared-prod.firefox_desktop_derived.review_checker_microsurvey_v1` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
sql/moz-fx-data-shared-prod/firefox_desktop_derived/review_checker_clients_v1/schema.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
fields: | ||
- name: submission_date | ||
type: DATE | ||
mode: NULLABLE | ||
- name: normalized_channel | ||
type: STRING | ||
mode: NULLABLE | ||
- name: normalized_country_code | ||
type: STRING | ||
mode: NULLABLE | ||
- name: legacy_client_id | ||
type: STRING | ||
mode: NULLABLE | ||
- name: client_id | ||
type: STRING | ||
mode: NULLABLE | ||
- name: sample_id | ||
type: INTEGER | ||
mode: NULLABLE | ||
- name: shopping_product_page_visits | ||
type: INTEGER | ||
mode: NULLABLE | ||
- name: is_opt_in | ||
type: INTEGER | ||
mode: NULLABLE | ||
- name: is_opt_out | ||
type: INTEGER | ||
mode: NULLABLE | ||
- name: sap | ||
type: INTEGER | ||
mode: NULLABLE | ||
- name: ad_click | ||
type: INTEGER | ||
mode: NULLABLE | ||
- name: active_hours_sum | ||
type: FLOAT | ||
mode: NULLABLE | ||
- name: is_fx_dau | ||
type: INTEGER | ||
mode: NULLABLE |
22 changes: 22 additions & 0 deletions
22
sql/moz-fx-data-shared-prod/firefox_desktop_derived/review_checker_events_v1/metadata.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
friendly_name: Review checker events data | ||
description: |- | ||
The events table includes telemetry related to the review checker sidebar including user | ||
interaction with the sidebar, open and closed states, and the status of reviews (stale, unavailable, etc.) | ||
owners: | ||
- [email protected] | ||
- [email protected] | ||
labels: | ||
incremental: true | ||
schedule: daily | ||
scheduling: | ||
dag_name: bqetl_review_checker | ||
task_name: firefox_desktop_review_checker_events__v1 | ||
bigquery: | ||
time_partitioning: | ||
type: day | ||
field: submission_date | ||
require_partition_filter: true | ||
clustering: | ||
fields: | ||
- normalized_channel | ||
- sample_id |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
sql/moz-fx-data-shared-prod/firefox_desktop_derived/review_checker_events_v1/schema.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
fields: | ||
- name: submission_date | ||
type: DATE | ||
mode: NULLABLE | ||
- name: client_id | ||
type: STRING | ||
mode: NULLABLE | ||
- name: is_exposed_event | ||
type: INTEGER | ||
mode: NULLABLE | ||
- name: is_opt_in_event | ||
type: INTEGER | ||
mode: NULLABLE | ||
- name: is_surface_displayed | ||
type: INTEGER | ||
mode: NULLABLE | ||
- name: is_engaged_with_sidebar | ||
type: INTEGER | ||
mode: NULLABLE | ||
- name: experiments | ||
type: RECORD | ||
mode: REPEATED | ||
fields: | ||
- name: key | ||
type: STRING | ||
mode: NULLABLE | ||
- name: value | ||
type: RECORD | ||
mode: NULLABLE | ||
fields: | ||
- name: branch | ||
type: STRING | ||
mode: NULLABLE | ||
- name: extra | ||
type: RECORD | ||
mode: NULLABLE | ||
fields: | ||
- name: enrollment_id | ||
type: STRING | ||
mode: NULLABLE | ||
- name: type | ||
type: STRING | ||
mode: NULLABLE | ||
- name: normalized_channel | ||
type: STRING | ||
mode: NULLABLE | ||
- name: normalized_country_code | ||
type: STRING | ||
mode: NULLABLE | ||
- name: sample_id | ||
type: INTEGER | ||
mode: NULLABLE | ||
- name: os_version | ||
type: NUMERIC | ||
mode: NULLABLE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
sql/moz-fx-data-shared-prod/org_mozilla_fenix/review_checker_events/view.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
CREATE OR REPLACE VIEW | ||
`moz-fx-data-shared-prod.org_mozilla_fenix.review_checker_events` | ||
AS | ||
SELECT | ||
* | ||
FROM | ||
`moz-fx-data-shared-prod.org_mozilla_fenix_derived.review_checker_events_v1` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
friendly_name: Review checker events data | ||
friendly_name: Fenix review checker clients data | ||
description: |- | ||
owners: | ||
- [email protected] | ||
|
@@ -8,13 +8,13 @@ labels: | |
schedule: daily | ||
scheduling: | ||
dag_name: bqetl_review_checker | ||
task_name: {{ app_name }}_review_checker_events__v1 | ||
task_name: org_mozilla_fenix_review_checker_clients__v1 | ||
bigquery: | ||
time_partitioning: | ||
type: day | ||
field: submission_date | ||
require_partition_filter: true | ||
clustering: | ||
fields: | ||
- normalized_channel | ||
- sample_id | ||
- normalized_channel | ||
- sample_id |
107 changes: 107 additions & 0 deletions
107
sql/moz-fx-data-shared-prod/org_mozilla_fenix_derived/review_checker_clients_v1/query.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
WITH shopping_metrics AS ( | ||
SELECT | ||
client_info.client_id AS client_id, | ||
DATE(submission_timestamp) AS submission_date, | ||
SUM( | ||
CASE | ||
WHEN metrics.counter.shopping_product_page_visits IS NOT NULL | ||
THEN COALESCE(CAST(metrics.counter.shopping_product_page_visits AS INT64), 0) | ||
ELSE 0 | ||
END | ||
) AS shopping_product_page_visits, | ||
CASE | ||
WHEN metrics.boolean.shopping_settings_user_has_onboarded = TRUE | ||
AND metrics.boolean.shopping_settings_component_opted_out = FALSE | ||
THEN 1 | ||
ELSE 0 | ||
END AS is_opt_in, | ||
CASE | ||
WHEN metrics.boolean.shopping_settings_component_opted_out = TRUE | ||
THEN 1 | ||
ELSE 0 | ||
END AS is_opt_out, | ||
CASE | ||
WHEN metrics.boolean.shopping_settings_user_has_onboarded = TRUE | ||
THEN 1 | ||
ELSE 0 | ||
END AS is_onboarded, | ||
CASE | ||
WHEN metrics.boolean.shopping_settings_nimbus_disabled_shopping = TRUE | ||
THEN 1 | ||
ELSE 0 | ||
END AS is_nimbus_disabled, | ||
normalized_channel, | ||
normalized_country_code, | ||
sample_id, | ||
ANY_VALUE(ping_info.experiments) AS experiments, | ||
FROM | ||
`moz-fx-data-shared-prod.org_mozilla_fenix_stable.metrics_v1` | ||
WHERE | ||
DATE(submission_timestamp) = @submission_date | ||
GROUP BY | ||
client_id, | ||
submission_date, | ||
is_opt_in, | ||
is_opt_out, | ||
normalized_channel, | ||
normalized_country_code, | ||
sample_id, | ||
is_onboarded, | ||
is_nimbus_disabled | ||
), | ||
active AS ( | ||
SELECT | ||
client_info.client_id, | ||
DATE(submission_timestamp) AS submission_date, | ||
COALESCE(SUM(metrics.timespan.glean_baseline_duration.value), 0) / 3600.0 AS active_hours | ||
FROM | ||
`moz-fx-data-shared-prod.fenix.baseline` | ||
WHERE | ||
DATE(submission_timestamp) = @submission_date | ||
GROUP BY | ||
client_info.client_id, | ||
submission_date | ||
), | ||
search AS ( | ||
SELECT | ||
submission_date, | ||
client_id, | ||
search_count AS sap, | ||
ad_click | ||
FROM | ||
`moz-fx-data-shared-prod.search.mobile_search_clients_engines_sources_daily` | ||
WHERE | ||
submission_date = @submission_date | ||
AND normalized_app_name = "Fenix" | ||
), | ||
joined_data AS ( | ||
SELECT | ||
sm.submission_date, | ||
normalized_channel, | ||
normalized_country_code, | ||
sm.client_id, | ||
sm.sample_id, | ||
sm.shopping_product_page_visits, | ||
sm.experiments, | ||
sm.is_opt_in, | ||
sm.is_opt_out, | ||
s.sap, | ||
s.ad_click, | ||
active.active_hours AS active_hours_sum | ||
FROM | ||
shopping_metrics sm | ||
LEFT JOIN | ||
active | ||
ON | ||
active.client_id = sm.client_id | ||
AND active.submission_date = sm.submission_date | ||
LEFT JOIN | ||
search AS s | ||
ON | ||
s.client_id = sm.client_id | ||
AND s.submission_date = sm.submission_date | ||
) | ||
SELECT | ||
* | ||
FROM | ||
joined_data |
Oops, something went wrong.