Skip to content

Select counties under a specific state for data export #721

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

Closed
kenneth-lee-ch opened this issue Jan 14, 2021 · 5 comments · Fixed by #811
Closed

Select counties under a specific state for data export #721

kenneth-lee-ch opened this issue Jan 14, 2021 · 5 comments · Fixed by #811
Assignees
Labels
enhancement New feature or request

Comments

@kenneth-lee-ch
Copy link

It would be great if I can select all the counties under a specific state without typing each one of the county names for exporting data.

User story

I tried to download all county-level data for California, but I had to manually type each county name...which was not a fond experience for me.

Additional context

@sgratzl
Copy link
Member

sgratzl commented Jan 19, 2021

related issue: cmu-delphi/delphi-epidata#380

@krivard
Copy link
Contributor

krivard commented Jan 21, 2021

Hi Kenneth -- we have some plans in motion in the backend that will make it easier to support that kind of query, but they won't be completed for several weeks. In the meantime, if you are able to use the R or Python clients, there is a (terrible, but less terrible than typing in all the county ids by hand) workaround: fetch the data on all counties, then filter for the state prefix once you have all the data. County FIPS codes use the format XXYYY, where XX is the FIPS code for the state. You can see all state FIPS codes here: https://www.nrcs.usda.gov/wps/portal/nrcs/detail/?cid=nrcs143_013696

In R, that would be something like:

library(covidcast)
library(dplyr)
df <- covidcast_signal("fb-survey", "smoothed_wcli")
df_california <- filter(df, startsWith(geo_value, "06"))

the one major downside being that querying all counties for a large timespan will take ages for dense signals like cases/deaths and safegraph... but at least that's your computer taking ages, and not requiring your attention.

@kenneth-lee-ch
Copy link
Author

kenneth-lee-ch commented Jan 21, 2021

Hi Katie, I have been doing that since August last year. Currently, I write the data frame to a .csv and use that.csv to make things faster e.g. knitting a .rmd to an HTML file without re-fetching all the data. I thought this feature will be good to have if someone goes to the website and just wants to get that .csv.

@tildechris
Copy link
Contributor

Hi Kenneth -- we have some plans in motion in the backend that will make it easier to support that kind of query, but they won't be completed for several weeks.

@krivard, is there an existing issue that we can link here to track that backend improvement?

@krivard
Copy link
Contributor

krivard commented Feb 2, 2021

sgratzl added a commit that referenced this issue Mar 11, 2021
@sgratzl sgratzl self-assigned this Mar 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants