awacke1 commited on
Commit
089705c
Β·
1 Parent(s): e68ca63

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +33 -32
app.py CHANGED
@@ -3,48 +3,48 @@ import folium
3
  from streamlit_folium import folium_static
4
  from folium.plugins import MarkerCluster
5
 
6
- # Define California medical centers data
7
- california_med_centers = [
8
- ('UCSF Medical Center', 37.7631, -122.4576, 'General medical and surgical', 'San Francisco'),
9
- ('Cedars-Sinai Medical Center', 34.0762, -118.3790, 'Heart specialty', 'Los Angeles'),
10
- ('Stanford Health Care', 37.4331, -122.1750, 'Teaching hospital', 'Stanford'),
11
- ('UCLA Medical Center', 34.0659, -118.4466, 'Research and teaching', 'Los Angeles'),
12
- ('Scripps La Jolla Hospitals', 32.8851, -117.2255, 'Multiple specialties', 'La Jolla'),
13
- ('Sharp Memorial Hospital', 32.7992, -117.1542, 'Trauma center', 'San Diego'),
14
- ('Huntington Hospital', 34.1330, -118.1475, 'Non-profit hospital', 'Pasadena'),
15
- ('Hoag Memorial Hospital', 33.6045, -117.8664, 'Community hospital', 'Newport Beach'),
16
- ('UCSD Medical Center', 32.7554, -117.1682, 'Academic health center', 'San Diego'),
17
- ('UC Davis Medical Center', 38.5539, -121.4554, 'Public academic health', 'Sacramento'),
18
- ('John Muir Medical Center', 37.9192, -122.0426, 'Heart care', 'Walnut Creek'),
19
- ('Santa Clara Valley Medical Center', 37.3121, -121.9769, 'County hospital', 'San Jose'),
20
- ('Kaiser Permanente San Francisco', 37.7741, -122.4179, 'Health maintenance organization', 'San Francisco'),
21
- ('City of Hope', 34.1285, -117.9665, 'Cancer center', 'Duarte'),
22
- ('UCI Medical Center', 33.7886, -117.8572, 'University hospital', 'Orange'),
23
- ('Good Samaritan Hospital', 34.0506, -118.2831, 'Private hospital', 'Los Angeles'),
24
- ('Los Angeles County General', 34.0581, -118.2917, 'Public hospital', 'Los Angeles'),
25
- ('California Pacific Medical Center', 37.7864, -122.4357, 'Private non-profit', 'San Francisco'),
26
- ('Sutter Roseville Medical Center', 38.7521, -121.2760, 'General medical and surgical', 'Roseville'),
27
- ('St. Joseph Hospital', 33.7821, -117.9188, 'Faith-based care', 'Orange')
28
  ]
29
 
30
- # Create a map centered on California
31
- m = folium.Map(location=[36.7783, -119.4179], zoom_start=6)
32
 
33
  # Add markers for each medical center and add them to a MarkerCluster
34
  marker_cluster = MarkerCluster().add_to(m)
35
- for center in california_med_centers:
36
  folium.Marker(
37
  location=[center[1], center[2]],
38
  popup=f'<b>{center[0]}</b><br>Description: {center[3]}<br>City: {center[4]}',
39
- icon=folium.Icon(color='red')
40
  ).add_to(marker_cluster)
41
 
42
  # Display the map
43
  folium_static(m)
44
 
45
  st.markdown("""
46
- # πŸ₯ California Medical Centers πŸŒ†
47
- The map above shows the location of various medical centers and hospitals in California. Hover over the markers to learn more about each location.
48
  """)
49
 
50
  # Function to update the map when a button is clicked
@@ -53,10 +53,11 @@ def update_map(center_data):
53
  m.zoom_start = 13
54
  folium_static(m)
55
 
56
- for i in range(0, len(california_med_centers), 4):
 
57
  cols = st.columns(4)
58
  for j in range(4):
59
- if i + j < len(california_med_centers):
60
  with cols[j]:
61
- if st.button(california_med_centers[i + j][0]):
62
- update_map(california_med_centers[i + j])
 
3
  from streamlit_folium import folium_static
4
  from folium.plugins import MarkerCluster
5
 
6
+ # Define Minnesota medical centers data
7
+ minnesota_med_centers = [
8
+ ('Mayo Clinic', 44.0224, -92.4658, 'General medical and surgical', 'Rochester'),
9
+ ('University of Minnesota Medical Center', 44.9721, -93.2595, 'Teaching hospital', 'Minneapolis'),
10
+ ('Abbott Northwestern Hospital', 44.9526, -93.2622, 'Heart specialty', 'Minneapolis'),
11
+ ('Regions Hospital', 44.9558, -93.0942, 'Trauma center', 'St. Paul'),
12
+ ('St. Cloud Hospital', 45.5671, -94.1989, 'Multiple specialties', 'St. Cloud'),
13
+ ('Park Nicollet Methodist Hospital', 44.9304, -93.3640, 'General medical and surgical', 'St. Louis Park'),
14
+ ('Fairview Ridges Hospital', 44.7391, -93.2777, 'Community hospital', 'Burnsville'),
15
+ ('Mercy Hospital', 45.1761, -93.3099, 'Acute care', 'Coon Rapids'),
16
+ ('North Memorial Health Hospital', 45.0131, -93.3246, 'General medical and surgical', 'Robbinsdale'),
17
+ ('Essentia Health-Duluth', 46.7860, -92.1011, 'Community hospital', 'Duluth'),
18
+ ('M Health Fairview Southdale Hospital', 44.8806, -93.3241, 'Community hospital', 'Edina'),
19
+ ('Woodwinds Health Campus', 44.9272, -92.9689, 'Community hospital', 'Woodbury'),
20
+ ('United Hospital', 44.9460, -93.1052, 'Acute care', 'St. Paul'),
21
+ ('Buffalo Hospital', 45.1831, -93.8772, 'Community hospital', 'Buffalo'),
22
+ ('Maple Grove Hospital', 45.1206, -93.4790, 'Community hospital', 'Maple Grove'),
23
+ ('Olmsted Medical Center', 44.0234, -92.4610, 'General medical and surgical', 'Rochester'),
24
+ ('Hennepin Healthcare', 44.9738, -93.2605, 'Teaching hospital', 'Minneapolis'),
25
+ ('St. Francis Regional Medical Center', 44.7658, -93.5143, 'Community hospital', 'Shakopee'),
26
+ ('Lakeview Hospital', 45.0422, -92.8137, 'Community hospital', 'Stillwater'),
27
+ ('St. Luke\'s Hospital', 46.7831, -92.1043, 'Community hospital', 'Duluth')
28
  ]
29
 
30
+ # Create a map centered on Minnesota
31
+ m = folium.Map(location=[45.6945, -93.9002], zoom_start=6)
32
 
33
  # Add markers for each medical center and add them to a MarkerCluster
34
  marker_cluster = MarkerCluster().add_to(m)
35
+ for center in minnesota_med_centers:
36
  folium.Marker(
37
  location=[center[1], center[2]],
38
  popup=f'<b>{center[0]}</b><br>Description: {center[3]}<br>City: {center[4]}',
39
+ icon=folium.Icon(color='blue')
40
  ).add_to(marker_cluster)
41
 
42
  # Display the map
43
  folium_static(m)
44
 
45
  st.markdown("""
46
+ # πŸ₯ Minnesota Medical Centers 🌳
47
+ The map above shows the location of various medical centers and hospitals in Minnesota. Hover over the markers to learn more about each location.
48
  """)
49
 
50
  # Function to update the map when a button is clicked
 
53
  m.zoom_start = 13
54
  folium_static(m)
55
 
56
+ # Display buttons to focus on specific medical centers
57
+ for i in range(0, len(minnesota_med_centers), 4):
58
  cols = st.columns(4)
59
  for j in range(4):
60
+ if i + j < len(minnesota_med_centers):
61
  with cols[j]:
62
+ if st.button(minnesota_med_centers[i + j][0]):
63
+ update_map(minnesota_med_centers[i + j])