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 Blockgroups level fix #73 #122

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
Open

Conversation

jbousquin
Copy link

Added "blockgroup" as level for census and ACS (Issue #73). Tiger layers are 16 (census) and 10 (ACS).

On the issue thread @dfolch pointed out 2 items for additional consideration:

  1. cenpy API name for this level. cenpy uses "blockgroup" consistently, so I used the same except for geo_unit since census requires "block group" as the string. Looking to other similar project - ACS.R uses block.group for geo.make but both "blockgroup" and "block group" in documentation/messages. tidycensus (also R) uses "block group" as the expected geography value (accepts 'cbg' as well).
  2. Missing years. 'block group' is a defined geo unit in 2013 on but not 2010-2012 (e.g. 2012). There is already a NotImplementedError on ACS years before 2013. This will need to be revisited if earlier years are ever added.

I did some manual tests but wasn't sure how you wanted unit tests added (in test_functional_products.py?)

Added {'blockgroup':10} to layer_lookup for tiger decennial map service layer
Added query hierarchy for blockgroup
@ljwolf
Copy link
Member

ljwolf commented Oct 23, 2020

Hey, thanks for this! this is excellent!

The test_functional_products.py file is a direct conversion of the demo notebook announcing the product API, which should probably just use something like the pytest nbval plugin to actually ensure that the products don't change.

So, if you add a query to the blockgroups to that code (as you have) that's fine!

@ljwolf ljwolf self-requested a review October 23, 2020 09:20
Changed key to 2011 since there seems to be a problem on the census side with 2012 & 2013.
@jbousquin
Copy link
Author

Set up travis with my fork so I could re-run tests since some of the errors are inconsistent (e.g. HTTP Error 500: Internal Server Error). Let me know if there is a better way to document this.

The key error in test_functional.py is new in the past week, looks like a problem on the census side with 2012 & 2013. They have it listed under available APIs link but calls give a 404 error. For now I just changed the key to CBP2011.

@yonil7
Copy link

yonil7 commented Sep 12, 2021

Is this feature scheduled for the next release?

jbousquin and others added 10 commits November 23, 2021 16:50
Get alt levels for diff years (see PR: cenpy-devs@bdfc399)
Catch and redirect if ACS 2020 to Census 2020. Could be done in tiger, but this way it will be assigned to attribute. Could be done earlier in product but suspect this will be more concise. Could also be done as a try/catch instead, but current key error handling is good.
Update catch to allow 2021 as latest
Add 2020 and 2021 as test case
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

Successfully merging this pull request may close these issues.

3 participants