Skip to content

Commit f9a4be0

Browse files
authored
Merge pull request #421 from Esri/manushi-opioidAnalysis
Adding narrative to opioid drive time analysis
2 parents f008afc + 43b89de commit f9a4be0

File tree

1 file changed

+106
-18
lines changed

1 file changed

+106
-18
lines changed

samples/04_gis_analysts_data_scientists/drive_time_analysis_for_opioid_epidemic.ipynb

Lines changed: 106 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,55 @@
1111
"cell_type": "markdown",
1212
"metadata": {},
1313
"source": [
14-
"This notebook performs drive time analysis for clinics of opioid epidemic treatment/prevention/both in the county of Oakland, Michigan. "
14+
"This notebook performs drive time analysis for clinics of opioid epidemic treatment and/or prevention centers in the county of Oakland, Michigan. "
1515
]
1616
},
1717
{
1818
"cell_type": "markdown",
1919
"metadata": {},
2020
"source": [
21-
"### 1. Reading in clinics and Oakland county census block group (CBG) boundaries"
21+
"### Problem\n",
22+
"\n",
23+
"Drug overdoses are a leading cause of injury death in the United States, resulting in approximately __52,000 deaths in 2015. In the same year, the overdose death rate in non metropolitan areas of the country (17 per 100,000) surpassed the metropolitan area rate (16.2 per 100,000), which historically wasn't the case.__\n",
24+
"\n",
25+
"While metro areas have more people, and consequently, a greater incidence of drug use and overdose, the one stark disadvantage in the non metro areas is the comparatively limited access to opioid epidemic prevention/treatment facilities and transit."
26+
]
27+
},
28+
{
29+
"cell_type": "markdown",
30+
"metadata": {},
31+
"source": [
32+
"### Data Driven Approach\n",
33+
"\n",
34+
"Here, we demonstrate an analysis of how several parts of Oakland county in Michigan are accessible from their opioid epidemic prevention and/or treatment centers within 5, 10, 15, 20 and 25 minutes of drive time. The areas of the county identified within those time bound service areas are then enriched with factors such as\n",
35+
"\n",
36+
"> Health insurance spending\n",
37+
">\n",
38+
"> Number of people with a Bachelor's Degree\n",
39+
">\n",
40+
"> Total Population in 2017\n",
41+
"\n",
42+
"This provides a __better understanding of the population served or under-served by these treatment facilities and the plausible contributing factors.__"
43+
]
44+
},
45+
{
46+
"cell_type": "markdown",
47+
"metadata": {},
48+
"source": [
49+
"### Steps of analysis\n",
50+
"\n",
51+
"1. Get data for clinics and census block groups boundary (CBG) in Oakland County\n",
52+
"2. Generate areas served based on time taken to drive to the clinics\n",
53+
"3. Spatially join the service areas generated with the CBG to obtain drive time to closest clinic for each CBG.\n",
54+
"4. Enrich each CBG with additional data to estimate influencing factors.\n",
55+
"5. Map it!"
56+
]
57+
},
58+
{
59+
"cell_type": "markdown",
60+
"metadata": {},
61+
"source": [
62+
"Let's get started by first importing necessary modules and connecting to our GIS"
2263
]
2364
},
2465
{
@@ -32,6 +73,24 @@
3273
"from arcgis.features import FeatureLayer"
3374
]
3475
},
76+
{
77+
"cell_type": "code",
78+
"execution_count": 6,
79+
"metadata": {},
80+
"outputs": [],
81+
"source": [
82+
"# Connect to GIS\n",
83+
"from arcgis.gis import GIS\n",
84+
"gis = GIS(profile=\"your_online_profile\") "
85+
]
86+
},
87+
{
88+
"cell_type": "markdown",
89+
"metadata": {},
90+
"source": [
91+
"### 1. Reading in clinics and Oakland county census block group (CBG) boundaries"
92+
]
93+
},
3594
{
3695
"cell_type": "code",
3796
"execution_count": 2,
@@ -70,6 +129,13 @@
70129
"print('Total number of rows in the oakland dataset: ' + str(len(oakland_features.features)))"
71130
]
72131
},
132+
{
133+
"cell_type": "markdown",
134+
"metadata": {},
135+
"source": [
136+
"We notice that Oakland County, MI has __122 clinics__ and __934 CBG__"
137+
]
138+
},
73139
{
74140
"cell_type": "code",
75141
"execution_count": 4,
@@ -416,17 +482,6 @@
416482
"oakland.head()"
417483
]
418484
},
419-
{
420-
"cell_type": "code",
421-
"execution_count": 6,
422-
"metadata": {},
423-
"outputs": [],
424-
"source": [
425-
"# Connect to GIS\n",
426-
"from arcgis.gis import GIS\n",
427-
"gis = GIS(profile=\"your_online_profile\") "
428-
]
429-
},
430485
{
431486
"cell_type": "code",
432487
"execution_count": 19,
@@ -473,8 +528,9 @@
473528
"source": [
474529
"Service areas around the clinics need to be generated twice for two different sets of drive time inputs:\n",
475530
"\n",
476-
"> 1. __`[5, 10, 15, 20, 25]`__ that is needed to get the drive time required from each CBG to the closest clinic\n",
477-
"> 2. __`[5]`__ that is needed purely for visualization purposes"
531+
"> 1. __`[5, 10, 15, 20, 25]`__ that is needed to get the drive time required from each CBG to the closest clinic. While adding more/less intervals is certainly an option, the choice of time intervals here is meant to span the range (closest-farthest clinic) as well as assume a range of safety, i.e. time within which a person can be driven/drive to a clinic to avoid delays.\n",
532+
">\n",
533+
"> 2. __`[5]`__ that is needed purely for visualization purposes (as seen towards the end of the notebook). Feel free to modify this function parameter based on how you would like to visualize the map."
478534
]
479535
},
480536
{
@@ -569,6 +625,13 @@
569625
"print('Total number of rows in the service area (upto 25 mins) dataset: '+ str(len(driveAll_features.features)))"
570626
]
571627
},
628+
{
629+
"cell_type": "markdown",
630+
"metadata": {},
631+
"source": [
632+
"This implies that only 5 clinics in this county can be driven to within 5 minutes."
633+
]
634+
},
572635
{
573636
"cell_type": "code",
574637
"execution_count": 14,
@@ -765,7 +828,7 @@
765828
"cell_type": "markdown",
766829
"metadata": {},
767830
"source": [
768-
"### 3. Spatially join the `result_url` layer with `oakland_cbg` layer to obtain drive times for each census block group"
831+
"### 3. Spatially join the `drive_times_all_layer` layer with `oakland_cbg` layer to obtain drive times for each census block group"
769832
]
770833
},
771834
{
@@ -833,6 +896,13 @@
833896
"print('Total number of rows in the drive time (upto 25 mins) dataset: '+ str(len(drive_times_features.features)))"
834897
]
835898
},
899+
{
900+
"cell_type": "markdown",
901+
"metadata": {},
902+
"source": [
903+
"This implies that the farthest clinic in the county is within a 25 minute drive time window"
904+
]
905+
},
836906
{
837907
"cell_type": "code",
838908
"execution_count": 37,
@@ -1464,8 +1534,26 @@
14641534
"Similar maps can be generated for the following variables too\n",
14651535
"> 1. Travel Time (`ToBreak`)\n",
14661536
"> 2. Population (`TOTPOP_CY`)\n",
1467-
"> 3. Citizens with Bachelor's Degree (`BACHDEG_CY`)\n"
1537+
"> 3. Citizens with Bachelor's Degree (`BACHDEG_CY`)"
14681538
]
1539+
},
1540+
{
1541+
"cell_type": "markdown",
1542+
"metadata": {},
1543+
"source": [
1544+
"### Conclusion\n",
1545+
"\n",
1546+
"As we can see from the map, clinics are concentrated in a certain part of the county. A few counties have relatively larger population, as compared to their health care spending and population count with Bachelor's degrees and don't have clinics very close by (drime time greater than 10 mins). This subtly hints at disparity in location of clinics with population/affluence level of the county. \n",
1547+
"\n",
1548+
"This analysis also sets stage for bringing in data about patients of this epidemic, to do a socio-economic study of this epidemic."
1549+
]
1550+
},
1551+
{
1552+
"cell_type": "code",
1553+
"execution_count": null,
1554+
"metadata": {},
1555+
"outputs": [],
1556+
"source": []
14691557
}
14701558
],
14711559
"metadata": {
@@ -1484,7 +1572,7 @@
14841572
"name": "python",
14851573
"nbconvert_exporter": "python",
14861574
"pygments_lexer": "ipython3",
1487-
"version": "3.7.2"
1575+
"version": "3.7.1"
14881576
}
14891577
},
14901578
"nbformat": 4,

0 commit comments

Comments
 (0)