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

add support for additional aggregations by time period and other geographies #26

Open
critzo opened this issue Dec 15, 2020 · 1 comment
Labels
backlog enhancement New feature or request P2

Comments

@critzo
Copy link

critzo commented Dec 15, 2020

Logging some ideas from conversation with a developer who integrates our data using BQ now. These could be future additions to the stats-pipeline, or could be fulfilled by producing examples using the existing planned statistics:

Geographies:

  • State (v0)
  • County (v0)
  • County Subdivision (FUTURE)
  • Census-Defined Place (FUTURE)
  • Tribal Areas (FUTURE)
  • School districts (unified, secondary, elementary) (FUTURE)
  • Congressional districts (FUTURE)
  • State legislative districts (upper, lower) (FUTURE)

Example time period aggregations:

  • day
  • week
  • month
  • quarter
  • year
@critzo
Copy link
Author

critzo commented Sep 9, 2021

Aggregation by any of the time periods above is possible using the current output. By querying the stats tables in BigQuery, we can add summary statistics over any day, week, month, quarter, year, or multi-year.

For example, the query below would provide stats for US counties in the first quarter of 2021:

WITH
mlab_us_counties AS (
	SELECT * FROM `measurement-lab.statistics.v0_us_counties`
	WHERE date BETWEEN '2021-01-01' AND '2021-06-30'
)
SELECT 
	MIN(download_MIN) AS download_MIN,
	AVG(download_MED) as download_MED,
	MAX(download_MAX) AS download_MAX,
	MIN(upload_MIN) AS upload_MIN,
	AVG(upload_MED) AS upload_MED, 
        MAX(upload_MAX) AS upload_MAX,
	county_fips_code,
  county_name
FROM mlab_us_counties
GROUP BY county_fips_code, county_name

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backlog enhancement New feature or request P2
Projects
None yet
Development

No branches or pull requests

2 participants