File size: 2,218 Bytes
0d3b956
 
a3a53d2
0d3b956
a3a53d2
e3887ab
6cb3226
 
 
 
 
 
 
 
 
0d3b956
e3887ab
 
4f6ea8d
 
 
 
 
 
 
 
 
 
 
 
 
 
0d3b956
4f6ea8d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import streamlit as st
from graphviz import Digraph

st.set_page_config(page_title="Ideal Care Plan for Top 10 Health Conditions")

health_conditions = [
    {"condition": "Heart disease ❤️", "spending": 214.3},
    {"condition": "Trauma-related disorders 🤕", "spending": 198.6},
    {"condition": "Cancer 🦀", "spending": 171.0},
    {"condition": "Mental disorders 🧠", "spending": 150.8},
    {"condition": "Osteoarthritis and joint disorders 🦴", "spending": 142.4},
    {"condition": "Diabetes 🍬", "spending": 107.4},
    {"condition": "Chronic obstructive pulmonary disease and asthma 🫁", "spending": 91.0},
    {"condition": "Hypertension 🩺", "spending": 83.9},
    {"condition": "Hyperlipidemia 🍔", "spending": 83.9},
    {"condition": "Back problems 👨‍⚕️", "spending": 67.0},
]

urls = {
    "Heart disease ❤️": "https://www.cdc.gov/heartdisease",
    "Trauma-related disorders 🤕": "https://www.nimh.nih.gov/health/topics/post-traumatic-stress-disorder-ptsd/index.shtml",
    "Cancer 🦀": "https://www.cancer.gov/",
}

dot = Digraph(comment="Ideal Care Plan for Top 10 Health Conditions")
dot.graph_attr["rankdir"] = "LR"
for condition in health_conditions:
    name = condition["condition"]
    spending = condition["spending"]
    if name in urls:
        url = urls[name]
        dot.node(name, f"{name}\n${spending:.1f}B", href=url)
    else:
        dot.node(name, f"{name}\n${spending:.1f}B")

dot.edges([
    ("Heart disease ❤️", "Hypertension 🩺"),
    ("Heart disease ❤️", "Hyperlipidemia 🍔"),
    ("Trauma-related disorders 🤕", "Mental disorders 🧠"),
    ("Cancer 🦀", "Heart disease ❤️"),
    ("Cancer 🦀", "Trauma-related disorders 🤕"),
    ("Cancer 🦀", "Osteoarthritis and joint disorders 🦴"),
    ("Mental disorders 🧠", "Heart disease ❤️"),
    ("Mental disorders 🧠", "Trauma-related disorders 🤕"),
    ("Osteoarthritis and joint disorders 🦴", "Back problems 👨‍⚕️"),
    ("Diabetes 🍬", "Heart disease ❤️"),
    ("Diabetes 🍬", "Hypertension 🩺"),
    ("Chronic obstructive pulmonary disease and asthma 🫁", "Heart disease ❤️"),
])

st.graphviz_chart(dot.pipe(format="svg"))