Closed anajens closed 2 years ago
Hi @anajens , I thought about this issue but it might be a little more complicated that I thought. For example, do we want the module to be interchangeable between EGT03
and EGT04
by a checkbox or something? It might be a good idea to move this issue out of this sprint.
Hi @yli110-stat697
Yes I think some kinds of dynamic UI is needed to switch between a "Visit" analysis vs "Worst" flag:
I agree that this might be tricky so I will move to the backlog.
@imazubi any suggestions with dynamic UI in teal.modules?
@yli110-stat697 see the branch 112_enhance_tm_t_shift_by_arm@main There you can see the changes I made in the UI:
I added a radiobuttons input so that the user can select which is the type of analysis to be carried out.
Additionally I added two new inputs that are going to be shown/hidden (as well as the visit_var
) conditional on the radiobuttons value.
worst_flag_var
worst_flag_indicator
I think with this you can be in a good shape to enhance the template function so that the module both type of analysis, so feel free to keep working on this branch. :)
@shajoezhu
This is awesome! Thanks for making these changes!
Hey @shajoezhu and @Nolan-Steed I had a little progress here https://github.com/insightsengineering/teal.modules.clinical/blob/112_EGT04_in_tm_t_shift_by_arm%40main/R/tm_t_shift_by_arm.R
Currently the old code for EGT03 worked (example in roxygen header), and you can get the EGT04 be using code below. The next step could be updating the ui_shift_by_arm_with_worst_flag
to introduce dynamic UI between EGT03 and EGT04. Let me know if you want to keep working on this, otherwise I can further updating the ui_shift_by_arm_with_worst_flag
app <- init(
data = cdisc_data(
cdisc_dataset("ADSL", adsl, code = 'ADSL <- synthetic_cdisc_data("latest")$adsl'),
cdisc_dataset("ADEG", adeg, code = 'ADEG <- synthetic_cdisc_data("latest")$adeg'),
check = TRUE
),
modules = modules(
tm_t_shift_by_arm(
label = "Shift by Arm Table",
dataname = "ADEG",
arm_var = choices_selected(
variable_choices(adsl, subset = c("ARM", "ARMCD")),
selected = "ARM"
),
paramcd = choices_selected(
value_choices(adeg, "PARAMCD"),
selected = "ECGINTP"
),
analysis_by_worst_flag = TRUE,
worst_flag_var = choices_selected(
variable_choices(adeg, c("WORS02FL", "WORS01FL")),
selected = "WORS02FL"
),
worst_flag = choices_selected(
value_choices(adeg, "WORS02FL"),
selected = "Y", fixed = TRUE
),
aval_var = choices_selected(
variable_choices(adeg, subset = "AVALC"),
selected = "AVALC", fixed = TRUE
),
base_var = choices_selected(
variable_choices(adeg, subset = "BASEC"),
selected = "BASEC", fixed = TRUE
),
useNA = "ifany"
)
)
)
shinyApp(app$ui, app$server)
Update
tm_t_shift_by_arm
in order to work with EGT04 template.