insightsengineering / teal.transform

Reproducible transform and merge module for teal applications
https://insightsengineering.github.io/teal.transform/
Other
3 stars 2 forks source link

allow data_extract_input to work with "interaction" variables #41

Open cicdguy opened 3 years ago

cicdguy commented 3 years ago

In teal.modules.clinical::tm_a_mmrm, one of the variables needed for the analysis allows for "interaction" terms. These are passed into the template in this form: variable1:variable2 or variable1*variable2.

If we are using a data_extract_input and data_merge_module, these variables do not exist in the data - but their component variables do (and they must).

What we need from data_extract_input is to optionally accept some split criteria to separate interaction selections into their component variables. Or maybe this has to be done at the data_merge_module level.

The goal is to enable something like this:

data_extract_spec(
  dataname = dataname,
  select =   select_spec(
    choices = c("BASE", "AGE", "SEX", "BASE:AVISIT")
  )
)

Such that the data_extract_input shows this in the module:

image

But is doing this behind the scenes (Show R Code):

image

Note how the "variables" being selected are BASE, AVISIT, and SEX (BASE:AVISIT has been split).

You may see the current workaround in tm_a_mmrm which currently uses 2 data_extract_inputs to accomplish this.

Provenance:

Creator: SUNDRELV
nikolas-burkoff commented 1 year ago

so I think we can now do this see here