diff --git a/.Rbuildignore b/.Rbuildignore index be57da9..9683917 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -2,3 +2,9 @@ ^\.Rproj\.user$ ^README\.Rmd$ ^LICENSE\.md$ +^data-raw$ +^_pkgdown\.yml$ +^docs$ +^pkgdown$ +^\.github$ +^pins$ diff --git a/.github/.gitignore b/.github/.gitignore new file mode 100644 index 0000000..2d19fc7 --- /dev/null +++ b/.github/.gitignore @@ -0,0 +1 @@ +*.html diff --git a/.github/workflows/pkgdown.yaml b/.github/workflows/pkgdown.yaml new file mode 100644 index 0000000..a7276e8 --- /dev/null +++ b/.github/workflows/pkgdown.yaml @@ -0,0 +1,48 @@ +# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples +# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help +on: + push: + branches: [main, master] + pull_request: + branches: [main, master] + release: + types: [published] + workflow_dispatch: + +name: pkgdown + +jobs: + pkgdown: + runs-on: ubuntu-latest + # Only restrict concurrency for non-PR jobs + concurrency: + group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }} + env: + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + permissions: + contents: write + steps: + - uses: actions/checkout@v4 + + - uses: r-lib/actions/setup-pandoc@v2 + + - uses: r-lib/actions/setup-r@v2 + with: + use-public-rspm: true + + - uses: r-lib/actions/setup-r-dependencies@v2 + with: + extra-packages: any::pkgdown, local::. + needs: website + + - name: Build site + run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE) + shell: Rscript {0} + + - name: Deploy to GitHub pages 🚀 + if: github.event_name != 'pull_request' + uses: JamesIves/github-pages-deploy-action@v4.5.0 + with: + clean: false + branch: gh-pages + folder: docs diff --git a/.gitignore b/.gitignore index 508df78..cc50487 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ .Rproj.user .Rhistory +docs diff --git a/DESCRIPTION b/DESCRIPTION index e1b7886..a116a45 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -9,3 +9,4 @@ License: Apache License (>= 2) Encoding: UTF-8 Roxygen: list(markdown = TRUE) RoxygenNote: 7.3.1 +URL: https://andrewallenbruce.github.io/northstar/ diff --git a/NAMESPACE b/NAMESPACE index 3cd5e9f..9097f75 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -1,3 +1,4 @@ # Generated by roxygen2: do not edit by hand export(github_raw) +export(limiting_charge) diff --git a/R/utils.R b/R/utils.R index aad4b0f..8f0a241 100644 --- a/R/utils.R +++ b/R/utils.R @@ -7,3 +7,15 @@ github_raw <- function(x) { paste0("https://raw.githubusercontent.com/", x) } + +#' Calculate limiting charge +#' @param x numeric +#' @return description +#' @examples +#' limiting_charge(26.35) +#' @export +limiting_charge <- function(x) { + stopifnot("x must be numeric" = is.numeric(x)) + x * 1.0925 # PAR FEE + # x * 1.150115 # NON-PAR FEE +} diff --git a/_pkgdown.yml b/_pkgdown.yml new file mode 100644 index 0000000..9f8a29a --- /dev/null +++ b/_pkgdown.yml @@ -0,0 +1,4 @@ +url: https://andrewallenbruce.github.io/northstar/ +template: + bootstrap: 5 + diff --git a/data-raw/pfs.R b/data-raw/pfs.R new file mode 100644 index 0000000..f5ff198 --- /dev/null +++ b/data-raw/pfs.R @@ -0,0 +1,135 @@ +library(readxl) +library(tidyverse) +library(janitor) + +root <- c("C:/Users/Andrew/Desktop/payer_guidelines/data/") + +# NATIONAL PHYSICIAN FEE SCHEDULE RELATIVE VALUE FILE CALENDAR YEAR 2024 +# rvu_xl <- here::here("data/RVU24A-010323/PPRRVU24_JAN.xlsx") + +rvu_xl <- glue::glue("{root}RVU24A-010323/PPRRVU24_JAN.xlsx") +pfs_pay_xl <- glue::glue("{root}PFREV24A_0/PFALL24.csv") +gpci_xl <- glue::glue("{root}RVU24A-010323/GPCI2024.xlsx") + + +rvu <- read_excel(rvu_xl, col_types = "text") |> + row_to_names(row_number = 9) |> + clean_names() |> + mutate(across(c(work_rvu, + non_fac_pe_rvu, + facility_pe_rvu, + non_facility_total, + facility_total, + mp_rvu, + conv_factor, + pre_op, + intra_op, + post_op, + non_facility_pe_used_for_opps_payment_amount, + facility_pe_used_for_opps_payment_amount, + mp_used_for_opps_payment_amount + ), + readr::parse_number)) |> + rename( + status = status_code, + unused = not_used_for_medicare_payment, + work.rvu = work_rvu, + pe.rvu_nonfac = non_fac_pe_rvu, + nonfac_ind_na = non_fac_na_indicator, + pe.rvu_fac = facility_pe_rvu, + fac_ind_na = facility_na_indicator, + mp.rvu = mp_rvu, + total_nonfac = non_facility_total, + total_fac = facility_total, + pctc = pctc_ind, + endo = endo_base, + cf = conv_factor, + phys_sup_diag_proc = physician_supervision_of_diagnostic_procedures, + calc_flag = calculation_flag, + diag_img_fm_ind = diagnostic_imaging_family_indicator, + pe.rvu_nonfac_opps = non_facility_pe_used_for_opps_payment_amount, + pe.rvu_fac_opps = facility_pe_used_for_opps_payment_amount, + mp.rvu_opps = mp_used_for_opps_payment_amount + ) + +rvu |> + filter(hcpcs == "A0021") + +# ANNUAL PHYSICIAN FEE SCHEDULE PAYMENT AMOUNT FILE +# pfs_pay_xl <- here::here("data/PFREV24A_0/PFALL24.csv") + +pfs_pay <- readr::read_csv(pfs_pay_xl, col_types = strrep("c", 16)) |> + slice(-c(990483:990487)) + +names(pfs_pay) <- c( + "year", + "carrier_no", + "locality", + "hcpcs", + "mod", + "fee_nonfac", # "non_fac_fee_sched_amount" + "fee_fac", # "facility_fee_sched_amount" + "pctc", + "status", + "mult_surg", + "ther_red_nonfac", # "therapy_reduction_nonfac" + "flat_visit", # flat_visit_fee + "ther_red_fac", # "therapy_reduction_fac" + "opps", # "opps_indicator" + "opps_nonfac", + "opps_fac" +) + +pfs_pay <- pfs_pay |> + mutate(across(c( + year, + contains("fac"), + flat_visit + ), readr::parse_number)) |> + select(-pctc) + +pfs_pay |> + filter(hcpcs == "A0021") + +# ADDENDUM E. FINAL CY 2024 GEOGRAPHIC PRACTICE COST INDICES (GPCIs) BY STATE AND MEDICARE LOCALITY +# gpci_xl <- here::here("data/RVU24A-010323/GPCI2024.xlsx") + +gpci <- read_excel(gpci_xl, col_types = "text") |> + row_to_names(row_number = 2) |> + clean_names() |> + filter(!is.na(state)) |> + rename(mac = medicare_administrative_contractor_mac, + locality = locality_number, + gpci.pw_floor = x2024_pw_gpci_with_1_0_floor, + gpci.pe = x2024_pe_gpci, + gpci.mp = x2024_mp_gpci + ) |> + mutate(across(contains("gpci"), readr::parse_number)) |> + mutate(locality_name = str_remove_all(locality_name, fixed("*")), + state = fct(state)) + +gpci + + +board <- pins::board_folder(here::here("pins")) + +board |> + pins::pin_write(rvu, + name = "rvu", + title = "PFS RVU 2024", + description = "National Physician Fee Schedule Relative Value File January 2024 Release", + type = "qs") +board |> + pins::pin_write(pfs_pay, + name = "pymt", + title = "PFS Payment Amount 2024", + description = "Annual Physician Fee Schedule Payment Amount File 2024", + type = "qs") +board |> + pins::pin_write(gpci, + name = "gpci", + title = "GPCIs 2024", + description = "Geographic Practice Cost Indices (GPCIs) by State and Medicare Locality 2024", + type = "qs") + +board |> pins::write_board_manifest() diff --git a/man/limiting_charge.Rd b/man/limiting_charge.Rd new file mode 100644 index 0000000..c7f47ce --- /dev/null +++ b/man/limiting_charge.Rd @@ -0,0 +1,20 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/utils.R +\name{limiting_charge} +\alias{limiting_charge} +\title{Calculate limiting charge} +\usage{ +limiting_charge(x) +} +\arguments{ +\item{x}{numeric} +} +\value{ +description +} +\description{ +Calculate limiting charge +} +\examples{ +limiting_charge(26.35) +} diff --git a/pins/_pins.yaml b/pins/_pins.yaml new file mode 100644 index 0000000..956b93d --- /dev/null +++ b/pins/_pins.yaml @@ -0,0 +1,6 @@ +gpci: +- gpci/20240229T141339Z-56bda/ +pymt: +- pymt/20240229T141334Z-f3472/ +rvu: +- rvu/20240229T141242Z-b9bfe/ diff --git a/pins/gpci/20240229T141339Z-56bda/data.txt b/pins/gpci/20240229T141339Z-56bda/data.txt new file mode 100644 index 0000000..a4aa63d --- /dev/null +++ b/pins/gpci/20240229T141339Z-56bda/data.txt @@ -0,0 +1,11 @@ +file: gpci.qs +file_size: 3789 +pin_hash: 56bda82317bd4f61 +type: qs +title: GPCIs 2024 +description: Geographic Practice Cost Indices (GPCIs) by State and Medicare Locality + 2024 +tags: ~ +urls: ~ +created: 20240229T141339Z +api_version: 1 diff --git a/pins/gpci/20240229T141339Z-56bda/gpci.qs b/pins/gpci/20240229T141339Z-56bda/gpci.qs new file mode 100644 index 0000000..e059b6a Binary files /dev/null and b/pins/gpci/20240229T141339Z-56bda/gpci.qs differ diff --git a/pins/pymt/20240229T141334Z-f3472/data.txt b/pins/pymt/20240229T141334Z-f3472/data.txt new file mode 100644 index 0000000..59166c5 --- /dev/null +++ b/pins/pymt/20240229T141334Z-f3472/data.txt @@ -0,0 +1,10 @@ +file: pymt.qs +file_size: 8590506 +pin_hash: f347237b879b8c9a +type: qs +title: PFS Payment Amount 2024 +description: Annual Physician Fee Schedule Payment Amount File 2024 +tags: ~ +urls: ~ +created: 20240229T141334Z +api_version: 1 diff --git a/pins/pymt/20240229T141334Z-f3472/pymt.qs b/pins/pymt/20240229T141334Z-f3472/pymt.qs new file mode 100644 index 0000000..3cf78f6 Binary files /dev/null and b/pins/pymt/20240229T141334Z-f3472/pymt.qs differ diff --git a/pins/rvu/20240229T141242Z-b9bfe/data.txt b/pins/rvu/20240229T141242Z-b9bfe/data.txt new file mode 100644 index 0000000..4014071 --- /dev/null +++ b/pins/rvu/20240229T141242Z-b9bfe/data.txt @@ -0,0 +1,10 @@ +file: rvu.qs +file_size: 487417 +pin_hash: b9bfe6b2b6fbc381 +type: qs +title: PFS RVU 2024 +description: National Physician Fee Schedule Relative Value File January 2024 Release +tags: ~ +urls: ~ +created: 20240229T141242Z +api_version: 1 diff --git a/pins/rvu/20240229T141242Z-b9bfe/rvu.qs b/pins/rvu/20240229T141242Z-b9bfe/rvu.qs new file mode 100644 index 0000000..1201c81 Binary files /dev/null and b/pins/rvu/20240229T141242Z-b9bfe/rvu.qs differ