Hospital General Information from Hospital Compare

The main CMS Hospital Compare website is here. The website for data is here.


In [1]:
url <- "https://data.medicare.gov/views/bg9k-emty/files/7825b9e4-e595-4f25-86e0-32a68d7ac7a4?content_type=application%2Fzip%3B%20charset%3Dbinary&filename=Hospital_Revised_Flatfiles.zip"
f <- tempfile()
download.file(url, f, mode="wb")
file.info(f)
unzip(f, list=TRUE)
unzip(f, exdir=tempdir())


Out[1]:
sizeisdirmodemtimectimeatimeexe
C:\Users\chanb\AppData\Local\Temp\RtmpKGofmf\file1114383eed014721503FALSE6662016-05-05 12:03:372016-05-05 12:03:292016-05-05 12:03:29no
Out[1]:
NameLengthDate
1Ambulatory Surgical Measures-Facility.csv21013852016-02-23 10:13:00
2Ambulatory Surgical Measures-National.csv8462016-02-23 10:13:00
3Ambulatory Surgical Measures-State.csv123342016-02-23 10:13:00
4Complications - Hospital.csv99585092016-04-19 13:13:00
5Complications - National.csv11282016-04-19 13:13:00
6Complications - State.csv522052016-04-19 13:13:00
7Footnote Crosswalk.csv19152016-04-19 13:12:00
8FY2014_Distribution_of_Net_Change_in_Base_Op_DRG_Payment_Amt.csv3042015-10-19 12:32:00
9FY2014_Net_Change_in_Base_Op_DRG_Payment_Amt.csv9732015-10-19 12:32:00
10FY2014_Percent_Change_in_Medicare_Payments.csv6702015-10-22 14:54:00
11FY2014_Value_Based_Incentive_Payment_Amount.csv7952015-10-19 12:32:00
12HCAHPS - Hospital.csv1020629092016-04-19 13:22:00
13HCAHPS - National.csv62432016-04-19 13:22:00
14HCAHPS - State.csv3594442016-04-19 13:22:00
15Healthcare Associated Infections - Hospital.csv621523852016-04-19 13:17:00
16Healthcare Associated Infections - National.csv10922016-04-19 13:17:00
17Healthcare Associated Infections - State.csv1494962016-04-19 13:17:00
18Hospital General Information.csv8230302016-04-19 13:13:00
19Hospital.pdf20377742016-04-18 19:12:00
20HOSPITAL_QUARTERLY_HAC_DOMAIN_HOSPITAL_02_26_2016.csv4160262016-02-26 14:37:00
21HOSPITAL_QUARTERLY_IPFQR_MEASURES_HOSPITAL.csv30110022016-03-24 10:17:00
22HOSPITAL_QUARTERLY_IPFQR_MEASURES_NATIONAL.csv45582016-02-23 10:13:00
23HOSPITAL_QUARTERLY_IPFQR_MEASURES_STATE.csv844542016-02-23 10:13:00
24HOSPITAL_QUARTERLY_QUALITYMEASURE_PCH_HOSPITAL.csv71822016-02-28 21:38:00
25hvbp_ami_02_18_2016.csv5416272016-02-28 22:20:00
26hvbp_Efficiency_02_18_2016.csv4567552016-02-28 22:26:00
27hvbp_hai_02_18_2016.csv7922442016-02-28 22:31:00
28hvbp_hcahps_02_18_2016.csv13356972016-02-29 10:45:00
29hvbp_imm2_02_18_2016.csv4677632016-02-29 11:01:00
30hvbp_outcome_02_18_2016.csv16786502016-03-10 11:17:00
31hvbp_pn_02_18_2016.csv4716082016-02-29 10:05:00
32hvbp_scip_02_18_2016.csv6379652016-02-29 10:29:00
33hvbp_tps_02_18_2016.csv7898762016-02-29 10:15:00
34Measure Dates.csv211762016-04-19 13:12:00
35Medicare Hospital Spending by Claim.csv111330222016-03-24 17:54:00
36Medicare Hospital Spending per Patient - Hospital.csv7647262016-04-19 13:12:00
37Medicare Hospital Spending per Patient - National.csv2822016-04-19 13:12:00
38Medicare Hospital Spending per Patient - State.csv84962016-04-19 13:12:00
39Outpatient Imaging Efficiency - Hospital.csv55425472016-04-19 13:12:00
40Outpatient Imaging Efficiency - National.csv6542016-04-19 13:12:00
41Outpatient Imaging Efficiency - State.csv294992016-04-19 13:12:00
42Outpatient Procedures - Volume.csv5931192016-02-18 10:32:00
43Payment - National.csv5802016-04-19 13:13:00
44Payment - State.csv173002016-04-19 13:13:00
45Payment and Value of Care - Hospital.csv56512872016-04-19 13:13:00
46readme.txt3522005-05-12 09:01:00
47READMISSION REDUCTION.csv23279382016-02-18 10:32:00
48Readmissions and Deaths - Hospital.csv198887522016-04-19 13:13:00
49Readmissions and Deaths - National.csv19802016-04-19 13:13:00
50Readmissions and Deaths - State.csv930412016-04-19 13:13:00
51Structural Measures - Hospital.csv67362842016-04-19 13:13:00
52Timely and Effective Care - Hospital.csv545590812016-04-19 13:13:00
53Timely and Effective Care - National.csv177672016-04-19 13:13:00
54Timely and Effective Care - State.csv4921282016-04-19 13:13:00
55Value of Care - National.csv51582016-04-19 13:13:00

In [2]:
library(data.table)
D <- fread(file.path(tempdir(), "Hospital General Information.csv"))
old <- names(D)
new <- gsub("\\s", "", old)
setnames (D, old, new)
str(D)
D[State == "OR", .N, .(State, HospitalType, HospitalOwnership, EmergencyServices)]


Classes 'data.table' and 'data.frame':	4799 obs. of  11 variables:
 $ ProviderID       : chr  "010001" "010005" "010006" "010007" ...
 $ HospitalName     : chr  "SOUTHEAST ALABAMA MEDICAL CENTER" "MARSHALL MEDICAL CENTER SOUTH" "ELIZA COFFEE MEMORIAL HOSPITAL" "MIZELL MEMORIAL HOSPITAL" ...
 $ Address          : chr  "1108 ROSS CLARK CIRCLE" "2505 U S HIGHWAY 431 NORTH" "205 MARENGO STREET" "702 N MAIN ST" ...
 $ City             : chr  "DOTHAN" "BOAZ" "FLORENCE" "OPP" ...
 $ State            : chr  "AL" "AL" "AL" "AL" ...
 $ ZIPCode          : chr  "36301" "35957" "35631" "36467" ...
 $ CountyName       : chr  "HOUSTON" "MARSHALL" "LAUDERDALE" "COVINGTON" ...
 $ PhoneNumber      : chr  "3347938701" "2565938310" "2567688400" "3344933541" ...
 $ HospitalType     : chr  "Acute Care Hospitals" "Acute Care Hospitals" "Acute Care Hospitals" "Acute Care Hospitals" ...
 $ HospitalOwnership: chr  "Government - Hospital District or Authority" "Government - Hospital District or Authority" "Government - Hospital District or Authority" "Voluntary non-profit - Private" ...
 $ EmergencyServices: chr  "Yes" "Yes" "Yes" "Yes" ...
 - attr(*, ".internal.selfref")=<externalptr> 
Out[2]:
StateHospitalTypeHospitalOwnershipEmergencyServicesN
1ORAcute Care HospitalsVoluntary non-profit - OtherYes6
2ORAcute Care HospitalsGovernment - LocalYes1
3ORAcute Care HospitalsVoluntary non-profit - PrivateYes18
4ORAcute Care HospitalsVoluntary non-profit - ChurchYes7
5ORAcute Care HospitalsGovernment - Hospital District or AuthorityYes2
6ORACUTE CARE - VETERANS ADMINISTRATIONGovernment FederalNo2
7ORCritical Access HospitalsVoluntary non-profit - PrivateYes7
8ORCritical Access HospitalsVoluntary non-profit - ChurchYes7
9ORCritical Access HospitalsGovernment - Hospital District or AuthorityYes10
10ORCritical Access HospitalsProprietaryYes1