File size: 2,516 Bytes
5fbed17
67cc902
5fbed17
8f73dc0
63ec242
67cc902
63ec242
67cc902
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5fbed17
 
67cc902
63ec242
 
5fbed17
67cc902
8f73dc0
63ec242
67cc902
 
 
 
 
 
63ec242
67cc902
 
 
 
 
63ec242
67cc902
 
63ec242
67cc902
 
63ec242
67cc902
 
 
 
 
 
 
 
 
 
 
 
 
 
63ec242
67cc902
 
 
81f1eee
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
import streamlit as st
import plotly.graph_objects as go
import pandas as pd
#from transformers import pipeline

# Define a list of dictionaries containing hospital data
hospitals = [
    {
        'name': 'Hackensack University Medical Center',
        'beds': 775,
        'lat': 40.9008,
        'lon': -74.0679
    },
    {
        'name': 'Robert Wood Johnson University Hospital',
        'beds': 965,
        'lat': 40.4862,
        'lon': -74.4518
    },
    {
        'name': 'Atlantic Health System - Morristown Medical Center',
        'beds': 712,
        'lat': 40.7869,
        'lon': -74.4774
    },
    {
        'name': 'Jersey Shore University Medical Center',
        'beds': 646,
        'lat': 40.1955,
        'lon': -74.0636
    },
    {
        'name': 'Cooper University Hospital',
        'beds': 635,
        'lat': 39.9384,
        'lon': -75.1181
    }
]

# Save the hospital data to a CSV file
df = pd.DataFrame(hospitals)
df.to_csv('hospitals.csv', index=False)

# Load the Hugging Face model
#model = pipeline('sentiment-analysis')

# Define a function to analyze the sentiment of hospital names
def analyze_sentiment(text):
    result = model(text)
    score = result[0]['score']
    label = result[0]['label']
    return score, label

# Analyze the sentiment of each hospital name
for hospital in hospitals:
    score, label = analyze_sentiment(hospital['name'])
    hospital['sentiment_score'] = score
    hospital['sentiment_label'] = label

# Sort the hospitals by number of beds
sorted_hospitals = sorted(hospitals, key=lambda x: x['beds'], reverse=True)

# Get the top 5 hospitals
top_hospitals = sorted_hospitals[:5]

# Create a treemap of hospital bed counts in New Jersey
fig = go.Figure(
    go.Treemap(
        labels=[hospital['name'] for hospital in sorted_hospitals],
        parents=['New Jersey' for hospital in sorted_hospitals],
        values=[hospital['beds'] for hospital in sorted_hospitals],
        text=[f"{hospital['name']}<br>Beds: {hospital['beds']}" for hospital in sorted_hospitals],
        hovertemplate='<b>%{label}</b><br>%{text}<extra></extra>'
    )
)
fig.update_layout(
    title='Hospital Bed Counts in New Jersey',
    margin=dict(t=50, l=25, r=25, b=25),
)

# Display the treemap and top 5 hospitals
st.plotly_chart(fig)
st.write('**Top 5 Hospitals in New Jersey**')
for i, hospital in enumerate(top_hospitals):
    st.write(f"{i+1}. {hospital['name']} - Beds: {hospital['beds']} - Latitude: {hospital['lat']} - Longitude: {hospital['lon']}")