Spaces:
Runtime error
Runtime error
Upload app.py
Browse files
app.py
ADDED
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
import graphviz as gv
|
3 |
+
from graphviz import Graph
|
4 |
+
import folium
|
5 |
+
from streamlit_folium import folium_static
|
6 |
+
|
7 |
+
# Define the cluster relations graph using gvmap
|
8 |
+
g = Graph(format='svg')
|
9 |
+
g.graph_attr['bgcolor'] = '#FFFFFF'
|
10 |
+
g.graph_attr['outputorder'] = 'edgesfirst'
|
11 |
+
g.graph_attr['size'] = '10,10'
|
12 |
+
g.node_attr['style'] = 'filled'
|
13 |
+
g.node_attr['shape'] = 'box'
|
14 |
+
g.node_attr['fillcolor'] = '#FFDAB9'
|
15 |
+
|
16 |
+
with g.subgraph(name='cluster_NJ') as c:
|
17 |
+
c.graph_attr['bgcolor'] = '#ADD8E6'
|
18 |
+
c.node_attr['color'] = '#000000'
|
19 |
+
c.node_attr['fontcolor'] = '#000000'
|
20 |
+
c.attr(label='New Jersey', fontsize='24')
|
21 |
+
c.node('Hackensack Meridian Health', URL='https://www.hackensackmeridianhealth.org/', target='_blank', tooltip='Hackensack Meridian Health: Hackensack University Medical Center')
|
22 |
+
c.node('RWJBarnabas Health', URL='https://www.rwjbh.org/', target='_blank', tooltip='RWJBarnabas Health: Robert Wood Johnson University Hospital')
|
23 |
+
c.node('Atlantic Health System', URL='https://www.atlantichealth.org/', target='_blank', tooltip='Atlantic Health System: Morristown Medical Center')
|
24 |
+
c.node('Virtua Health', URL='https://www.virtua.org/', target='_blank', tooltip='Virtua Health: Virtua Memorial Hospital')
|
25 |
+
c.node('Inspira Health', URL='https://www.inspirahealthnetwork.org/', target='_blank', tooltip='Inspira Health: Inspira Medical Center Vineland')
|
26 |
+
c.node('Cooper University Health Care', URL='https://www.cooperhealth.org/', target='_blank', tooltip='Cooper University Health Care: Cooper University Hospital')
|
27 |
+
c.node('University Hospital', URL='https://www.uhnj.org/', target='_blank', tooltip='University Hospital: University Hospital')
|
28 |
+
c.node('Robert Wood Johnson University Hospital Hamilton', URL='https://www.rwjbh.org/robert-wood-johnson-university-hospital-hamilton/', target='_blank', tooltip='Robert Wood Johnson University Hospital Hamilton: Robert Wood Johnson University Hospital Hamilton')
|
29 |
+
c.node('Trinitas Regional Medical Center', URL='https://www.trinitasrmc.org/', target='_blank', tooltip='Trinitas Regional Medical Center: Trinitas Regional Medical Center')
|
30 |
+
c.node('Capital Health Regional Medical Center', URL='https://www.capitalhealth.org/', target='_blank', tooltip='Capital Health Regional Medical Center: Capital Health Regional Medical Center')
|
31 |
+
|
32 |
+
# Render the graph using streamlit
|
33 |
+
st.graphviz_chart(g)
|
34 |
+
|
35 |
+
# Define hospitals data
|
36 |
+
hospitals = [('Hackensack Meridian Health', 'Hackensack University Medical Center', 40.899886, -74.039179),
|
37 |
+
('RWJBarnabas Health', 'Robert Wood Johnson University Hospital', 40.491301, -74.450611),
|
38 |
+
('Atlantic Health System', 'Morristown Medical Center', 40.787231, -74.473851),
|
39 |
+
('Virtua Health', 'Virtua Memorial Hospital', 39.931229, -75.025831),
|
40 |
+
('Inspira Health', 'Inspira Medical Center Vineland', 39.460225, -75.035542),
|
41 |
+
('Cooper University Health Care', 'Cooper University Hospital', 39.942743, -75.119090),
|
42 |
+
('University Hospital', 'University Hospital', 40.742310, -74.177609),
|
43 |
+
('Robert Wood Johnson University Hospital Hamilton', 'Robert Wood Johnson University Hospital Hamilton', 40.214008, -74.679619),
|
44 |
+
('Trinitas Regional Medical Center', 'Trinitas Regional Medical Center', 40.661474, -74.215013),
|
45 |
+
('Capital Health Regional Medical Center', 'Capital Health Regional Medical Center', 40.266778, -74.796452)]
|
46 |
+
|
47 |
+
#Create a map centered on New Jersey
|
48 |
+
m = folium.Map(location=[40.0583, -74.4057], zoom_start=8)
|
49 |
+
|
50 |
+
#Add markers for each hospital
|
51 |
+
for hospital in hospitals:
|
52 |
+
folium.Marker(
|
53 |
+
location=[hospital[2], hospital[3]],
|
54 |
+
popup=f'{hospital[1]}<br>{hospital[2]},{hospital[3]}'
|
55 |
+
).add_to(m)
|
56 |
+
|
57 |
+
#Display the map in Streamlit
|
58 |
+
folium_static(m)
|