Skip to content

Commit

Permalink
modifier additions
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewallenbruce committed Jun 29, 2024
1 parent 0a10ef6 commit 801105a
Show file tree
Hide file tree
Showing 12 changed files with 229 additions and 62 deletions.
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export(is_category_II)
export(is_category_III)
export(is_level_I)
export(is_level_II)
export(is_rarc_code)
export(is_valid_length)
export(limiting_charge)
export(non_participating_fee)
Expand Down
38 changes: 35 additions & 3 deletions R/adjustments.R
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,35 @@ carc_add_dash <- \(x, placeholder = "||") {
)
}

#' Validate RARC Codes
#'
#' @param x `<chr>` vector of RARC adjustment codes, a two-to-three character
#' alphanumeric string.
#'
#' @template returns
#'
#' @examples
#' x <- c("- 253", "OA-23", "PI-", "-45 ",
#' "OA23", "MA109", "N9", "N722")
#'
#' is_rarc_code(x)
#'
#' x[which(is_rarc_code(x))]
#'
#' @autoglobal
#'
#' @export
is_rarc_code <- function(x) {

stringr::str_detect(
gsub("-", "", gsub(" ", "", x)),
stringr::regex(
"^[AMN]{1,2}[0-9]{1,3}$"
)
)

}

#' Validate CARC Codes
#'
#' @param x `<chr>` vector of CARC adjustment codes; should be of the form
Expand Down Expand Up @@ -298,9 +327,12 @@ is_carc_full <- function(x) {
#' @export
is_carc_code <- function(x) {

stringr::str_detect(gsub(" ", "", x),
stringr::regex("^[ACIOPR]{2}-?[ABDPW]?[0-9]{1,3}$"))

stringr::str_detect(
gsub(" ", "", x),
stringr::regex(
"^[ACIOPR]{2}-?[ABDPW]?[0-9]{1,3}$"
)
)
}

#' Validate CARC Group Codes
Expand Down
55 changes: 30 additions & 25 deletions R/ncci.R
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
#' NCCI Add-On Code Edits
#' NCCI Edits: Add-On Codes
#'
#' Medicare NCCI Add-On Code Edits
#' An Add-on Code (AOC) is a Healthcare Common Procedure Coding System (HCPCS) /
#' Current Procedural Terminology (CPT) code that describes a service that is
#' performed in conjunction with the primary service by the same practitioner.
#' An AOC is rarely eligible for payment if it’s the only procedure reported by
#' a practitioner.
#'
#' An AOC is a HCPCS/CPT code that describes a service that, with rare
#' exception, is performed in conjunction with another primary service by the
#' same practitioner. An AOC is rarely eligible for payment if it is the only
#' procedure reported by a practitioner.
#' Add-on codes may be identified in three ways:
#' 1. The add-on code is in the AOC file as a Type 1, Type 2, or Type 3 AOC (formerly displayed as Type I, Type II or Type III).
#' 2. In the Medicare Physician Fee Schedule, an AOC generally has a global surgery period of `ZZZ`.
#' 3. In the CPT Manual, an add-on code is designated by the symbol `+`. The code descriptor of an AOC generally includes phrases such as "each additional" or "(List separately in addition to primary procedure)."
#'
#' Some CPT codes are identified as Add-on Codes (AOCs), which describe a
#' service that can only be reported in addition to a primary procedure.
Expand All @@ -17,24 +21,31 @@
#' performed in addition to the primary procedure. By contrast, incidental
#' services that are necessary to accomplish the primary procedure (e.g., lysis
#' of adhesions in the course of an open cholecystectomy) are not separately
#' reportable with an AOC. Similarly, complications inherent in an invasive
#' procedure occurring during the procedure are not separately reportable. For
#' example, control of bleeding during an invasive procedure is considered part
#' of the procedure and is not separately reportable.
#' reportable with an AOC.
#'
#' Similarly, complications inherent in an invasive procedure occurring during
#' the procedure are not separately reportable. For example, control of bleeding
#' during an invasive procedure is considered part of the procedure and is not
#' separately reportable.
#'
#' Although the AOC and primary code are normally reported for the same date of
#' service, there are unusual circumstances where the two services may be
#' reported for different dates of service (e.g., 99291 and 99292).
#'
#' ## AOC Edit Types
#' * Type 1: CPT Professional or HCPCS files define all acceptable primary codes. MACs should not allow other primary codes with Type 1 AOCs.
#' * Type 2: CPT Professional and HCPCS files do not define any primary codes. MACs should develop their own lists of acceptable primary codes.
#' * Type 3: CPT Professional or HCPCS files define some, but not all, acceptable primary codes. MACs should allow the listed primary codes for these AOCs but may develop their own lists of additional acceptable primary codes.
#'
#' ## PTP Edits In general, NCCI PTP edits do not include edits with most AOCs
#' because edits related to the primary procedure(s) are adequate to prevent
#' inappropriate payment for an add-on coded procedure (i.e., if an edit
#' prevents payment of the primary procedure code, the AOC shall not be paid).
#' CMS divided the AOCs into three types to distinguish the payment policy for each type:
#'
#' * Type 1: A Type 1 AOC has a limited number of identifiable primary procedure codes. The Change Request (CR) lists the Type 1 AOCs with their acceptable primary procedure codes. A Type 1 AOC, with one exception, is eligible for payment if one of the listed primary procedure codes is also eligible for payment to the same practitioner for the same patient on the same date of service. Claims processing contractors must adopt edits to assure that Type 1 AOCs are never paid unless a listed primary procedure code is also paid.
#' * Type 2: A Type 2 AOC does not have a specific list of primary procedure codes. The CR lists the Type 2 AOCs without any primary procedure codes. Claims processing contractors are encouraged to develop their own lists of primary procedure codes for this type of AOC. Like the Type 1 AOCs, a Type 2 AOC is eligible for payment if an acceptable primary procedure code as determined by the claims processing contractor is also eligible for payment to the same practitioner for the same patient on the same date of service.
#' * Type 3: A Type 3 AOC has some, but not all, specific primary procedure codes identified in the CPT Manual. The CR lists the Type 3 AOCs with the primary procedure codes that are specifically identifiable. However, claims processing contractors are advised that these lists are not exclusive and there are other acceptable primary procedure codes for AOCs in this Type. Claims processing contractors are encouraged to develop their own lists of additional primary procedure codes for this group of AOCs. Like the Type 1 AOCs, a Type 3 AOC is eligible for payment if an acceptable primary procedure code as determined by the claims processing contractor is also eligible for payment to the same practitioner for the same patient on the same date of service.
#'
#' ## PTP Edits
#'
#' In general, NCCI PTP edits do not include edits with most AOCs because edits
#' related to the primary procedure(s) are adequate to prevent inappropriate
#' payment for an add-on coded procedure (i.e., if an edit prevents payment of
#' the primary procedure code, the AOC shall not be paid).
#'
#' @note Version: 2024-04-01
#'
Expand Down Expand Up @@ -95,7 +106,7 @@ search_aocs <- function(hcpcs_code = NULL,
return(.add_class(aoc))
}

#' NCCI Medically Unlikely Edits (MUEs)
#' NCCI Edits: Medically Unlikely Edits (MUEs)
#'
#' National Correct Coding Initiative (NCCI) Medically Unlikely Edits (MUEs) are
#' used by Medicare Administrative Contractors (MACs) to reduce improper
Expand Down Expand Up @@ -196,7 +207,7 @@ search_mues <- function(hcpcs_code = NULL,
return(.add_class(mue))
}

#' NCCI Procedure to Procedure (PTP) Edits
#' NCCI Edits: Procedure to Procedure (PTP)
#'
#' National Correct Coding Initiative (NCCI) Procedure-to-Procedure (PTP) edits
#' prevent inappropriate payment of services that should not be reported
Expand All @@ -208,12 +219,6 @@ search_mues <- function(hcpcs_code = NULL,
#' the Column Two code is denied unless a clinically appropriate NCCI
#' PTP-associated modifier is also reported.
#'
#' The NCCI [PTP
#' edits](https://www.cms.gov/medicare/coding-billing/national-correct-coding-initiative-ncci-edits/medicare-ncci-procedure-procedure-ptp-edits)
#' and
#' [MUEs](https://www.cms.gov/medicare/coding-billing/national-correct-coding-initiative-ncci-edits/medicare-ncci-medically-unlikely-edits)
#' are usually updated at least quarterly.
#'
#' ## PTP Modifiers
#'
#' Modifiers that may be used under appropriate clinical circumstances to bypass
Expand Down
58 changes: 58 additions & 0 deletions data-raw/modifiers.R
Original file line number Diff line number Diff line change
Expand Up @@ -427,3 +427,61 @@ pin_update(
title = "HCPCS Modifiers",
description = "Level I and II HCPCS Modifiers"
)

# Additional Modifiers
addition <- rvest::read_html("https://www.novitas-solutions.com/webcenter/portal/MedicareJH/pagebyid?contentId=00144506") |>
rvest::html_elements("table") |>
rvest::html_table() |>
purrr::pluck(14) |>
janitor::clean_names() |>
dplyr::mutate(
references = dplyr::na_if(references, "") |>
stringr::str_squish()
)

addition

add_categories <- dplyr::tribble(
~type, ~modifier,

"Additional", "AB, AE, AF, AG, AI, AK, AM, AO, AT, AZ, BL, CA, CB, CG, CR, CS, CT, DA, ER, ET, FB, FC, FS, FX, FY, G7, GC, GE, GG, GJ, GU, J1, J2, J3, JC, JA, JB, JC, JD, JG, JW, JZ, KX, L1, LU, M2, PD, PI, PO, PN, PS, PT, Q0, Q1, Q3, Q4, Q5, Q6, QJ, QQ, RD, RE, SC, SF, SS, SW, TB, TC, TS, UJ, UN, UP, UQ, UR, US, X1, X2, X3, X4, X5, XE, XP, XS, XU",
"Advance beneficiary notice", "GA, GX, GY, GZ",
"Advanced diagnostic imaging", "MA, MB, MC, MD, ME, MF, MG, MG, MH, QQ",
"Ambulance", "D, E, G, H, I, J, N, P, R, S, X, GM, QL, QM, QN",
"Anatomical", "E1, E2, E3, E4, FA, F1, F2, F4, F5, F6, F7, F8, F9, LC, LD, LM, LT, RC, RI, RT, TA, T1, T2, T3, T4, T5, T6, T7, T8, T9",
"Anesthesia", "AA, AD, G8, G9, P1, P2, P3, P4, P5, P6, QK, QS, QY, QX, QZ, 23, 33",
"Assistant at surgery", "AS, 80, 81, 82",
# End stage renal disease (ESRD) and Erythropoiesis stimulating agent (ESA)
"ESRD/ESA", "AX, EA, EB, EC, AY, ED, EE, EJ, EM, G1, G2, G3, G4, G5, G6, GS, JA, JB, JE, V5, V6, V7, V8, V9",
"Global surgery", "24, 25, 54, 55, 57, 58, 78, 79, FT",
"Hospice", "GV, GW",
"Laboratory", "90, 91, 92, LR, QW",
"Other", "26, 27, 33, 59, 76, 77, 96, 97",
"Podiatry", "Q7, Q8, Q9",
"QPP", "1P, 2P, 3P, 8P, AQ, AR, MA, MB, MC, MD, ME, MF, MG, MH, X1, X2, X3, X4, X5",
"Surgical", "22, 50, 51, 52, 53, 62, 66, 73, 74, PA, PB, PC",
"Telehealth", "95, FQ, GQ, GT, G0",
"Therapy", "GN, GO, GP, KX, CO, CQ",
"Functional", "22, 26, 50, 51, 52, 53, 54, 55, 58, 62, 66, 78, 79, 80, 81, 82, AA, AD, AS, TC, QK, QW, QY"
) |>
tidyr::separate_longer_delim(modifier, delim = ", ") |>
dplyr::select(modifier, type)

mod_addition <- addition |>
dplyr::full_join(
add_categories
) |>
dplyr::select(
modifier,
type,
description,
references
)

# Update Pin
pin_update(
mod_addition,
name = "mod_addition",
title = "HCPCS Modifiers",
description = "Level I and II HCPCS Modifiers"
)
2 changes: 2 additions & 0 deletions inst/extdata/pins/_pins.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ hcpcs_lvl2:
- hcpcs_lvl2/20240625T180704Z-a38f5/
modifiers:
- modifiers/20240618T182144Z-22317/
mod_addition:
- mod_addition/20240629T190314Z-eac7b/
ncci_aoc:
- ncci_aoc/20240620T170255Z-3930c/
ncci_aoc_nested:
Expand Down
10 changes: 10 additions & 0 deletions inst/extdata/pins/mod_addition/20240629T190314Z-eac7b/data.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
file: mod_addition.qs
file_size: 7712
pin_hash: eac7b5d0c7478224
type: qs
title: HCPCS Modifiers
description: Level I and II HCPCS Modifiers
tags: ~
urls: ~
created: 20240629T190314Z
api_version: 1
Binary file not shown.
27 changes: 27 additions & 0 deletions man/is_rarc_code.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

45 changes: 28 additions & 17 deletions man/search_aocs.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/search_mues.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 1 addition & 6 deletions man/search_ptps.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 801105a

Please sign in to comment.