The Colorado Department of Health Care Policy and Financing (HCPF) website for fee schedules is here.
However, Colorado's Medicaid fee schedules are a pain in the ass. They are publicly available as Microsoft Excel files but...
.xls
and .xlsx
)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 bfbbd07a2d538ec57e61cddf3616993aa74b78b1
(5/4/2016).
Step 4 is below.
In [1]:
files <- paste("Data", list.files(file.path(getwd(), "Data")), sep="/")
files
Out[1]:
In [2]:
library(data.table)
readFS <- function (f) {
require(data.table, quietly=TRUE)
if (grepl("jan", f, ignore.case=TRUE)) {month <- 1}
if (grepl("jul", f, ignore.case=TRUE)) {month <- 7}
for (i in 2012:2016) {if (grepl(sprintf("%d", i), f)) {year <- i}}
colClasses <- c("character", "character", "numeric", "character", "character", rep("numeric", 3), "character")
D <- data.table(read.csv(f, header=FALSE, colClasses=colClasses, skip=5, na.strings=c(""), strip.white=TRUE))
old <- names(D)
keep <- c("procedure_code",
"modifier",
"base_value",
"conversion_factor",
"total_allowable",
"min_age",
"max_age",
"postop_days",
"prior_auth_needed")
if (length(old) > length(keep)) {new <- c(keep, old[(length(keep) + 1):length(old)])}
else {new <- keep}
setnames(D, old, new)
D <- D[!is.na(procedure_code)]
D <- D[,
`:=` (conversion_factor = as.numeric(conversion_factor),
total_allowable = toupper(total_allowable),
prior_auth_needed = toupper(prior_auth_needed),
effective_date = as.Date(sprintf("%d-%d-01", year, month)))]
D <- D[, total_allowable := gsub("MANNUAL", "MANUAL", total_allowable)]
D <- D[, total_allowable := gsub("\\bMANUAL\\b", "MANUALLY", total_allowable)]
D <- D[, total_allowable := gsub("IMMUNZATION", "IMMUNIZATION", total_allowable)]
D[, c(keep, "effective_date"), with=FALSE]
}
Cycle through all the CSV files.
In [3]:
D <- list()
for (i in 1:length(files)) {
D[[i]] <- readFS(file.path(getwd(), files[i]))
}
fs <- rbindlist(D)
In [4]:
fs[, .N, effective_date][order(effective_date)]
Out[4]:
In [5]:
summary(fs[, base_value])
summary(fs[, conversion_factor])
fs[grep("[a-z]", total_allowable, ignore.case=TRUE), .N, total_allowable]
summary(fs[, min_age])
summary(fs[, max_age])
fs[, .N, prior_auth_needed]
Out[5]:
Out[5]:
Out[5]:
Out[5]:
Out[5]:
Out[5]:
In [6]:
head(fs)
tail(fs)
Out[6]:
Out[6]: