Skip to content

Commit

Permalink
Merge branch 'main' into teal_data@main
Browse files Browse the repository at this point in the history
  • Loading branch information
gogonzo committed Oct 17, 2023
2 parents 354a79d + ebbf7a6 commit 0185fb7
Show file tree
Hide file tree
Showing 27 changed files with 682 additions and 28 deletions.
2 changes: 2 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,5 @@ repos:
\.github/.*\.yaml|
data/.*
)$
- id: no-browser-statement
name: Check for browser() statement
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Type: Package
Package: teal
Title: Exploratory Web Apps for Analyzing Clinical Trials Data
Version: 0.14.0.9009
Date: 2023-09-20
Version: 0.14.0.9012
Date: 2023-10-13
Authors@R: c(
person("Dawid", "Kaledkowski", , "[email protected]", role = c("aut", "cre")),
person("Pawel", "Rucki", , "[email protected]", role = "aut"),
Expand Down
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export(init)
export(module)
export(modules)
export(new_tdata)
export(report_card_template)
export(reporter_previewer_module)
export(show_rcode_modal)
export(srv_teal_with_splash)
Expand Down
2 changes: 1 addition & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# teal 0.14.0.9009
# teal 0.14.0.9012

### Miscellaneous

Expand Down
31 changes: 31 additions & 0 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,34 @@ teal_data_to_filtered_data <- function(x) { # nolint
check = FALSE
)
}

#' Template Function for `TealReportCard` Creation and Customization
#'
#' This function generates a report card with a title,
#' an optional description, and the option to append the filter state list.
#'
#' @param title (`character(1)`) title of the card (unless overwritten by label)
#' @param label (`character(1)`) label provided by the user when adding the card
#' @param description (`character(1)`) optional additional description
#' @param with_filter (`logical(1)`) flag indicating to add filter state
#' @param filter_panel_api (`FilterPanelAPI`) object with API that allows the generation
#' of the filter state in the report
#'
#' @return (`TealReportCard`) populated with a title, description and filter state
#'
#' @export
report_card_template <- function(title, label, description = NULL, with_filter, filter_panel_api) {
checkmate::assert_string(title)
checkmate::assert_string(label)
checkmate::assert_string(description, null.ok = TRUE)
checkmate::assert_flag(with_filter)
checkmate::assert_class(filter_panel_api, classes = "FilterPanelAPI")

card <- teal::TealReportCard$new()
title <- if (label == "") title else label
card$set_name(title)
card$append_text(title, "header2")
if (!is.null(description)) card$append_text(description, "header3")
if (with_filter) card$append_fs(filter_panel_api$get_filter_state())
card
}
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# `teal`: Interactive Exploratory Data Analysis with Shiny Web-Applications <a href='https://insightsengineering.github.io/teal/'><img src="man/figures/teal.png" align="right" height="139" style="max-width: 100%;"/></a >
# `teal`: Interactive Exploratory Data Analysis with Shiny Web-Applications <a href='https://insightsengineering.github.io/teal/'><img src="man/figures/teal.png" align="right" height="139" style="max-width: 100%; max-height: 139px;"/></a >

<!-- start badges -->
[![Check 🛠](https://github.com/insightsengineering/teal/actions/workflows/check.yaml/badge.svg)](https://insightsengineering.github.io/teal/main/unit-test-report/)
Expand Down Expand Up @@ -105,7 +105,7 @@ shinyApp(app$ui, app$server)

Please see [`teal.gallery`](https://insightsengineering.github.io/teal.gallery) and [TLG Catalog](https://insightsengineering.github.io/tlg-catalog) to see examples of `teal` apps.

Please start with the ["Getting Started" article](https://insightsengineering.github.io/teal/latest-tag/articles/teal.html) and then other [package vignettes](https://insightsengineering.github.io/teal/articles/index.html) for more detailed guide.
Please start with the ["Technical Blueprint" article](https://insightsengineering.github.io/teal/latest-tag/articles/blueprint/index.html), ["Getting Started" article](https://insightsengineering.github.io/teal/latest-tag/articles/teal.html), and then other [package vignettes](https://insightsengineering.github.io/teal/latest-tag/articles/index.html) for more detailed guide.

## Getting help

Expand Down
91 changes: 68 additions & 23 deletions _pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ template:

navbar:
structure:
left: [intro, reference, articles, tutorials, news, reports]
left: [intro, reference, articles, blueprint, tutorials, news, reports]
right: [search, github]
components:
reports:
Expand All @@ -16,33 +16,77 @@ navbar:
href: coverage-report/
- text: Unit test report
href: unit-test-report/
blueprint:
text: Technical Blueprint
menu:
- text: About Blueprint
href: articles/blueprint/index.html
- text: Introduction
href: articles/blueprint/intro.html
- text: Actors
href: articles/blueprint/actors.html
- text: Data Flow
href: articles/blueprint/dataflow.html
- text: Product Map
href: articles/blueprint/products_map.html
- text: Features
navbar: Features
- text: "`qenv`"
href: articles/blueprint/qenv.html
- text: Filter Panel
href: articles/blueprint/filter_panel.html
- text: Delayed Data Loading (DDL)
href: articles/blueprint/ddl.html
- text: Module and Encapsulation
href: articles/blueprint/module_encapsulation.html

github:
icon: fa-github
href: https://github.com/insightsengineering/teal

articles:
- title: Get Started
navbar: ~
contents:
- teal
- title: Articles
navbar: Using teal
contents:
- filter-panel
- teal-options
- teal-bs-themes
- title: Articles
navbar: Data in teal Apps
contents:
- including-adam-data-in-teal
- including-general-data-in-teal
- including-mae-data-in-teal
- preprocessing-data
- title: Articles
navbar: Extending teal
contents:
- creating-custom-modules
- adding-support-for-reporting
- title: Get Started
navbar: ~
contents:
- teal
- title: Using teal
navbar: Using teal
contents:
- filter-panel
- teal-options
- teal-bs-themes
- title: Data in teal Apps
navbar: Data in teal Apps
contents:
- including-adam-data-in-teal
- including-general-data-in-teal
- including-mae-data-in-teal
- preprocessing-data
- title: Extending teal
navbar: Extending teal
contents:
- creating-custom-modules
- adding-support-for-reporting
- title: 📃 Technical Blueprint
desc: >
The purpose of the blueprint is to aid new developer’s comprehension of the
fundamental principles of the `teal` framework. We will explore crucial `teal`
concepts such as data flow, actors, and filter panel, among others.
contents:
- blueprint/index
- blueprint/intro
- blueprint/actors
- blueprint/dataflow
- blueprint/products_map
- title: ""
desc: >
Features
contents:
- blueprint/qenv
- blueprint/filter_panel
- blueprint/ddl
- blueprint/module_encapsulation


reference:
- title: Core `teal` Functions
Expand All @@ -62,6 +106,7 @@ reference:
contents:
- reporter_previewer_module
- TealReportCard
- report_card_template
- title: Functions for Module Developers
contents:
- tdata
Expand Down
10 changes: 10 additions & 0 deletions inst/WORDLIST
Original file line number Diff line number Diff line change
@@ -1,20 +1,30 @@
ADaM
CDISC
DDL
Forkers
Hoffmann
MultiAssayExperiment
Pre
Reproducibility
TLG
Theming
UI
UIs
UX
analysing
cloneable
customizable
dropdown
funder
omics
pharmaverse
pre
preprocessed
programmatically
qenv
repo
reproducibility
summarization
tabsetted
themer
uncheck
Binary file added man/figures/filterpanel.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added man/figures/notification.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added man/figures/reporter.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added man/figures/showrcode.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified man/figures/teal.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
33 changes: 33 additions & 0 deletions man/report_card_template.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 26 additions & 0 deletions tests/testthat/test-utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,29 @@ testthat::test_that("get_teal_bs_theme", {
testthat::expect_warning(get_teal_bs_theme(), "the default shiny bootstrap is used")
})
})

testthat::test_that("report_card_template function returns TealReportCard object with appropriate content and labels", {
fd <- teal.slice::init_filtered_data(list(iris = list(dataset = iris)))
filter_panel_api <- teal.slice::FilterPanelAPI$new(fd)

card <- shiny::isolate(report_card_template(
title = "Card title",
label = "Card label",
description = "Sample description",
with_filter = TRUE,
filter_panel_api = filter_panel_api
))
testthat::expect_s3_class(card, c("TealReportCard"))
testthat::expect_equal(card$get_name(), "Card label")
testthat::expect_length(card$get_content(), 4)

card <- shiny::isolate(report_card_template(
title = "Card title",
label = "",
with_filter = FALSE,
filter_panel_api = filter_panel_api
))
testthat::expect_s3_class(card, c("TealReportCard"))
testthat::expect_equal(card$get_name(), "Card title")
testthat::expect_length(card$get_content(), 1)
})
10 changes: 10 additions & 0 deletions vignettes/blueprint/_setup.Rmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

```{css, echo=FALSE}
pre.mermaid {
background: transparent;
}
```

```{r, echo=FALSE}
shiny::tags$script(type = "module", "import mermaid from 'https://cdn.jsdelivr.net/npm/mermaid/+esm'")
```
Loading

0 comments on commit 0185fb7

Please sign in to comment.