Ingest census data directly, add unemployment to the score (#214)

* Ingest two data sources and add to score

Co-authored-by: Jorge Escobar <jorge.e.escobar@omb.eop.gov>
This commit is contained in:
Lucas Merrill Brown 2021-06-24 14:11:07 -07:00 committed by GitHub
commit 589ec483e3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 395 additions and 26 deletions

View file

@ -71,10 +71,10 @@
"# Rename unclear name \"id\" to \"census_block_group_id\", as well as other renamings.\n",
"cejst_df.rename(\n",
" columns={\n",
" \"ID\": CENSUS_BLOCK_GROUP_ID_FIELD,\n",
" \"ACSTOTPOP\": CENSUS_BLOCK_GROUP_POPULATION_FIELD,\n",
" \"score_a\": CEJST_SCORE_FIELD,\n",
" \"score_a_percentile\": CEJST_PERCENTILE_FIELD,\n",
" \"GEOID10\": CENSUS_BLOCK_GROUP_ID_FIELD,\n",
" \"Total population\": CENSUS_BLOCK_GROUP_POPULATION_FIELD,\n",
" \"Score C\": CEJST_SCORE_FIELD,\n",
" \"Score C (percentile)\": CEJST_PERCENTILE_FIELD,\n",
" },\n",
" inplace=True,\n",
" errors=\"raise\",\n",
@ -110,10 +110,13 @@
"# Data from https://calenviroscreen-oehha.hub.arcgis.com/#Data, specifically:\n",
"# https://oehha.ca.gov/media/downloads/calenviroscreen/document/calenviroscreen40resultsdatadictionaryd12021.zip\n",
"\n",
"download = requests.get(\"https://justice40-data.s3.amazonaws.com/CalEnviroScreen/CalEnviroScreen_4.0_2021.zip\", verify=False)\n",
"download = requests.get(\n",
" \"https://justice40-data.s3.amazonaws.com/CalEnviroScreen/CalEnviroScreen_4.0_2021.zip\",\n",
" verify=False,\n",
")\n",
"file_contents = download.content\n",
"zip_file_path = TEMP_DATA_DIR\n",
"zip_file = open(zip_file_path / \"downloaded.zip\", \"wb\")\n",
"zip_file = open(zip_file_path / \"downloaded.zip\", \"wb\")\n",
"zip_file.write(file_contents)\n",
"zip_file.close()"
]
@ -298,11 +301,11 @@
"id": "0c534966",
"metadata": {
"variables": {
"all_100_sum": "1168",
"all_100_sum_percent": "59%",
"at_least_one_sum": "1817",
"at_least_one_sum_percent": "92%",
"cejst_cbgs_ca_only": "6987",
"all_100_sum": "1373",
"all_100_sum_percent": "69%",
"at_least_one_sum": "1866",
"at_least_one_sum_percent": "94%",
"cejst_cbgs_ca_only": "10849",
"ces_tracts_count": "1983"
}
},
@ -319,14 +322,6 @@
"\n",
"Out of every CalEnviroScreen Disadvantaged Community census tract, {{all_100_sum}} ({{all_100_sum_percent}}) of these census tracts have 100% of the included census block groups within them considered priority communities by the current version of the CEJST score."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "db3c7d38",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
@ -345,7 +340,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.0"
"version": "3.7.1"
}
},
"nbformat": 4,