Wednesday, December 10, 2014

Nursing home comparison using quality and safety data from actual inspections

I put together an interactive map with data tables showing nursing home quality data from Nursing Home Compare. The table is specifically the Nursing Home Deficiencies table, which tabulates deficiencies in safety, fire safety, and health.

In the above interactive map, you can search for nursing homes by adjusting the filters on the right side. The filters include state, number of deficiencies, general type of deficiencies (they are generally categorized into fire safety and health), and "scope severity code", which is well defined on the following website: There is a good report on the completeness and accuracy of Nursing Home Compare data from the OIG on this site: Here are the typical types of nursing home deficiencies cited:
  • Allow residents to easily view the results of the nursing home's most recent inspection.
  • Reasonably accommodate the needs and preferences of each resident.
  • Keep all essential equipment working safely.
  • Properly hold, secure, and manage each resident's personal money which is deposited with the nursing home.
  • Upon the death of a resident, convey the resident's personal funds and an accounting of those funds to the appropriate party.
  • Provide at least one room set aside to use as a resident dining room and for activities, that is a good size, with good lighting, air flow and furniture.
  • Let residents refuse treatment, refuse to take part in an experiment, or formulate advance directives.
  • Immediately tell the resident, the resident's doctor, and a family member of situations (injury/decline/room, etc.) that affect the resident.
  • Make sure that doctors see a resident's plan of care at every visit and make notes about progress and orders in writing.
  • Provide routine and emergency drugs through a licensed pharmacist and only under the general supervision of a licensed nurse.
  • Provide or obtain laboratory services only when ordered by the attending physician.
  • Keep accurate, complete and organized clinical records on each resident that meet professional standards.
  • Provide housekeeping and maintenance services.
  • Conduct initial and periodic assessments of each resident's functional capacity.
  • Ensure each resident receives an accurate assessment by a qualified health professional.
  • Develop a complete care plan that meets all the resident's needs, with timetables and actions that can be measured.
  • Allow residents the right to participate in the planning or revision of care and treatment.
  • Ensure services provided by the nursing facility meet professional standards of quality.
  • Provide necessary care and services to maintain or improve the highest well being of each resident .
  • Ensure that each resident who enters the nursing home without a catheter is not given a catheter, unless medically necessary, and that incontinent patients receive proper services to prevent urinary tract infections and restore normal bladder functions.
  • Ensure residents maintain acceptable nutritional status.
  • Ensure that each resident's 1) entire drug/medication regimen is free from unnecessary drugs; and 2) is managed and monitored to achieve highest level of well-being.
  • At least once a month, have a licensed pharmacist review each resident's medication(s) and report any irregularities to the attending doctor.
  • Maintain drug records and properly mark/label drugs and other similar products according to accepted professional standards.
  • Corridor and hallway doors that block smoke.
  • Automatic sprinkler systems that have been maintained in working order.
  • Exits that are free from obstructions and can be used at all times.
  • Proper medical gas storage and administration areas.
  • Properly installed electrical wiring and equipment.
  • Special areas constructed so that walls can resist fire for one hour or an approved fire extinguishing system.
  • Properly hold, secure, and manage each resident's personal money which is deposited with the nursing home.
  • Ensure that a nursing home area is free from accident hazards and provide adequate supervision to prevent avoidable accidents.
  • Store, cook, and serve food in a safe and clean way.
To go to the version of my map this is not constrained by the size of my blog column, go to the following link: Nursing Home Quality and Safety Search.

Monday, December 8, 2014

How to create your own data visualization map using live Hospital Compare data from CMS/Medicare and Tableau Public

In this post I'm going to show a step-by-step way to create your own data visualization map using *live* Hospital Compare data . By "live" data I mean that the data visualization we create will update automatically when CMS updates its data set; we will not have to download the new data, rather we will build the connection between Tableau and the public data available on CMS' web site.

Here is an example of the end product we will build:

Just to summarize what the above map shows: Each hospital is represented as a circle on a map, color coded by its score on one of the questions from the HCAHPS survey. The user can click on the filters on the right and move the map to look at other state's hospitals, and switch which HCAHPS question he is interested in. What's *REALLY* cool though, is that this data is not static. When CMS updates the hospital scores, our map will update automatically.

To build the above:

First, download the newest version of Tableau Public. Tableau is the software that you will use to build the above interactive map. Next, find the dataset that you are interested in analyzing. There are many open datasets available for public consumption. I'm personally interested in healthcare data. For this example, go to Hospital Compare  (

Click on "Hospital Compare."

Scroll down and choose the dataset you would like to explore. For this example, I chose "HCAHPS - Hospital." (click on it). You could instead choose "HCAHPS - State," which has state-level patient satisfaction scores instead of hospital-level data. Obviously, the state level data set is a lot smaller and easier to handle, but also much less interesting.

This is what it should look like. What you will see is a scrollable table of all of the HCAHPS data. In the top right section you will see many options for playing with and exporting the data.

Click on "Export." As you can see, you can download a static version of the data in Excel or CSV format, but that is not what we are going to do. Instead, click on "OData." OData is an open data access protocol that allows us to connect to live data (there's a lot more to it, but you don't need to know more for this project). 

Where it says "Copy this link", copy the link. Simple enough.

Now open Tableau. This is what it should look like when you first open it:

Click on "Open Data." (It's not a bad idea to watch some of the getting started videos)

Next, you are given options as to what sort of data you want to connect to. Click on "OData."

Paste the link from the CMS website (the one we copied) into the first field, as I have done above. You should not need to enter authentication information for this dataset. Click on "Connect." If this step works, it should look like this:

Notice that Tableau figured out the name of the dataset ("HCAHPS - Hospital (OData)"), so we are connected now to live data! Click on "OK." Tableau will now essentially go through all of the data and process it. For a big dataset such as this one, this could take 5-15 minutes. Be patient, this is a one-time process. Tableau will be loading the data onto its servers. 

This is not the time and place for me to teach you how to use Tableau -- there are plenty of great demos on You Tube -- you should watch some of these while the data is loading. 

Here is the window you will see while the data is loading:

Once the data is loaded, you will see the main Tableau page:

Your data is essentially auto-divided into "Dimensions" and "Measures." Please watch Tableau introductory videos to learn the difference. You have many options to visualize the data; we are going to build a quick map. We want to see each hospital listed individually on a map and color coded by its HCAHPS score. To do this, we need to know the longitude and latitude of each hospital; thankfully the dataset we connected to already has this data under "Measures." Note that there are two sets of longitude and latitude: one set says "location latitude" (this is directly from CMS' data set) and the other set says "generated" (this is a calculated latitude or longitude based on the zip code [that's my understanding, I may be wrong]). Because there may be more than one hospital in a single zip code, you want to avoid the "generated" data and instead using the ones labelled as "location latitude" (and longitude). The other reason to do this is because by using the actual long/lat data, the hospital will be placed accurately on the map, whereas otherwise it would be placed at the zip code marker. 

Drag "location latitude" (from under "Measures") to the empty white box next to "Rows" (at the top). And then drag "location longitude" to "Columns." It  should look like this afterwards:

Next, we want to focus on just one HCAHPS question at a time, so we will add a filter. Drag "Hcahps Question" from the "Dimensions" section into the "Filters" box to the left of the map. Scroll down the options of what to filter, and choose which question you want to visualize. I chose the next to last one, "Patients who reported YES, they would definitely recommend the hospital," because I think that is the best overall measure of patient satisfaction (Likelihood to Recommend).

Next comes the fun part --- we need to actually add the hospitals to the map. So drag "Hospital Name" from the Dimensions section into the white box labelled "Marks". Drag it UNDER the tooltip, not into it (for now). You should see each hospital as a little dot on the map now. Tableau knows where to put each one because each hospital is mapped to a specific longitude and latitude. Amazing.

Now, we want to color-code each hospital by its score. So drag "Hcahps Answer Percent" from the Measures section into the "Color" box under "Marks."

Now each hospital should be color coded by its Hcahps score for the question you clicked in the filter. But notice that every hospital looks red and the scale for the score goes up to 620. That's because it is set to "SUM". We need to change it to average. Click on the green oval labelled "SUM(Hcanps An.." in the Marks section, then "Measure" then "Average". Zoom the map out. It should look something like this:

Now click on "Hcahps Question P.." in the Filters section and check off "Show Quick Filter". This will create a clickable filter on the right, so that you can choose different HCAHPS questions.

Now, we want to make sure that when we click on a dot we see the name of the hospital and its score. Click on the rounded box labelled "Tooltip." It should be empty. Click on "Insert" to insert whatever fields you want to add and you can manually type in labels for those fields. Here is what mine looks like:

Click OK. Now when you click on a hospital dot, you should see the hospital name and score.

Really awesome! Tableau can do so much more than this, but this is a great way to get your feet wet.

Now you can click on File > Save to Web to save or share this creation of yours.

You should know a couple things: with Tableau Public, which is free, your data visualizations are public. If you want to analyze non-public or secure data then you will need to purchase a different version of Tableau.

Friday, December 5, 2014

Cool new way to search for Assisted Living Facilities using a Map with nearby hospital quality data

I just put this map together, essentially a mashup of assisted living facilities and hospital quality data from HCAHPS. I first published this on Seniorbility (a senior cognitive monitoring and safety service), and I am republishing it here to make it more widely available. I was browsing around Assisted Living websites and found the search process to be pretty deplorable. Obviously, this map is just a first step. If anybody has access to a national database of senior housing facilities with addresses, phone numbers, and/or websites, please let me know! (Direct message me @amohseni or put a comment on this post).

Hugster launched: video postcards made easy at

 I'm excited to announce that I've launched Hugster, which is an online service that makes it easy to design, order and mail video p...