census_getter is a tool to get Census 5-year ACS data using an expression file. The expression file provides information to the program- each row specifies information about which variables should be retrieved and how they should be aggregated. Currently, this tool returns data at the block group level- data at the tract level is apportioned to the block group either by total households or total population, which is also specified in the expresson file.
-
Setup census api key as an env variable
- Get a free census api key here: https://api.census.gov/data/key_signup.html
- Save your api key as an env variable named CENSUS_KEY
-
Install uv
- Open Powershell as administrator
- Enter the following:
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex" -
Switch to CMD and clone the census_getter repository
git clone https://github.com/psrc/census_getter.git -
Try running an example: Starting from the census_getter directory run:
uv run census_getter\run.py -c examples\population_synthesizer\configs_census_getter -
Setup and run a new example project
- Create a new folder in census_getter\examples
- Copy configs directory from another example
- Customize what ACS data to download in configs_census_getter\census_getter_expressions.csv
- Customize which steps to run and other settings in configs_census_getter\settings.yaml
- Run example using steps from above starting in the census_getter directory
uv run census_getter\run.py -c examples\<example_dir>\configs_census_getter - Use -c argument if you want to use a different configs folder and settings.yaml:
uv run census_getter\run.py -c <path to configs folder>
-
Run populationsim as a step within pypyr pipeline
- Copy the configs_popsim folder to your project
- Make sure in configs_census_getter/settings.yaml that
configs_popsimpoints to the popsim configs directory