Skip to content

Commit

Permalink
Merge pull request #157 from OHDSI/issue_154
Browse files Browse the repository at this point in the history
test summary
  • Loading branch information
catalamarti authored Oct 13, 2024
2 parents be94ef7 + 847773a commit c69389d
Show file tree
Hide file tree
Showing 13 changed files with 137 additions and 35 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ License: Apache License (>= 2)
Encoding: UTF-8
LazyData: true
RoxygenNote: 7.3.2
URL: https://oxford-pharmacoepi.github.io/omopViewer/
URL: https://OHDSI.github.io/omopViewer/
Depends:
R (>= 2.10)
Imports:
Expand Down
2 changes: 1 addition & 1 deletion R/about.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ createAbout <- function(logo) {
"This shiny app was generated with ",
shiny::a(
"omopViewer",
href = "https://github.com/oxford-pharmacoepi/omopViewer",
href = "https://github.com/OHDSI/omopViewer",
target = "_blank"
),
shiny::strong("v{as.character(utils::packageVersion("omopViewer"))}")
Expand Down
2 changes: 1 addition & 1 deletion R/appDynamic.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ launchDynamicApp <- function() {
}

createDynamicUi <- function(choices) {
logo <- "https://oxford-pharmacoepi.github.io/Oxinfer/images/hds_logo_noline.svg"
logo <- "https://OHDSI.github.io/Oxinfer/images/hds_logo_noline.svg"
c(
'bslib::page_navbar(',
c(
Expand Down
16 changes: 13 additions & 3 deletions R/summary.R
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ resultVersions <- function(result) {
x <- sets |>
dplyr::group_by(.data$package_name, .data$package_version) |>
dplyr::summarise(
result_ids = paste0(.data$result_id, collapse = "; "),
result_ids = glue::glue_collapse(.data$result_id, sep = ", ", last = " and "),
.groups = "drop"
) |>
dplyr::inner_join(
Expand All @@ -76,10 +76,19 @@ resultVersions <- function(result) {
dplyr::mutate(message = paste0(
dplyr::if_else(.data$n > 1, "x", "v"),
"- **", .data$package_name, "** ", .data$package_version,
dplyr::if_else(.data$n > 1, paste0(": ", .data$result_ids), "")
" in result_id(s): ", .data$result_ids
))

c("### Package versions", x$message)
mes <- x$message
if (nrow(x) > 0) {
if (substr(mes[1], 1, 1) == "x") mes <- c("", "Inconsistent versions:", mes)
id <- which(substr(mes, 1, 1) == "v")[1]
if (!is.na(id)) {
mes <- subs(mes, mes[id], c("", "Consistent versions:", mes[id]))
}
}

c("### Package versions", mes)
}
resultSuppression <- function(result) {
sets <- omopgenerics::settings(result)
Expand Down Expand Up @@ -118,6 +127,7 @@ createBody <- function(x) {
}
return(xx)
}) |>
paste0(collapse = "\n") |>
shiny::markdown()
}

Expand Down
8 changes: 4 additions & 4 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ knitr::opts_chunk$set(
# omopViewer

<!-- badges: start -->
[![R-CMD-check](https://github.com/oxford-pharmacoepi/omopViewer/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/oxford-pharmacoepi/omopViewer/actions/workflows/R-CMD-check.yaml)
[![R-CMD-check](https://github.com/OHDSI/omopViewer/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/OHDSI/omopViewer/actions/workflows/R-CMD-check.yaml)
[![CRAN status](https://www.r-pkg.org/badges/version/omopViewer)](https://CRAN.R-project.org/package=omopViewer)
[![Lifecycle: experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://lifecycle.r-lib.org/articles/stages.html#experimental)
[![Codecov test coverage](https://codecov.io/gh/oxford-pharmacoepi/omopViewer/branch/main/graph/badge.svg)](https://app.codecov.io/gh/oxford-pharmacoepi/omopViewer?branch=main)
[![Codecov test coverage](https://codecov.io/gh/OHDSI/omopViewer/branch/main/graph/badge.svg)](https://app.codecov.io/gh/OHDSI/omopViewer?branch=main)
<!-- badges: end -->

> [!IMPORTANT]
Expand All @@ -29,11 +29,11 @@ The goal of omopViewer is to allow the user to easily create Shiny Apps to visua

## Installation

You can install the development version of omopViewer from [GitHub](https://github.com/oxford-pharmacoepi/omopViewer) with:
You can install the development version of omopViewer from [GitHub](https://github.com/OHDSI/omopViewer) with:

``` {r, eval = FALSE}
install.packages("pak")
pak::pkg_install("oxford-pharmacoepi/omopViewer")
pak::pkg_install("OHDSI/omopViewer")
```

## Main functionalities
Expand Down
23 changes: 10 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,30 @@

<!-- badges: start -->

[![R-CMD-check](https://github.com/oxford-pharmacoepi/omopViewer/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/oxford-pharmacoepi/omopViewer/actions/workflows/R-CMD-check.yaml)
[![R-CMD-check](https://github.com/OHDSI/omopViewer/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/OHDSI/omopViewer/actions/workflows/R-CMD-check.yaml)
[![CRAN
status](https://www.r-pkg.org/badges/version/omopViewer)](https://CRAN.R-project.org/package=omopViewer)
[![Lifecycle:
experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://lifecycle.r-lib.org/articles/stages.html#experimental)
[![Codecov test
coverage](https://codecov.io/gh/oxford-pharmacoepi/omopViewer/branch/main/graph/badge.svg)](https://app.codecov.io/gh/oxford-pharmacoepi/omopViewer?branch=main)
coverage](https://codecov.io/gh/OHDSI/omopViewer/branch/main/graph/badge.svg)](https://app.codecov.io/gh/OHDSI/omopViewer?branch=main)
<!-- badges: end -->

> [!IMPORTANT]
> This package is under construction and this is just a first Beta release,
> please use it carefully and report any issue that you encounter using it.
> \[!IMPORTANT\] This package is under construction and this is just a
> first Beta release, please use it carefully and report any issue that
> you encounter using it.
The goal of omopViewer is to allow the user to easily create Shiny Apps
to visualise study results in `<summarised_result>` format.

## Installation

You can install the development version of omopViewer from
[GitHub](https://github.com/oxford-pharmacoepi/omopViewer) with:
[GitHub](https://github.com/OHDSI/omopViewer) with:

``` r
install.packages("pak")
pak::pkg_install("oxford-pharmacoepi/omopViewer")
pak::pkg_install("OHDSI/omopViewer")
```

## Main functionalities
Expand All @@ -53,17 +53,14 @@ cdm <- mockCohortCharacteristics()
#> Note: method with signature 'DBIConnection#Id' chosen for function 'dbExistsTable',
#> target signature 'duckdb_connection#Id'.
#> "duckdb_connection#ANY" would also be valid
#> ! cohort columns will be reordered to match the expected order:
#> cohort_definition_id, subject_id, cohort_start_date, and cohort_end_date.
#> ! cohort columns will be reordered to match the expected order:
#> cohort_definition_id, subject_id, cohort_start_date, and cohort_end_date.
result <- summariseCharacteristics(cdm$cohort1) |>
bind(summariseCohortAttrition(cdm$cohort1))
#> ℹ adding demographics columns
#> ℹ summarising data
#> ✔ summariseCharacteristics finished!

exportStaticApp(result = result)
#> ℹ shiny folder will be overwritten.
#> ℹ Processing data
#> ✔ Data processed: 2 result types idenfied: `summarise_characteristics` and
#> `summarise_cohort_attrition`.
Expand All @@ -85,8 +82,8 @@ launchDynamicApp()

- `tidyData` is an experimental version of the `tidy.summarised_result`
method defined in **visOmopResults**.
- `omopViewerTable` is an experimental version of the `visOmopTable` function
defined in **visOmopResults**.
- `omopViewerTable` is an experimental version of the `visOmopTable`
function defined in **visOmopResults**.
- `filterData` is a function used internally in the package to subset
the result. It is not meant to be for user use. It is exported because
it is used in the *exportStaticApp()* function.
2 changes: 1 addition & 1 deletion _pkgdown.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
url: https://oxford-pharmacoepi.github.io/omopViewer/
url: https://OHDSI.github.io/omopViewer/
template:
bootstrap: 5

2 changes: 1 addition & 1 deletion man/omopViewer-package.Rd

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

12 changes: 6 additions & 6 deletions tests/testthat/_snaps/appStatic.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"This shiny app was generated with ",
shiny::a(
"omopViewer",
href = "https://github.com/oxford-pharmacoepi/omopViewer",
href = "https://github.com/OHDSI/omopViewer",
target = "_blank"
),
shiny::strong("v0.0.0.900")
Expand Down Expand Up @@ -90,7 +90,7 @@
"This shiny app was generated with ",
shiny::a(
"omopViewer",
href = "https://github.com/oxford-pharmacoepi/omopViewer",
href = "https://github.com/OHDSI/omopViewer",
target = "_blank"
),
shiny::strong("v0.0.0.900")
Expand Down Expand Up @@ -168,7 +168,7 @@
"This shiny app was generated with ",
shiny::a(
"omopViewer",
href = "https://github.com/oxford-pharmacoepi/omopViewer",
href = "https://github.com/OHDSI/omopViewer",
target = "_blank"
),
shiny::strong("v0.0.0.900")
Expand Down Expand Up @@ -823,7 +823,7 @@
"This shiny app was generated with ",
shiny::a(
"omopViewer",
href = "https://github.com/oxford-pharmacoepi/omopViewer",
href = "https://github.com/OHDSI/omopViewer",
target = "_blank"
),
shiny::strong("v0.0.0.900")
Expand Down Expand Up @@ -1478,7 +1478,7 @@
"This shiny app was generated with ",
shiny::a(
"omopViewer",
href = "https://github.com/oxford-pharmacoepi/omopViewer",
href = "https://github.com/OHDSI/omopViewer",
target = "_blank"
),
shiny::strong("v0.0.0.900")
Expand Down Expand Up @@ -2137,7 +2137,7 @@
"This shiny app was generated with ",
shiny::a(
"omopViewer",
href = "https://github.com/oxford-pharmacoepi/omopViewer",
href = "https://github.com/OHDSI/omopViewer",
target = "_blank"
),
shiny::strong("v0.0.0.900")
Expand Down
6 changes: 3 additions & 3 deletions tests/testthat/_snaps/packagesSupported.md
Original file line number Diff line number Diff line change
Expand Up @@ -1281,7 +1281,7 @@
"This shiny app was generated with ",
shiny::a(
"omopViewer",
href = "https://github.com/oxford-pharmacoepi/omopViewer",
href = "https://github.com/OHDSI/omopViewer",
target = "_blank"
),
shiny::strong("v0.0.0.900")
Expand Down Expand Up @@ -3152,7 +3152,7 @@
"This shiny app was generated with ",
shiny::a(
"omopViewer",
href = "https://github.com/oxford-pharmacoepi/omopViewer",
href = "https://github.com/OHDSI/omopViewer",
target = "_blank"
),
shiny::strong("v0.0.0.900")
Expand Down Expand Up @@ -3910,7 +3910,7 @@
"This shiny app was generated with ",
shiny::a(
"omopViewer",
href = "https://github.com/oxford-pharmacoepi/omopViewer",
href = "https://github.com/OHDSI/omopViewer",
target = "_blank"
),
shiny::strong("v0.0.0.900")
Expand Down
61 changes: 61 additions & 0 deletions tests/testthat/_snaps/summary.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# test cardSummary

Code
displayOutput(x)
Output
<div class="card bslib-card bslib-mb-spacing html-fill-item html-fill-container" data-bslib-card-init data-require-bs-caller="card()" data-require-bs-version="5">
<div class="card-header">Results summary</div>
<div class="card-body bslib-gap-spacing html-fill-item html-fill-container" style="margin-top:auto;margin-bottom:auto;flex:1 1 auto;">
<h3>Result overview</h3>
<ul>
<li>Results contain <strong>0</strong> rows with <strong>0</strong> different result_ids.</li>
<li>Results contain <strong>0</strong> different result types: ``.</li>
<li>Results contain data from <strong>0</strong> different cdm objects: &quot;**&quot;.</li>
</ul>
<h3>Package versions</h3>
<h3>Result suppression</h3>
<h3>Explore settings</h3>
<div class="datatables html-widget html-fill-item" id="htmlwidget-54fc7ec149945f3f3c9a" style="width:100%;height:auto;"></div>
<script type="application/json" data-for="htmlwidget-54fc7ec149945f3f3c9a">{"x":{"filter":"top","vertical":false,"filterHTML":"<tr>\n <td data-type=\"integer\" style=\"vertical-align: top;\">\n <div class=\"form-group has-feedback\" style=\"margin-bottom: auto;\">\n <input type=\"search\" placeholder=\"All\" class=\"form-control\" style=\"width: 100%;\" disabled=\"\"/>\n <span class=\"glyphicon glyphicon-remove-circle form-control-feedback\"><\/span>\n <\/div>\n <div style=\"display: none;position: absolute;width: 200px;opacity: 1\">\n <div data-min=\"0\" data-max=\"1\"><\/div>\n <span style=\"float: left;\"><\/span>\n <span style=\"float: right;\"><\/span>\n <\/div>\n <\/td>\n <td data-type=\"character\" style=\"vertical-align: top;\">\n <div class=\"form-group has-feedback\" style=\"margin-bottom: auto;\">\n <input type=\"search\" placeholder=\"All\" class=\"form-control\" style=\"width: 100%;\" disabled=\"\"/>\n <span class=\"glyphicon glyphicon-remove-circle form-control-feedback\"><\/span>\n <\/div>\n <\/td>\n <td data-type=\"character\" style=\"vertical-align: top;\">\n <div class=\"form-group has-feedback\" style=\"margin-bottom: auto;\">\n <input type=\"search\" placeholder=\"All\" class=\"form-control\" style=\"width: 100%;\" disabled=\"\"/>\n <span class=\"glyphicon glyphicon-remove-circle form-control-feedback\"><\/span>\n <\/div>\n <\/td>\n <td data-type=\"character\" style=\"vertical-align: top;\">\n <div class=\"form-group has-feedback\" style=\"margin-bottom: auto;\">\n <input type=\"search\" placeholder=\"All\" class=\"form-control\" style=\"width: 100%;\" disabled=\"\"/>\n <span class=\"glyphicon glyphicon-remove-circle form-control-feedback\"><\/span>\n <\/div>\n <\/td>\n<\/tr>","data":[[],[],[],[]],"container":"<table class=\"display\">\n <thead>\n <tr>\n <th>result_id<\/th>\n <th>result_type<\/th>\n <th>package_name<\/th>\n <th>package_version<\/th>\n <\/tr>\n <\/thead>\n<\/table>","options":{"scrollX":true,"columnDefs":[{"className":"dt-right","targets":0},{"name":"result_id","targets":0},{"name":"result_type","targets":1},{"name":"package_name","targets":2},{"name":"package_version","targets":3}],"order":[],"autoWidth":false,"orderClasses":false,"orderCellsTop":true},"selection":{"mode":"multiple","selected":null,"target":"row","selectable":null}},"evals":[],"jsHooks":[]}</script>
</div>
<script data-bslib-card-init>bslib.Card.initializeAllCards();</script>
</div>

---

Code
displayOutput(x)
Output
<div class="card bslib-card bslib-mb-spacing html-fill-item html-fill-container" data-bslib-card-init data-require-bs-caller="card()" data-require-bs-version="5">
<div class="card-header">Results summary</div>
<div class="card-body bslib-gap-spacing html-fill-item html-fill-container" style="margin-top:auto;margin-bottom:auto;flex:1 1 auto;">
<h3>Result overview</h3>
<ul>
<li>Results contain <strong>3</strong> rows with <strong>3</strong> different result_ids.</li>
<li>Results contain <strong>2</strong> different result types: <code>counts</code> and <code>sums</code>.</li>
<li>Results contain data from <strong>2</strong> different cdm objects: &quot;<em>mock</em>&quot; and &quot;<em>eunomia</em>&quot;.</li>
</ul>
<h3>Package versions</h3>
<p>Inconsistent versions:</p>
<ul>
<li><span style="color:red"> <strong>omopViewer</strong> 0.1.0 in result_id(s): 1</span></li>
<li><span style="color:red"> <strong>omopViewer</strong> 0.2.0 in result_id(s): 2</span></li>
</ul>
<p>Consistent versions:</p>
<ul>
<li><span style="color:green"> <strong>omopgenerics</strong> 1.0.0 in result_id(s): 3</span></li>
</ul>
<h3>Result suppression</h3>
<ul>
<li><span style="color:red"> <strong>2</strong> not suppressed results.</span></li>
<li><span style="color:green"> <strong>1</strong> suppressed results at minCellCount = <code>5</code>.</span></li>
</ul>
<h3>Explore settings</h3>
<div class="datatables html-widget html-fill-item" id="htmlwidget-56c06f4b75099cd2bc2f" style="width:100%;height:auto;"></div>
<script type="application/json" data-for="htmlwidget-56c06f4b75099cd2bc2f">{"x":{"filter":"top","vertical":false,"filterHTML":"<tr>\n <td data-type=\"integer\" style=\"vertical-align: top;\">\n <div class=\"form-group has-feedback\" style=\"margin-bottom: auto;\">\n <input type=\"search\" placeholder=\"All\" class=\"form-control\" style=\"width: 100%;\"/>\n <span class=\"glyphicon glyphicon-remove-circle form-control-feedback\"><\/span>\n <\/div>\n <div style=\"display: none;position: absolute;width: 200px;opacity: 1\">\n <div data-min=\"1\" data-max=\"3\"><\/div>\n <span style=\"float: left;\"><\/span>\n <span style=\"float: right;\"><\/span>\n <\/div>\n <\/td>\n <td data-type=\"character\" style=\"vertical-align: top;\">\n <div class=\"form-group has-feedback\" style=\"margin-bottom: auto;\">\n <input type=\"search\" placeholder=\"All\" class=\"form-control\" style=\"width: 100%;\"/>\n <span class=\"glyphicon glyphicon-remove-circle form-control-feedback\"><\/span>\n <\/div>\n <\/td>\n <td data-type=\"number\" style=\"vertical-align: top;\">\n <div class=\"form-group has-feedback\" style=\"margin-bottom: auto;\">\n <input type=\"search\" placeholder=\"All\" class=\"form-control\" style=\"width: 100%;\"/>\n <span class=\"glyphicon glyphicon-remove-circle form-control-feedback\"><\/span>\n <\/div>\n <div style=\"display: none;position: absolute;width: 200px;opacity: 1\">\n <div data-min=\"1\" data-max=\"5\"><\/div>\n <span style=\"float: left;\"><\/span>\n <span style=\"float: right;\"><\/span>\n <\/div>\n <\/td>\n <td data-type=\"character\" style=\"vertical-align: top;\">\n <div class=\"form-group has-feedback\" style=\"margin-bottom: auto;\">\n <input type=\"search\" placeholder=\"All\" class=\"form-control\" style=\"width: 100%;\"/>\n <span class=\"glyphicon glyphicon-remove-circle form-control-feedback\"><\/span>\n <\/div>\n <\/td>\n <td data-type=\"character\" style=\"vertical-align: top;\">\n <div class=\"form-group has-feedback\" style=\"margin-bottom: auto;\">\n <input type=\"search\" placeholder=\"All\" class=\"form-control\" style=\"width: 100%;\"/>\n <span class=\"glyphicon glyphicon-remove-circle form-control-feedback\"><\/span>\n <\/div>\n <\/td>\n<\/tr>","data":[[1,2,3],["counts","counts","sums"],[null,1,5],["omopViewer","omopViewer","omopgenerics"],["0.1.0","0.2.0","1.0.0"]],"container":"<table class=\"display\">\n <thead>\n <tr>\n <th>result_id<\/th>\n <th>result_type<\/th>\n <th>min_cell_count<\/th>\n <th>package_name<\/th>\n <th>package_version<\/th>\n <\/tr>\n <\/thead>\n<\/table>","options":{"scrollX":true,"columnDefs":[{"className":"dt-right","targets":[0,2]},{"name":"result_id","targets":0},{"name":"result_type","targets":1},{"name":"min_cell_count","targets":2},{"name":"package_name","targets":3},{"name":"package_version","targets":4}],"order":[],"autoWidth":false,"orderClasses":false,"orderCellsTop":true},"selection":{"mode":"multiple","selected":null,"target":"row","selectable":null}},"evals":[],"jsHooks":[]}</script>
</div>
<script data-bslib-card-init>bslib.Card.initializeAllCards();</script>
</div>

Loading

0 comments on commit c69389d

Please sign in to comment.