Skip to content

Commit

Permalink
Update to shinydashboard
Browse files Browse the repository at this point in the history
  • Loading branch information
SandraKla committed Jul 15, 2023
1 parent 06964f5 commit ad38d6b
Show file tree
Hide file tree
Showing 11 changed files with 895 additions and 272 deletions.
8 changes: 2 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

![](https://img.shields.io/github/license/SandraKla/Zlog_AdRI.svg)
![](https://img.shields.io/github/last-commit/SandraKla/Zlog_AdRI/master.svg)
![](https://img.shields.io/github/languages/count/SandraKla/Zlog_AdRI.svg)
![](https://img.shields.io/github/languages/top/SandraKla/Zlog_AdRI.svg)

This Shiny App computes the zlog values of the preceding and the subsequent reference interval for different analytes for each age group. Many medical reference intervals are not age-dependent and have large jumps between the individual age groups. This should be prevented by considering the zlog value. The lower reference limits (LL) and upper reference limits (UL) can transform any result x into a zlog value using the following equation:

Expand Down Expand Up @@ -43,7 +41,7 @@ And then start the app with the following code:
runApp("app.R")
```
The package [DT](https://cran.r-project.org/web/packages/DT/index.html) (≥ 0.21) is downloaded or imported when starting this app. The used [R](https://www.r-project.org)-Version must be ≥ 4.1.2 (2021-11-01) -- "Bird Hippie".
The package [DT](https://cran.r-project.org/web/packages/DT/index.html) (≥ 0.21) and [shinydashboard](https://cran.r-project.org/web/packages/shinydashboard/index.html) (≥ 0.7.2) is downloaded or imported when starting this app. The used [R](https://www.r-project.org)-Version must be ≥ 4.1.2 (2021-11-01).
## Usage
Expand Down Expand Up @@ -71,6 +69,4 @@ You are welcome to:
For more information use the [Homepage](https://sandrakla.github.io/Zlog_AdRI/)!
Link to the publication: [A zlog-based algorithm and tool for plausibility checks of reference intervals](https://www.degruyter.com/document/doi/10.1515/cclm-2022-0688/html)
See also the CRAN-package "zlog": Sebastian Gibb. (2021). ampel-leipzig/zlog: First public CRAN release. (1.0.0). Zenodo. [10.5281/zenodo.4732319](https://doi.org/10.5281/zenodo.4732319)
Link to the publication: [A zlog-based algorithm and tool for plausibility checks of reference intervals](https://www.degruyter.com/document/doi/10.1515/cclm-2022-0688/html)
237 changes: 140 additions & 97 deletions app.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
####################################### WELCOME TO THE SHINY APP ##################################
####################################### from Sandra K. (2022) #####################################
####################################### from Sandra K. (2023) #####################################
###################################################################################################

####################################### Load Script and Example-Dataset ###########################
Expand All @@ -14,110 +14,153 @@ if("DT" %in% rownames(installed.packages())){
install.packages("DT")
library(DT)}

if("shinydashboard" %in% rownames(installed.packages())){
library(shinydashboard)} else{
install.packages("shinydashboard")
library(shinydashboard)}

####################################### User Interface ############################################

ui <- fluidPage(
ui <- dashboardPage(
dashboardHeader(title = "Zlog_AdRI", titleWidth = 350),
dashboardSidebar(
width = 350,
sidebarMenu(
id = "sidebarid",

div(
style = "text-align:center",
br(),
"Tool for Plausibility Checks of Reference Interval Limits"
),

fileInput(
"data_table",
"Upload CSV File:",
accept = c("text/csv",
"text/comma-separated-values,text/plain",
".csv")
),
conditionalPanel(condition = "input.tabselected == 'Table'",
selectInput(
"sex",
"Select the sex:",
choices = c("Female (F)" = "F", "Male (M)" = "M")
)),
conditionalPanel(
condition = "input.tabselected == 'Plot'",
selectInput(
"sex_plot",
"Select the sex:",
choices = c("Female (F)" = "F", "Male (M)" = "M")
)
),
conditionalPanel(
condition = "input.tabselected == 'Plot'",
hr(),
selectInput(
"parameter",
"Select the lab parameter:",
choices = dataset_original$CODE,
selected = TRUE
)
),
conditionalPanel(
condition = "input.tabselected == 'Plot'",
selectInput(
"xaxis_scale",
"Select the x-axis scaling:",
choices = c(
"Days" = "days",
"Years" = "years",
"Days/Years" = "days_years"
),
selected = TRUE
)
),
conditionalPanel(
condition = "input.tabselected == 'Plot'",
checkboxInput("xlog", "Logarithmic scale for the x-axis", value = FALSE)
),

hr(),

div(
style = "text-align:center",
"For further information visit our",
a("Website", href = "https://sandrakla.github.io/Zlog_AdRI/"),
"or",
br(),
"read the publication",
a("doi: 10.1515/cclm-2022-0688", href = "https://doi.org/10.1515/cclm-2022-0688"),
"!"
)
)
),

theme = "style.css",

titlePanel("", windowTitle = "zlog"),

sidebarLayout(
dashboardBody(fluidRow(
tabBox(
title = "Zlog_AdRI",
id = "tabselected",
width = 9,
tabPanel(
"Table",
icon = icon("table"),

p(
"This Shiny App computes the zlog values of the preceding and the subsequent reference
interval (RI) for different lab parameters for each age group. Many medical RI are
not age-dependent and have large jumps between the individual age groups.
This should be prevented by considering the zlog value. The zlog value should be optimally
between -1.96 and 1.96. The further away the values, the more likely the RI jump is implausible."
),

DT::dataTableOutput("table")
),

############################# Sidebar ###################################################
sidebarPanel(width = 3,

h3("Tool for Plausibility Checks of Reference Interval Limits"), br(),

fileInput("data_table", "Upload CSV File:", accept = c(
"text/csv",
"text/comma-separated-values,text/plain",
".csv")), #hr(),

#helpText("Settings for the calculation of the zlog-value:"),
#checkboxInput("replacement", "Customize replacement values for the RI", value = FALSE),
#conditionalPanel(
# condition = "input.replacement == 1",
# numericInput("replace_low", "Replacement value for the LL:",
# 0.001, min = 0, max = 100)),
#conditionalPanel(
# condition = "input.replacement == 1",
# numericInput("replace_upper", "Replacement value for the UL:",
# 100, min = 0.1, max = 1000)),

#hr(),

conditionalPanel(
condition = "input.tabselected == 'Table'",
selectInput("sex", "Select the sex:", choices = #c("All (AL)"="B", "Female (F)"="F", "Male (M)"="M"))),
c("Female (F)"="F", "Male (M)"="M"))),
conditionalPanel(
condition = "input.tabselected == 'Plot'",
selectInput("sex_plot", "Select the sex:", choices = c("Female (F)"="F", "Male (M)"="M"))),

conditionalPanel(
condition = "input.tabselected == 'Plot'", hr(),
selectInput("parameter", "Select the lab parameter:", choices = dataset_original$CODE,
selected = TRUE)),
conditionalPanel(
condition = "input.tabselected == 'Plot'",
selectInput("xaxis_scale", "Select the x-axis scaling:",
choices = c("Days"="days",
"Years"="years",
"Days/Years"="days_years"),
selected = TRUE)),
conditionalPanel(
condition = "input.tabselected == 'Plot'",
checkboxInput("xlog", "Logarithmic scale for the x-axis", value = FALSE)),

hr(),

numericInput("maxzlog", "Maximum absolute zlog value:", 10, min = 0, max = 50),
htmlOutput("helptext"),

hr(),

helpText("For further information visit our", a("Website", href="https://sandrakla.github.io/Zlog_AdRI/"),"!")
# br(), "Link to the publication: A Tool for Plausibility Checks of Reference Interval Limits")
tabPanel(
"Plot",
icon = icon("calculator"),

p(
"Original RI (top) and zlog values for the selected lab parameter for each age group (bottom).
The direction of the triangles in the lower figure indicates the zlog values of the preceding (left) and the
following age group (right).
Blue color indicates lower, red the upper reference limits.
The dotted green lines represent the common reference interval of -1.96 to +1.96.
The further the traingles are from these lines, the more likely there is an implausible age jump."
),

################################# Main Panel ################################################
mainPanel(width = 9,

tabsetPanel(type = "pills", id = "tabselected",

tabPanel("Table", icon = icon("table"),

p(style = "background-color:#A9A9A9;",

"This Shiny App computes the zlog values of the preceding and the subsequent reference
interval (RI) for different analytes for each age group. Many medical RI are
not age-dependent and have large jumps between the individual age groups.
This should be prevented by considering the zlog value. The zlog value should be optimally
between -1.96 and 1.96. The further away the values, the more likely the RI jump is implausible."),
htmlOutput("caution"),

#downloadButton("download_data_example", icon = icon("download"), "Download the example data"),
DT::dataTableOutput("table")),

tabPanel("Plot", icon = icon("calculator"),

p(style = "background-color:#A9A9A9;",

"Original RI (top) and zlog values for the selected lab analytes for each age group (bottom).
The direction of the triangles in the lower figure indicates the zlog values of the preceding (left) and the
following age group (right).
Blue color indicates lower, red the upper reference limits.
The dotted green lines represent the common reference interval of -1.96 to +1.96.
The further the traingles are from these lines, the more likely there is an implausible age jump."),

plotOutput("plot", height = "700px")
)

plotOutput("plot", height = "700px")
)
),

box(
title = tagList(shiny::icon("info"), "Lab parameters with a value of 0:"),
status = "info",
width = 3,
solidHeader = TRUE,

htmlOutput("caution")
),

box(
title = tagList(shiny::icon("warning"), "High zlog values:"),
status = "danger",
width = 3,
solidHeader = TRUE,

numericInput(
"maxzlog",
"Maximum absolute zlog value:",
10,
min = 0,
max = 50
),
htmlOutput("helptext")
)
)
))
)


####################################### Server ####################################################

Expand Down
5 changes: 2 additions & 3 deletions docs/about.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ You are welcome to:

For more information use the [Homepage](https://sandrakla.github.io/Zlog_AdRI/)!

Link to the publication: *A zlog-based algorithm and tool for plausibility checks of reference intervals*

See also the CRAN-package "zlog": Sebastian Gibb. (2021). ampel-leipzig/zlog: First public CRAN release. (1.0.0). Zenodo. [10.5281/zenodo.4732319](https://doi.org/10.5281/zenodo.4732319)
Link to the publication: [A zlog-based algorithm and tool for plausibility checks of reference intervals](https://www.degruyter.com/document/doi/10.1515/cclm-2022-0688/html)

## References

Expand All @@ -26,5 +24,6 @@ Hoffmann G, Klawonn F, Lichtinghagen R & Orth M. The zlog value as a basis for t
* [R](https://www.r-project.org) ≥ 4.1.2
* [DT](https://cran.r-project.org/web/packages/DT/index.html) ≥ 0.21
* [shiny](https://cran.r-project.org/web/packages/shiny/index.html) ≥ 1.7.1
* [shinydashboard](https://cran.r-project.org/web/packages/shinydashboard/index.html) ≥ 0.7.2

Older versions may also work, but full functionality is not guaranteed.
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ If the zlog value deviates significantly from -1.96 to 1.96, the reference inter
<img src="shiny.png" align="center"/>
<img src="shiny_table.png" align="center"/>

Link to the publication: *A zlog-based algorithm and tool for plausibility checks of reference intervals*
Link to the publication: [A zlog-based algorithm and tool for plausibility checks of reference intervals](https://www.degruyter.com/document/doi/10.1515/cclm-2022-0688/html)
16 changes: 9 additions & 7 deletions docs/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,24 @@ Use the function ```runGitHub()``` from the package [shiny](https://cran.r-proje

```bash
if("shiny" %in% rownames(installed.packages())){
library(shiny)} else{install.packages("shiny")}
library(shiny)} else{install.packages("shiny")
library(shiny)}
runGitHub("Zlog_AdRI", "SandraKla")
```
**Method 2** (not recommended):
Download the Zip-File this Shiny App. Unzip the file and set your working direction to the path of the folder.
The package [shiny](https://cran.r-project.org/web/packages/shiny/index.html) (≥ 1.4.0) must be installed before using the Shiny App:
Download the Zip-File from this Shiny App. Unzip the file and set your working direction to the path of the folder.
The package [shiny](https://cran.r-project.org/web/packages/shiny/index.html) (≥ 1.7.1) must be installed before using the Shiny App:
```bash
# Test if shiny is installed:
if("shiny" %in% rownames(installed.packages())){
library(shiny)} else{install.packages("shiny")}
library(shiny)} else{install.packages("shiny")
library(shiny)}
```
And then start the app with the following code:
```bash
runApp("app.R")
runApp("app.R")
```
In RStudio with installed [shiny](https://cran.r-project.org/web/packages/shiny/index.html) use the Run App-Button when opening the zlog project:
Expand All @@ -32,8 +35,7 @@ In RStudio with installed [shiny](https://cran.r-project.org/web/packages/shiny/
<img src="shiny_button.png"/>
</p>
The package [DT](https://cran.r-project.org/web/packages/DT/index.html) is downloaded or imported when starting this app. For more information about the required packages, see [About](./about.md).
The package [DT](https://cran.r-project.org/web/packages/DT/index.html) (≥ 0.21) and [shinydashboard](https://cran.r-project.org/web/packages/shinydashboard/index.html) (≥ 0.7.2) is downloaded or imported when starting this app. The used [R](https://www.r-project.org)-Version must be ≥ 4.1.2 (2021-11-01).
## CALIPER-Dataset
Expand Down
Binary file modified docs/shiny.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 modified docs/shiny_caution.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 modified docs/shiny_high_zlog.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 modified docs/table.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit ad38d6b

Please sign in to comment.