Hospital Sorting Example 1

Getting a sorted list of hospitals by ranking

User input is in bold.

$ python3 sort-hospital.py

To help consumers make informed decisions about health care,
the Centers for Medicare & Medicaid Services collects data
about the cost and quality of care at over 4,000 Medicare
qualified hospitals.

This program allows you to explore this data.

1. Search by city and state
2. Search by hospital name
3. Rank hospitals by city and state
4. Find the ten most affordable treatment options by state
5. Quit
Choice: 3

Enter city: Swarthmore
Enter state: PA

Sorry, no matches were found.

1. Search by city and state
2. Search by hospital name
3. Rank hospitals by city and state
4. Find the ten most affordable treatment options by state
5. Quit
Choice: 3

Enter city: Ames
Enter state: IA

            HOSPITAL NAME         CITY ST RATING HEART($) PNEUM($) HIPKN($)
------------------------- ------------ -- ------ -------- -------- --------
Mary Greeley Medical Cent         Ames IA      4    22543    16406    20960

1 match found
Average of reported ratings: 4.0 (-1 means not reported)

1. Search by city and state
2. Search by hospital name
3. Rank hospitals by city and state
4. Find the ten most affordable treatment options by state
5. Quit
Choice: 3

Enter city: Lincoln
Enter state: NE

            HOSPITAL NAME         CITY ST RATING HEART($) PNEUM($) HIPKN($)
------------------------- ------------ -- ------ -------- -------- --------
Chi Health Nebraska Heart      Lincoln NE      5    28251        0        0
     Bryan Medical Center      Lincoln NE      3    26686    17552    22951
  Chi Health St Elizabeth      Lincoln NE      3    24848    17908    20265
Lincoln Surgical Hospital      Lincoln NE     -1        0        0    19480

4 matches found
Average of reported ratings: 3.7 (-1 means not reported)

1. Search by city and state
2. Search by hospital name
3. Rank hospitals by city and state
4. Find the ten most affordable treatment options by state
5. Quit
Choice: 3

Enter city: Pittsburgh
Enter state: PA

            HOSPITAL NAME         CITY ST RATING HEART($) PNEUM($) HIPKN($)
------------------------- ------------ -- ------ -------- -------- --------
        St Clair Hospital   Pittsburgh PA      5    23627    18211    21249
           Upmc Passavant   Pittsburgh PA      4    23155    16813    22784
Magee Womens Hospital Of    Pittsburgh PA      3        0    16295    20613
         Upmc St Margaret   Pittsburgh PA      3    24766    17922    22229
       West Penn Hospital   Pittsburgh PA      3    27651    21367    21494
               Upmc Mercy   Pittsburgh PA      2    23720    20420    25478
Upmc Presbyterian Shadysi   Pittsburgh PA      1    26543    18708    21361
Allegheny General Hospita   Pittsburgh PA      1    25479    19793    18622
Upmc Children's Hospital    Pittsburgh PA     -1        0        0        0
Children's Home Of Pittsb   Pittsburgh PA     -1        0        0        0
The Children's Institute    Pittsburgh PA     -1        0        0        0

11 matches found
Average of reported ratings: 2.8 (-1 means not reported)

1. Search by city and state
2. Search by hospital name
3. Rank hospitals by city and state
4. Find the ten most affordable treatment options by state
5. Quit
Choice: 3

Enter city: Philadelphia
Enter state: PA

            HOSPITAL NAME         CITY ST RATING HEART($) PNEUM($) HIPKN($)
------------------------- ------------ -- ------ -------- -------- --------
          Jeanes Hospital Philadelphia PA      4    24487    16806    23341
Penn Presbyterian Medical Philadelphia PA      4    23340    16061    22936
Cancer Treatment Centers  Philadelphia PA      3        0        0        0
   Chestnut Hill Hospital Philadelphia PA      3    24409    18808    24351
Hospital Of Univ Of Penns Philadelphia PA      3    25346    18444        0
        Nazareth Hospital Philadelphia PA      2    24009    19744    19691
              Aria Health Philadelphia PA      2    24188    19259    23101
    Pennsylvania Hospital Philadelphia PA      2    24667    16058    23603
Roxborough Memorial Hospi Philadelphia PA      2    24743    20956        0
Temple University Hospita Philadelphia PA      2    25411    18759    23817
Albert Einstein Medical C Philadelphia PA      1    24954    17784    26336
Hahnemann University Hosp Philadelphia PA      1    23575    19902    26404
Thomas Jefferson Universi Philadelphia PA      1    23738    17427    18490
Shriners Hospitals For Ch Philadelphia PA     -1        0        0        0
St Christopher's Hospital Philadelphia PA     -1        0        0        0
Children's Hospital Of Ph Philadelphia PA     -1        0        0        0
      Kensington Hospital Philadelphia PA     -1        0        0        0
       Wills Eye Hospital Philadelphia PA     -1        0        0        0

18 matches found
Average of reported ratings: 2.3 (-1 means not reported)

1. Search by city and state
2. Search by hospital name
3. Rank hospitals by city and state
4. Find the ten most affordable treatment options by state
5. Quit
Choice: 5

Goodbye!