awacke1 commited on
Commit
6deed07
·
1 Parent(s): ee252e6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -36
app.py CHANGED
@@ -31,46 +31,33 @@ with g.subgraph(name='cluster_MN') as c:
31
  st.graphviz_chart(g)
32
 
33
 
34
- def render_hospital_graph(hospital):
35
- g = gv.Graph(format='svg')
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', 'Beds: 627', 'Specialties: Cardiovascular care, neurosciences, cancer care'),
60
- ('Fairview Health Services', 'University of Minnesota Medical Center', 'Beds: 914', 'Specialties: Cancer care, transplant services, orthopedics'),
61
- ('HealthPartners', 'Regions Hospital', 'Beds: 454', 'Specialties: Level I Trauma Center, heart care, cancer care'),
62
- ('Mayo Clinic', 'Saint Marys Hospital', 'Beds: 1,265', 'Specialties: Cardiology, neurology, gastroenterology'),
63
- ('CentraCare', 'St. Cloud Hospital', 'Beds: 489', 'Specialties: Cancer care, heart care, neuroscience'),
64
- ('Essentia Health', 'St. Mary’s Medical Center', 'Beds: 330', 'Specialties: Cancer care, heart care, orthopedics'),
65
- ('Hennepin Healthcare', 'HCMC', 'Beds: 497', 'Specialties: Level I Trauma Center, burn center, cancer care'),
66
- ("Children's Minnesota", "Children's Hospitals and Clinics of Minnesota", 'Beds: 381', 'Specialties: Pediatrics, heart care, neonatology'),
67
- ('Sanford Health', 'Sanford Bemidji Medical Center', 'Beds: 161', 'Specialties: Cancer care, heart care, orthopedics'),
68
- ("St. Luke's Hospital", "St. Luke's Hospital", 'Beds: 267', 'Specialties: Cancer care, heart care, orthopedics')]
69
 
70
- # Render a separate graph for each hospital
 
 
 
71
  for hospital in hospitals:
72
- svg_output = render_hospital_graph(hospital)
73
- st.write(svg_output, unsafe_allow_html=True)
 
 
 
 
 
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