|
| 1 | +# Environmental Justice API |
| 2 | + |
| 3 | +## Overview |
| 4 | +This API provides access to Environmental Justice data from multiple sources. It supports retrieving data from individual sources or as a combined dataset with defined precedence rules. |
| 5 | + |
| 6 | +## Endpoints |
| 7 | + |
| 8 | +### GET /api/environmental-justice/ |
| 9 | + |
| 10 | +Retrieves environmental justice data based on specified data source. |
| 11 | + |
| 12 | +#### Query Parameters |
| 13 | + |
| 14 | +| Parameter | Description | Default | Options | |
| 15 | +|-------------|-------------|------------|----------------------------------------------| |
| 16 | +| data_source | Data source filter | "combined" | "spreadsheet", "ml_production", "ml_testing", "combined" | |
| 17 | + |
| 18 | +#### Data Source Behavior |
| 19 | + |
| 20 | +1. **Single Source** |
| 21 | + - `?data_source=spreadsheet`: Returns only spreadsheet data |
| 22 | + - `?data_source=ml_production`: Returns only ML production data |
| 23 | + - `?data_source=ml_testing`: Returns only ML testing data |
| 24 | + |
| 25 | +2. **Combined Data** (Default) |
| 26 | + - Access via `?data_source=combined` or no parameter |
| 27 | + - Merges data from 'spreadsheet' and 'ml_production' sources |
| 28 | + - Precedence rules: |
| 29 | + - If the same dataset exists in both sources, the spreadsheet version is used |
| 30 | + - Unique datasets from ml_production are included |
| 31 | + - ML testing data is not included in combined view |
| 32 | + |
| 33 | +#### Example Requests |
| 34 | + |
| 35 | +```bash |
| 36 | +# Get combined data (default) |
| 37 | +GET /api/environmental-justice/ |
| 38 | + |
| 39 | +# Get combined data (explicit) |
| 40 | +GET /api/environmental-justice/?data_source=combined |
| 41 | + |
| 42 | +# Get only spreadsheet data |
| 43 | +GET /api/environmental-justice/?data_source=spreadsheet |
| 44 | + |
| 45 | +# Get only ML production data |
| 46 | +GET /api/environmental-justice/?data_source=ml_production |
| 47 | + |
| 48 | +# Get only ML testing data |
| 49 | +GET /api/environmental-justice/?data_source=ml_testing |
| 50 | +``` |
| 51 | + |
| 52 | +#### Response Fields |
| 53 | + |
| 54 | +Each record includes the following fields: |
| 55 | +- dataset |
| 56 | +- description |
| 57 | +- description_simplified |
| 58 | +- indicators |
| 59 | +- intended_use |
| 60 | +- latency |
| 61 | +- limitations |
| 62 | +- project |
| 63 | +- source_link |
| 64 | +- strengths |
| 65 | +- format |
| 66 | +- geographic_coverage |
| 67 | +- data_visualization |
| 68 | +- spatial_resolution |
| 69 | +- temporal_extent |
| 70 | +- temporal_resolution |
| 71 | +- sde_link |
| 72 | +- data_source |
| 73 | + |
| 74 | +## Data Source Definitions |
| 75 | + |
| 76 | +- **spreadsheet**: Primary source data from environmental justice spreadsheets |
| 77 | +- **ml_production**: Production machine learning processed data |
| 78 | +- **ml_testing**: Testing/staging machine learning processed data |
| 79 | + |
| 80 | +## Precedence Rules |
| 81 | +When retrieving combined data: |
| 82 | +1. If a dataset exists in both spreadsheet and ml_production: |
| 83 | + - The spreadsheet version takes precedence |
| 84 | + - The ml_production version is excluded |
| 85 | +2. Datasets unique to ml_production are included in the response |
| 86 | +3. ML testing data is never included in combined results |
0 commit comments