File size: 5,486 Bytes
17d5ebc
d4ac004
975a985
 
d4ac004
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9eae4dc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d4ac004
9eae4dc
 
 
 
 
d4ac004
975a985
9eae4dc
d4ac004
9eae4dc
 
 
 
 
 
 
 
d4ac004
9eae4dc
d4ac004
 
 
9eae4dc
 
d4ac004
 
975a985
9eae4dc
 
 
 
 
 
 
 
 
 
 
 
975a985
9eae4dc
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
import streamlit as st
import pandas as pd
import pydeck as pdk

# Define the list of dictionaries with hospital information
hospital_list = [
    {
        'bed_count': 2766,
        'name': 'New York-Presbyterian Hospital',
        'city': 'New York',
        'state': 'NY',
        'latitude': 40.8404,
        'longitude': -73.9508,
        'zip': '10032'
    },
    {
        'bed_count': 2145,
        'name': 'Florida Hospital Orlando',
        'city': 'Orlando',
        'state': 'FL',
        'latitude': 28.5536,
        'longitude': -81.3568,
        'zip': '32803'
    },
    {
        'bed_count': 2020,
        'name': 'Jackson Memorial Hospital',
        'city': 'Miami',
        'state': 'FL',
        'latitude': 25.7893,
        'longitude': -80.2124,
        'zip': '33136'
    },
    {
        'bed_count': 1997,
        'name': 'Keck Medical Center of USC',
        'city': 'Los Angeles',
        'state': 'CA',
        'latitude': 34.0522,
        'longitude': -118.2437,
        'zip': '90033'
    },
    {
        'bed_count': 1956,
        'name': 'Montefiore Medical Center',
        'city': 'Bronx',
        'state': 'NY',
        'latitude': 40.8471,
        'longitude': -73.8816,
        'zip': '10467'
    },
    {
        'bed_count': 1926,
        'name': 'Rush University Medical Center',
        'city': 'Chicago',
        'state': 'IL',
        'latitude': 41.8745,
        'longitude': -87.6676,
        'zip': '60612'
    },
    {
        'bed_count': 1918,
        'name': 'University of Michigan Hospitals-Michigan Medicine',
        'city': 'Ann Arbor',
        'state': 'MI',
        'latitude': 42.2814,
        'longitude': -83.7483,
        'zip': '48109'
    },
    {
        'bed_count': 1863,
        'name': 'Parkland Health and Hospital System',
        'city': 'Dallas',
        'state': 'TX',
        'latitude': 32.7767,
        'longitude': -96.7970,
        'zip': '75235'
    },
    {
        'bed_count': 1858,
        'name': 'Houston Methodist Hospital',
        'city': 'Houston',
        'state': 'TX',
        'latitude': 29.7181,
        'longitude': -95.4044,
        'zip': '77030'
    },
    {
        'bed_count': 1800,
        'name': 'Brigham and Women\'s Hospital',
        'city': 'Boston',
        'state': 'MA',
        'latitude': 42.3367,
        'longitude': -71.1075,
        'zip': '02115'
    },
    {
        'bed_count': 1771,
        'name': 'Cleveland Clinic',
        'city': 'Cleveland',
        'state': 'OH',
        'latitude': 41.5047,    'longitude': -81.6218,
    'zip': '44195'
    },
    {
        'bed_count': 1730,
        'name': 'The Mount Sinai Hospital',
        'city': 'New York',
        'state': 'NY',
        'latitude': 40.7909,
        'longitude': -73.9524,
        'zip': '10029'
    },
    {
        'bed_count': 1729,
        'name': 'Northwestern Memorial Hospital',
        'city': 'Chicago',
        'state': 'IL',
        'latitude': 41.8953,
        'longitude': -87.6251,
        'zip': '60611'
    },
    {
        'bed_count': 1660,
        'name': 'Hospitals of the University of Pennsylvania-Penn Presbyterian',
        'city': 'Philadelphia',
        'state': 'PA',
        'latitude': 39.9526,
        'longitude': -75.1652,
        'zip': '19104'
    },
    {
        'bed_count': 1642,
        'name': 'Johns Hopkins Hospital',
        'city': 'Baltimore',
        'state': 'MD',
        'latitude': 39.2967,
        'longitude': -76.5913,
        'zip': '21287'
    },
    {
        'bed_count': 1614,
        'name': 'Cedars-Sinai Medical Center',
        'city': 'Los Angeles',
        'state': 'CA',
        'latitude': 34.0762,
        'longitude': -118.3882,
        'zip': '90048'
    },
    {
        'bed_count': 1577,
        'name': 'Massachusetts General Hospital',
        'city': 'Boston',
        'state': 'MA',
        'latitude': 42.3639,
        'longitude': -71.0711,
        'zip': '02114'
    },
    {
        'bed_count': 1566,
        'name': 'NYU Langone Hospitals',
        'city': 'New York',
        'state': 'NY',
        'latitude': 40.7429,
        'longitude': -73.9750,
        'zip': '10016'
    },
    {
        'bed_count': 1547,
        'name': 'Mayo Clinic Hospital-Rochester',
        'city': 'Rochester',
        'state': 'MN',
        'latitude': 44.0121,
        'longitude': -92.4802,
        'zip': '55902'
    },
    {
        'bed_count': 1537,
        'name': 'Stanford Health Care-Stanford Hospital',
        'city': 'Stanford',
        'state': 'CA',
        'latitude': 37.4354,
        'longitude': -122.1777,
        'zip': '94305'
    }
]




# Create a pandas dataframe from the hospital list
df = pd.DataFrame(hospital_list)

# Define the Pydeck layer
layer = pdk.Layer(
    'ScatterplotLayer',
    data=df,
    get_position='[longitude, latitude]',
    get_radius='bed_count/10',
    get_fill_color='[bed_count, 0, 255-bed_count]',
    get_line_color=[255, 255, 255],
    pickable=True
)

# Define the tooltip
tooltip = {
    'html': '<b>{name}</b><br/>{bed_count} beds<br/>{city}, {state} {zip}',
    'style': {
        'backgroundColor': 'white',
        'color': 'black'
    }
}

# Define the Pydeck map
deck = pdk.Deck(
    map_style='mapbox://styles/mapbox/light-v9',
    initial_view_state=pdk.ViewState(
        latitude=37.0902,
        longitude=-95.7129,
        zoom=3,
        pitch=0
    ),
    layers=[layer],
    tooltip=tooltip
)

# Render the map using st.pydeck_chart
st.pydeck_chart(deck)