awacke1 commited on
Commit
6f9064a
·
1 Parent(s): 339611a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +35 -36
app.py CHANGED
@@ -32,44 +32,43 @@ st.graphviz_chart(g)
32
 
33
 
34
 
 
 
 
 
 
 
 
 
35
 
36
-
37
- # Define the cluster relations graph using gvmap
38
- g = gv.Graph(format='svg')
39
- g.graph_attr['bgcolor'] = '#FFFFFF'
40
- g.graph_attr['outputorder'] = 'edgesfirst'
41
- g.graph_attr['size'] = '10,10'
42
- g.node_attr['style'] = 'filled'
43
- g.node_attr['shape'] = 'box'
44
- g.node_attr['fillcolor'] = '#FFDAB9'
45
-
46
- with g.subgraph(name='cluster_MN') as c:
47
- c.graph_attr['bgcolor'] = '#ADD8E6'
48
- c.node_attr['color'] = '#000000'
49
- c.node_attr['fontcolor'] = '#000000'
50
- c.attr(label='Minnesota', fontsize='24')
51
- for hospital in [('Allina Health', 'Abbott Northwestern Hospital', 'Beds: 627', 'Specialties: Cardiovascular care, neurosciences, cancer care'),
52
- ('Fairview Health Services', 'University of Minnesota Medical Center', 'Beds: 914', 'Specialties: Cancer care, transplant services, orthopedics'),
53
- ('HealthPartners', 'Regions Hospital', 'Beds: 454', 'Specialties: Level I Trauma Center, heart care, cancer care'),
54
- ('Mayo Clinic', 'Saint Marys Hospital', 'Beds: 1,265', 'Specialties: Cardiology, neurology, gastroenterology'),
55
- ('CentraCare', 'St. Cloud Hospital', 'Beds: 489', 'Specialties: Cancer care, heart care, neuroscience'),
56
- ('Essentia Health', 'St. Mary’s Medical Center', 'Beds: 330', 'Specialties: Cancer care, heart care, orthopedics'),
57
- ('Hennepin Healthcare', 'HCMC', 'Beds: 497', 'Specialties: Level I Trauma Center, burn center, cancer care'),
58
- ("Children's Minnesota", "Children's Hospitals and Clinics of Minnesota", 'Beds: 381', 'Specialties: Pediatrics, heart care, neonatology'),
59
- ('Sanford Health', 'Sanford Bemidji Medical Center', 'Beds: 161', 'Specialties: Cancer care, heart care, orthopedics'),
60
- ("St. Luke's Hospital", "St. Luke's Hospital", 'Beds: 267', 'Specialties: Cancer care, heart care, orthopedics')]:
61
- hospital_name, hospital_desc, bed_count, specialties = hospital
62
- with c.subgraph(name=f'cluster_{hospital_name}') as s:
63
- s.attr(label=hospital_name, fontsize='16')
64
- s.node(hospital_desc, fontsize='12')
65
- with s.subgraph(name=f'cluster_{hospital_desc}') as s1:
66
  s1.attr(fontsize='10')
67
- s1.node(bed_count)
68
- s1.node(specialties)
69
 
70
- # Use neato to rearrange the clusters
71
- g.layout(prog='neato')
72
 
73
- # Render the graph using streamlit
74
- st.graphviz_chart(g)
 
 
 
 
 
 
 
 
 
 
 
 
 
75
 
 
32
 
33
 
34
 
35
+ def render_hospital_graph(hospital):
36
+ g = gv.Graph(format='svg')
37
+ g.graph_attr['bgcolor'] = '#FFFFFF'
38
+ g.graph_attr['outputorder'] = 'edgesfirst'
39
+ g.graph_attr['size'] = '10,10'
40
+ g.node_attr['style'] = 'filled'
41
+ g.node_attr['shape'] = 'box'
42
+ g.node_attr['fillcolor'] = '#FFDAB9'
43
 
44
+ with g.subgraph(name=f'cluster_{hospital[0]}') as c:
45
+ c.graph_attr['bgcolor'] = '#ADD8E6'
46
+ c.node_attr['color'] = '#000000'
47
+ c.node_attr['fontcolor'] = '#000000'
48
+ c.attr(label=hospital[0], fontsize='24')
49
+ with c.subgraph(name=f'cluster_{hospital[1]}') as s:
50
+ s.attr(label=hospital[1], fontsize='16')
51
+ s.node(hospital[2], fontsize='12')
52
+ with s.subgraph(name=f'cluster_{hospital[2]}') as s1:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
53
  s1.attr(fontsize='10')
54
+ s1.node(hospital[3])
 
55
 
56
+ g.layout(prog='neato')
57
+ st.graphviz_chart(g)
58
 
59
+ # Define hospitals data
60
+ hospitals = [('Allina Health', 'Abbott Northwestern Hospital', 'Beds: 627', 'Specialties: Cardiovascular care, neurosciences, cancer care'),
61
+ ('Fairview Health Services', 'University of Minnesota Medical Center', 'Beds: 914', 'Specialties: Cancer care, transplant services, orthopedics'),
62
+ ('HealthPartners', 'Regions Hospital', 'Beds: 454', 'Specialties: Level I Trauma Center, heart care, cancer care'),
63
+ ('Mayo Clinic', 'Saint Marys Hospital', 'Beds: 1,265', 'Specialties: Cardiology, neurology, gastroenterology'),
64
+ ('CentraCare', 'St. Cloud Hospital', 'Beds: 489', 'Specialties: Cancer care, heart care, neuroscience'),
65
+ ('Essentia Health', 'St. Mary’s Medical Center', 'Beds: 330', 'Specialties: Cancer care, heart care, orthopedics'),
66
+ ('Hennepin Healthcare', 'HCMC', 'Beds: 497', 'Specialties: Level I Trauma Center, burn center, cancer care'),
67
+ ("Children's Minnesota", "Children's Hospitals and Clinics of Minnesota", 'Beds: 381', 'Specialties: Pediatrics, heart care, neonatology'),
68
+ ('Sanford Health', 'Sanford Bemidji Medical Center', 'Beds: 161', 'Specialties: Cancer care, heart care, orthopedics'),
69
+ ("St. Luke's Hospital", "St. Luke's Hospital", 'Beds: 267', 'Specialties: Cancer care, heart care, orthopedics')]
70
+
71
+ # Render a separate graph for each hospital
72
+ for hospital in hospitals:
73
+ render_hospital_graph(hospital)
74