Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -3,48 +3,48 @@ import folium
|
|
3 |
from streamlit_folium import folium_static
|
4 |
from folium.plugins import MarkerCluster
|
5 |
|
6 |
-
# Define
|
7 |
-
|
8 |
-
('
|
9 |
-
('
|
10 |
-
('
|
11 |
-
('
|
12 |
-
('
|
13 |
-
('
|
14 |
-
('
|
15 |
-
('
|
16 |
-
('
|
17 |
-
('
|
18 |
-
('
|
19 |
-
('
|
20 |
-
('
|
21 |
-
('
|
22 |
-
('
|
23 |
-
('
|
24 |
-
('
|
25 |
-
('
|
26 |
-
('
|
27 |
-
('St.
|
28 |
]
|
29 |
|
30 |
-
# Create a map centered on
|
31 |
-
m = folium.Map(location=[
|
32 |
|
33 |
# Add markers for each medical center and add them to a MarkerCluster
|
34 |
marker_cluster = MarkerCluster().add_to(m)
|
35 |
-
for center in
|
36 |
folium.Marker(
|
37 |
location=[center[1], center[2]],
|
38 |
popup=f'<b>{center[0]}</b><br>Description: {center[3]}<br>City: {center[4]}',
|
39 |
-
icon=folium.Icon(color='
|
40 |
).add_to(marker_cluster)
|
41 |
|
42 |
# Display the map
|
43 |
folium_static(m)
|
44 |
|
45 |
st.markdown("""
|
46 |
-
# π₯
|
47 |
-
The map above shows the location of various medical centers and hospitals in
|
48 |
""")
|
49 |
|
50 |
# Function to update the map when a button is clicked
|
@@ -53,10 +53,11 @@ def update_map(center_data):
|
|
53 |
m.zoom_start = 13
|
54 |
folium_static(m)
|
55 |
|
56 |
-
|
|
|
57 |
cols = st.columns(4)
|
58 |
for j in range(4):
|
59 |
-
if i + j < len(
|
60 |
with cols[j]:
|
61 |
-
if st.button(
|
62 |
-
update_map(
|
|
|
3 |
from streamlit_folium import folium_static
|
4 |
from folium.plugins import MarkerCluster
|
5 |
|
6 |
+
# Define Minnesota medical centers data
|
7 |
+
minnesota_med_centers = [
|
8 |
+
('Mayo Clinic', 44.0224, -92.4658, 'General medical and surgical', 'Rochester'),
|
9 |
+
('University of Minnesota Medical Center', 44.9721, -93.2595, 'Teaching hospital', 'Minneapolis'),
|
10 |
+
('Abbott Northwestern Hospital', 44.9526, -93.2622, 'Heart specialty', 'Minneapolis'),
|
11 |
+
('Regions Hospital', 44.9558, -93.0942, 'Trauma center', 'St. Paul'),
|
12 |
+
('St. Cloud Hospital', 45.5671, -94.1989, 'Multiple specialties', 'St. Cloud'),
|
13 |
+
('Park Nicollet Methodist Hospital', 44.9304, -93.3640, 'General medical and surgical', 'St. Louis Park'),
|
14 |
+
('Fairview Ridges Hospital', 44.7391, -93.2777, 'Community hospital', 'Burnsville'),
|
15 |
+
('Mercy Hospital', 45.1761, -93.3099, 'Acute care', 'Coon Rapids'),
|
16 |
+
('North Memorial Health Hospital', 45.0131, -93.3246, 'General medical and surgical', 'Robbinsdale'),
|
17 |
+
('Essentia Health-Duluth', 46.7860, -92.1011, 'Community hospital', 'Duluth'),
|
18 |
+
('M Health Fairview Southdale Hospital', 44.8806, -93.3241, 'Community hospital', 'Edina'),
|
19 |
+
('Woodwinds Health Campus', 44.9272, -92.9689, 'Community hospital', 'Woodbury'),
|
20 |
+
('United Hospital', 44.9460, -93.1052, 'Acute care', 'St. Paul'),
|
21 |
+
('Buffalo Hospital', 45.1831, -93.8772, 'Community hospital', 'Buffalo'),
|
22 |
+
('Maple Grove Hospital', 45.1206, -93.4790, 'Community hospital', 'Maple Grove'),
|
23 |
+
('Olmsted Medical Center', 44.0234, -92.4610, 'General medical and surgical', 'Rochester'),
|
24 |
+
('Hennepin Healthcare', 44.9738, -93.2605, 'Teaching hospital', 'Minneapolis'),
|
25 |
+
('St. Francis Regional Medical Center', 44.7658, -93.5143, 'Community hospital', 'Shakopee'),
|
26 |
+
('Lakeview Hospital', 45.0422, -92.8137, 'Community hospital', 'Stillwater'),
|
27 |
+
('St. Luke\'s Hospital', 46.7831, -92.1043, 'Community hospital', 'Duluth')
|
28 |
]
|
29 |
|
30 |
+
# Create a map centered on Minnesota
|
31 |
+
m = folium.Map(location=[45.6945, -93.9002], zoom_start=6)
|
32 |
|
33 |
# Add markers for each medical center and add them to a MarkerCluster
|
34 |
marker_cluster = MarkerCluster().add_to(m)
|
35 |
+
for center in minnesota_med_centers:
|
36 |
folium.Marker(
|
37 |
location=[center[1], center[2]],
|
38 |
popup=f'<b>{center[0]}</b><br>Description: {center[3]}<br>City: {center[4]}',
|
39 |
+
icon=folium.Icon(color='blue')
|
40 |
).add_to(marker_cluster)
|
41 |
|
42 |
# Display the map
|
43 |
folium_static(m)
|
44 |
|
45 |
st.markdown("""
|
46 |
+
# π₯ Minnesota Medical Centers π³
|
47 |
+
The map above shows the location of various medical centers and hospitals in Minnesota. Hover over the markers to learn more about each location.
|
48 |
""")
|
49 |
|
50 |
# Function to update the map when a button is clicked
|
|
|
53 |
m.zoom_start = 13
|
54 |
folium_static(m)
|
55 |
|
56 |
+
# Display buttons to focus on specific medical centers
|
57 |
+
for i in range(0, len(minnesota_med_centers), 4):
|
58 |
cols = st.columns(4)
|
59 |
for j in range(4):
|
60 |
+
if i + j < len(minnesota_med_centers):
|
61 |
with cols[j]:
|
62 |
+
if st.button(minnesota_med_centers[i + j][0]):
|
63 |
+
update_map(minnesota_med_centers[i + j])
|