Social Vulnerability Index 2018 - United States
Posted on jeu. 09 avril 2020 in Health • 4 min read
Social Vulnerability Index 2018 - United States¶
CDC’s Social Vulnerability Index (SVI) is a tool to spatially identify socially vulnerable populations. The SVI uses U.S. Census variables that reflect at-risk populations to identify and map vulnerable areas. Information on the location and relative concentration of different types of social vulnerabilities in small geographic areas, such as census tracts can help emergency managers locate and plan for the specific needs of their communities, before, during, and after a disaster.
The SVI draws together 15 different measures of vulnerability in 4 different themes :
- Socio-Economic Status
- Household Composition & Disability
- Minority Status & Language
- Housing Type & Transportation
Using a percentile ranking method, each tract receives a separate ranking from 0 (lowest vulnerability) to 1 (highest vulnerability) for each of the 4 themes, as well as an overall ranking.
Import required libraries¶
import pandas as pd
import numpy as np
import geopandas as gpd
import json
import plotly.express as px
import plotly.io as pio
from IPython.display import Image, Javascript
from PIL import Image as PILImage
Javascript(
"""require.config({
paths: {
plotly: 'https://cdn.plot.ly/plotly-latest.min'
}
});"""
)
pio.renderers.default = 'notebook_connected'
Data pre-processing¶
To visualize the Social Vulnerability Index in the US, we chose to use a Choropleth Map which is a map composed of colored polygons. It is a useful way to represent spatial variations of a quantity.
In order to make Choropleth Maps we need two main types of input :
- Geometry information to shape the map : here a JSON file
- A list of values indexed by feature identifier to color the map : here a CSV file
JSON file¶
Here we load a CSV file containing the geometry information for US counties, where feature.id
is a 'FIPS' code.
We only keep the columns required and convert the CSV file into a GeoJSON file.
map_path = 'Data/SVI2018_US_county.shp'
map_df = gpd.read_file(map_path)
map_df.drop(map_df.loc[:, 'LOCATION':'Shape_STLe'].columns, inplace=True, axis = 1)
geo_json_data = json.loads(map_df.to_json())
CSV file¶
Here we load the CSV file which contains the SVI data by county, also indexed by 'FIPS' code.
We select and properly rename the required columns to color our maps.
In the dataset, values of -999 represent "null" or "no data", so we replace these values by special value np.nan
in order to ignore them on our mapping.
df = pd.read_csv('Data/SVI2018_US_COUNTY.csv', dtype={"FIPS": str})
df.rename(columns={'RPL_THEME1':'SS_SVI', 'RPL_THEME2':'HCD_SVI', 'RPL_THEME3':'MSL_SVI', 'RPL_THEME4':'HTT_SVI', 'RPL_THEMES': 'SVI'}, inplace=True)
df.replace(-999.0, np.nan, inplace=True)
svi = df[['ST','STATE','ST_ABBR','COUNTY','FIPS','SS_SVI','HCD_SVI','MSL_SVI','HTT_SVI','SVI']]
svi.head()
SVI Mapping¶
To create our Choropleth Maps we will use Plotly Express' px.choropleth
function.
The GeoJSON data is passed to the geojson
argument, and the data is passed into the color
argument of px.choropleth
, in the same order as the IDs are passed into the locations
argument.
We use the featureidkey
parameter to specify where to match the values of locations
. Here we use the 'FIPS' key in the properties
field.
The SVI score is ranked from 0 (lowest vulnerability) to 1 (highest vulnerability), which is why we have defined the range_color
from 0 to 1.
Our dataset focusing on the United States, we have set layout.geo.scope
to 'usa' to automatically configure the map to display data centered on the United States in an appropriate projection.
Overall SVI Map¶
fig_svi = px.choropleth(svi,
geojson=geo_json_data,
locations='FIPS',
color='SVI',
featureidkey='properties.FIPS',
hover_data=['STATE', 'COUNTY'],
color_continuous_scale="YlOrRd",
range_color=(0, 1),
scope='usa',
title='<b>U.S. Social Vulnerability Index 2018 - Overall Map</b><br>' +
'<i>Source : Agency for Toxic Substances and Disease Registry</i>',
labels={'SVI':'Overall SVI'}
)
# Style
fig_svi.update_layout(
font_family='Helvetica',
font_color='grey',
font_size=12,
title_font_size=20
)
Image(data=fig_svi.to_image())
Socio-Economic Status Map¶
fig_ss_svi = px.choropleth(svi,
geojson=geo_json_data,
locations='FIPS',
color='SS_SVI',
featureidkey='properties.FIPS',
hover_data=['STATE', 'COUNTY'],
color_continuous_scale='Greens',
range_color=(0, 1),
scope='usa',
title='<b>U.S. SVI 2018 - Socio-Economic Status Map</b><br>' +
'<i>Source : Agency for Toxic Substances and Disease Registry</i>',
labels={'SS_SVI':'SVI : Socio-<br>Economic Status'}
)
# Style
fig_ss_svi.update_layout(
font_family='Helvetica',
font_color='grey',
font_size=12,
title_font_size=20
)
Image(data=fig_ss_svi.to_image())
Household Composition & Disability Map¶
fig_hcd_svi = px.choropleth(svi,
geojson=geo_json_data,
locations='FIPS',
color='HCD_SVI',
featureidkey='properties.FIPS',
hover_data=['STATE', 'COUNTY'],
color_continuous_scale='YlOrBr',
range_color=(0, 1),
scope='usa',
title='<b>U.S. SVI 2018 - Household Composition & Disability Map</b><br>' +
'<i>Source : Agency for Toxic Substances and Disease Registry</i>',
labels={'HCD_SVI':'SVI : Household<br>Composition & Disability'}
)
# Style
fig_hcd_svi.update_layout(
font_family='Helvetica',
font_color='grey',
font_size=12,
title_font_size=20
)
Image(data=fig_hcd_svi.to_image())
Minority Status & Language Map¶
fig_msl_svi = px.choropleth(svi,
geojson=geo_json_data,
locations='FIPS',
color='MSL_SVI',
featureidkey='properties.FIPS',
hover_data=['STATE', 'COUNTY'],
color_continuous_scale="Purples",
range_color=(0, 1),
scope='usa',
title='<b>U.S. SVI 2018 - Minority Status & Language Map</b><br>' +
'<i>Source : Agency for Toxic Substances and Disease Registry</i>',
labels={'MSL_SVI':'SVI : Minority<br>Status & Language'}
)
# Style
fig_msl_svi.update_layout(
font_family='Helvetica',
font_color='grey',
font_size=12,
title_font_size=20
)
Image(data=fig_msl_svi.to_image())
Housing Type & Transportation Map¶
fig_htt_svi = px.choropleth(svi,
geojson=geo_json_data,
locations='FIPS',
color='HTT_SVI',
featureidkey='properties.FIPS',
hover_data=['STATE', 'COUNTY'],
color_continuous_scale='Blues',
range_color=(0, 1),
scope='usa',
title='<b>U.S. SVI 2018 - Housing Type & Transportation Map</b><br>' +
'<i>Source : Agency for Toxic Substances and Disease Registry</i>',
labels={'HTT_SVI':'SVI : Housing<br>Type & Transportation'}
)
# Style
fig_htt_svi.update_layout(
font_family='Helvetica',
font_color='grey',
font_size=12,
title_font_size=20
)
Image(data=fig_htt_svi.to_image())
Sources¶
SVI Documentation & Data from Agency for Toxic Substances and Disease Registry