Skip to contents

This function tries to find all the billable ICD codes that can be translated by CMS GEMs for each of the input diagnosis codes representing a major category.

Usage

find_billable(dx, version = 10, year = 2018,
              match_all = TRUE, decimal = FALSE,
              output = c("character", "list", "tidy-data"), ...)

Arguments

dx

A character vector representing diagnosis codes. Each element of the vector can either represent individual diagnosis code or a set of diagnosis codes that are concartenated by commas in between.

version

A numeric value specifying the version of the diagnosis codes that should be either 9 for ICD-9 codes or 10 for ICD-10 codes.

year

A numeric value specifying the year of the CMS GEMs. The currently available options are 2017 and 2018. By default, 2018 CMS GEMs is used.

match_all

A logical value specifying the strategy for finding billable codes based on the input diagnosis category. If TRUE (the default), the function will add the regular expression "[[[[:alnum:]]{1,4}]]" to the tail of diagnosis category so that all the billable diagnosis codes under the given category will be matched. If FALSE, the function will add the regular experssion "[[:alnum:]]" repeatedly at most four times until any set of billable codes are matched.

decimal

A logical value. If TRUE, the diagnosis codes would be returned with decimal points. The default is FALSE.

output

A character value specifying the format of the output. The avaiable options are "character", "list", and "tidy-data". By default, option "character" is used and results in a character vector that consists of element-wise concatenatation by commas of all the translated diagnosis codes from the original codes. If "list" is specified, all the translated codes will not be concartenated and a list of character vectors will be returned by the function. Similarly, if "tidy-data" is specified, a data frame in a tidy format will be returned. The first column of the data frame consists of the original diagnosis codes; the second column consists of the translated diagnosis codes.

...

Other arguments for future usage. A warning will be thrown out if any argument goes into ... accidentally.

Value

A character vector of the same length with the input vector will be returned by default or if output = "charactor". A list of character vectors will be returned if output = "list"; A data frame in tidy-format will be returned if output = "tidy-data". See argument output for details.

Details

It is designed to be used with the function icd_map for translating the diagnosis codes that are not billable but representing major categories. Notice that only the character vector output can be directly passed to the function icd_map for translation.

See also

icd_map

Author

Wenjie Wang <[email protected]>

Examples

library(touch)

### for ICD-9 codes
icd9_major <- c("001", "316", "808", NA, "not_a_dx")

## find all billable codes under the major category
find_billable(icd9_major, version = 9)
#> [1] "0010,0011,0019"                                                                           
#> [2] "316"                                                                                      
#> [3] "8080,8081,8082,8083,80841,80842,80843,80844,80849,80851,80852,80853,80854,80859,8088,8089"
#> [4] NA                                                                                         
#> [5] NA                                                                                         

## find the billable codes right under the major category
(icd9_billable <- find_billable(icd9_major, version = 9,
                                match_all = FALSE))
#> [1] "0010,0011,0019"                "316"                          
#> [3] "8080,8081,8082,8083,8088,8089" NA                             
#> [5] NA                             

## compare the translation results
icd_map(icd9_major, nomatch = NA)
#> [1] NA    "F54" NA    NA    NA   
icd_map(icd9_billable, nomatch = NA)
#> [1] "A000,A001,A009"                                                                 
#> [2] "F54"                                                                            
#> [3] "S32409A,S32409B,S32501A,S32501B,S32502A,S32502B,S32509A,S32509B,S329XXA,S329XXB"
#> [4] NA                                                                               
#> [5] NA                                                                               

### for ICD-10 codes
icd10_major <- c("T36.0X2", "T36.3X2", "T38.6X2")

## find all billable codes and output in different formats
find_billable(icd10_major, version = 10)
#> [1] "T360X2A,T360X2D,T360X2S" "T363X2A,T363X2D,T363X2S"
#> [3] "T386X2A,T386X2D,T386X2S"
find_billable(icd10_major, version = 10, output = "list")
#> [[1]]
#> [1] "T360X2A" "T360X2D" "T360X2S"
#> 
#> [[2]]
#> [1] "T363X2A" "T363X2D" "T363X2S"
#> 
#> [[3]]
#> [1] "T386X2A" "T386X2D" "T386X2S"
#> 
find_billable(icd10_major, version = 10, output = "tidy-data")
#>   ICD-10 Billable_ICD-10
#> 1 T360X2         T360X2A
#> 2 T360X2         T360X2D
#> 3 T360X2         T360X2S
#> 4 T363X2         T363X2A
#> 5 T363X2         T363X2D
#> 6 T363X2         T363X2S
#> 7 T386X2         T386X2A
#> 8 T386X2         T386X2D
#> 9 T386X2         T386X2S

## add decimal if wanted
(icd10_billable <- find_billable(icd10_major, version = 10, decimal = TRUE))
#> [1] "T36.0X2A,T36.0X2D,T36.0X2S" "T36.3X2A,T36.3X2D,T36.3X2S"
#> [3] "T38.6X2A,T38.6X2D,T38.6X2S"

## compare the translation results
icd_map(icd10_major, from = 10, to = 9, nomatch = NA)
#> [1] NA NA NA
icd_map(icd10_billable, from = 10, to = 9)
#> [1] "9090+E959,9600+E9504,V5889" "9090+E959,9603+E9504,V5889"
#> [3] "9090+E959,9621+E9504,V5889"