Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adoption Report #5

Open
maceto opened this issue Aug 5, 2023 · 6 comments
Open

Adoption Report #5

maceto opened this issue Aug 5, 2023 · 6 comments
Assignees

Comments

@maceto
Copy link
Collaborator

maceto commented Aug 5, 2023

Could you describe the origin/source of this data?

[
	{
		date: '2020-01-01',
		technology: 'Wordpress',
		adoption: {
			mobile: 10,
			desktop: 10,
			across_dataset: 20,
		},
	}
]

The goal is to create a script to query this data from BQ transform and save it in Firestore.

@rviscomi
Copy link
Member

rviscomi commented Sep 3, 2023

Query

CREATE TEMPORARY FUNCTION GET_ADOPTION(
  records ARRAY<STRUCT<
      client STRING,
      origins INT64
  >>
) RETURNS STRUCT<
  desktop INT64,
  mobile INT64
> LANGUAGE js AS '''
return Object.fromEntries(records.map(({client, origins}) => {
  return [client, origins];
}));
''';

SELECT
  date,
  app AS technology,
  rank,
  geo,
  GET_ADOPTION(ARRAY_AGG(STRUCT(
    client,
    origins
  ))) AS adoption
FROM
  `httparchive.core_web_vitals.technologies`
WHERE
  date = '2023-07-01'
GROUP BY
  date,
  app,
  rank,
  geo

Example record

{
  "date": "2023-07-01",
  "technology": "WordPress",
  "rank": "ALL",
  "geo": "ALL",
  "adoption": {
    "desktop": "2040628",
    "mobile": "3422903"
  }
}

@maceto
Copy link
Collaborator Author

maceto commented Sep 9, 2023

@rviscomi, should we have any mandatory param for this endpoint?

@rviscomi
Copy link
Member

Maybe just:

  • technology
  • rank
  • geo

@sarahfossheim WDYT?

@maceto
Copy link
Collaborator Author

maceto commented Sep 15, 2023

Example of how to consume this endpoint

curl --request GET \
  --url 'https://dev-gw-2vzgiib6.ue.gateway.dev/v1/adoption?geo=Mexico&technology=["Blueshift","GoCache"]&rank=ALL'

@rviscomi
Copy link
Member

Per our chat, try reformatting in the Python to this structure:

{
  "Blueshift": [{"date": ...}],
  "GoCache": []
}

@maceto
Copy link
Collaborator Author

maceto commented Sep 16, 2023

@rviscomi @sarahfossheim, all the changes discussed are already deployed.

New URL https://dev-gw-2vzgiib6.uk.gateway.dev/v1/adoption

Documentation: https://github.com/HTTPArchive/tech-report-apis#get-adoption

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants