Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -31,46 +31,33 @@ with g.subgraph(name='cluster_MN') as c:
|
|
31 |
st.graphviz_chart(g)
|
32 |
|
33 |
|
34 |
-
|
35 |
-
|
36 |
-
g.graph_attr['bgcolor'] = '#FFFFFF'
|
37 |
-
g.graph_attr['outputorder'] = 'edgesfirst'
|
38 |
-
g.graph_attr['size'] = '10,10'
|
39 |
-
g.node_attr['style'] = 'filled'
|
40 |
-
g.node_attr['shape'] = 'box'
|
41 |
-
g.node_attr['fillcolor'] = '#FFDAB9'
|
42 |
-
|
43 |
-
with g.subgraph(name=f'cluster_{hospital[0]}') as c:
|
44 |
-
c.graph_attr['bgcolor'] = '#ADD8E6'
|
45 |
-
c.node_attr['color'] = '#000000'
|
46 |
-
c.node_attr['fontcolor'] = '#000000'
|
47 |
-
c.attr(label=hospital[0], fontsize='24')
|
48 |
-
with c.subgraph(name=f'cluster_{hospital[1]}') as s:
|
49 |
-
s.attr(label=hospital[1], fontsize='16')
|
50 |
-
s.node(hospital[2], fontsize='12')
|
51 |
-
with s.subgraph(name=f'cluster_{hospital[2]}') as s1:
|
52 |
-
s1.attr(fontsize='10')
|
53 |
-
s1.node(hospital[3])
|
54 |
-
|
55 |
-
svg_output = g.pipe(format='svg')
|
56 |
-
return svg_output
|
57 |
|
58 |
# Define hospitals data
|
59 |
-
hospitals = [('Allina Health', 'Abbott Northwestern Hospital',
|
60 |
-
('Fairview Health Services', 'University of Minnesota Medical Center',
|
61 |
-
('HealthPartners', 'Regions Hospital',
|
62 |
-
('Mayo Clinic', 'Saint Marys Hospital',
|
63 |
-
('CentraCare', 'St. Cloud Hospital',
|
64 |
-
('Essentia Health', 'St. Mary’s Medical Center',
|
65 |
-
('Hennepin Healthcare', 'HCMC',
|
66 |
-
("Children's Minnesota", "Children's Hospitals and Clinics of Minnesota",
|
67 |
-
('Sanford Health', 'Sanford Bemidji Medical Center',
|
68 |
-
("St. Luke's Hospital", "St. Luke's Hospital",
|
69 |
|
70 |
-
#
|
|
|
|
|
|
|
71 |
for hospital in hospitals:
|
72 |
-
|
73 |
-
|
|
|
|
|
|
|
|
|
|
|
74 |
|
75 |
|
76 |
|
|
|
31 |
st.graphviz_chart(g)
|
32 |
|
33 |
|
34 |
+
import folium
|
35 |
+
from streamlit_folium import folium_static
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
|
37 |
# Define hospitals data
|
38 |
+
hospitals = [('Allina Health', 'Abbott Northwestern Hospital', 44.957071, -93.262609),
|
39 |
+
('Fairview Health Services', 'University of Minnesota Medical Center', 44.973944, -93.230865),
|
40 |
+
('HealthPartners', 'Regions Hospital', 44.948451, -93.093207),
|
41 |
+
('Mayo Clinic', 'Saint Marys Hospital', 44.020716, -92.467034),
|
42 |
+
('CentraCare', 'St. Cloud Hospital', 45.570253, -94.168973),
|
43 |
+
('Essentia Health', 'St. Mary’s Medical Center', 46.802551, -92.099605),
|
44 |
+
('Hennepin Healthcare', 'HCMC', 44.973946, -93.261186),
|
45 |
+
("Children's Minnesota", "Children's Hospitals and Clinics of Minnesota", 44.946371, -93.233535),
|
46 |
+
('Sanford Health', 'Sanford Bemidji Medical Center', 47.496691, -94.864009),
|
47 |
+
("St. Luke's Hospital", "St. Luke's Hospital", 46.774196, -92.104049)]
|
48 |
|
49 |
+
# Create a map centered on Minnesota
|
50 |
+
m = folium.Map(location=[46.729553, -94.6859], zoom_start=7)
|
51 |
+
|
52 |
+
# Add markers for each hospital
|
53 |
for hospital in hospitals:
|
54 |
+
folium.Marker(
|
55 |
+
location=[hospital[2], hospital[3]],
|
56 |
+
popup=f'{hospital[1]}<br>{hospital[2]},{hospital[3]}'
|
57 |
+
).add_to(m)
|
58 |
+
|
59 |
+
# Display the map in Streamlit
|
60 |
+
folium_static(m)
|
61 |
|
62 |
|
63 |
|