Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion jobs/webcompat-kb/data/metrics/rescores.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,3 @@ routine_updates = [
"moz-fx-dev-dschubert-wckb.webcompat_knowledge_base.WEBCOMPAT_METRIC_SCORE_SITE_RANK_MODIFIER",
"moz-fx-dev-dschubert-wckb.webcompat_knowledge_base.WEBCOMPAT_METRIC_YYYYMM",
]
stage = true

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1 +1 @@
name = "WEBCOMPAT_METRIC_SCORE_SITE_RANK_MODIFIER"
name = "WEBCOMPAT_METRIC_SCORE_SITE_RANK_MODIFIER"
Original file line number Diff line number Diff line change
@@ -1,11 +1,36 @@
CREATE OR REPLACE FUNCTION `{{ ref(name) }}`(url STRING, crux_yyyymm INT64) RETURNS NUMERIC AS (
(SELECT
IFNULL(IF(MIN(host_ranks.global_rank) <= MIN(IFNULL(host_ranks.local_rank, host_ranks.global_rank)), MAX(1.5 * global_scores.score), MAX(local_scores.score)), 1)
FROM
`{{ ref ('crux_imported.host_min_ranks') }}` AS host_ranks
LEFT JOIN `{{ ref('dim_bug_score') }}` AS local_scores ON local_scores.lookup_type = 'site_rank' AND host_ranks.local_rank <= cast(local_scores.lookup_value as int64)
LEFT JOIN `{{ ref('dim_bug_score') }}` AS global_scores ON global_scores.lookup_type = 'site_rank' AND host_ranks.global_rank <= cast(global_scores.lookup_value as int64)
WHERE
host_ranks.yyyymm = crux_yyyymm AND `{{ ref('WEBCOMPAT_HOST') }}`(host_ranks.host) = `{{ ref('WEBCOMPAT_HOST') }}`(url)
(
SELECT
CAST(CASE
WHEN MIN(host_ranks.global_rank) <= 1000 THEN 15
WHEN
MIN(host_ranks.core_rank) <= 1000 OR
MIN(host_ranks.india_rank) <= 1000 OR
MIN(host_ranks.brazil_rank) <= 1000 OR
MIN(host_ranks.indonesia_rank) <= 1000 OR
MIN(host_ranks.mexico_rank) <= 1000 OR
MIN(host_ranks.italy_rank) <= 1000 OR
MIN(host_ranks.spain_rank) <= 1000 OR
MIN(host_ranks.netherlands_rank) <= 1000
THEN 10
WHEN MIN(host_ranks.global_rank) <= 10000 THEN 7.5
WHEN MIN(host_ranks.local_rank) <= 1000 THEN 5
WHEN
MIN(host_ranks.core_rank) <= 10000 OR
MIN(host_ranks.india_rank) <= 10000 OR
MIN(host_ranks.brazil_rank) <= 10000 OR
MIN(host_ranks.indonesia_rank) <= 10000 OR
MIN(host_ranks.mexico_rank) <= 10000 OR
MIN(host_ranks.italy_rank) <= 10000 OR
MIN(host_ranks.spain_rank) <= 10000 OR
MIN(host_ranks.netherlands_rank) <= 10000
THEN 5
WHEN MIN(host_ranks.local_rank) <= 10000 THEN 2.5
ELSE 1
END AS NUMERIC)
FROM
`{{ ref ('crux_imported.host_min_ranks') }}` AS host_ranks
WHERE
host_ranks.yyyymm = crux_yyyymm AND `{{ ref('WEBCOMPAT_HOST') }}`(host_ranks.host) = `{{ ref('WEBCOMPAT_HOST') }}`(url)
)
);
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
CREATE OR REPLACE FUNCTION `{{ ref(name) }}`() RETURNS INT64 AS (
202512
);
202603
);

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
name = "WEBCOMPAT_METRIC_SCORE_SITE_RANK_MODIFIER_BEFORE_RESCORE_SITE_RANKS_UPDATE_202603"
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
CREATE OR REPLACE FUNCTION `{{ ref(name) }}`(url STRING, crux_yyyymm INT64) RETURNS NUMERIC AS (
(SELECT
IFNULL(IF(MIN(host_ranks.global_rank) <= MIN(IFNULL(host_ranks.local_rank, host_ranks.global_rank)), MAX(1.5 * global_scores.score), MAX(local_scores.score)), 1)
FROM
`{{ ref ('crux_imported.host_min_ranks') }}` AS host_ranks
LEFT JOIN `{{ ref('dim_bug_score') }}` AS local_scores ON local_scores.lookup_type = 'site_rank' AND host_ranks.local_rank <= cast(local_scores.lookup_value as int64)
LEFT JOIN `{{ ref('dim_bug_score') }}` AS global_scores ON global_scores.lookup_type = 'site_rank' AND host_ranks.global_rank <= cast(global_scores.lookup_value as int64)
WHERE
host_ranks.yyyymm = crux_yyyymm AND `{{ ref('WEBCOMPAT_HOST') }}`(host_ranks.host) = `{{ ref('WEBCOMPAT_HOST') }}`(url)
)
);
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
name = "WEBCOMPAT_METRIC_YYYYMM_BEFORE_RESCORE_SITE_RANKS_UPDATE_202603"
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
CREATE OR REPLACE FUNCTION `{{ ref(name) }}`() RETURNS INT64 AS (
202603
);
202512
);
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
name = "scored_site_reports_before_rescore_site_ranks_update_202603"
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
WITH
host_categories AS (
SELECT
`{{ ref('WEBCOMPAT_HOST') }}`(host) as webcompat_host,
`{{ ref('webcompat_knowledge_base.WEBCOMPAT_HOST') }}`(host) as webcompat_host,
{% for metric in metrics.values() if metric.host_min_ranks_condition() -%}
{{ metric.host_min_ranks_condition() }} AS is_{{ metric.name }}{{ ',' if not loop.last }}
{% endfor %}
FROM
`{{ ref('crux_imported.host_min_ranks') }}`
WHERE
yyyymm = `{{ ref('RESCORE_SITE_RANKS_UPDATE_202603_WEBCOMPAT_METRIC_YYYYMM') }}`()
yyyymm = `{{ ref('WEBCOMPAT_METRIC_YYYYMM_BEFORE_RESCORE_SITE_RANKS_UPDATE_202603') }}`()
GROUP BY
webcompat_host),
/* Individual score components for each bug.
Expand Down Expand Up @@ -50,9 +50,9 @@ WITH
(weights.lookup_type = "branch"
AND weights.lookup_value = IFNULL(JSON_VALUE(site_reports.user_story, "$.branch"), "release"), weights.score, 0)) AS branch_score,
FROM
`{{ ref('site_reports') }}` AS site_reports
`{{ ref('webcompat_knowledge_base.site_reports') }}` AS site_reports
CROSS JOIN
`{{ ref('dim_bug_score') }}` AS weights
`{{ ref('webcompat_knowledge_base.dim_bug_score') }}` AS weights
GROUP BY
number),

Expand All @@ -62,12 +62,12 @@ These could be inlined, but it's slightly easier to read if they're computed in
computed_scores AS (
SELECT
number,
`{{ ref('WEBCOMPAT_METRIC_SCORE_NO_SITE_RANK') }}`(keywords,
`{{ ref('webcompat_knowledge_base.WEBCOMPAT_METRIC_SCORE_NO_SITE_RANK') }}`(keywords,
user_story) AS triage_score_no_rank,
`{{ ref('RESCORE_SITE_RANKS_UPDATE_202603_WEBCOMPAT_METRIC_SCORE_SITE_RANK_MODIFIER') }}`(url,
`{{ ref('RESCORE_SITE_RANKS_UPDATE_202603_WEBCOMPAT_METRIC_YYYYMM') }}`()) AS site_rank_score
`{{ ref('WEBCOMPAT_METRIC_SCORE_SITE_RANK_MODIFIER_BEFORE_RESCORE_SITE_RANKS_UPDATE_202603') }}`(url,
`{{ ref('WEBCOMPAT_METRIC_YYYYMM_BEFORE_RESCORE_SITE_RANKS_UPDATE_202603') }}`()) AS site_rank_score
FROM
`{{ ref('site_reports') }}` AS site_reports
`{{ ref('webcompat_knowledge_base.site_reports') }}` AS site_reports
),

site_report_scores AS (
Expand All @@ -86,7 +86,7 @@ site_report_scores AS (
{{ metric.site_reports_condition('host_categories') }} AS is_{{ metric.name }}{{ ',' if not loop.last }}
{% endfor %}
FROM
`{{ ref('site_reports') }}` AS site_reports
`{{ ref('webcompat_knowledge_base.site_reports') }}` AS site_reports
JOIN
scores
USING
Expand All @@ -98,7 +98,7 @@ site_report_scores AS (
LEFT JOIN
host_categories
ON
host_categories.webcompat_host = `{{ ref('WEBCOMPAT_HOST') }}`(site_reports.url))
host_categories.webcompat_host = `{{ ref('webcompat_knowledge_base.WEBCOMPAT_HOST') }}`(site_reports.url))

SELECT
site_report_scores.*,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ def argument_parser(self) -> argparse.ArgumentParser:
return parser

def main(self, args: argparse.Namespace) -> Optional[int]:
if args.reason is None:
if args.reason is None and args.phase == "create-schemas":
raise ValueError("Missing --reason")

config = Config(write=args.write, stage=args.stage)
Expand Down
Loading