Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

128 aet02 template #204

Merged
merged 31 commits into from
Jul 6, 2022
Merged

128 aet02 template #204

merged 31 commits into from
Jul 6, 2022

Conversation

Meixh2021
Copy link
Contributor

close insightsengineering/chevron-tasks#42

Hi @wangh107 @barnett11, thanks to the @BFalquet, I believed the current version of chevron can help sort the AEBODSYS correctly.

For the No Coding Available, I just added additional dm_explicit_na(na_level = "No Coding available") to fix that issue.

I corrected a sorting problem when the argument lbl_overall = NULL, the sorting will be based on the last column but not the whole column in aet02_1().

You might check the issue again with the following codes:

dpath <- "root/clinical_studies/ro_testing/cdp_testing/spa_testing/data_analysis/spaenv_testing/qa/outdata_vad"
adsl <- rice::rice_read(file.path(dpath,"adsl.sas7bdat"))
adae <- rice::rice_read(file.path(dpath,"adae.sas7bdat"))

library(dm)
library(chevron)

dm.data <- dm(adsl, adae) %>%
  dm_add_pk(adae, AESEQ) %>%
  dm_add_pk(adsl, c(USUBJID, STUDYID)) %>%
  dm_add_fk(adae, c(USUBJID, STUDYID), adsl) %>% 
  dm_explicit_na(na_level = "No Coding available") # Missing data

### Option to see the label format
dm.data <- dm.data %>%
  dm_zoom_to(adae) %>%
  mutate(AEBODSYS = formatters::with_label(AEBODSYS, "MedDRA System Organ Class")) %>%
  mutate(AEDECOD = formatters::with_label(AEDECOD, "MedDRA Preferred Term")) %>%
  dm_update_zoomed()

dm.data.1 <- dm.data %>%
  aet02_1_pre()
aet02_1(adam_db = dm.data.1, .study = list(actualarm = "TRT01A",
                                         lbl_overall = NULL))
dm.data.3 <- dm.data %>%
  aet02_3_pre()
aet02_3(adam_db = dm.data.3, .study = list(actualarm = "TRT01A",
                                         lbl_overall = NULL))

Thanks!

@Meixh2021 Meixh2021 requested review from wangh107 and barnett11 June 21, 2022 17:52
@github-actions
Copy link
Contributor

github-actions bot commented Jun 21, 2022

Code Coverage Summary

Filename                           Stmts    Miss  Cover    Missing
-------------------------------  -------  ------  -------  ---------
R/aet01.R                            252     252  0.00%    38-455
R/aet02.R                            189     189  0.00%    47-456
R/aet03.R                             66      66  0.00%    41-157
R/aet04.R                             86      86  0.00%    49-182
R/assertions.R                        23      23  0.00%    21-46
R/cmt01a.R                           156     156  0.00%    50-427
R/cmt02_pt.R                          37      37  0.00%    34-108
R/dm_explicit_na.R                    44      44  0.00%    46-123
R/dmt01.R                             29      29  0.00%    44-125
R/dst01.R                            231     231  0.00%    5-609
R/dtht01.R                            77      77  0.00%    44-192
R/egt01.R                             44      44  0.00%    45-137
R/egt02.R                             56      56  0.00%    42-218
R/ext01.R                             69      69  0.00%    39-243
R/gen_args.R                           1       1  0.00%    18
R/lbt01.R                             39      39  0.00%    43-127
R/mht01.R                             57      57  0.00%    39-139
R/sample_study_object.R               14      14  0.00%    14-35
R/standard_data_preprocessing.R      221     221  0.00%    52-508
R/utils.R                            144     144  0.00%    11-377
R/vst01.R                             45      45  0.00%    46-140
R/vst02.R                             92      92  0.00%    42-254
TOTAL                               1972    1972  0.00%

Results for commit: b52fd42c9c2697357d23d4fae236d7bd4e6c8d75

Minimum allowed coverage is 80%

♻️ This comment has been updated with latest results

@wangh107
Copy link
Contributor

Thanks @Meixh2021

Tim @barnett11 , what do you think if we include the following steps in the corresponding preprocess functions aet02_x_pre:

  1. Replacing missing with "No Code available" for variables AEBODSYS, AEHLT, AEDECOD (depending on which variables are used)
  2. Assign correct label format in table header
    e.g. mutate(AEBODSYS = formatters::with_label(AEBODSYS, "MedDRA System Organ Class"))

@barnett11
Copy link
Contributor

Thanks @Meixh2021

Tim @barnett11 , what do you think if we include the following steps in the corresponding preprocess functions aet02_x_pre:

  1. Replacing missing with "No Code available" for variables AEBODSYS, AEHLT, AEDECOD (depending on which variables are used)
  2. Assign correct label format in table header
    e.g. mutate(AEBODSYS = formatters::with_label(AEBODSYS, "MedDRA System Organ Class"))

Yes that should do it thanks @wangh107

@Meixh2021
Copy link
Contributor Author

Thanks @Meixh2021
Tim @barnett11 , what do you think if we include the following steps in the corresponding preprocess functions aet02_x_pre:

  1. Replacing missing with "No Code available" for variables AEBODSYS, AEHLT, AEDECOD (depending on which variables are used)
  2. Assign correct label format in table header
    e.g. mutate(AEBODSYS = formatters::with_label(AEBODSYS, "MedDRA System Organ Class"))

Yes that should do it thanks @wangh107

@wangh107 @barnett11 for item 2, currently the label of output is based on the label of the data. My question is shall we force the labels? For example, do all outputs generated by aet02_x() have the same label "MedDRA System Organ Class" but not its original label for AEBODSYS?

@barnett11
Copy link
Contributor

Thanks @Meixh2021
Tim @barnett11 , what do you think if we include the following steps in the corresponding preprocess functions aet02_x_pre:

  1. Replacing missing with "No Code available" for variables AEBODSYS, AEHLT, AEDECOD (depending on which variables are used)
  2. Assign correct label format in table header
    e.g. mutate(AEBODSYS = formatters::with_label(AEBODSYS, "MedDRA System Organ Class"))

Yes that should do it thanks @wangh107

@wangh107 @barnett11 for item 2, currently the label of output is based on the label of the data. My question is shall we force the labels? For example, do all outputs generated by aet02_x() have the same label "MedDRA System Organ Class" but not its original label for AEBODSYS?

Yes, we should use the template-defined column name regardless of the CDISC attributed label thanks

@wangh107
Copy link
Contributor

Another question for Tim @barnett11
How should we treat the No Coding Available when sorting?
Do we treat it as the regular category and sort by frequency?
OR
Should the No Coding Available category always be placed in the last?

@barnett11
Copy link
Contributor

Another question for Tim @barnett11 How should we treat the No Coding Available when sorting? Do we treat it as the regular category and sort by frequency? OR Should the No Coding Available category always be placed in the last?

There is no specific guidance @Meixh2021 , but the general practice of just including in the frequency list is sufficient thanks

Copy link
Contributor

@BFalquet BFalquet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the good work. Please see my comments inside.

you can have a look at insightsengineering/tern#577 if that helps for dtht01.

cheers

@Meixh2021
Copy link
Contributor Author

Thank you for the good work. Please see my comments inside.

you can have a look at insightsengineering/tern#577 if that helps for dtht01.

cheers

Thanks @BFalquet, now I believe that this pull request can also help solve some issues in insightsengineering/chevron-tasks#47. 😄

Copy link
Contributor

@wangh107 wangh107 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Meixh2021
Suggest to include a data process in aet02_x_pre to code missing in AEBODSYS, AEHLT, AEDECOD as "No Coding Available" (only do it in the 3 mentioned variables in adae dataset, not the whole dm object.)

@Meixh2021 Meixh2021 requested review from wangh107 and BFalquet June 28, 2022 19:40
@Meixh2021
Copy link
Contributor Author

@barnett11 Hi Tim, if you are available, would you please review the current template can meet the TLG criteria? Thank you!

Copy link
Contributor

@BFalquet BFalquet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good to me, thank you for the work. Beware that important changes are coming to chevron soon.

@wangh107 wangh107 merged commit 0fde66e into main Jul 6, 2022
@wangh107 wangh107 deleted the 128_aet02_template branch July 6, 2022 20:52
@barnett11
Copy link
Contributor

Thanks @Meixh2021
Please note this pre-processing of Not Coded does not work if dm_explicit_na has been used on the data prior to passing of function. The terms for AEBODSYS and AEDECOD then appear as <MISSING>.
FYI @wangh107 , @BFalquet

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants