Skip to content

Closes #73: add ADVS example and update ADSL example and corresponding specs#83

Merged
rossfarrugia merged 35 commits intomainfrom
73_add_adam_example_ADVS_ADSL
Mar 4, 2025
Merged

Closes #73: add ADVS example and update ADSL example and corresponding specs#83
rossfarrugia merged 35 commits intomainfrom
73_add_adam_example_ADVS_ADSL

Conversation

@Fanny-Gautier
Copy link
Copy Markdown
Collaborator

@Fanny-Gautier Fanny-Gautier commented Jan 23, 2025

Pull Request

DESCRIPTION GOES HERE

Before you submit your pull request, take a look at the following checklist. Many thanks for your contribution!

  • Title: Place Closes #<insert_issue_number> at the beginning of your PR title. Use the Edit button in the top-right if you need to update.
  • Linked Issue: Ensure the related issue is linked in the "Development Section" on the right-hand side.
  • First Contribution: If this is your first contribution, add yourself to the DESCRIPTION file.
  • Impact on Examples: If your updates impact any examples, review locally for warnings or errors in the impacted example pages.
  • Merge Conflicts: Developers should address any merge conflicts and merge upon successful review.
  • New Packages: If new packages were used, ensure they are included in the DESCRIPTION file's Imports section.
  • Updated Examples: If you added or updated an example, ensure it runs on the latest CRAN release versions of all packages used.
  • Testing Instructions: Provide instructions on how to test the code if necessary.

Copy link
Copy Markdown
Collaborator

@bms63 bms63 left a comment

Choose a reason for hiding this comment

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

I am so excited about this @Fanny-Gautier !!!! I will try to get to early next week.

@pharmaverse/admiral we got some new integrated examples coming online as a result of @Fanny-Gautier hard work. Anyone got time to help out with the review?

This aligns ADSL closer to admiral ADSL and introduces ADVS as another example

image

@Fanny-Gautier Fanny-Gautier marked this pull request as ready for review January 24, 2025 09:42
adam/adsl.qmd Outdated
Comment on lines +69 to +70
where_sep_sheet = FALSE,
quiet = TRUE
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Could we mention why we are setting these arguments like this?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

where_sep_sheet explained
quiet dropped and thus left to the default value since we do not have any warnings to mute

predecessor_only = FALSE, keep = TRUE)
ds_list = list("dm" = dm_suppdm, "suppdm" = dm_suppdm),
predecessor_only = FALSE, keep = FALSE)
head(adsl_preds, n=10)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

could we display this in a prettier way using reactable package? https://github.com/pharmaverse/admiraldiscovery/blob/v0.3.0/R/interactive.R here is what Daniel uses it in admiraldiscovery

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

It's not looking that great without customizing it:
image

Could you please suggest where I could save the customization that it's not directly in the code itself ?
image

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

to compare with head()
image

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

we could just create another folder called functions at the top-level. and store the fancy code in there. and then your code could call the reactable code from the functions folder

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

but yeah agree the vanilla reactable looks sad

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This will be implemented later, once #84 is completed.

adam/adsl.qmd Outdated
Now we have the base dataset, we can start to create some variables.
There are a few options to create grouping variables and their corresponding numeric variables.

Option 1: We can start with creating the subgroups using the controlled terminology, in this case `AGEGR1`.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Could we make use of how the logs section does this? This is a pretty long section
image

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

At least "Option 1" should be bold.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@bms63 Could you let me know what you expect here using logr / logrx ? Thanks

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

metatools option | admiral option

maybe??

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

As agreed with @bms63 today, it will be done later since I am lost with this request.

Now we have sorted out what we can easily do with controlled terminology it is time to start deriving some variables. Here you could refer directly to using the `{admiral}` template and [vignette](https://pharmaverse.github.io/admiral/cran-release/articles/adsl.html) in practice, but for the purpose of this end-to-end ADaM vignette we will share a few exposure derivations from there. We derive the start and end of treatment (which requires dates to first be converted from DTC to DTM), the treatment duration, and the safety population flag.
### Exposure derivations

Now we have sorted out what we can easily do with controlled terminology it is time to start deriving some variables.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

So good! I'm excited!!

adam/adsl.qmd Outdated
condition = (EXDOSE > 0 | (EXDOSE == 0 & str_detect(EXTRT, "PLACEBO")))
) %>%
drop_unspec_vars(metacore) # This will drop any columns that aren't specified in the metacore object
drop_unspec_vars(metacore) # This will drop any columns that are not specified in the metacore object
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

ummm...should this step just go at the end or am i missing something?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

dropped

@rossfarrugia
Copy link
Copy Markdown
Contributor

this is nice package we use on blogging site that automatically creates links for functions and packages. very handy - maybe should become standard (add to checklist?)

I have no strong opinion honestly speaking. In general, I'm not a fan of extending dependencies and keep things small and simple but if this helps and it's robust enough - let's go with it!

Same here @bms63 - happy if you want to go ahead and make an issue for this one to get it added across all the blogs, if anyone has time to take it on.

Copy link
Copy Markdown
Collaborator

@bundfussr bundfussr left a comment

Choose a reason for hiding this comment

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

Is it possible to add a TOC to the pages like in the admiral vignettes?

Do we need to repeat so much information from the admiral vignettes?
It's not clear to me what we want to show. Do we want to show how to create an ADSL or ADVS dataset or how admiral and other pharmaverse packages work together?
In the former case I wonder why we show this in two places (admiral vignettes and pharmaverse examples). In the later case I would reduce the number of admiral function calls and focus on those where other packages are used like checks or writing xpt files or those where other packages provide alternative functions like deriving grouping variables.

adam/adsl.qmd Outdated
Now we have the base dataset, we can start to create some variables.
There are a few options to create grouping variables and their corresponding numeric variables.

Option 1: We can start with creating the subgroups using the controlled terminology, in this case `AGEGR1`.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

At least "Option 1" should be bold.

@bms63
Copy link
Copy Markdown
Collaborator

bms63 commented Jan 28, 2025

Is it possible to add a TOC to the pages like in the admiral vignettes?

@Fanny-Gautier I think this is definitely needed

Do we need to repeat so much information from the admiral vignettes? It's not clear to me what we want to show. Do we want to show how to create an ADSL or ADVS dataset or how admiral and other pharmaverse packages work together? In the former case I wonder why we show this in two places (admiral vignettes and pharmaverse examples). In the later case I would reduce the number of admiral function calls and focus on those where other packages are used like checks or writing xpt files or those where other packages provide alternative functions like deriving grouping variables.

Yes, primary goal is to show how the different packages work together. Secondary goal is to have more ready to go examples for teaching workshops.

I think expanding the script is handy especially as @Fanny-Gautier has created a more robust specification file for the two datasets - we could handwave away/hide some of the derivations and say see the full script if it is indeed too wordy. TBD!

Understood on we are repeating information here, but folks coming to this site I would think would like having the full script available to them rather than an abbreviated script and then have to go to admiral to get more derivations/information on that dataset. Maintaining alignment is something giving me anxiety.

Regarding workshop goal - for ADSL we found a lot of stuff was pretty out of date and spec was pretty barebones. This update really brings stuff up to date for us. Hopefully, if someone wants to teach another workshop on programming ADSL from a spec to xpt file it will be almost 100% ready to go.

Happy to keep discussing!! Thanks for the feedback

@rossfarrugia
Copy link
Copy Markdown
Contributor

Hi all, once all the above review comments are resolved I'm happy for this one to be approved/merged. I only had chance to review high level but I understand the perspective of having more "workshop-ready" examples, and this is something I also hear reflected in feedback from Posit colleagues. Thanks @Fanny-Gautier for all the efforts!! 🌟

@rossfarrugia
Copy link
Copy Markdown
Contributor

@Fanny-Gautier as per chat today please name the specs file with "safety_specs" rather than ADSL, ADVS so that i can then add ADAE later in same file

Fanny-Gautier and others added 2 commits February 25, 2025 16:17
Co-authored-by: Stefan Bundfuss <80953585+bundfussr@users.noreply.github.com>
Co-authored-by: Stefan Bundfuss <80953585+bundfussr@users.noreply.github.com>
@Fanny-Gautier
Copy link
Copy Markdown
Collaborator Author

@jimrothstein Thanks a lot for your comments. Please find below my answers

  • harmonize ?? You mean merging, mapping, comparing, identifying? .... 2 different things into one?

harmonized means consistent metadata/specifications object

  • I assume SAS people understand this, I don't

This is more a CDISC's standard: There are the main data domains (= Parent in our example e.g. DM) which contain pre-defined and standard variables. New variables which are not as per standard cannot be added to a data domain. If a user has additional data for a domain which cannot be entered into the domain using the standard SDTM variables, then a supplemental qualifier dataset must be used (SUPPDM in our example).

  • Another excellent description, though do not know what controlled terminology means.

Controlled Terminology is the set of codelists and valid values used with data items within CDISC-defined datasets. Controlled Terminology provides the values required for submission to FDA and PMDA in CDISC-compliant datasets. Controlled Terminology does not tell you WHAT to collect; it tells you IF you collected a particular data item, how you should submit it in your electronic dataset.

  • In line 102, change , (comma) to and

The function takes in the previously created {metacore} object a reference variable which is in our case AGE and the name of the sub-grouped variable which is here AGEGR1. Should it be rephrased?

@Fanny-Gautier
Copy link
Copy Markdown
Collaborator Author

All good for now (Ben's comment to compare the options using lorgx might be implemented later: @rossfarrugia the PR is ready for your review. Thanks

@rossfarrugia rossfarrugia merged commit ca4a508 into main Mar 4, 2025
2 checks passed
@rossfarrugia rossfarrugia deleted the 73_add_adam_example_ADVS_ADSL branch March 4, 2025 13:36
@rossfarrugia
Copy link
Copy Markdown
Contributor

Thanks @Fanny-Gautier for all the efforts here! I've merged now. Once Jeff's PR merges and I add the ADAE example then I'll post in pharmaverse slack to announce to the community we now have a better set of ADaM examples.

@bms63
Copy link
Copy Markdown
Collaborator

bms63 commented Mar 4, 2025

@Fanny-Gautier many thanks for driving this through from the R/Pharma workshop. Thank you @rossfarrugia and @bundfussr for helping with review and great discussion!! Looking forward to ADAE!

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.

ADaM example for ADVS and update ADSL (as being used for upcoming R/Pharma workshop)

6 participants