Overview
OpenAVM Kit can enrich your property data with demographic information from the U.S. Census Bureau using the Census API. This adds valuable context like median income, population density, and other block group-level statistics to your dataset.Why Use Census Enrichment?
Census data provides important neighborhood context for property valuation:- Demographic characteristics - Population, age distribution, household composition
- Economic indicators - Median income, employment rates, poverty levels
- Housing statistics - Occupancy rates, housing values, rent levels
- Geographic context - Block group and tract-level aggregations
Getting a Census API Key
The Census API requires a free API key.Sign Up for an API Key
- Visit the Census API Key Signup page: api.census.gov/data/key_signup.html
- Fill out the registration form with your information
- Agree to the Census Bureau’s Terms of Service
- Submit the form
- Check your email for the API key (usually arrives within minutes)
The Census API key is free and has generous rate limits for most use cases. Keep your key secure but note that it’s less sensitive than authentication tokens for other services.
Configuration
Add API Key to .env File
Store your Census API key in the.env file located in the notebooks/ directory:
Enable Census Enrichment
Add Census configuration to your locality’ssettings.json:
Configuration Options
Set to
true to enable Census data enrichmentThe Census year to query. Use the most recent available year for current data.Common years:
2020- Decennial Census2022- American Community Survey (ACS) 5-year estimates2021- American Community Survey (ACS) 5-year estimates
The 5-digit FIPS code identifying your locality (state + county code)Format:
SSCCC where:SS= 2-digit state codeCCC= 3-digit county code
48453- Travis County, Texas (state 48, county 453)24510- Baltimore City, Maryland (state 24, county 510)06037- Los Angeles County, California (state 06, county 037)
List of Census variables to include in your datasetCommon fields:
median_income- Median household incometotal_pop- Total populationmedian_age- Median agemedian_home_value- Median home valuepct_owner_occupied- Percentage of owner-occupied housing unitspct_renter_occupied- Percentage of renter-occupied housing unitsunemployment_rate- Unemployment rate
Example Configurations
How It Works
Spatial Join Process
- Download Census Data - The library queries the Census API for your specified fields at the block group level
- Match Geography - Census block groups are spatially joined to your parcels based on location
- Add Fields - Census variables are added as new columns to your parcel dataset
- Use in Models - The enriched fields are available for feature engineering and modeling
Data Granularity
Census enrichment uses block group level data, which provides a good balance between:- Granularity - Small enough to capture neighborhood variation
- Privacy - Large enough to protect individual privacy
- Stability - Sufficient sample sizes for reliable estimates
Using Census Data in Code
The Census enrichment happens automatically during the data processing pipeline:Available Census Variables
The Census API provides hundreds of variables. Here are some commonly used ones:Economic Variables
median_income- Median household incomeper_capita_income- Per capita incomepoverty_rate- Percentage below poverty lineunemployment_rate- Unemployment ratemedian_earnings- Median earnings for workers
Demographic Variables
total_pop- Total populationmedian_age- Median ageavg_household_size- Average household sizepct_male- Percentage malepct_female- Percentage female
Housing Variables
median_home_value- Median home valuemedian_rent- Median gross rentpct_owner_occupied- Percentage owner-occupied unitspct_renter_occupied- Percentage renter-occupied unitsvacancy_rate- Housing vacancy rate
Education Variables
pct_high_school- Percentage with high school diplomapct_bachelor_degree- Percentage with bachelor’s degreepct_graduate_degree- Percentage with graduate degree
Troubleshooting
API Key Not Found
Error:Missing 'CENSUS_API_KEY' in environment
Solution: Verify your .env file contains the CENSUS_API_KEY variable and is located in the notebooks/ directory.
Invalid FIPS Code
Error:Invalid FIPS code or no data returned
Solution: Double-check your 5-digit FIPS code. Ensure it matches your locality exactly. Use the Census Bureau’s FIPS code reference.
Variable Not Found
Error:Census variable not found
Solution: The variable name may have changed between Census years. Check the Census API documentation for your selected year to verify variable names.
Rate Limiting
Error:API rate limit exceeded
Solution: The Census API has rate limits. If you’re making many requests:
- Add delays between requests
- Cache results locally
- Contact the Census Bureau for higher limits if needed
Best Practices
Next Steps
OpenStreetMap
Add geographic features from OpenStreetMap
Settings Configuration
Learn more about settings.json structure
Cloud Storage
Configure cloud storage for your data
Data Processing
Learn about the data processing pipeline