Anacostia DC Air pollution and water warning system using EJScreen data.
This project analyzes environmental justice data for the District of Columbia, with a focus on the Anacostia area. It integrates EJScreen API data with TIGER/Line shapefiles to create spatial visualizations and analyses of environmental and demographic indicators.
- Data Filtering: Filter EJScreen data for DC (District of Columbia)
- API Integration: Fetch environmental and demographic data from the EJScreen API
- Spatial Analysis: Merge data with TIGER/Line shapefiles for geographic visualization
- Batch Processing: Fetch data for multiple block groups with rate limiting
dc-south-east-study/
├── data/
│ ├── raw/ # Raw data files and shapefiles
│ └── processed/ # Processed data and merged shapefiles
├── notebooks/ # Jupyter notebooks for analysis
├── src/ # Source code
│ ├── config.py # Configuration constants
│ ├── start.py # Filter EJScreen data for DC
│ ├── get_data_from_api.py # Single API data fetch
│ ├── get_study_data.py # Batch API data fetching
│ └── clean_data.py # Merge data with shapefiles
├── pyproject.toml # Poetry dependencies
└── requirements.txt # pip dependencies
- Python 3.10 or higher
- Poetry (recommended) or pip
macOS (using Homebrew):
brew install pipx
pipx ensurepath
pipx install poetryWindows (using Scoop):
scoop install pipx
pipx ensurepath
pipx install poetryAlternative (using pip):
pip install poetryUsing Poetry (recommended):
poetry installUsing pip:
pip install -r requirements.txtFilter the national EJScreen dataset to only include DC data:
poetry run python src/start.py
# or
python src/start.pyThis will:
- Read the EJScreen tract-level data
- Filter for DC (ST_ABBREV == 'DC')
- Save filtered data to
data/processed/track/
Single Block Group:
poetry run python src/get_data_from_api.pyMultiple Block Groups (Anacostia area):
poetry run python src/get_study_data.pyThis will:
- Fetch data for all block groups in southeast Anacostia
- Fetch city-level data for Washington, DC
- Save results to CSV files in
data/processed/block_group/
Merge filtered CSV data with TIGER/Line shapefiles for spatial analysis:
poetry run python src/clean_data.pyThis will:
- Load TIGER/Line tract shapefiles
- Merge with filtered EJScreen data
- Save merged shapefile to
data/processed/shapefiles/track/
Configuration constants are defined in src/config.py, including:
- File paths
- API endpoints
- Block group IDs
- Request delays
The project uses modern Python practices:
- Type hints
- Pathlib for file paths
- Error handling
- Configuration management
Development dependencies (installed with Poetry):
black: Code formattingruff: Fast lintingmypy: Type checkingpytest: Testing
Run formatting:
poetry run black src/Run linting:
poetry run ruff check src/- EJScreen: EPA's Environmental Justice Screening and Mapping Tool
- TIGER/Line: U.S. Census Bureau geographic boundary files
See LICENSE file for details.
- Ensure code follows the project's style guidelines
- Add type hints to all functions
- Include docstrings for public functions
- Test your changes before submitting