-
Notifications
You must be signed in to change notification settings - Fork 14
Closes #146: Interactive exploration of datasets vignette in website #227
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
Merged
Lina2689
merged 25 commits into
main
from
146-documentation-allow-interactive-exploration-of-datasets-in-vignette
Feb 19, 2026
Merged
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
08181de
add vignette & link pkgdown
Gero1999 3fa8b91
build-ignore articles folder
Gero1999 19cb2fc
Add DT and rlang to DESCRIPTION dependencies
jimrothstein 99db239
Add rlang and DT libraries to vignette preview-sdtm.Rmd
jimrothstein 038a216
Add htmltools to DESCRIPTION dependencies
jimrothstein 06de02a
use reactable instead of DT
Gero1999 22f693c
use specs yaml to separate datasets by therapeutic area
Gero1999 04da339
description: add yaml, rm rlang in suggests
Gero1999 66d30f0
change vignette title to "Preview of SDTM Datasets"
Gero1999 77c1b17
load pharmaversesdtm pkg in vignette chunk
Gero1999 7fa02c8
Sort therapeutic areas in preview-sdtm.Rmd
Gero1999 7587ba6
apply suggestion for text
Gero1999 ec97091
update vignettes/articles/preview-sdtm.Rmd
Gero1999 252e7d7
apply suggestions from manciniedoardo & specify collapsibles style
Gero1999 262f5d9
news: inform of new vignette in Documentation
Gero1999 f681b47
mv vignette tab to the left of news
Gero1999 f01e5b7
propercase therapeutic area names & add reference links in collapsible
Gero1999 b6a66d0
readme: include top msg to preview vignette
Gero1999 de0973e
apply Fanny-Gautier suggestions & bump pkg version
Gero1999 adaa0d6
fix warning vignette & improve table readability
Gero1999 bd691b1
add author description
Gero1999 6bc2cd1
man: fix workflow fail, roxygenise
Gero1999 59484bf
fix: aut spelling
Gero1999 7f0a5de
rm line in NEWS, mv aut in DESCRIPTION
Gero1999 e87c843
sort datasets alphabetically within each area
Gero1999 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -24,3 +24,4 @@ | |
| ^cran-comments\.md$ | ||
| ^.devcontainer$ | ||
| ^revdep | ||
| ^vignettes/articles$ | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,77 @@ | ||
| --- | ||
| title: "Explore SDTM Datasets" | ||
| output: rmarkdown::html_vignette | ||
| vignette: > | ||
| %\VignetteIndexEntry{Explore SDTM Datasets} | ||
| %\VignetteEngine{knitr::rmarkdown} | ||
| %\VignetteEncoding{UTF-8} | ||
| --- | ||
|
|
||
| # Datasets Preview | ||
|
|
||
| Here is a preview of all datasets included in the `{pharmaversesdtm}` package. Organized by therapeutic area, each dataset is displayed in a collapsible panel with filtering options for easier exploration. For simplicity, only the first 50 rows of each dataset are shown. | ||
|
|
||
| ```{r echo=FALSE} | ||
| library(pharmaversesdtm) | ||
| library(htmltools) | ||
| library(reactable) | ||
| library(yaml) | ||
|
|
||
| specs_yml <- read_yaml(system.file("extdata/sdtms-specs.json", package = "pharmaversesdtm")) | ||
| specs_yml <- specs_yml$`sdtms-specs` | ||
|
|
||
| # Group datasets by therapeutic area | ||
Fanny-Gautier marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| areas <- sort(unique(sapply(specs_yml, function(x) x$therapeutic_area))) | ||
| propercase <- \(w) paste0(toupper(substr(w, 1, 1)), tolower(substring(w, 2))) | ||
|
|
||
| collapsible_groups <- lapply(areas, function(area) { | ||
| # Indices of datasets in this area, ordered alphabetically by name | ||
| area_indices <- which(sapply(specs_yml, function(x) x$therapeutic_area) == area) | ||
| order_indices <- order(sapply(specs_yml[area_indices], function(x) x$name)) | ||
| area_indices <- area_indices[order_indices] | ||
|
|
||
| # Create collapsibles for this area | ||
| area_panels <- lapply(area_indices, function(ix) { | ||
| dataset_name <- specs_yml[[ix]]$name | ||
| dataset_title <- specs_yml[[ix]]$label | ||
| # Ensure valid UTF-8 dataset content | ||
| dataset <- get(dataset_name, envir = asNamespace("pharmaversesdtm")) | ||
| if (is.data.frame(dataset)) { | ||
| for (col in names(dataset)) { | ||
| if (is.character(dataset[[col]])) { | ||
| dataset[[col]] <- iconv(dataset[[col]], to = "UTF-8", sub = "?") | ||
| } | ||
| } | ||
| } | ||
| tags$details( | ||
| style = "margin-bottom: 10px; border: 1px solid #ccc; border-radius: 5px; padding: 5px;", | ||
| tags$summary( | ||
| style = "cursor: pointer; font-weight: bold;", | ||
| paste0(dataset_name, ": ", dataset_title) | ||
| ), | ||
| tags$a( | ||
| href = paste0("https://pharmaverse.github.io/pharmaversesdtm/reference/", dataset_name, ".html"), | ||
| target = "_blank", | ||
| "Reference link" | ||
| ), | ||
| reactable( | ||
| head(dataset, 50), | ||
| defaultPageSize = 50, | ||
| height = 500, | ||
| filterable = TRUE, | ||
| pagination = TRUE, | ||
| wrap = FALSE, | ||
| resizable = TRUE, | ||
| striped = TRUE, | ||
| defaultColDef = colDef( | ||
| minWidth = 120, | ||
| align = "center" | ||
| ) | ||
| ) | ||
| ) | ||
| }) | ||
| tagList(tags$h3(propercase(area)), area_panels) | ||
| }) | ||
|
|
||
| browsable(tagList(collapsible_groups)) | ||
| ``` | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.