awacke1 commited on
Commit
e68ca63
Β·
1 Parent(s): 14452ec

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +62 -0
app.py ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ 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
51
+ def update_map(center_data):
52
+ m.location = [center_data[1], center_data[2]]
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])