Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -35,7 +35,6 @@ def add_medical_center_paths(m, source, med_centers):
|
|
35 |
folium.Marker([lat, lon], popup=name).add_to(m)
|
36 |
distance_info = gmaps.distance_matrix(source, (lat, lon), mode='driving')
|
37 |
distance = distance_info['rows'][0]['elements'][0]['distance']['text']
|
38 |
-
folium.PolyLine(coords, color='red').add_to(m)
|
39 |
folium.map.Marker(
|
40 |
[coords[-1][0], coords[-1][1]],
|
41 |
icon=folium.DivIcon(
|
@@ -46,11 +45,11 @@ def add_medical_center_paths(m, source, med_centers):
|
|
46 |
).add_to(m)
|
47 |
|
48 |
# Streamlit UI
|
49 |
-
st.title('Google Maps and
|
50 |
st.sidebar.header('Directions')
|
51 |
|
52 |
-
source_location = st.sidebar.text_input("Source Location", "
|
53 |
-
destination_location = st.sidebar.text_input("Destination Location", "
|
54 |
|
55 |
if st.sidebar.button('Get Directions'):
|
56 |
steps, coords = get_directions_and_coords(source_location, destination_location)
|
@@ -64,35 +63,23 @@ if st.sidebar.button('Get Directions'):
|
|
64 |
else:
|
65 |
st.write("No available routes.")
|
66 |
|
67 |
-
#
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
('
|
75 |
-
('
|
76 |
-
('
|
77 |
-
('
|
78 |
-
('
|
79 |
-
('Park Nicollet Methodist Hospital', 44.9304, -93.3640, 'General medical and surgical', 'St. Louis Park'),
|
80 |
-
('Fairview Ridges Hospital', 44.7391, -93.2777, 'Community hospital', 'Burnsville'),
|
81 |
-
('Mercy Hospital', 45.1761, -93.3099, 'Acute care', 'Coon Rapids'),
|
82 |
-
('North Memorial Health Hospital', 45.0131, -93.3246, 'General medical and surgical', 'Robbinsdale'),
|
83 |
-
('Essentia Health-Duluth', 46.7860, -92.1011, 'Community hospital', 'Duluth'),
|
84 |
-
('M Health Fairview Southdale Hospital', 44.8806, -93.3241, 'Community hospital', 'Edina'),
|
85 |
-
('Woodwinds Health Campus', 44.9272, -92.9689, 'Community hospital', 'Woodbury'),
|
86 |
-
('United Hospital', 44.9460, -93.1052, 'Acute care', 'St. Paul'),
|
87 |
-
('Buffalo Hospital', 45.1831, -93.8772, 'Community hospital', 'Buffalo'),
|
88 |
-
('Maple Grove Hospital', 45.1206, -93.4790, 'Community hospital', 'Maple Grove'),
|
89 |
-
('Olmsted Medical Center', 44.0234, -92.4610, 'General medical and surgical', 'Rochester'),
|
90 |
-
('Hennepin Healthcare', 44.9738, -93.2605, 'Teaching hospital', 'Minneapolis'),
|
91 |
-
('St. Francis Regional Medical Center', 44.7658, -93.5143, 'Community hospital', 'Shakopee'),
|
92 |
-
('Lakeview Hospital', 45.0422, -92.8137, 'Community hospital', 'Stillwater'),
|
93 |
-
('St. Luke\'s Hospital', 46.7831, -92.1043, 'Community hospital', 'Duluth')
|
94 |
]
|
95 |
|
96 |
# Annotate distances and paths for each medical center
|
97 |
-
|
|
|
|
|
|
|
98 |
folium_static(m2)
|
|
|
35 |
folium.Marker([lat, lon], popup=name).add_to(m)
|
36 |
distance_info = gmaps.distance_matrix(source, (lat, lon), mode='driving')
|
37 |
distance = distance_info['rows'][0]['elements'][0]['distance']['text']
|
|
|
38 |
folium.map.Marker(
|
39 |
[coords[-1][0], coords[-1][1]],
|
40 |
icon=folium.DivIcon(
|
|
|
45 |
).add_to(m)
|
46 |
|
47 |
# Streamlit UI
|
48 |
+
st.title('Google Maps and California Medical Centers 🌴')
|
49 |
st.sidebar.header('Directions')
|
50 |
|
51 |
+
source_location = st.sidebar.text_input("Source Location", "Venice Beach, CA")
|
52 |
+
destination_location = st.sidebar.text_input("Destination Location", "Santa Monica, CA")
|
53 |
|
54 |
if st.sidebar.button('Get Directions'):
|
55 |
steps, coords = get_directions_and_coords(source_location, destination_location)
|
|
|
63 |
else:
|
64 |
st.write("No available routes.")
|
65 |
|
66 |
+
# Top 10 medical centers in California
|
67 |
+
california_med_centers = [
|
68 |
+
('UCLA Medical Center', 34.0665, -118.4467, 'General medical and surgical', 'Los Angeles'),
|
69 |
+
('Cedars-Sinai Medical Center', 34.0762, -118.3801, 'Heart specialty', 'Los Angeles'),
|
70 |
+
('UCSF Medical Center', 37.7631, -122.4576, 'Teaching hospital', 'San Francisco'),
|
71 |
+
('Stanford Health Care-Stanford Hospital', 37.4331, -122.1754, 'Teaching hospital', 'Stanford'),
|
72 |
+
('Scripps La Jolla Hospitals', 32.8844, -117.2256, 'General medical and surgical', 'La Jolla'),
|
73 |
+
('Sharp Memorial Hospital', 32.8002, -117.1542, 'Community hospital', 'San Diego'),
|
74 |
+
('UCSD Medical Center-Hillcrest', 32.7550, -117.1711, 'Teaching hospital', 'San Diego'),
|
75 |
+
('Hoag Memorial Hospital Presbyterian', 33.6117, -117.8771, 'Community hospital', 'Newport Beach'),
|
76 |
+
('UCI Medical Center', 33.7886, -117.8934, 'Teaching hospital', 'Orange'),
|
77 |
+
('Long Beach Memorial Medical Center', 33.8034, -118.1689, 'Community hospital', 'Long Beach')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
78 |
]
|
79 |
|
80 |
# Annotate distances and paths for each medical center
|
81 |
+
st.markdown("## 🏥 California Medical Centers 🌴")
|
82 |
+
m2 = folium.Map(location=[34.0522, -118.2437], zoom_start=6)
|
83 |
+
marker_cluster = MarkerCluster().add_to(m2)
|
84 |
+
add_medical_center_paths(m2, source_location, california_med_centers)
|
85 |
folium_static(m2)
|