Get the Current Hospital Data Set from CMS with {}


Steven P. Sanderson II, MPH


February 10, 2023


Getting data for health care in the US can sometimes be hard. With my R package {} I am hoping to alleviate some of that pain.

Right now the package is bring actively developed from what was a simple yet sleepy simulated administrative data set is getting supercharged into a a full blow package that will retrieve data from outside sources. One such source is CMS.

At the start, and this is going to be a long road, I have started to build some functionality around getting the current hospital data from CMS. Let’s take a look at how it works.


Here is the function which has no parameters. This function will download the current and the official hospital data sets from the website.

The function makes use of a temporary directory and file to save and unzip the data. This will grab the current Hospital Data Files, unzip them and return a list of tibbles with each tibble named after the data file.

The function returns a list object with all of the current hospital data as a tibble. It does not save the data anywhere so if you want to save it you will have to do that manually.

This also means that you would have to store the data as a variable in order to access the data later on. It does have a given attributes and a class so that it can be piped into other functions.


Now let’s see it in action.


We will download the current hospital data sets and take a look.


current_hospital_dataset <- current_hosp_data()

This function downloads 70 files. Let’s see which ones have been downloaded.

 [1] "ASC_Facility.csv"                                                
 [2] "ASC_National.csv"                                                
 [3] "ASC_State.csv"                                                   
 [4] "ASCQR_OAS_CAHPS_BY_ASC.csv"                                      
 [5] "ASCQR_OAS_CAHPS_NATIONAL.csv"                                    
 [6] "ASCQR_OAS_CAHPS_STATE.csv"                                       
 [7] "CJR_PY6_Quality_Reporting_July_2022_Production_File.csv"         
 [8] "CMS_PSI_6_decimal_file.csv"                                      
 [9] "Complications_and_Deaths_Hospital.csv"                           
[10] "Complications_and_Deaths_National.csv"                           
[11] "Complications_and_Deaths_State.csv"                              
[12] "Data_Updates_January_2023.csv"                                   
[13] "Footnote_Crosswalk.csv"                                          
[14] "FY_2023_HAC_Reduction_Program_Hospital.csv"                      
[15] "FY_2023_Hospital_Readmissions_Reduction_Program_Hospital.csv"    
[16] "FY2021_Distribution_of_Net_Change_in_Base_Op_DRG_Payment_Amt.csv"
[17] "FY2021_Net_Change_in_Base_Op_DRG_Payment_Amt.csv"                
[18] "FY2021_Percent_Change_in_Medicare_Payments.csv"                  
[19] "FY2021_Value_Based_Incentive_Payment_Amount.csv"                 
[20] "HCAHPS_Hospital.csv"                                             
[21] "HCAHPS_National.csv"                                             
[22] "HCAHPS_State.csv"                                                
[23] "Healthcare_Associated_Infections_Hospital.csv"                   
[24] "Healthcare_Associated_Infections_National.csv"                   
[25] "Healthcare_Associated_Infections_State.csv"                      
[26] "Hospital_General_Information.csv"                                
[27] "HOSPITAL_QUARTERLY_MSPB_6_DECIMALS.csv"                          
[28] "hvbp_clinical_outcomes.csv"                                      
[29] "hvbp_efficiency_and_cost_reduction.csv"                          
[30] "hvbp_person_and_community_engagement.csv"                        
[31] "hvbp_safety.csv"                                                 
[32] "hvbp_tps.csv"                                                    
[33] "IPFQR_QualityMeasures_Facility.csv"                              
[34] "IPFQR_QualityMeasures_National.csv"                              
[35] "IPFQR_QualityMeasures_State.csv"                                 
[36] "Maternal_Health_Hospital.csv"                                    
[37] "Maternal_Health_National.csv"                                    
[38] "Maternal_Health_State.csv"                                       
[39] "Measure_Dates.csv"                                               
[40] "Medicare_Hospital_Spending_by_Claim.csv"                         
[41] "Medicare_Hospital_Spending_Per_Patient_Hospital.csv"             
[42] "Medicare_Hospital_Spending_Per_Patient_National.csv"             
[43] "Medicare_Hospital_Spending_Per_Patient_State.csv"                
[44] "OAS_CAHPS_Footnotes.csv"                                         
[45] "OQR_OAS_CAHPS_BY_HOSPITAL.csv"                                   
[46] "OQR_OAS_CAHPS_NATIONAL.csv"                                      
[47] "OQR_OAS_CAHPS_STATE.csv"                                         
[48] "Outpatient_Imaging_Efficiency_Hospital.csv"                      
[49] "Outpatient_Imaging_Efficiency_National.csv"                      
[50] "Outpatient_Imaging_Efficiency_State.csv"                         
[51] "Payment_National.csv"                                            
[52] "Payment_State.csv"                                               
[53] "Payment_and_Value_of_Care_Hospital.csv"                          
[54] "PCH_HCAHPS_HOSPITAL.csv"                                         
[55] "PCH_HCAHPS_NATIONAL.csv"                                         
[56] "PCH_HCAHPS_STATE.csv"                                            
[58] "PCH_ONCOLOGY_CARE_MEASURES_HOSPITAL.csv"                         
[59] "PCH_OUTCOMES_HOSPITAL.csv"                                       
[60] "PCH_OUTCOMES_NATIONAL.csv"                                       
[61] "Timely_and_Effective_Care_Hospital.csv"                          
[62] "Timely_and_Effective_Care_National.csv"                          
[63] "Timely_and_Effective_Care_State.csv"                             
[64] "Unplanned_Hospital_Visits_Hospital.csv"                          
[65] "Unplanned_Hospital_Visits_National.csv"                          
[66] "Unplanned_Hospital_Visits_State.csv"                             
[67] "VA_IPF.csv"                                                      
[68] "VA_TE.csv"                                                       
[69] "Value_of_Care_National.csv"                                      
[70] "Veterans_Health_Administration_Provider_Level_Data.csv"          

More to come in the future!