The CMS code functions

Hello friends! Wow, it has been way too long since my last post. Things have been absurdly busy, as I’m guessing they have for you. I’d like to be more active on this blog in 2017, so let’s start now!

I get a lot of requests to pull data pertaining to CMS measures, especially for purposes of tracking our progress against CQR. That system is not the least bit user-friendly, so it’s nice to be able to bring up a report that shows how we’re doing organization-wide on a given measure.

But have you looked at the provided definitions of some of these measures? It’s enough to make you pull your hair out! For example, here’s the denominator of the CMS 130 (colorectal cancer screening) measure:

  • “Encounter, Performed: Office Visit”
  • “Encounter, Performed: Face-to-Face Interaction”
  • “Encounter, Performed: Preventive Care Services – Established Office Visit, 18 and Up”
  • “Encounter, Performed: Preventive Care Services-Initial Office Visit, 18 and Up”
  • “Encounter, Performed: Home Healthcare Services”
  • “Encounter, Performed: Annual Wellness Visit”
  • during “Measurement Period”

Except for these exclusions, of course:

  • “Diagnosis, Resolved: Malignant Neoplasm of Colon”
  • “Diagnosis, Active: Malignant Neoplasm of Colon”
  • “Diagnosis, Inactive: Malignant Neoplasm of Colon”
  • “Procedure, Performed: Total Colectomy”
  • starts before end of “Measurement Period”

And then there’s the numerator to deal with:

  • “Procedure, Performed: Colonoscopy” <= 9 year(s) ends before end of "Measurement Period"
  • “Laboratory Test, Performed: Fecal Occult Blood Test (FOBT) (result)” during “Measurement Period”
  • “Procedure, Performed: Flexible Sigmoidoscopy” <= 4 year(s) ends before end of "Measurement Period"

Yeah, that should be simple. (We really need a sarcasm font, people.)

Now you probably know that you can find all of these value sets in Administration, under Codes > Settings > Data Mappings. But that’s not very helpful when you need to pull the corresponding Order, Problem, and Procedure data. Unless you want to type in all those codes manually, you need an easier way.

Of course all of those value sets live in the database, and you could go dig for them, but why do that when I’ve already built a delightful table-valued function for you? Check it out…

So what’s it do? Well, you feed it a CMS measure number, and it spits out all the relevant codes in multiple formats. It also gives you the value set name each code belongs to so you can filter appropriately. I should mention that the database does contain a few stored procedures that venture down this rabbit hole. However, I did not find them suitable to my purposes, especially since I wanted a table-valued function, and honestly the code I’ve found in that database is so poorly formatted it’s practically impossible to figure out what any given procedure does. Thus, I rolled my own.

To illustrate, let’s take another look at that denominator definition:

  • “Encounter, Performed: Office Visit”
  • “Encounter, Performed: Face-to-Face Interaction”
  • “Encounter, Performed: Preventive Care Services – Established Office Visit, 18 and Up”
  • “Encounter, Performed: Preventive Care Services-Initial Office Visit, 18 and Up”
  • “Encounter, Performed: Home Healthcare Services”
  • “Encounter, Performed: Annual Wellness Visit”
  • during “Measurement Period”

We’re pulling data for CMS 130, and to get our list of qualifying patients, we’re going to want to look at service charges that fall into these value sets. I’m going to severely over-simplify this just to get the point across – it’s up to you to put a provider or date range filter on this…

This gives us all the patients who have a service charge in these value sets. Again, further filtering is your job. We join ORDERS to the function on the PrefixedCode value because, if you take a look at that table, you’ll see that the CODE values are stored with a CPT- or SCT- prefix. In other tables, you may find the codes stored without a prefix.

The function also provides MasterDiagnosisId values for ICD codes. I use these when I’m querying the problem list, like this…

Now… why not just compare PROBLEM.CODE against the Code value in the function? Because that’s an ICD9 code, and we’ve moved past that now. Those three MasterDiagnosisId values exist in the PROBLEM table for a reason, so use them.

ORDERS and PROBLEM aren’t the only tables you can use this function with, but they’re probably the two you’d use it with most often.

When you’re looking for observations, however, there’s a better function. This one gives you the HDIDs (and OBSVALUES where applicable) for each measure:

I hope this gives you a sense of how useful these functions can be when pulling CMS data. Let me know what you think, and if you have a better way I’d love to hear about it!

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">