knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)

1. Background

In 2019, we purchased more than 100 procedures that are commonly performed by general surgery surgeons from CMS. The purchased procedures went back from 2007. Since we already have Medicare data from 2007-2016 for the original 5 procedures, we received the purchased procedures in separate datasets. After 2016, all newly added procedures and original 5 procedures are together in one data file each year.

2. Datasets

Changes needed for professional claims (Carrier claim and line files). New procedure files location on Maize: Shared3/DMH_Shared/Dimick_Improve_Surgical_Care/SAS_Files/New_Hernia_ECMD. We don't need to rerun standardization process for MBSF and MedPAR because we already have 100% MedPAR and MBSF datasets each year. Added beneficiaries and MedPAR cases that are related to Carrier files are already included in the old files.

Note: in the data folder, you can find the datasets from 2007-2017. As mentioned above, after 2016, all procedures will be in one data file under yearly purchased, eg. Dimick_Improve_Surgical_Care/SAS_Files/2017.

Contents

The datasets we use are carrier files named as: bcarrier_ln_20xx and bcarrier_clms_20xx

# example
# do not run
purrr::map(c(2007:2016), # year
           ~add_new_procedure(claim = TRUE, 
                              src_data_root = "/Volumes/George_Surgeon_Projects/original_medicare_selected_vars/data/",
                              year = .x))

3. Process

Create a defined CPT to procedure names map.

The map we use for the project is at ecs_list. - In the list, CPTs to ECS procedures are not uniquely mapped. Make sure to get unique maps between cpt to ECS to avoid data processing errors (introduce by left join process)

# do not run
# ecs_list_with_coded_flg.csv was downloaded from https://docs.google.com/spreadsheets/d/1Fa2xWCRIe5-_3F7MpQPvJfCzy_lBtWFvB_TGevnZ60Q/edit#gid=1841533335
cpt_map = readr::read_csv("/Volumes/George_Surgeon_Projects/standardized_medicare_data_using_R/input/raw/ecs_list_with_coded_flg.csv") 
# one cpt to one procedure
cpt_ecs_map = cpt_map %>% 
  distinct(cpt, ecs_id, ECSProcedureName, ProcedureGroup)

Standardization and ceeating analytic files

standardization

# you can control years by editing import_src
import_src <- read_csv("data/2020/import_source.csv") %>% 
  filter(source_dir<2017)

Creating analytic files

# do not run
# procedure map defined by cpt 
define_proc_by_cpt <- readr::read_csv(paste0(wd$input_data, "cpt_ecs_map.csv")) %>% 
  transmute(cpt_cd = as.character(cpt), e_proc_grp = ecs_id, e_proc_grp_lbl = ECSProcedureName) %>% 
  distinct()


UMCSTaR/medicareR documentation built on May 11, 2022, 7:31 p.m.