-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.py
118 lines (82 loc) · 4.15 KB
/
app.py
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# This file generated by Quarto; do not edit by hand.
from __future__ import annotations
from pathlib import Path
from shiny import App, Inputs, Outputs, Session, ui
def server(input: Inputs, output: Outputs, session: Session) -> None:
from shiny import render, reactive, req
from shiny.express import input, ui
import pandas as pd
from tirads import TIRADSReport, tirads_map_desc
# ========================================================================
width_choices = "400px"
# ========================================================================
ui.input_radio_buttons(
"composition",
"Choose one:",
tirads_map_desc["composition"],
width = width_choices
)
# ========================================================================
ui.input_radio_buttons(
"echogenicity",
"Choose one:",
tirads_map_desc["echogenicity"],
width = width_choices
)
# ========================================================================
ui.input_radio_buttons(
"shape",
"Choose one:",
tirads_map_desc["shape"],
width = width_choices
)
# ========================================================================
ui.input_radio_buttons(
"margin",
"Choose one:",
tirads_map_desc["margin"],
width = width_choices
)
# ========================================================================
ui.input_checkbox_group(
"echogenic_foci",
"Choose All That Apply",
tirads_map_desc["echogenic_foci"],
width = width_choices
)
# ========================================================================
ui.input_numeric("size_cm", None, value=None, min=0)
# ========================================================================
@reactive.calc
def tirads_results():
req(input.echogenic_foci())
res = TIRADSReport(
composition=input.composition(),
echogenicity=input.echogenicity(),
shape=input.shape(),
margin=input.margin(),
echogenic_foci= input.echogenic_foci(),
size_cm=input.size_cm())
return res
# ========================================================================
@render.ui
def render_md_summary():
return ui.markdown(tirads_results().to_md_str_summary())
# ========================================================================
@render.data_frame
def output_df():
df = tirads_results().get_points_df()
return render.DataGrid(df)
# ========================================================================
@render.ui
def render_md_actions():
return ui.markdown(tirads_results().to_md_str_actions())
# ========================================================================
return None
_static_assets = ["tirads-calc_files","images/tirads-chart.png","images/composition-w-text.png","images/echogenicity-w-text.png","images/shape-w-text.png","images/margin-w-text.png","images/margin-ete.png","images/echogenic-foci-w-text.png","images/size-measure.jpg","images/tirads-alternative.png","images/cover.png","tirads-calc_files/libs/quarto-html/tippy.css","tirads-calc_files/libs/quarto-html/quarto-syntax-highlighting.css","tirads-calc_files/libs/bootstrap/bootstrap-icons.css","tirads-calc_files/libs/bootstrap/bootstrap.min.css","images/favicon/apple-touch-icon.png","images/favicon/favicon-32x32.png","images/favicon/favicon-16x16.png","images/favicon/site.webmanifest","css/style.css","tirads-calc_files/libs/clipboard/clipboard.min.js","tirads-calc_files/libs/quarto-html/quarto.js","tirads-calc_files/libs/quarto-html/popper.min.js","tirads-calc_files/libs/quarto-html/tippy.umd.min.js","tirads-calc_files/libs/quarto-html/anchor.min.js","tirads-calc_files/libs/bootstrap/bootstrap.min.js"]
_static_assets = {"/" + sa: Path(__file__).parent / sa for sa in _static_assets}
app = App(
Path(__file__).parent / "tirads-calc.html",
server,
static_assets=_static_assets,
)