{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Site Selection: Health clinics\n", "\n", ">* π Ready To Run!\n", "* π₯οΈ Requires Network Analysis Organization Configuration\n", "* π¬ Data Science\n", "* πΈοΈ Network Analysis" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Clinic access for the chronically ill\n", "\n", "Location is everything for the chronically ill. For patients with amyotrophic lateral sclerosis (ALS), visits to clinics are exhausting full-day engagements involving sessions with highly trained specialists from several disciplines. Patients with long drives to their nearest clinic may also face the additional hardship of having to plan for travel days to and from the clinic as well as for food and lodging. \n", "\n", "This notebook demonstrates how ArcGIS can perform network analysis to identify potential sites for new ALS clinics in California to improve access for patients who do not live near a clinic.\n", "\n", "
Note: The examples in this notebook is intended to serve only as a technology demonstration. The analysis results should not be used for any planning purposes as the data for ALS patient locations are fictional. The ALS clinic locations were obtained from data that was publically available in October 2017." ] }, { "cell_type": "markdown", "metadata": { "toc": true }, "source": [ "
Locations of ALS patients that must travel for over 90 minutes to access a clinic.\n",
"
Existing ALS clinics.\n",
"
90 minute drive times from existing ALS clinics.\n",
"
Candidate cities for new ALS clinics."
]
},
{
"cell_type": "code",
"execution_count": 25,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"
"
],
"text/plain": [
"
"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"To perform network analysis, you need a network dataset, which models a transportation network. In the ArcGIS API for Python, the network dataset is accessed through a network service hosted in your Organization.\n",
"\n",
"### Location-Allocation Analysis\n",
"\n",
"The goal of [location-allocation](http://pro.arcgis.com/en/pro-app/help/analysis/networks/location-allocation-analysis-layer.htm) is to locate facilities in a way that supplies the demand points most efficiently. As the name suggests, location-allocation is a two-fold problem that simultaneously locates facilities and allocates demand points to the facilities."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"\n",
"
"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"\n",
"### The `solve_location_allocation` tool\n",
"\n",
"In this notebook, we will use the [solve_location_allocation](http://esri.github.io/arcgis-python-api/apidoc/html/arcgis.network.analysis.html#solve-location-allocation) tool to find the best locations for new ALS clinics in California. Inputs to this tool include [FeatureSet](http://esri.github.io/arcgis-python-api/apidoc/html/arcgis.features.toc.html#featureset)s containing the following data:\n",
"* facilities\n",
"* demand points. \n",
"\n",
"For the examples in this notebook, the facilities are a set of candidate locations for new ALS clinics. These locations could be actual addresses. However, for these examples, the candidate locations are cities that could potentially host new ALS clinics and are represented by their centroid points. The candidate cities were pre-selected based on the following criteria:\n",
"* they are within California\n",
"* they are outside of the 90 minute drive time areas from existing ALS clinics\n",
"* they have populations of at least 60,000, and are therefore assumed to have sufficient health care facilities and professionals to support an ALS clinic\n",
"\n",
"The analyses in this notebook could lead to further multi-criteria analysis to identify specific locations within a city or other geographic area. For examples of Jupyter Notebooks with multi-criteria suitability analysis see [Calculating cost surfaces using weighted overlay analysis](https://developers.arcgis.com/python/sample-notebooks/calculating-cost-surfaces-using-weighted-overlay-analysis/) and [Finding suitable spots for placing heart defibrillator equipments in public](https://developers.arcgis.com/python/sample-notebooks/finding-suitable-spots-for-aed-devices-using-raster-analytics/)\n",
"\n",
"For the demand points, we will use point locations of fictional ALS patients. These locations are aggregated to zip code centroids and contain an estimated number of ALS patients based on the total population within each zip code.\n",
"\n",
"The output of the tool is a named tuple which contains the following data:\n",
"* solve_succeeded (`bool`)\n",
"* output_facilities (`FeatureSet`)\n",
"* output_demand_points (`FeatureSet`)\n",
"* output_allocation_lines (`FeatureSet`)\n",
"\n",
"To prepare to run the `solve_location_allocation` tool we will first perform the following steps:\n",
"1. Extract the required input `FeatureSets` for the tool from `FeatureLayerCollection` items in the GIS.\n",
"2. Define a function to extract, symbolize, and display the output results from the `solve_location_allocation` tool."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Analysis Preparation"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"
\n",
" \n",
"
\n",
"\n",
" \n",
" \n",
" \n",
" \n",
" SHAPE \n",
" fid \n",
" name \n",
" num_patien \n",
" objectid \n",
" population \n",
" state \n",
" zip_code \n",
" \n",
" \n",
" 0 \n",
" {\"x\": -13637994.1059, \"y\": 4556818.18590001, \"... \n",
" 1 \n",
" Sausalito \n",
" 2 \n",
" 1 \n",
" 11539.0 \n",
" CA \n",
" 94965 \n",
" \n",
" \n",
" 1 \n",
" {\"x\": -13769834.5883, \"y\": 4788472.863200009, ... \n",
" 2 \n",
" Fort Bragg \n",
" 2 \n",
" 2 \n",
" 14803.0 \n",
" CA \n",
" 95437 \n",
" \n",
" \n",
" 2 \n",
" {\"x\": -13739947.675599998, \"y\": 4755880.422900... \n",
" 3 \n",
" Redwood Valley \n",
" 1 \n",
" 3 \n",
" 6162.0 \n",
" CA \n",
" 95470 \n",
" \n",
" \n",
" 3 \n",
" {\"x\": -13599952.4789, \"y\": 4648310.701499999, ... \n",
" 4 \n",
" Napa \n",
" 10 \n",
" 4 \n",
" 66380.0 \n",
" CA \n",
" 94558 \n",
" \n",
" \n",
" \n",
"4 \n",
" {\"x\": -13642962.993099997, \"y\": 4718351.166199... \n",
" 5 \n",
" Clearlake \n",
" 3 \n",
" 5 \n",
" 17446.0 \n",
" CA \n",
" 95422 \n",
" \n",
" \n",
"
\n",
"\n",
" \n",
" \n",
" \n",
" \n",
" SHAPE \n",
" fid \n",
" name \n",
" objectid \n",
" population \n",
" state \n",
" weight \n",
" zip_code \n",
" \n",
" \n",
" 0 \n",
" {\"x\": -13637994.1059, \"y\": 4556818.18590001, \"... \n",
" 1 \n",
" Sausalito \n",
" 1 \n",
" 11539.0 \n",
" CA \n",
" 2 \n",
" 94965 \n",
" \n",
" \n",
" 1 \n",
" {\"x\": -13769834.5883, \"y\": 4788472.863200009, ... \n",
" 2 \n",
" Fort Bragg \n",
" 2 \n",
" 14803.0 \n",
" CA \n",
" 2 \n",
" 95437 \n",
" \n",
" \n",
" 2 \n",
" {\"x\": -13739947.675599998, \"y\": 4755880.422900... \n",
" 3 \n",
" Redwood Valley \n",
" 3 \n",
" 6162.0 \n",
" CA \n",
" 1 \n",
" 95470 \n",
" \n",
" \n",
" 3 \n",
" {\"x\": -13599952.4789, \"y\": 4648310.701499999, ... \n",
" 4 \n",
" Napa \n",
" 4 \n",
" 66380.0 \n",
" CA \n",
" 10 \n",
" 94558 \n",
" \n",
" \n",
" \n",
"4 \n",
" {\"x\": -13642962.993099997, \"y\": 4718351.166199... \n",
" 5 \n",
" Clearlake \n",
" 5 \n",
" 17446.0 \n",
" CA \n",
" 3 \n",
" 95422 \n",
" \n",
" \n",
"
\n",
"\n",
" \n",
" \n",
" \n",
" \n",
" Name \n",
" FacilityType \n",
" DemandCount \n",
" DemandWeight \n",
" \n",
" \n",
" 0 \n",
" Bakersfield \n",
" 0 \n",
" 0 \n",
" 0 \n",
" \n",
" \n",
" 1 \n",
" Redding \n",
" 0 \n",
" 0 \n",
" 0 \n",
" \n",
" \n",
" 2 \n",
" Visalia \n",
" 3 \n",
" 66 \n",
" 299 \n",
" \n",
" \n",
" 3 \n",
" Santa Maria \n",
" 0 \n",
" 0 \n",
" 0 \n",
" \n",
" \n",
" 4 \n",
" Santa Barbara \n",
" 0 \n",
" 0 \n",
" 0 \n",
" \n",
" \n",
" 5 \n",
" Chico \n",
" 0 \n",
" 0 \n",
" 0 \n",
" \n",
" \n",
" 6 \n",
" Merced \n",
" 0 \n",
" 0 \n",
" 0 \n",
" \n",
" \n",
" 7 \n",
" Clovis \n",
" 0 \n",
" 0 \n",
" 0 \n",
" \n",
" \n",
" \n",
"8 \n",
" Fresno \n",
" 0 \n",
" 0 \n",
" 0 \n",
" "
],
"text/plain": [
"
\n",
" \n",
"
\n",
"\n",
" \n",
" \n",
" \n",
" \n",
" Name \n",
" FacilityType \n",
" DemandCount \n",
" DemandWeight \n",
" \n",
" \n",
" 0 \n",
" Bakersfield \n",
" 3 \n",
" 40 \n",
" 185.701736 \n",
" \n",
" \n",
" 1 \n",
" Redding \n",
" 0 \n",
" 0 \n",
" 0.000000 \n",
" \n",
" \n",
" 2 \n",
" Visalia \n",
" 0 \n",
" 0 \n",
" 0.000000 \n",
" \n",
" \n",
" 3 \n",
" Santa Maria \n",
" 3 \n",
" 29 \n",
" 64.546570 \n",
" \n",
" \n",
" 4 \n",
" Santa Barbara \n",
" 3 \n",
" 25 \n",
" 52.453430 \n",
" \n",
" \n",
" 5 \n",
" Chico \n",
" 3 \n",
" 16 \n",
" 62.000000 \n",
" \n",
" \n",
" 6 \n",
" Merced \n",
" 3 \n",
" 58 \n",
" 223.298264 \n",
" \n",
" \n",
" 7 \n",
" Clovis \n",
" 0 \n",
" 0 \n",
" 0.000000 \n",
" \n",
" \n",
" \n",
"8 \n",
" Fresno \n",
" 0 \n",
" 0 \n",
" 0.000000 \n",
" "
],
"text/plain": [
"