Spaces:
Running on CPU Upgrade
Running on CPU Upgrade
File size: 3,305 Bytes
61d29fc | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 | # US Census Bureau Data Scripts
Scripts for working with [US Census Bureau](https://www.census.gov/) geographic and demographic data.
## Data Source
- **Website**: https://www.census.gov/
- **API**: https://www.census.gov/data/developers.html
- **Geography**: https://www.census.gov/geographies.html
- **Coverage**: All US jurisdictions
- **Data Types**: Geographic boundaries, demographics, housing, economic data
## Scripts
### Core Scripts
- **`census_ingestion.py`** - Download Census Gazetteer files (government jurisdictions)
- **`acs_ingestion.py`** ⭐ **NEW** - Download American Community Survey demographic data
- `download_county_mappings.py` - Download Census Geographic Relationship Files
- `create_zip_county_mapping.py` - Create ZIP-to-county mapping table
### New: American Community Survey (ACS) Integration
The **`acs_ingestion.py`** script provides comprehensive demographic data download capabilities:
**Key Features:**
- Download demographic, economic, housing, and health data
- Support for multiple geography levels (county, place, tract)
- Automatic caching to D drive or custom directory
- Census API integration with rate limiting
- 20+ pre-configured key tables
**Quick Start:**
```python
from acs_ingestion import ACSDataIngestion
from pathlib import Path
# Use D drive for storage
acs = ACSDataIngestion(data_dir=Path("D:/open-navigator-data/acs"))
# Download median household income
income_df = await acs.download_acs_data_api("B19013", "county", "*")
# Download child health insurance (oral health focus!)
insurance_df = await acs.download_acs_data_api("B27010", "county", "*")
```
**See Also:**
- Full documentation: `website/docs/data-sources/census-acs.md`
- D drive setup: `website/docs/deployment/d-drive-configuration.md`
- Example script: `examples/download_acs_to_d_drive.py`
## Key Datasets
### Census of Governments (census_ingestion.py)
- Counties (3,200+)
- Municipalities/Cities (19,500+)
- Townships (36,000+)
- School Districts (13,000+)
### American Community Survey (acs_ingestion.py) ⭐
- **Demographics**: Age, race, ethnicity, language
- **Economics**: Income, poverty, employment
- **Health Insurance**: Coverage by age (critical for oral health!)
- **Education**: School enrollment, attainment
- **Housing**: Occupancy, value, rent
### Geographic Relationship Files
- ZIP Code Tabulation Area (ZCTA) to County mappings
- County to State mappings
- Place to County mappings
## Usage Examples
### Download ACS Data to D Drive
```bash
# Download all key demographic tables for all counties
python examples/download_acs_to_d_drive.py --geography county --state "*"
# Download California counties only
python examples/download_acs_to_d_drive.py --geography county --state 06
# Download health insurance data only
python examples/download_acs_to_d_drive.py --health-insurance-only
# List all available tables
python examples/download_acs_to_d_drive.py --list-tables
```
### Download County Mappings
```bash
# Download county relationship files
python download_county_mappings.py
# Create ZIP-county mapping
python create_zip_county_mapping.py
```
### Download Jurisdiction Lists
```bash
# Ingest Census API data
python census_ingestion.py --state MA --dataset acs5
```
## Data License
US Census Bureau data is public domain.
|