Showing posts with label Healthcare. Show all posts
Showing posts with label Healthcare. Show all posts

Friday, January 8, 2016

Gazetteer Database for Geographic Analysis

A couple of years ago, I had a tricky problem to solve. I inherited a tool a group of analysts were using to allocate website search based on ZIP code and location name (e.g., city, most commonly) for clients based on their own locations. The tool used the output of a predictive model for website search activity and inputs from the client, including addresses, for configuring the search locations that would be allocated for the client.

In addition to setting up relevant geographies based on the client's locations, the tool attempted to collect additional nearby locations that were likely relevant to the client (a "market"). The problem was that it did not find good matches for cities, towns, and other locations people were using on the website. As a result, the analysts were doing quite a bit of work to correct the output by removing and adding locations by hand. It was very time consuming, and I had to do something about it.

EDIT: I updated the following paragraph after I remembered how the algorithm was originally working. Initially I wrote that it calculated distances between locations, but it did not.

I reviewed the process and the data used to obtain location names. The algorithm used a simple lookup from ZIP code to location name, usually city or town. It did not attempt to look up nearby location names. The data did include latitude and longitude for the locations, so I thought I'd try adding code to lookup nearby locations with this data. I asked around in the software development area and found that they were using a fuzzy distance calculation based on a globe. When I tried it out using the existing location data, I found several problems. Some of the latitude/longitude coordinates were in the wrong state or in the middle of nowhere. Additionally, the data was missing quite a few relevant locations, like alternative names for cities and towns, as well as neighborhood names, parks, and a variety of other place names people use in web searches. I discovered it was several years out of date, and there was no chance it would be updated. So I decided the data was simply junk. I had to find a new source.

I began searching online for government sources of location information. After all, the US government establishes ZIP codes, city and town designations, and executes the census every once in a while. The US government also has to release this data publicly, according to law. (This doesn't mean it's free, or easy to obtain.) So there must be publicly-available data regarding locations. Luckily, I ended up finding a free online source: the US Gazetteer Files (see "Places" and "ZIP Code Tabulation Areas" sections).
What's a "gazetteer"? A gazetteer is a list of information about the locations on a map. In this case, the US Gazetteer data includes latitude and longitude, useful for geographic analysis.
As I used the data, I found a few gaps, so I searched again and found the US Board on Geographic Names (see "Populated Places" under "Topical Gazetteers"). By integrating these two data sets, I had a rather comprehensive listing of all sorts of places around the US.

Next, I had to get the new location data working with the search configuration tool. The tool was written with a web front-end for the inputs, SQL to collect the data and apply the inputs, and Excel as the output data. So I had to do a bit of ETL (actually, I did ELT, loading before transforming) to get the new location data working with the tool. I ended up designing the model pictured here:



The main data is in gz_place and gz_zip, storing locations and ZIP code data, respectively. On the right of gz_place are some lookup tables, including a table with alternative names (gz_name_xwalk - "xwalk" meaning crosswalk). The ZIP table references a master list of potential ZIP codes (see the prior post about creating that table), a list of invalid ZIP codes that showed up in the prior location data, and a list of ZIP codes I determined were "inside" other ZIP codes (the algorithm for is another discussion entirely).

The data on the left is a bit more interesting. There are some metadata tables not really connected to the rest (gz_metadata, gz_source), documenting quick facts about the data and where I found the data. Two reference tables also float off on their own, with a list of raw location names (gz_name) and a list of states (gz_state_51 - 51 to include DC), each including associated information.

Now I didn't want the tool to calculate distances between everything and everything else each time an analyst ran the tool, so I decided to precompute the distances and store only those within a certain proximity. I decided there were 3 types of distances required: ZIP to ZIP, location to location, and location to ZIP (and it could be used vice versa). To limit processing, I used a mapping of states and their neighbor states to connect the initial set of ZIPs and locations to use. This helped to decrease the run time. At the same time, I calculated the distances between each set of latitudes and longitudes, and retained only those within a certain number of miles. The final, filtered results are stored in gz_distance, with a lookup table describing the distance types (gz_distance_type).

Finally, I could get the better location data into the tool. I replaced the original code with new code that uses the new location data, doing a simple lookup of the locations specified by the client (ZIP codes) and filtering for an appropriate distance. I created a few new inputs to help the analyst tweak the distance that the tool would use to filter the crosswalk, with the idea that clients in rural areas may find a larger area more relevant, and clients in dense urban areas may find a smaller area more relevant.

The results were excellent. The analysts praised the new process for being more accurate, less time consuming, and easy to use. There were some manual aspects to the process, for example, correcting spelling errors entered by users on the website, but these would become less of an issue as time went by. (Especially the spelling errors. The website administrators were switching from one vendor data set to another, which had better location suggestions/requirements based on the user's input.) Overall, it was almost completely automated and only required updates once in a while when new locations were added.

This was one of those projects where I really enjoyed the autonomy I was given. I was simply given a task (make this tool work better), and given free reign over how to do that. I worked with many people to get their feedback and help, especially from the database maintainer and a few users for testing the new inputs on the tool. (One interesting thing I did with the database was to partition the gz_distance table based on distance type. I got help from the database maintainer on the best way to do that.) And best of all, I really enjoyed the project.

Sunday, November 14, 2010

AHIP Answers

I use Google Analytics to observe the trends on my site, including this blog. Searches including the term AHIP (America's Health Insurance Plans) have a high hit rate, including the following phrases:
  • AHIP certification test questions
  • AHIP course [material | answers]
  • AHIP final exam questions
  • AHIP fundamentals of health insurance part a [answer | exam | tips]
  • AHIP practice test questions
  • AHIP questions
  • AHIP study [guide | material]
  • AHIP test [answers | help | tips]
  • answers [for AHIP | to the AHIP exam]
  • how to study for AHIP test
  • passing the AHIP test
  • sample questions of the AHIP
  • what is hardest part of the AHIP test in 2010
Long list, right? It would seem there are people desperate to find answers on AHIP examinations. Well, I would like to tell everyone what the answer to every AHIP exam question is:
  1. Read the material!
It's as simple as that. All the answers and how to study them are there. To help, you could take notes, make flash cards, use the provided study guide, etc., which are all basic study skills. Trying to avoid reading the material is not only lazy, but deceitful, and rather defeats the purpose of the AHIP courses and exams: to educate people about the American insurance system, especially targeted for those people who work in the system. Now why would you want to cheat your way through that? Isn't the system broken enough? Do you really need to contribute to it by cheating on a simple test?

Now, if you're reading this and you have an exam coming up, turn off the screen, pick up the book, and start reading.

    Saturday, July 3, 2010

    New Transitions

    I have been working with an insurance company for almost two years, and I primarily worked with insurance claims to evaluate the effectiveness of care for our members and to discover patterns in care. Last week I accepted a new position with a physician clinical practice organization. The new position will provide experience on the other side of the health care industry, working with data from the doctor's office rather than the insurance company.

    My wife, Kyra, is also looking for a new job. She's been having a rough time at her current child care center with the way it's being run. Last weekend she started submitting applications, and she's already had two interviews. She hopes to have a new job very soon, we hope with a daycare center where Luca can enroll and Kyra can seek state teaching certification. One day she would like to teach in an elementary school.

    My son, Luca, has been growing rapidly. He's very talkative and he really seems to know what he wants. He enjoys going to school and visiting his friends. On the weekends, he's been taking swimming lessons and he loves the water! A bit too much actually--he really wants to swim on his own, but I'm sure he'd sink like a rock! Soon he will be two, and we hope to have a big birthday party for him.

    So we're all undergoing changes. It may be a turbulent summer, but I hope we all end up a little older, a little wiser, and a little happier with these new transitions.

    Saturday, June 20, 2009

    HEDIS 2009 Complete

    We just completed HEDIS 2009!

    For those of you who don't know what HEDIS is, the acronym stands for Health Plan Employer Data and Information Set. In order to obtain accreditation from the National Committee for Quality Assurance, health plans must analyze their health care data to generate percentages related to the quality of care provided by the health care providers. The data is used to compare health plans and provide information about where health care can be improved, for the health plans specifically and for our nation in general.

    An easy is example of a HEDIS measure is the percent of pregnant women who obtain the recommended number of prenatal visits before giving birth. This percent is part of the FPC measure (Frequency of Ongoing Prenatal Care). Another example is the percent of children who obtain the recommended vaccinations at specific times during their development. This comprises the CIS measure (Childhood Immunization Status). More complex measures, such as CDC or the set of RRU measures, measure the quality of care for diabetics or the cost of care for specific disorders across the health plan (respectively).

    Toward the end of HEDIS, I invented a couple of new words related to the process:
    • HEDISache - A headache brought on by working on HEDIS.
    • THEDIS - Pronounced tuh-he-dis. Alternatively, THEDIouS, pronounced tuh-he-di-ous. - An adjective describing what it's like to review HEDIS data: tedious.
    • HEDIlunch - Lunch with other people who worked on HEDIS, usually after successful completion.
    I also see a car with the license plate "PBH" on my way home from work just about every day. It reminds me of the measure, "Persistence of Beta-blocker Treatment After a Heart Attack." Each measure has a three-letter acronym, and this one is abbreviated PBH. My wife rolls her eyes whenever I recite the name after seeing the license plate. I guess I"ll remember that one for a while!

    Update: I noted the wrong pregnancy measure, PPC, instead of FPC. It is now correct.