import streamlit as st st.markdown(""" 👋 Welcome to my guide on creating a streamlit application for tracking health care problems and conditions! 👨‍⚕️👩‍⚕️ 📜 Here's a step by step outline to get you started: Step 1: Install Streamlit 📥 First things first, let's make sure we have Streamlit installed! Here's how: add a requirements.txt file with each library you will need including: streamlit pandas geopy folium Step 2: Create a new file 🆕 Now that Streamlit is installed, let's create a new Python file for our application. Here's how: Create a new app.py file. Step 3: Import the necessary libraries 📚 The requirements.txt will be executed with pip install -r requirements.txt This will import the following libraries: streamlit (for building the app) pandas (for working with data) geopy (for geocoding and distance calculations) folium (for creating maps) Step 4: Create the user interface 🖥️ Now let's create the user interface for our app! Here's how: Use the streamlit library to create a title for the app Create an input field for the user to enter their location Create checkboxes for the health care problems and conditions the user is interested in Use the streamlit library to create a button to submit the user's input Step 5: Retrieve and filter data 📊 Now that we have the user's input, let's retrieve and filter the data we need. Here's how: Use the pandas library to read in a dataset of health care providers and facilities in the area Use the geopy library to geocode the user's location Calculate the distance between the user's location and each provider/facility in the dataset Filter the dataset based on the user's selected health care problems/conditions Step 6: Display the results 🌟 Finally, let's display the results to the user! Here's how: Use the folium library to create a map with markers for each provider/facility in the filtered dataset Display the map to the user Use the streamlit library to display a table with information about each provider/facility in the filtered dataset 🎉 And that's it! You now have a streamlit application for tracking health care problems and conditions and identifying providers and facilities in the user's area. Good luck building your app! 🚀 """) import streamlit as st import pandas as pd from geopy.geocoders import Nominatim import folium # Set page title st.set_page_config(page_title="Healthcare Providers Map") # Define function to get geolocation data from user's input def get_location(address): geolocator = Nominatim(user_agent="my_app") location = geolocator.geocode(address) return (location.latitude, location.longitude) # Define function to filter providers by selected health conditions def filter_providers(df, conditions): return df[df['Conditions'].apply(lambda x: any(item for item in conditions if item in x))] # Load data #df = pd.read_csv('healthcare_providers.csv') df = pd.read_csv('minnesota_providers.csv') # Create UI elements st.title("Healthcare Providers Map") location_input = st.text_input("Enter your address to find healthcare providers in your area:") conditions_checkboxes = st.sidebar.multiselect("Select the health conditions you are interested in:", ['Asthma', 'Cancer', 'Diabetes', 'Heart disease', 'High blood pressure']) if st.button("Find Providers"): # Get user's location user_location = get_location(location_input) # Filter providers based on selected conditions filtered_providers = filter_providers(df, conditions_checkboxes) # Create map with markers for each provider m = folium.Map(location=user_location, zoom_start=12) for index, row in filtered_providers.iterrows(): folium.Marker([row['Latitude'], row['Longitude']], popup=row['Name']).add_to(m) # Display map to user folium_static(m) import pandas as pd # Define column names for the providers columns = ['Name', 'Address', 'City', 'State', 'Zipcode', 'Phone', 'Website'] # Define the list of providers as a list of lists providers = [ ['Minnesota Community Care', '570 University Avenue', 'Saint Paul', 'MN', '55103', '(651) 602-7500', 'https://mncc.org/'], ['Hennepin Healthcare', '701 Park Avenue', 'Minneapolis', 'MN', '55415', '(612) 873-3000', 'https://www.hennepinhealthcare.org/'], ['Allina Health', '800 East 28th Street', 'Minneapolis', 'MN', '55407', '(612) 863-4000', 'https://www.allinahealth.org/'], ['Fairview Health Services', '2450 Riverside Avenue', 'Minneapolis', 'MN', '55454', '(612) 672-7000', 'https://www.fairview.org/'], ['HealthPartners', '8170 33rd Avenue South', 'Bloomington', 'MN', '55425', '(952) 883-6000', 'https://www.healthpartners.com/'], ['Mayo Clinic Health System', '1216 Second Street Southwest', 'Rochester', 'MN', '55902', '(507) 266-7890', 'https://www.mayoclinic.org/'], ] # Create a DataFrame from the providers list df = pd.DataFrame(providers, columns=columns) # Save the DataFrame as a CSV file df.to_csv('minnesota_providers.csv', index=False)