Function to web scrape ICD discharge diagnosis code sets from the CDC FTP server or CMS website. If pulling ICD-10 codes, by default the function will search for the most recent year's code set publication by NCHS. Users can specify earlier publication years back to 2019 if needed. The ICD-9 option will only web scrape the most recent, final ICD-9 code set publication (2014) from the CMS website. This function will return an error message if the FTP server or CMS website is unresponsive or if a timeout of 60 seconds is reached. The result is a dataframe with 3 fields: code, description, and set (ICD version concatenated with year). Codes are standardized to upper case with punctuation and extra leading/tailing white space removed to enable successful joining.
webscrape_icd(icd_version = "ICD10", year = NULL, quiet = FALSE)
A character value of either "icd10", "ICD10", "icd9", or "ICD9" to specify ICD version
A numeric integer indicating the year of desired ICD-10 code set.
Defaults to NULL
to pull the most recent year's publication.
logical. If TRUE
, suppress status messages (if any),
and the progress bar.
A dataframe