cenpy-devs / cenpy

Explore and download data from Census APIs
Other
183 stars 44 forks source link

Add Blockgroups level fix #73 #122

Open jbousquin opened 4 years ago

jbousquin commented 4 years ago

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?)

ljwolf commented 4 years ago

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!

jbousquin commented 4 years ago

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 commented 3 years ago

Is this feature scheduled for the next release?