awacke1's picture
Update app.py
6313803 verified
import gradio as gr
import pandas as pd
import plotly.graph_objects as go
from datasets import load_dataset
dataset = load_dataset('text', data_files={'train': ['NPI_2023_01_17-05.10.57.PM.csv'], 'test': 'NPI_2023_01_17-05.10.57.PM.csv'})
#1.6GB NPI file with MH therapy taxonomy provider codes (NUCC based) with human friendly replacement labels (e.g. Counselor rather than code)
datasetNYC = load_dataset("gradio/NYC-Airbnb-Open-Data", split="train")
df = datasetNYC.to_pandas()
def MatchText(pddf, name):
pd.set_option("display.max_rows", None)
data = pddf
swith=data.loc[data['text'].str.contains(name, case=False, na=False)]
return swith
def getDatasetFind(findString):
#finder = dataset.filter(lambda example: example['text'].find(findString))
finder = dataset['train'].filter(lambda example: example['text'].find(findString))
finder = finder = finder.to_pandas()
g1=MatchText(finder, findString)
return g1
def filter_map(min_price, max_price, boroughs):
filtered_df = df[(df['neighbourhood_group'].isin(boroughs)) & (df['price'] > min_price) & (df['price'] < max_price)]
names = filtered_df["name"].tolist()
prices = filtered_df["price"].tolist()
text_list = [(names[i], prices[i]) for i in range(0, len(names))]
fig = go.Figure(go.Scattermapbox(
customdata=text_list,
lat=filtered_df['latitude'].tolist(),
lon=filtered_df['longitude'].tolist(),
mode='markers',
marker=go.scattermapbox.Marker(
size=6
),
hoverinfo="text",
hovertemplate='Name: %{customdata[0]}Price: $%{customdata[1]}'
))
fig.update_layout(
mapbox_style="open-street-map",
hovermode='closest',
mapbox=dict(
bearing=0,
center=go.layout.mapbox.Center(
lat=40.67,
lon=-73.90
),
pitch=0,
zoom=9
),
)
return fig
def centerMap(min_price, max_price, boroughs):
filtered_df = df[(df['neighbourhood_group'].isin(boroughs)) & (df['price'] > min_price) & (df['price'] < max_price)]
names = filtered_df["name"].tolist()
prices = filtered_df["price"].tolist()
text_list = [(names[i], prices[i]) for i in range(0, len(names))]
latitude = 44.9382
longitude = -93.6561
fig = go.Figure(go.Scattermapbox(
customdata=text_list,
lat=filtered_df['latitude'].tolist(),
lon=filtered_df['longitude'].tolist(), mode='markers',
marker=go.scattermapbox.Marker(
size=6
),
hoverinfo="text",
#hovertemplate='Lat: %{lat} Long:%{lng} City: %{cityNm}'
))
fig.update_layout(
mapbox_style="open-street-map",
hovermode='closest',
mapbox=dict(
bearing=0,
center=go.layout.mapbox.Center(
lat=latitude,
lon=longitude
),
pitch=0,
zoom=9
),
)
return fig
def SolutionIntent():
markdown="""
# Solution Intent
Intent of this space is to provide AI models around maps and **Earth** **Modeling** pursuits which solves for the following pains experienced by people traveling around an area.
**Long Term Plan** is to create an interactive 3D laden view in real time which can easily show walking and driving routes to points of interest.
# Problems solved include:
1. When visiting a new place the **Route** from start to finish includes some difficult challenges including knowing where optimal **Parking** resides..
2. Entrances for large building such as **Hospitals**, **Clinics**, **Urgent Care Facilities** pose the problem where to get from **Parking** to the office doors,
3. It is hard to predict which route to take where **Handicap** accessible routes lay.
4. For maximum enjoyment and intellectual stimulation, **Routes** which are ideal should include information on **Points of Interest** or **POI** reside.
5. For memory impaired individuals it sometimes is problematic to understand what the route to **Home** is.
6. Each person has particular places they enjoy or would like to visit. This personalized **Favorites** list would have order and correlation between any two places.
7. Knowing how to process **Automated** information gathering such as mapped **Latitude and Longitude** and distance calculations or regional routes with time expectations.
# Information Layers and Maps
Information layers such as rental prices of places to stay can be shown on a map which allow people looking for locality or commonality of walking distance or driving distance factors allows people plan and understand optimal alignment of wants, needs and offerings in a location.
The snapshot below shows the places available in **New York** specifically **Manhattan** and **Central Park** which contains a **Museum** route.
![image/png](https://cdn-uploads.huggingface.co/production/uploads/620630b603825909dcbeba35/9Dlpfg-TzDxliMFOmyaFB.png)
# Knowledge on High-Demand Properties and Areas or Points of Interest 🏒
In dynamic worlds of real estate and practice, staying ahead means making informed decisions.
This article offers insights for Knowledge Seekers and Entrepreneurs for locating properties in high-demand areas.
The knowledge provided by this app should highlight the best points of interest and publications regarding an area.
## Understanding the Landscape πŸŒ†
1. **High-Demand Areas** πŸ™οΈ:
- *Location is Key*: Invest in properties situated in neighborhoods with high demand for medical facilities and housing.
- *Data-Driven Decisions*: Utilize data analytics to identify areas with growing populations and increasing long term health needs.
- *Market Research*: Stay updated on real estate market trends and medical services demand in your personalized target locations.
2. **Points of Interest (POI)** πŸ“:
- *Cultural Hubs*: Properties near museums, theaters, and cultural landmarks often attract higher rental rates and patient traffic.
- *Proximity to Parks*: Green spaces enhance property value and offer patients a serene environment for recovery.
- *Accessibility**: Prioritize locations with easy access to public transport, major highways, and medical facilities.
3. **Publications and Resources** πŸ“š:
- *Real Estate Journals*: Stay informed with publications like [Realtor Magazine](https://magazine.realtor/).
- *Medical Journals*: Explore healthcare trends through respected journals like [NEJM](https://www.nejm.org/).
## Navigating the Medical Real Estate Nexus πŸ₯
1. **Optimal Clinic Locations** 🏨:
- *Proximity to Hospitals*: Consider **properties** near established **hospitals** to tap into **referral networks**.
- *Community Needs Analysis*: Assess **healthcare gaps** in the area and tailor your **services** to meet local demands.
- *Zoning Regulations*: Familiarize yourself with **zoning laws** affecting **medical practices** in different **neighborhoods**.
2. **Real Estate Investment Strategies** 🏠:
- *Diversification*: Diversify your **property portfolio** by investing in various **property types**, including **commercial spaces** near **medical centers**.
- *Long-Term Vision*: Think about **long-term growth** and **adaptability** when acquiring properties.
- *Property Management*: Ensure efficient **property management** for both **medical facilities** and **rental units**.
3. **Building Strong Networks** 🀝:
- *Medical Associations*: Join local **medical associations** and **networks** to foster **collaborations with peers and specialists**.
- *Real Estate Professionals*: Connect with **real estate** agents and **property management** experts for guidance.
## Staying Informed and Ahead πŸš€
1. **Market Intelligence** πŸ“Š:
- *Real Estate Analytics*: Leverage tools like [Zillow](https://www.zillow.com/) for real-time property data.
- *Medical Insights*: Stay updated on medical advancements and trends through [PubMed](https://pubmed.ncbi.nlm.nih.gov/).
2. **Continuous Learning** πŸ“–:
- *Real Estate Courses*: Invest in your real estate knowledge with online **courses** like:
- [Real Estate Investing for Beginners on Udemy](https://www.udemy.com/course/real-estate-investing-for-beginners-an-intro-to-investment/)
- [Coursera Real Estate Specialization](https://www.coursera.org/specializations/real-estate)
- [MIT OpenCourseWare Real Estate Economics](https://ocw.mit.edu/courses/urban-studies-and-planning/11-432-real-estate-economics-spring-2013/index.htm)
- *Medical Conferences*: Stay updated with the latest medical research and advancements by attending **conferences** and **seminars** such as:
- [American Medical Association (AMA) Conferences](https://www.ama-assn.org/meetings)
- [World Medical Association (WMA) Events](https://www.wma.net/events/)
- [MedPage Today's Conference Coverage](https://www.medpage.com/meetingcoverage)
3. **Community Engagement** 🏘️:
- *Local Involvement*: Be an active member of the **communities** where your **properties** are located.
- *Patient Outreach*: Engage with **patients** through **community health programs** and **educational initiatives**.
-
4. **Community Engagement by State** 🏘️:
- **Minnesota (MN)**: In the Land of 10,000 Lakes, engage with your local community through organizations like the [Minnesota Medical Association](https://www.mnmed.org/), and contribute to healthcare initiatives that matter.
- **California (CA)**: In the Golden State, participate in events organized by the [California Medical Association](https://www.cmadocs.org/), and explore opportunities for medical outreach and community involvement.
- **Washington (WA)**: In the Evergreen State, connect with the [Washington State Medical Association](https://wsma.org/) to join efforts in improving healthcare access and patient education.
- **Massachusetts (MA)**: In the Bay State, become an active member of the [Massachusetts Medical Society](https://www.massmed.org/) and engage in community health programs.
- **Texas (TX)**: In the Lone Star State, collaborate with the [Texas Medical Association](https://www.texmed.org/) on community outreach projects and initiatives.
- **New York (NY)**: In the Empire State, explore opportunities for community engagement through the [Medical Society of the State of New York](https://www.mssny.org/).
- **Florida (FL)**: In the Sunshine State, join efforts led by the [Florida Medical Association](https://www.flmedical.org/) to make a positive impact on local healthcare.
- **Hawaii (HI)**: In the Aloha State, participate in community health programs and initiatives supported by the [Hawaii Medical Association](https://www.hawaiimedicalassociation.org/).
- **Wisconsin (WI)**: In the Badger State, connect with the [Wisconsin Medical Society](https://www.wismed.org/) to engage in community health projects and support local healthcare initiatives.
By combining your **medical expertise** with **strategic real estate decisions** and a commitment to staying informed, you can excel in both fields and build a **valuable property collection** in **high-demand areas**.
# Examples:
## Doctors in Psychiatry and Psychologists Near Mound, MN
![image/png](https://cdn-uploads.huggingface.co/production/uploads/620630b603825909dcbeba35/f32-QmaYy92Ag4Pu3JXYk.png)
"""
return markdown
def GoogleEarth():
markdown="""
# Mound and Lake Minnetonka Area (Google Earth project)
Google Earth URL: https://earth.google.com/web/search/4704+cavan+road+mound+mn+55364/@44.91717772,-93.63685698,283.49123605a,6909.34027133d,30.00000001y,-113.43671639h,72.27862456t,0r/data=CigiJgokCUFjHTYfekZAERMrKMEgdUZAGTo4dDObZ1fAIdNa_O3zbFfAMikKJwolCiExM2ZOMTNIcUViQXp1QXM3alRFa3BTUTRKdnhBdUZqRHMgAToDCgEw
![image/png](https://cdn-uploads.huggingface.co/production/uploads/620630b603825909dcbeba35/5ob9-KGYdtQw8PY-YdYpv.png)
# East/West View of Phelps Island, Lord Fletchers and Al and Alma's
![image/png](https://cdn-uploads.huggingface.co/production/uploads/620630b603825909dcbeba35/Wh29MQZ6IXT0_yoDjTr7H.png)
# Historic Places on Lake Minnetonka
# Historic Places on Lake Minnetonka
## 1. Lord Fletcher's
- **Event**: 53rd Minnesota Bound Crappie Contest
- **Date**: May 6, 2023
- **Details**: Fishing contest for the biggest crappie, supporting Fishing for Life
- [Read more at kare11.com](https://www.kare11.com/article/news/local/kare11-saturday/annual-big-crappie-contest-on-lake-minnetonka-kicks-off-spring-fishing/89-63eba512-6c21-4bee-b4ea-35df2f463062)
## 2. Al and Alma's
- **Significance**: Known for supper club and charter cruises
- **Recent Event**: Al and Alma's owner acquired Tonka Bay Marina
- **Details**: This acquisition marks a significant expansion in their lake-based services
- [More information on Al and Alma's](https://bringmethenews.com/minnesota-lifestyle/tonka-bay-marina-sold-to-lakeside-supper-club-cruise-company-owner)
## 3. Tonka Toys
- **Historical Significance**: Started as Mound Metalcraft in 1946
- **Name Origin**: 'Tonka' is an homage to Lake Minnetonka
- **Legacy**: Evolved into a globally recognized toy brand under Hasbro
- [Read more at startribune.com](https://www.startribune.com/how-did-tonka-trucks-get-their-start-in-minnesota/600242109/)
- [Additional information at boingboing.net](https://boingboing.net/2023/04/21/tonkas-name-is-an-homage-to-lake-minnetonka.html)
# Historic Places on Lake Minnetonka
## 1. Lord Fletcher's
![Lord Fletcher's](https://www.lordfletchers.com/wp-content/uploads/2023/01/lake-room-1.jpg)
[Learn more about Lord Fletcher's on Wikipedia](https://en.wikipedia.org/wiki/Lord_Fletcher%27s)
## 2. Al and Alma's
![Al and Alma's](https://www.al-almas.com/wp-content/uploads/2022/03/IMG_4215-1024x683.jpg)
[Learn more about Al and Alma's on Wikipedia](https://en.wikipedia.org/wiki/Al_and_Alma%27s)
## 3. Tonka Toys in Mound, MN
![Tonka Toys](https://moundmuseum.com/wp-content/uploads/2020/05/Tonka-Museum-2.jpg)
[Learn more about Tonka Toys on Wikipedia](https://en.wikipedia.org/wiki/Tonka)
"""
return markdown
with gr.Blocks() as demo:
with gr.Column():
# Price/Boroughs/Map/Filter for AirBnB
with gr.Row():
min_price = gr.Number(value=250, label="Minimum Price")
max_price = gr.Number(value=1000, label="Maximum Price")
boroughs = gr.CheckboxGroup(choices=["Queens", "Brooklyn", "Manhattan", "Bronx", "Staten Island"], value=["Queens", "Brooklyn"], label="Select Boroughs:")
btn = gr.Button(value="Update Filter")
map = gr.Plot().style()
# Mental Health Provider Finder
with gr.Row():
df20 = gr.Textbox(lines=4, default="", label="Find Mental Health Provider e.g. City/State/Name/License:")
btn2 = gr.Button(value="Find")
with gr.Row():
df4 = gr.Dataframe(wrap=True, max_rows=10000, overflow_row_behaviour= "paginate")
# City Map
with gr.Row():
df2 = gr.Textbox(lines=1, default="Mound", label="Find City:")
latitudeUI = gr.Textbox(lines=1, default="44.9382", label="Latitude:")
longitudeUI = gr.Textbox(lines=1, default="-93.6561", label="Longitude:")
btn3 = gr.Button(value="Lat-Long")
demo.load(filter_map, [min_price, max_price, boroughs], map)
btn.click(filter_map, [min_price, max_price, boroughs], map)
btn2.click(getDatasetFind,df20,df4 )
# Lookup on US once you have city to get lat/long
# US 55364 Mound Minnesota MN Hennepin 053 44.9382 -93.6561 4
#latitude = 44.9382
#longitude = -93.6561
#btn3.click(centerMap, map)
btn3.click(centerMap, [min_price, max_price, boroughs], map)
# Display markdown for content
markdown = SolutionIntent()
gr.Markdown(markdown)
markdown = GoogleEarth()
gr.Markdown(markdown)
demo.launch()