-
Notifications
You must be signed in to change notification settings - Fork 15
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
Changes from 12 commits
08181de
3fa8b91
19cb2fc
99db239
038a216
06de02a
22f693c
04da339
66d30f0
77c1b17
7fa02c8
7587ba6
ec97091
252e7d7
262f5d9
f681b47
f01e5b7
b6a66d0
de0973e
adaa0d6
bd691b1
6bc2cd1
59484bf
7f0a5de
e87c843
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -24,3 +24,4 @@ | |
| ^cran-comments\.md$ | ||
| ^.devcontainer$ | ||
| ^revdep | ||
| ^vignettes/articles$ | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| --- | ||
| title: "Preview of SDTM Datasets" | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Suggest to rename to: "Explore SDTM Datasets" - similar in style to the admiral templates page. in general the more we can match the style of this page, the better. |
||
| date: "2026-01-17" | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No need for the date here I think? |
||
| output: rmarkdown::html_vignette | ||
| vignette: > | ||
| %\VignetteIndexEntry{Preview of 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. | ||
|
Gero1999 marked this conversation as resolved.
Outdated
|
||
|
|
||
| ```{r echo=FALSE} | ||
| library(pharmaversesdtm) | ||
| library(htmltools) | ||
| library(reactable) | ||
| library(yaml) | ||
|
|
||
| specs_yml <- yaml::read_yaml(system.file("extdata/sdtms-specs.json", package = "pharmaversesdtm")) | ||
|
Fanny-Gautier marked this conversation as resolved.
Outdated
|
||
| specs_yml <- specs_yml$`sdtms-specs` | ||
|
|
||
| # Group datasets by therapeutic area | ||
|
Fanny-Gautier marked this conversation as resolved.
|
||
| areas <- sort(unique(sapply(specs_yml, function(x) x$therapeutic_area))) | ||
|
|
||
| collapsible_groups <- lapply(areas, function(area) { | ||
| # Indices of datasets in this area | ||
| area_indices <- which(sapply(specs_yml, function(x) x$therapeutic_area) == area) | ||
| # 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( | ||
| tags$summary(paste0(dataset_name, ": ", dataset_title)), | ||
| reactable::reactable( | ||
|
Fanny-Gautier marked this conversation as resolved.
Outdated
|
||
| head(dataset, 50), | ||
| filterable = TRUE, | ||
| pagination = TRUE, | ||
| defaultPageSize = 5, | ||
| pageSizeOptions = c(5, 10, 25, 50), | ||
| showPageSizeOptions = TRUE | ||
| ) | ||
| ) | ||
| }) | ||
| tagList(tags$h3(area), area_panels) | ||
| }) | ||
|
|
||
| htmltools::browsable(tagList(collapsible_groups)) | ||
|
Fanny-Gautier marked this conversation as resolved.
Outdated
|
||
| ``` | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggest to move to the left of the changelog