The Washington state Health Care Authority website for fee schedules is here.
However, Washington's Medicaid fee schedules are a pain in the ass. They are publicly available as Microsoft Excel files but...
readxl
or xlsx
packages)All these issues makes codifying difficult. As a workaround, the following steps were taken.
The first 3 steps were done manually. The SHA for the commit of the CSV files is 5bde7f3e33e0c83bdace0ed0cf04553a41a8efb1 (5/5/2016). Step 4 is below.
In [3]:
files <- list.files(file.path(getwd(), "Data"))
files
files <- paste("Data", files, sep="/")
Out[3]:
In [2]:
library(data.table)
readFS <- function (f, skip) {
require(data.table, quietly=TRUE)
for (i in 11:16) {if (grepl(sprintf("%d\\.csv", i), f)) {year <- as.numeric(sprintf("20%d", i))}}
for (i in 1:12) {
monname <- format(as.Date(sprintf("%d-%d-01", year, i)), format="%B")
if (grepl(sprintf("_%02d", i), f) | grepl(tolower(monname), f, ignore.case=TRUE)) {
mm <- i
}
}
colClasses <- rep("character", 9)
D <- data.table(read.csv(f, header=FALSE, colClasses=colClasses, skip=skip, na.strings=c(""), strip.white=TRUE))
old <- names(D)
keep <- c("code_status_indicator",
"code",
"mod",
"nfs_maximum_allowable",
"fs_maximum_allowable",
"pa_required",
"global_days",
"comments")
if (length(old) > length(keep)) {new <- c(keep, old[(length(keep) + 1):length(old)])}
else {new <- keep}
setnames(D, old, new)
D <- D[, effective_date := as.Date(sprintf("%d-%d-01", year, mm))]
D[, c(keep, "effective_date"), with=FALSE]
}
In [3]:
fs <- rbindlist(list(readFS(file.path(getwd(), "Data/HCA_PREOH_January_1_2013.csv"), 9),
readFS(file.path(getwd(), "Data/physician_010114.csv"), 9),
readFS(file.path(getwd(), "Data/physician_010115.csv"), 9),
readFS(file.path(getwd(), "Data/physician_010116.csv"), 10),
readFS(file.path(getwd(), "Data/physician_040115.csv"), 9),
readFS(file.path(getwd(), "Data/physician_040116.csv"), 10),
readFS(file.path(getwd(), "Data/physician_070114.csv"), 9),
readFS(file.path(getwd(), "Data/physician_070115.csv"), 10),
readFS(file.path(getwd(), "Data/physician_100115.csv"), 10),
readFS(file.path(getwd(), "Data/preoh_010112.csv"), 6),
readFS(file.path(getwd(), "Data/preoh_01012011.csv"), 6),
readFS(file.path(getwd(), "Data/preoh_070112.csv"), 9),
readFS(file.path(getwd(), "Data/preoh_070113.csv"), 9),
readFS(file.path(getwd(), "Data/preoh_07012011.csv"), 6)))
str(fs)
In [4]:
fs[, .N, effective_date][order(effective_date)]
Out[4]:
In [5]:
head(fs)
tail(fs)
Out[5]:
Out[5]:
Rename object
In [ ]:
fsPhysician <- fs
In [18]:
library(data.table)
f <- file.path(getwd(), "Data/ambulance_transportation_022016.csv")
D <- data.table(read.csv(f, header=TRUE, na.strings=c(""), strip.white=TRUE, stringsAsFactors=FALSE))
old <- names(D)
new <- c("code_status_indicator",
"code",
"description",
"fs_maximum_allowable",
"limits")
setnames(D, old, new)
D <- D[, fs_maximum_allowable := as.numeric(gsub("[^0-9\\.]", "", fs_maximum_allowable))]
D <- D[, effective_date := as.Date("2006-07-01")]
str(D)
D
Out[18]: