Update app.py
Browse files
app.py
CHANGED
@@ -1,71 +1,28 @@
|
|
1 |
import streamlit as st
|
2 |
import plotly.graph_objects as go
|
3 |
|
4 |
-
|
5 |
-
conditions = [
|
6 |
-
{
|
7 |
-
"diagnosis": "Diagnosis 1",
|
8 |
-
"observations": "Observations 1",
|
9 |
-
"CCD": "CCD 1",
|
10 |
-
"CCD_procedures": "CCD Procedures 1"
|
11 |
-
},
|
12 |
-
# Add more conditions here
|
13 |
-
]
|
14 |
-
|
15 |
-
# MSK hip and knee surgery list dictionary
|
16 |
-
surgery_data = [
|
17 |
-
{
|
18 |
-
"CPTCode": "CPT Code 1",
|
19 |
-
"CPTDescription": "MSK Hip Surgery",
|
20 |
-
"ICD10Code": "ICD10 Code 1",
|
21 |
-
"ICD10Description": "ICD10 Description 1",
|
22 |
-
"Emoji": "π",
|
23 |
-
"Description": "Hip Surgery",
|
24 |
-
"Cost": 10
|
25 |
-
},
|
26 |
-
{
|
27 |
-
"CPTCode": "CPT Code 2",
|
28 |
-
"CPTDescription": "MSK Knee Surgery",
|
29 |
-
"ICD10Code": "ICD10 Code 2",
|
30 |
-
"ICD10Description": "ICD10 Description 2",
|
31 |
-
"Emoji": "π",
|
32 |
-
"Description": "Knee Surgery",
|
33 |
-
"Cost": 15
|
34 |
-
}
|
35 |
-
]
|
36 |
-
|
37 |
-
# Sort the surgery data by descending cost
|
38 |
-
surgery_data.sort(key=lambda x: x["Cost"], reverse=True)
|
39 |
-
|
40 |
-
# Function to create heatmap circle plot
|
41 |
-
def create_heatmap_circle_plot(surgery_data):
|
42 |
-
fig = go.Figure()
|
43 |
-
|
44 |
-
for surgery in surgery_data:
|
45 |
-
fig.add_trace(go.Scatter(
|
46 |
-
x=[surgery["CPTCode"]],
|
47 |
-
y=[surgery["Cost"]],
|
48 |
-
mode='markers',
|
49 |
-
marker=dict(
|
50 |
-
size=20,
|
51 |
-
color=[surgery["Cost"]],
|
52 |
-
colorscale='Viridis',
|
53 |
-
showscale=True
|
54 |
-
),
|
55 |
-
text=surgery["CPTDescription"],
|
56 |
-
hovertemplate='<b>%{text}</b><br><i>CPT Code</i>: %{x}<br><i>Cost</i>: %{y}'))
|
57 |
-
|
58 |
-
fig.update_layout(title='Heatmap Circle Plot of Surgery Types',
|
59 |
-
xaxis_title='CPT Codes',
|
60 |
-
yaxis_title='Cost (in billions)')
|
61 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
62 |
return fig
|
63 |
|
64 |
-
#
|
65 |
-
|
66 |
-
|
67 |
-
|
|
|
|
|
68 |
|
69 |
-
|
70 |
-
fig
|
71 |
-
st.plotly_chart(fig)
|
|
|
1 |
import streamlit as st
|
2 |
import plotly.graph_objects as go
|
3 |
|
4 |
+
import plotly.graph_objects as go
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
|
6 |
+
def create_sunburst_plot(labels, parents, values, ids, text):
|
7 |
+
fig = go.Figure(go.Sunburst(
|
8 |
+
labels=labels,
|
9 |
+
parents=parents,
|
10 |
+
values=values,
|
11 |
+
ids=ids,
|
12 |
+
text=text,
|
13 |
+
hoverinfo="label+value",
|
14 |
+
branchvalues="total",
|
15 |
+
))
|
16 |
+
|
17 |
+
fig.update_layout(margin=dict(t=0, l=0, r=0, b=0))
|
18 |
return fig
|
19 |
|
20 |
+
# Replace these lists with your own data
|
21 |
+
labels = ["Root", "Hip Surgery", "Knee Surgery", "CPT1", "CPT2", "CPT3", "CPT4"]
|
22 |
+
parents = ["", "Root", "Root", "Hip Surgery", "Hip Surgery", "Knee Surgery", "Knee Surgery"]
|
23 |
+
values = [None, 30, 40, 20, 10, 25, 15]
|
24 |
+
ids = ["Root", "Hip Surgery", "Knee Surgery", "CPT1", "CPT2", "CPT3", "CPT4"]
|
25 |
+
text = ["Root", "Hip Surgery", "Knee Surgery", "CPT1", "CPT2", "CPT3", "CPT4"]
|
26 |
|
27 |
+
fig = create_sunburst_plot(labels, parents, values, ids, text)
|
28 |
+
fig.show()
|
|