Skip to content

Commit

Permalink
origins from crawl
Browse files Browse the repository at this point in the history
  • Loading branch information
max-ostapenko committed Dec 21, 2024
1 parent c5ff065 commit 820af3c
Showing 1 changed file with 59 additions and 9 deletions.
68 changes: 59 additions & 9 deletions definitions/output/reports/cwv_tech_technologies.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,69 @@ publish('cwv_tech_technologies', {
tags: ['crux_ready']
}).query(ctx => `
/* {"dataform_trigger": "report_cwv_tech_complete", "name": "technologies", "type": "dict"} */
WITH pages AS (
SELECT
client,
root_page AS origin,
tech.technology
FROM ${ctx.ref('crawl', 'pages')},
UNNEST(technologies) AS tech
WHERE
date = '${pastMonth}'
${constants.devRankFilter}
), total_pages AS (
SELECT
client,
COUNT(DISTINCT origin) AS origins
FROM pages
GROUP BY client
), technologies AS (
SELECT
technology,
description,
ARRAY_TO_STRING(categories, ', ') AS category,
categories AS category_obj,
NULL AS similar_technologies
FROM ${ctx.ref('wappalyzer', 'apps')}
), tech_origins AS (
SELECT
client,
technology,
COUNT(DISTINCT origin) AS origins
FROM pages
GROUP BY
client,
technology
)
SELECT
client,
app AS technology,
technology,
description,
category,
SPLIT(category, ",") AS category_obj,
category_obj,
similar_technologies,
COALESCE(origins, 0) AS origins
FROM tech_origins
INNER JOIN technologies
USING(technology)
ORDER BY origins DESC
UNION ALL
SELECT
client,
'ALL' AS technology,
NULL AS description,
ARRAY_TO_STRING(categories, ', ') AS category,
categories AS category_obj,
NULL AS similar_technologies,
origins
FROM ${ctx.ref('core_web_vitals', 'technologies')}
LEFT JOIN ${ctx.ref('wappalyzer', 'apps')}
ON app = name
WHERE date = '${pastMonth}' AND
geo = 'ALL' AND
rank = 'ALL'
ORDER BY origins DESC
FROM total_pages
CROSS JOIN (
SELECT
ARRAY_AGG(DISTINCT category IGNORE NULLS ORDER BY category) AS categories
FROM technologies,
UNNEST(category_obj) AS category
) AS cat
`)

0 comments on commit 820af3c

Please sign in to comment.