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

APIConnection.query - documentation bug for geo_unit #145

Open
JoeGermuska opened this issue Jun 15, 2021 · 1 comment
Open

APIConnection.query - documentation bug for geo_unit #145

JoeGermuska opened this issue Jun 15, 2021 · 1 comment

Comments

@JoeGermuska
Copy link
Contributor

This is very small, but the docs for cenpy.remote.APIConnection.query indicate that geo_unit can be dict or string

cenpy/cenpy/remote.py

Lines 145 to 158 in 1072257

Conduct a query over the USCB api connection
Parameters
-----------
cols : list of str
census column names to request
geo_unit : dict or str
identifiers for the basic spatial unit of the query
geo_filter : dict
required geometries above the specified geo_unit needed
to complete the query
apikey : str
USCB-issued API key for your query.
**kwargs : additional search predicates can be passed here

but there's no sign in the implementation of ever checking for a dict.

Before submitting a PR, would it be better to fix the docs? Or add support for it as a dict? I mostly use the ACS, and as far as I can tell, the for parameter in the API never takes more than one type, so I'm not sure there's need for a dict -- but maybe some of the other endpoints behave differently?

@ronnie-llamado
Copy link
Member

I think adding support for dict would be preferable. This removes the string formatting responsibility from the end user.

In the ACS, the for parameter would only have one key but it can accept multiple types of values:

type query
wildcard https://api.census.gov/data/2019/acs/acs5?get=NAME&for=county:*&in=state:06
fips https://api.census.gov/data/2019/acs/acs5?get=NAME&for=county:069&in=state:06
list of fips https://api.census.gov/data/2019/acs/acs5?get=NAME&for=county:069,071&in=state:06

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