Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,10 +1,8 @@
|
|
1 |
-
import pandas as pd
|
2 |
import streamlit as st
|
3 |
from graphviz import Digraph
|
4 |
|
5 |
st.set_page_config(page_title="Ideal Care Plan for Top 10 Health Conditions")
|
6 |
|
7 |
-
# Create a pandas dataframe for the top 10 health conditions and their spending
|
8 |
health_conditions = [
|
9 |
{"condition": "Heart disease ❤️", "spending": 214.3},
|
10 |
{"condition": "Trauma-related disorders 🤕", "spending": 198.6},
|
@@ -18,37 +16,36 @@ health_conditions = [
|
|
18 |
{"condition": "Back problems 👨⚕️", "spending": 67.0},
|
19 |
]
|
20 |
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
else:
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
st.graphviz_chart(graph.pipe(format="svg"))
|
|
|
|
|
1 |
import streamlit as st
|
2 |
from graphviz import Digraph
|
3 |
|
4 |
st.set_page_config(page_title="Ideal Care Plan for Top 10 Health Conditions")
|
5 |
|
|
|
6 |
health_conditions = [
|
7 |
{"condition": "Heart disease ❤️", "spending": 214.3},
|
8 |
{"condition": "Trauma-related disorders 🤕", "spending": 198.6},
|
|
|
16 |
{"condition": "Back problems 👨⚕️", "spending": 67.0},
|
17 |
]
|
18 |
|
19 |
+
urls = {
|
20 |
+
"Heart disease ❤️": "https://www.cdc.gov/heartdisease",
|
21 |
+
"Trauma-related disorders 🤕": "https://www.nimh.nih.gov/health/topics/post-traumatic-stress-disorder-ptsd/index.shtml",
|
22 |
+
"Cancer 🦀": "https://www.cancer.gov/",
|
23 |
+
}
|
24 |
+
|
25 |
+
dot = Digraph(comment="Ideal Care Plan for Top 10 Health Conditions")
|
26 |
+
dot.graph_attr["rankdir"] = "LR"
|
27 |
+
for condition in health_conditions:
|
28 |
+
name = condition["condition"]
|
29 |
+
spending = condition["spending"]
|
30 |
+
if name in urls:
|
31 |
+
url = urls[name]
|
32 |
+
dot.node(name, f"{name}\n${spending:.1f}B", href=url)
|
33 |
else:
|
34 |
+
dot.node(name, f"{name}\n${spending:.1f}B")
|
35 |
+
|
36 |
+
dot.edges([
|
37 |
+
("Heart disease ❤️", "Hypertension 🩺"),
|
38 |
+
("Heart disease ❤️", "Hyperlipidemia 🍔"),
|
39 |
+
("Trauma-related disorders 🤕", "Mental disorders 🧠"),
|
40 |
+
("Cancer 🦀", "Heart disease ❤️"),
|
41 |
+
("Cancer 🦀", "Trauma-related disorders 🤕"),
|
42 |
+
("Cancer 🦀", "Osteoarthritis and joint disorders 🦴"),
|
43 |
+
("Mental disorders 🧠", "Heart disease ❤️"),
|
44 |
+
("Mental disorders 🧠", "Trauma-related disorders 🤕"),
|
45 |
+
("Osteoarthritis and joint disorders 🦴", "Back problems 👨⚕️"),
|
46 |
+
("Diabetes 🍬", "Heart disease ❤️"),
|
47 |
+
("Diabetes 🍬", "Hypertension 🩺"),
|
48 |
+
("Chronic obstructive pulmonary disease and asthma 🫁", "Heart disease ❤️"),
|
49 |
+
])
|
50 |
+
|
51 |
+
st.graphviz_chart(dot.pipe(format="svg"))
|
|