Skip to content

Commit

Permalink
pins, vignettes
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewallenbruce committed May 25, 2024
1 parent 22ef509 commit 0219e36
Show file tree
Hide file tree
Showing 8 changed files with 168 additions and 104 deletions.
66 changes: 37 additions & 29 deletions data-raw/claims99.R
Original file line number Diff line number Diff line change
@@ -1,31 +1,40 @@
## code to prepare `claims_99` dataset goes here

#qs::qread("C:/Users/andyb/Desktop/forager/extdata/large_claims_data/claims_99")

#"D:/medical_ins_large_claims/1999/claim99fr2.txt"

claims_99 <- fst::read_fst("C:/Users/andyb/Desktop/forager/extdata/large_claims_data/claims_99")

names(claims_99)[1] <- "claim_yr"
names(claims_99)[2] <- "pt_id"
names(claims_99)[4] <- "sex"
names(claims_99)[5] <- "birth_yr"

names(claims_99)[6] <- "hosp_covd_chrg"
names(claims_99)[7] <- "hosp_allw_chrg"
names(claims_99)[8] <- "hosp_paid_chrg"

names(claims_99)[9] <- "phys_covd_chrg"
names(claims_99)[10] <- "phys_allw_chrg"
names(claims_99)[11] <- "phys_paid_chrg"

names(claims_99)[12] <- "oth_covd_chrg"
names(claims_99)[13] <- "oth_allw_chrg"
names(claims_99)[14] <- "oth_paid_chrg"

names(claims_99)[15] <- "tot_covd_chrg"
names(claims_99)[16] <- "tot_allw_chrg"
names(claims_99)[17] <- "tot_paid_chrg"
path99 <- "D:/medical_ins_large_claims/1999/claim99fr2.txt"

claims_99 <- tidytable::fread(path99)

names_new <- c(
"CLAIMYR" = "claim_yr",
"CLAIMANT" = "claimant",
"RELATION" = "relation",
"PATSEX" = "sex",
"PATBRTYR" = "dob",
"HOSCVCHG" = "hosp_covd_chrg",
"HOSLWCHG" = "hosp_allw_chrg",
"HOSPDCHG" = "hosp_paid_chrg",
"PHYCVCHG" = "phys_covd_chrg",
"PHYLWCHG" = "phys_allw_chrg",
"PHYPDCHG" = "phys_paid_chrg",
"OTHCVCHG" = "oth_covd_chrg",
"OTHLWCHG" = "oth_allw_chrg",
"OTHPDCHG" = "oth_paid_chrg",
"TOTCVCHG" = "tot_covd_chrg",
"TOTLWCHG" = "tot_allw_chrg",
"TOTPDCHG" = "tot_paid_chrg",
"DIAG1" = "diag1",
"DIAG1CHG" = "diag1chg",
"DIAG2" = "diag2",
"DIAG2CHG" = "diag2chg",
"DIAG3" = "diag3",
"DIAG3CHG" = "diag3chg",
"DGCAT" = "dgcat",
"DGCATCHG" = "dgcatchg",
"EXPOSMEM" = "exposmem",
"PPO" = "ppo"
)


names(claims_99) |>
rlang::set_names(names_new)

claims_99 <- claims_99 |>
dplyr::tibble() |>
Expand All @@ -45,4 +54,3 @@ claims_99 <- claims_99 |>
# dplyr::mutate(diag2 = dplyr::na_if(diag2, ""),
# diag3 = dplyr::na_if(diag3, ""))

usethis::use_data(claims_99, overwrite = TRUE)
23 changes: 23 additions & 0 deletions data-raw/cppm_aging.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
source(here::here("data-raw", "pins_functions.R"))

cppm_ex <- tidytable::fread(here::here("cppm_ex.csv")) |>
janitor::clean_names() |>
dplyr::tibble() |>
dplyr::reframe(
date = readr::parse_date(
month,
format = "%b-%y"
) + lubridate::years(3),
gross_charges = charges,
ending_ar = ar_balance,
adjustments,
collections
)


pin_update(
cppm_ex,
name = "cppm_ex",
title = "CPPM Example",
description = "CPPM Example"
)
2 changes: 2 additions & 0 deletions inst/extdata/pins/_pins.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ aging_ex:
- aging_ex/20240509T015946Z-e1388/
aging_monthly:
- aging_monthly/20240513T182038Z-3ab2b/
cppm_ex:
- cppm_ex/20240524T221448Z-b7a0e/
healthyr:
- healthyr/20240523T135806Z-899d8/
monthly_raw:
Expand Down
Binary file not shown.
10 changes: 10 additions & 0 deletions inst/extdata/pins/cppm_ex/20240524T221448Z-b7a0e/data.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
file: cppm_ex.qs
file_size: 670
pin_hash: b7a0e6397f4827f5
type: qs
title: CPPM Example
description: CPPM Example
tags: ~
urls: ~
created: 20240524T221448Z
api_version: 1
21 changes: 11 additions & 10 deletions vignettes/articles/parbx-and-bpi.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,29 @@
title: "PARBx & BPI"
---

```{r, include = FALSE}
```{r setup, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
collapse = FALSE,
echo = TRUE,
message = FALSE,
warning = FALSE,
error = TRUE,
comment = "#>",
dpi = 300,
out.width = "100%",
fig.path = "man/figures/README-"
dpi = 600,
out.width = "100%"
)
```
options(scipen = 999)
```{r setup}
library(forager)
library(dplyr)
library(tidyr)
library(wakefield)
library(reactable)
library(reactablefmtr)
library(htmltools)
library(highcharter)
```

# PARB$x$

PARB$x$, or *Percentage of Accounts Receivable Beyond $x$ Days*, is exactly what it sounds like: monitoring the percentage of your AR balances as they age, in what are commonly referred to as aging “buckets” or “bins.” This idea, in and of itself, is not revolutionary, other than his suggestion to use PARB$x$ to resolve Days in AR’s inability to highlight the overall behavior of Accounts Receivable. The innovation comes in the form of using the PARB$x$ data to create an index that tracks a payer’s performance month-to-month and annually:
Expand Down Expand Up @@ -181,7 +181,8 @@ htmltools::div(class = "rcm-analysis", bpi_mon_tbl)
bpi_mon_long <- bpi_mon |>
select(payer, nov_parbx, dec_parbx) |>
rename(November = nov_parbx, December = dec_parbx) |>
tidyr::pivot_longer(!payer, names_to = "month", values_to = "parbx")
pivot_longer(!payer, names_to = "month", values_to = "parbx")
head(bpi_mon_long, 10)
```

Expand Down Expand Up @@ -422,7 +423,7 @@ div(class = "rcm-analysis", bpi_mon_wt_tbl)
bpi_mon_long_wt <- bpi_mon_wt |>
select(payer, nov_parbx_wt, dec_parbx_wt) |>
rename(November = nov_parbx_wt, December = dec_parbx_wt) |>
tidyr::pivot_longer(!payer, names_to = "month", values_to = "parbx_wt")
pivot_longer(!payer, names_to = "month", values_to = "parbx_wt")
parbx_hc2 <- bpi_mon_long_wt |>
hchart("line", hcaes(x = month, y = parbx_wt, group = payer),
Expand Down
Loading

0 comments on commit 0219e36

Please sign in to comment.