Skip to content

Commit

Permalink
Merge pull request #165 from OHDSI/issue_128
Browse files Browse the repository at this point in the history
Issue 128
  • Loading branch information
catalamarti authored Oct 14, 2024
2 parents 77e7ce3 + 341be85 commit 5de340f
Show file tree
Hide file tree
Showing 26 changed files with 155 additions and 159 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Package: omopViewer
Package: OmopViewer
Type: Package
Title: Visualise OMOP Results in a Shiny App
Version: 0.0.0.900
Expand Down
6 changes: 3 additions & 3 deletions R/about.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ createAbout <- function(logo) {
),
"This shiny app was generated with ",
shiny::a(
"omopViewer",
href = "https://github.com/OHDSI/omopViewer",
"OmopViewer",
href = "https://github.com/OHDSI/OmopViewer",
target = "_blank"
),
shiny::strong("v{as.character(utils::packageVersion("omopViewer"))}")
shiny::strong("v{as.character(utils::packageVersion("OmopViewer"))}")
)
)' |>
glue::glue() |>
Expand Down
6 changes: 3 additions & 3 deletions R/appDynamic.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ createDynamicUi <- function(choices) {
c(
'bslib::page_navbar(',
c(
pageTitle("omopViewer App", logo),
pageTitle("OmopViewer App", logo),
loadDataUi(),
createUi(choices),
'bslib::nav_spacer()',
Expand Down Expand Up @@ -174,13 +174,13 @@ messageProcessFiles <- function(x) {
}
mergeData <- function(newData, originalData) {
if (is.null(newData)) return(originalData)
id0 <- getOption("omopViewer.number_ids", 0L)
id0 <- getOption("OmopViewer.number_ids", 0L)
newData <- newData |>
dplyr::mutate(
id = .env$id0 + dplyr::row_number(),
upload_datetime = Sys.time() |> format("%Y-%m-%d %H:%M:%S")
)
options("omopViewer.number_ids" = id0 + nrow(newData))
options("OmopViewer.number_ids" = id0 + nrow(newData))
if (is.null(originalData)) {
return(newData)
} else {
Expand Down
6 changes: 3 additions & 3 deletions R/appStatic.R
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,8 @@ exportStaticApp <- function(result,
messageShiny <- function() {
c(
paste0(
"# Generated by omopViewer ",
as.character(utils::packageVersion("omopViewer"))
"# Generated by OmopViewer ",
as.character(utils::packageVersion("OmopViewer"))
),
"# Be careful editing this file",
""
Expand Down Expand Up @@ -179,7 +179,7 @@ logoPath <- function(logo) {
lowLogo <- stringr::str_to_lower(logo)
# add more logoKeywords in data-raw/internalData
if (lowLogo %in% logoKeywords) {
system.file(file.path("logos", paste0(lowLogo, "_logo.svg")), package = "omopViewer")
system.file(file.path("logos", paste0(lowLogo, "_logo.svg")), package = "OmopViewer")
} else {
logo
}
Expand Down
2 changes: 1 addition & 1 deletion R/background.R
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ createBackground <- function(background) {
'bslib::nav_panel(
title = "Background",
icon = shiny::icon("disease"),
omopViewer::cardFromMd("background.md")
OmopViewer::cardFromMd("background.md")
)'
}

Expand Down
2 changes: 1 addition & 1 deletion R/createServer.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ selectiseServer <- function(resultTypes, data) {
c(
'# fill selectise variables ----',
paste0('shiny::observe({
choices <- omopViewer::getChoices(', data, ', flatten = TRUE)
choices <- OmopViewer::getChoices(', data, ', flatten = TRUE)
for (k in seq_along(choices)) {
shiny::updateSelectizeInput(
session,
Expand Down
2 changes: 1 addition & 1 deletion R/panelFormatted.R
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ formattedServer <- function(rt, data) {
c(
'getFormattedData[formatCamel(rt)] <- shiny::reactive({
[data] |>
omopViewer::filterData("[rt]", input) |>
OmopViewer::filterData("[rt]", input) |>
[fun](
[args]
)
Expand Down
2 changes: 1 addition & 1 deletion R/panelPlot.R
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ plotsServer <- function(rt, data) {
plotServer <- purrr::map_chr(plots, \(id) {
c('createPlot[id] <- shiny::reactive({
result <- [data] |>
omopViewer::filterData("[rt]", input)
OmopViewer::filterData("[rt]", input)
[createPlotFunction(id)]
})',
'output$[rt]_plot_[id] <- [renderPlotFunction(id)]({
Expand Down
2 changes: 1 addition & 1 deletion R/panelRaw.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ downloadRawDataServer <- function(data) {
output$download_raw <- shiny::downloadHandler(
filename = "results.csv",
content = function(file) {
omopViewer::exportSummarisedResult([data], fileName = file)
OmopViewer::exportSummarisedResult([data], fileName = file)
}
)' |>
glue::glue(.open = "[", .close = "]") |>
Expand Down
4 changes: 2 additions & 2 deletions R/panelTidy.R
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ tidyUi <- function(tab) {
tidyServer <- function(rt, data) {
c(paste0('getTidyData', formatCamel(rt), ' <- shiny::reactive({
res <- ', data, ' |>
omopViewer::filterData("', rt, '", input) |>
omopViewer::tidyData()
OmopViewer::filterData("', rt, '", input) |>
OmopViewer::tidyData()
# columns to eliminate
colsEliminate <- colnames(res)
Expand Down
2 changes: 1 addition & 1 deletion R/summary.R
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,6 @@ summaryTab <- function(summary) {
'bslib::nav_panel(
title = "Summary",
icon = shiny::icon("file-alt"),
omopViewer::cardSummary(data)
OmopViewer::cardSummary(data)
)'
}
Binary file modified R/sysdata.rda
Binary file not shown.
16 changes: 8 additions & 8 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -13,33 +13,33 @@ knitr::opts_chunk$set(
)
```

# omopViewer
# OmopViewer

<!-- badges: start -->
[![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)
[![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/OHDSI/omopViewer/branch/main/graph/badge.svg)](https://app.codecov.io/gh/OHDSI/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]
> 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.
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/OHDSI/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("OHDSI/omopViewer")
pak::pkg_install("OHDSI/OmopViewer")
```

## Main functionalities

```{r}
library(omopViewer)
library(OmopViewer)
```

The package can be divided in 3 main functionalities:
Expand Down
24 changes: 10 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,40 +1,40 @@

<!-- README.md is generated from README.Rmd. Please edit that file -->

# omopViewer
# OmopViewer

<!-- badges: start -->

[![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)
[![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)
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/OHDSI/omopViewer/branch/main/graph/badge.svg)](https://app.codecov.io/gh/OHDSI/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.
The goal of omopViewer is to allow the user to easily create Shiny Apps
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/OHDSI/omopViewer) with:
You can install the development version of OmopViewer from
[GitHub](https://github.com/OHDSI/OmopViewer) with:

``` r
install.packages("pak")
pak::pkg_install("OHDSI/omopViewer")
pak::pkg_install("OHDSI/OmopViewer")
```

## Main functionalities

``` r
library(omopViewer)
library(OmopViewer)
```

The package can be divided in 3 main functionalities: - Static shiny
Expand All @@ -50,22 +50,18 @@ results and can be modified later locally.
# lets generate some results
library(CohortCharacteristics)
cdm <- mockCohortCharacteristics()
#> Note: method with signature 'DBIConnection#Id' chosen for function 'dbExistsTable',
#> target signature 'duckdb_connection#Id'.
#> "duckdb_connection#ANY" would also be valid
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`.
#> ℹ Creating shiny from provided data
#> ✔ Shiny created in: /Users/martics/Documents/GitHub/omopViewer/shiny
#> ✔ Shiny created in: C:/Users/martics/Documents/GitHub/omopViewer/shiny
```

## Dynamic shiny app
Expand Down
6 changes: 3 additions & 3 deletions data-raw/internalData.R
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ omopViewerPlotArguments <- dplyr::tribble(

omopViewerTables <- dplyr::tribble(
~table_id, ~result_tab_id, ~title, ~fun, ~output,
0L, 0L, "Formatted", "omopViewer::omopViewerTable", "gt",
0L, 0L, "Formatted", "OmopViewer::omopViewerTable", "gt",
1L, 1L, "Table cohort overlap", "tableCohortOverlap", "gt",
2L, 2L, "Table cohort attrition", "tableCohortAttrition", "gt",
3L, 3L, "Table cohort timing", "tableCohortTiming", "gt",
Expand Down Expand Up @@ -127,8 +127,8 @@ omopViewerProj <- c(
)

omopViewerGlobal <- c(
"data <- omopViewer::importSummarisedResult(here::here(\"data\")) |>",
"omopViewer::correctSettings()"
"data <- OmopViewer::importSummarisedResult(here::here(\"data\")) |>",
"OmopViewer::correctSettings()"
) |>
styleCode()

Expand Down
10 changes: 5 additions & 5 deletions man/omopViewer-package.Rd → man/OmopViewer-package.Rd

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

4 changes: 2 additions & 2 deletions tests/testthat.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
# * https://testthat.r-lib.org/articles/special-files.html

library(testthat)
library(omopViewer)
library(OmopViewer)

test_check("omopViewer")
test_check("OmopViewer")
Loading

0 comments on commit 5de340f

Please sign in to comment.