Quantcast
Channel: maps for developers - Medium
Viewing all articles
Browse latest Browse all 2230

Dashboards for healthcare resource planning with Mapbox, Tableau, and QGIS — Part II

$
0
0

By: Allan Walker

This is Part II in a series of projects for understanding and analyzing healthcare provider data. Check out Part I — Part II will walk you through further customizing your map and data, this time to assess illness incidents and reporting.

Healthcare organizations are usually split up into regions to help distribute efforts in recording incidents and reporting. For this project, I imagined that a regional manager or director would want to explore reports about each region using a map as the interface. Healthcare analysts can use our Business Intelligence tools in their own workflows to incorporate custom, interactive maps into dashboards. This makes it easier to derive insights by location and explore large datasets.

I’ll walk through creating a basemap in QGIS that displays labels for each region (including all islands and territories), customizing the style and presentation of the map with Mapbox Studio for use in a web dashboard, and then connecting the map to the data in Tableau. We’ll combine three distinct datasets, all without any code. This project is made entirely with open data — anyone with a Mapbox account and Tableau Public can make this visualization.

Something is missing

The United States Department of Health and Human Services organizes its Regions like this:

Map of US Department of Health & Human Services Regions created by Office of Intergovernmental and External Affairs (IEA)

However, reading through the text, something popped out to me about Region 9 — San Francisco.

I can see Arizona, California, Nevada, and Hawaii on the map, but I can’t see the other islands. So if we want to view an interactive report by region, we’ll need to add these islands to the map and group them with the Regions they belong in.

Building the custom Regions map

First, we’ll obtain the shape files for all of the Regions: download USGS TIGER/Line® ESRI Shapefile “States”, and then export the polygons of the islands— Micronesia, Marshall Islands, and Palau — from OpenStreetMap, using the template shapefiles from GADM.org.

Downloading OpenStreetMap data in QGIS using GADM.org layers, Palau depicted

Filter down the USGS TIGER/Line® ESRI Shapefile “States” file for the States and Territories in Region 9.

Filtering States on Name

Let’s then save the States file with a projection of WGS 84 EPSG:4326 with just the NAME attribute. Do the same for Micronesia, Marshall Islands, and Palau.

next, we’ll merge these files together (Menu → Vector → Data Management Tools → Merge Vector Layers).

Merging Layers

We also need to merge a column called REGION to the merged file using the Field Calculator (Menu → Layer → Properties → Toggle Edit Button (Pencil Icon) → Field Calculator (Abacus Icon).

Adding a REGION field with the QGIS Field Calculator, Edit Mode has been turned on.

Let’s do the same for the nine other Regions, filtering down the States shapefile, adding a REGION field, and saving each one back with a CRS of WGS 84 EPSG:4326. We’ll then merge the ten shapefiles together into one shapefile called HHSRegions.shp.

As a final step, we need the centers (Menu → Vector → Geometry Tools → Centroids) of the HHSRegions for labels as the background map in Mapbox for Tableau.

We can now save this file as HHSLabels.geojson and upload to Studio as a tileset, adding it to the “Dark” map style.

Mapbox Studio Style HHS Regions with HHS Labels tileset added to the “Dark” basemap

After it’s uploaded, click the Share, develop & use button next to the list of styles:

We want to select Tableau from the list, and copy/paste the Mapbox Integration URL into a notepad so we can use it later to pull the map into Tableau.

Getting the map ready for Tableau

After importing the ESRI Shapefile into Tableau (Connect → Spatial File → Navigate to HHSRegions.shp), create a worksheet called Map and set it up with Longitude on Rows, Latitude on Columns, and Geometry on the detail mark shelf. Let’s set the color to blue and change the transparency but keep the same color for the outline.

Tableau worksheet with imported ESRI Shapefile HHSRegions

Next, we’ll paste the Mapbox Integration URL we saved in Notepad (Menu → Map → Background Maps → Map Services → Add → Mapbox Maps).

Tableau worksheet with custom Mapbox Studio style integration

After adding the map, we need to generate a parameter called REGION, adding the Region Names and another value, ALL. We can conditionally filter the Regions with this calculation (credit Ben Sullins):

IFNULL([REGIONS],'Null') = IF [Parameters].[Region] != 'ALL' THEN [Parameters].[Region] ELSE IFNULL([REGIONS], 'Null') END

Now, when you choose “ALL” in the parameter, all of the Regions will show.

Tableau worksheet with a conditional filter using parameter values

Getting the data ready for Tableau

For this project, we’ll use Influenza data from CDC GIS Fluview and select ILINet and HHS Regions to generate a CSV file.

Downloading Data from CDC Fluview

Let’s also download the ILINet State Level Indicators which generates another CSV file.

Downloading ILINet State Activity Levels from CDC

We need to join the data on Year and Week, grouping States to Regions (Connect → Text File → Navigate to ILINet 2.csv & Connect → Text File → StateDatabySeason). We can then create a new worksheet called Chart. Let’s use the same conditional filter as the map worksheet.

Tableau worksheet re-using the REGIONS conditional filter, the same as the map.

We’ll also create a metric swapper parameter and a case statement calculated field.

Tableau worksheet with Case Statement Calculated Field to swap metric

Building the dashboard

We need to first add the worksheets and the parameters (Menu → Analysis → Parameters), including a Title as well as a caveat recognizing the data sources. Let’s then publish to Tableau Public (Menu → File → Save to Tableau Public).

Click through to see the Dashboard on Tableau Public

Healthcare analysts using this tool, or one like it, can select their Region and choose the metrics they want to explore. A person at the Director level could view data for all Regions they oversee.

Our business intelligence tools make it easier for health organizations to track resources, staffing, and other efforts to minimize per-patient costs at every administrative level, from individual facilities to national and regional boundaries.

Create a free account and start using our platform in your BI workflow. Get in touch with our team when you’re ready to roll out a solution to your customers.

Allan Walker


Dashboards for healthcare resource planning with Mapbox, Tableau, and QGIS — Part II was originally published in Points of interest on Medium, where people are continuing the conversation by highlighting and responding to this story.


Viewing all articles
Browse latest Browse all 2230

Trending Articles