import streamlit as st import pandas as pd import altair as alt # Define list of largest hospitals with latitude and longitude largest_hospitals = [ { 'name': 'Florida Hospital Orlando', 'city': 'Orlando', 'state': 'FL', 'zip_code': '32803', 'bed_count': 2411, 'lat': 28.562229, 'lng': -81.362976 }, { 'name': 'Cleveland Clinic', 'city': 'Cleveland', 'state': 'OH', 'zip_code': '44195', 'bed_count': 1730, 'lat': 41.501669, 'lng': -81.621275 }, { 'name': 'Mayo Clinic', 'city': 'Rochester', 'state': 'MN', 'zip_code': '55905', 'bed_count': 1372, 'lat': 44.020634, 'lng': -92.463476 }, { 'name': 'NewYork-Presbyterian Hospital-Columbia and Cornell', 'city': 'New York', 'state': 'NY', 'zip_code': '10032', 'bed_count': 2332, 'lat': 40.840886, 'lng': -73.942184 }, { 'name': 'UCHealth University of Colorado Hospital', 'city': 'Aurora', 'state': 'CO', 'zip_code': '80045', 'bed_count': 672, 'lat': 39.742401, 'lng': -104.834694 }, { 'name': 'Houston Methodist Hospital', 'city': 'Houston', 'state': 'TX', 'zip_code': '77030', 'bed_count': 1063, 'lat': 29.710292, 'lng': -95.399262 }, { 'name': 'Johns Hopkins Hospital', 'city': 'Baltimore', 'state': 'MD', 'zip_code': '21287', 'bed_count': 1293, 'lat': 39.297082, 'lng': -76.590726 }, { 'name': 'Massachusetts General Hospital', 'city': 'Boston', 'state': 'MA', 'zip_code': '02114', 'bed_count': 1032, 'lat': 42.363371, 'lng': -71.068635 }, { 'name': 'University of Michigan Hospitals-Michigan Medicine', 'city': 'Ann Arbor', 'state': 'MI', 'zip_code': '48109', 'bed_count': 1145, 'lat': 42.282531, 'lng': -83.728376 }, { 'name': 'Mount Sinai Hospital', 'city': 'New York', 'state': 'NY', 'zip_code': '10029', 'bed_count': 1168, 'lat': 40.789866, 'lng': -73.952348 } ] # Convert list of largest hospitals to a Pandas DataFrame largest_hospitals_df = pd.DataFrame(largest_hospitals) # Define chart functions def map_chart(): chart = alt.Chart(largest_hospitals_df).mark_circle().encode( longitude='lng:Q', latitude='lat:Q', size=alt.Size('bed_count:Q', title='Bed Count'), color=alt.Color('state:N', legend=alt.Legend(title='State')), tooltip=['name', 'bed_count', 'city', 'state'] ).properties( width=700, height=500, title='Location of Largest Hospitals in the US' ) st.altair_chart(chart) # Define chart buttons st.sidebar.header('Select a Chart') chart_options = ['Map Chart'] chart_choice = st.sidebar.selectbox('', chart_options) # Call chart functions based on user input if chart_choice == 'Map Chart': map_chart()