Skip to content

Commit

Permalink
pla, examples
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewallenbruce committed Jun 28, 2024
1 parent c0f4c55 commit 797c8cd
Show file tree
Hide file tree
Showing 18 changed files with 137 additions and 31 deletions.
2 changes: 2 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export(assign_adjustments)
export(calculate_amounts)
export(carc_add_dash)
export(data_dict)
export(get_example)
export(get_pin)
export(gt_theme_northstar)
export(is_category_I)
Expand All @@ -26,6 +27,7 @@ export(search_modifiers)
export(search_mues)
export(search_opps)
export(search_payment)
export(search_plas)
export(search_pos)
export(search_ptps)
export(search_rbcs)
Expand Down
27 changes: 27 additions & 0 deletions R/standards.R
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,33 @@ search_hcpcs <- function(hcpcs_code = NULL, ...) {

}


#' Proprietary Laboratory Analyses (PLA) Codes
#' (U codes)
#' https://www.ama-assn.org/practice-management/cpt/cpt-pla-codes
#
#' @template args-hcpcs
#'
#' @template args-dots
#'
#' @template returns
#'
#' @examples
#' search_plas(hcpcs_code = c("C9039", "J1835"))
#'
#' @autoglobal
#'
#' @family HIPAA Standards
#'
#' @export
search_plas <- function(hcpcs_code = NULL, ...) {

pla <- get_pin("cpt_pla")
pla <- fuimus::search_in_if(pla, pla$hcpcs_code, hcpcs_code)
return(.add_class(pla))

}

#' Place of Service (POS) Codes
#'
#' Place of Service Codes are two-digit codes placed on health care professional
Expand Down
30 changes: 21 additions & 9 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,8 @@ mount_board <- function(source = c("local", "remote")) {

switch(
source,
local = pins::board_folder(
fs::path_package(
"extdata/pins",
package = "northstar")
),
remote = pins::board_url(
"https://raw.githubusercontent.com/andrewallenbruce/northstar/master/inst/extdata/pins/"
)
)
local = pins::board_folder(fs::path_package("extdata/pins", package = "northstar")),
remote = pins::board_url("https://raw.githubusercontent.com/andrewallenbruce/northstar/master/inst/extdata/pins/"))
}

#' Get a pinned dataset from a [pins][pins::pins-package] board
Expand Down Expand Up @@ -64,6 +57,25 @@ list_pins <- function(...) {

}

#' Load Example Datasets
#'
#' @param name name of example
#'
#' @returns `<tibble>`
#'
#' @autoglobal
#'
#' @keywords internal
#'
#' @export
get_example <- function(name = c("report", "practicum")) {

name <- match.arg(name)

get_pin("examples")[[name]] |> .add_class()

}

#' Apply {gt} Theme
#'
#' @param gt_object `<gt_tbl>` A [gt][gt::gt-package] table object
Expand Down
6 changes: 1 addition & 5 deletions data-raw/denials.R
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,7 @@ scrape_urls <- function(url) {
pg |>
rvest::html_elements(".table") |>
rvest::html_table() |>
purrr::pluck(1) # |>
# janitor::clean_names() |>
# dplyr::select(
# adj_code = carc_rarc,
# adj_description = description)
purrr::pluck(1)
),
info = fuimus::null_if_empty(
pg |>
Expand Down
21 changes: 15 additions & 6 deletions data-raw/practicum.R → data-raw/examples.R
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
source(here::here("data-raw", "source_setup", "setup.R"))

# gs_id <- "1MVaKH6T6GZ39iKvrNRoiOBb47RQtMYJ4g0nvunmzsBg"

# Report Example ----------------
report <- qs::qread(here::here("data-raw", "rpt_clean"))


# Practicum Example ----------------
wkbk <- "1KUPLYD2dksyD4Gcc8pHL5Chw20Sjcck0HYM9VA_JZJ4"
sh1 <- read_sheet(wkbk, sheet = 1, col_types = "iicccccicccc")
sh2 <- read_sheet(wkbk, sheet = 2, col_types = "iicccccicccc")
sh3 <- read_sheet(wkbk, sheet = 3, col_types = "iicccccicccc")

# What year were these cases from?

practicum_raw <- vctrs::vec_rbind(
sh1,
sh2,
Expand Down Expand Up @@ -62,12 +66,17 @@ practicum <- practicum_raw |>
.before = 1
)

examples <- list(
report = report,
practicum = practicum
)

# Update pin -------------------
pin_update(
practicum,
name = "practicum",
title = "AAPC CPC Practicum Case Data",
description = "AAPC CPC Practicum Case Data"
examples,
name = "examples",
title = "Northstar Example Data",
description = "Northstar Example Data"
)

# Example usage ----------------
Expand Down
2 changes: 2 additions & 0 deletions inst/extdata/pins/_pins.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ denials_extract:
- denials_extract/20240618T141211Z-dd08c/
denials_site:
- denials_site/20240618T140439Z-58f21/
examples:
- examples/20240628T010539Z-7eb2f/
hcpcs_descriptions:
- hcpcs_descriptions/20240627T025507Z-9bffb/
hcpcs_desc_raw:
Expand Down
10 changes: 10 additions & 0 deletions inst/extdata/pins/examples/20240628T010539Z-7eb2f/data.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
file: examples.qs
file_size: 933969
pin_hash: 7eb2fa6e8fbe41d7
type: qs
title: Northstar Example Data
description: Northstar Example Data
tags: ~
urls: ~
created: 20240628T010539Z
api_version: 1
Binary file not shown.
10 changes: 0 additions & 10 deletions inst/extdata/pins/practicum/20240627T083139Z-d296e/data.txt

This file was deleted.

Binary file not shown.
18 changes: 18 additions & 0 deletions man/get_example.Rd

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

1 change: 1 addition & 0 deletions man/search_descriptions.Rd

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

1 change: 1 addition & 0 deletions man/search_hcpcs.Rd

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

1 change: 1 addition & 0 deletions man/search_modifiers.Rd

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

36 changes: 36 additions & 0 deletions man/search_plas.Rd

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

1 change: 1 addition & 0 deletions man/search_pos.Rd

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

1 change: 1 addition & 0 deletions man/search_rbcs.Rd

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

1 change: 0 additions & 1 deletion vignettes/northstar.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ library(gt)
search_descriptions(hcpcs_code = "39503")
```


```{r}
search_adjustments()
```
Expand Down

0 comments on commit 797c8cd

Please sign in to comment.