Skip to content

Commit

Permalink
Add options to download 2017, and 2018 AHRQ lists, and fixes jackwase…
Browse files Browse the repository at this point in the history
…y#142

Add options to download 2017, and 2018 AHRQ lists fixes jackwasey#142

Added ver into icd10_parse_ahrq_sas
  • Loading branch information
overmar committed May 12, 2019
1 parent 08cd232 commit d3a7756
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions R/parse-comorbid.R
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,13 @@ icd9_fetch_ahrq_sas <- function() {
}

icd10_fetch_ahrq_sas <- function(ver = "2016") {
if (!ver %in% c("2016","2017","2018")) {
stop(ver," not currently available")
}
.download_to_data_raw(
url = paste0(.ahrq_url_base, "comorbidityicd10/comformat_icd10cm_2016.txt"),
file_name = .get_versioned_raw_file_name("ahrq-comformat_icd10cm_2016.txt",
ver = "2016"
url = paste0(.ahrq_url_base, "comorbidityicd10/comformat_icd10cm_",ver,".txt"),
file_name = .get_versioned_raw_file_name(paste0("ahrq-comformat_icd10cm_",ver,".txt"),
ver = ver
)
)
}
Expand Down Expand Up @@ -139,9 +142,9 @@ icd9_parse_ahrq_sas <- function(save_pkg_data = FALSE) {
# This is in some ways simpler than that ICD-9 equivalent because I make no
# attempt to find all the child codes.
icd10_parse_ahrq_sas <- function(save_pkg_data = FALSE,
offline = TRUE) {
offline = TRUE, ver = "2016") {
assert_flag(save_pkg_data)
ahrq_info <- icd10_fetch_ahrq_sas()
ahrq_info <- icd10_fetch_ahrq_sas(ver = ver)
ahrq_sas_lines <- readLines(ahrq_info$file_path, warn = FALSE)
icd10_map_ahrq <- sas_format_extract_rcomfmt(ahrq_sas_lines)
unun <- function(x) unname(unlist(x))
Expand Down

0 comments on commit d3a7756

Please sign in to comment.