Skip to content

Commit

Permalink
Add Reset Button
Browse files Browse the repository at this point in the history
  • Loading branch information
SandraKla committed Nov 20, 2024
1 parent 45ed9fa commit 4e41a64
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 13 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<img src="www/Logo.svg" width="225px" height="150px" align="right"/>

![](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/last-commit/SandraKla/Zlog_AdRI/main.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 @@ -49,7 +49,7 @@ The package [DT](https://cran.r-project.org/web/packages/DT/index.html) (≥ 0.2
Data from the [CALIPER-Database](https://caliper.research.sickkids.ca/#/) with age-dependent reference intervals has been preloaded into this Shiny App. For this purpose, the data were brought into the appropriate shape for the analysis from the [Supplemental Table 2](https://academic.oup.com/clinchem/article/58/5/854/5620695#supplementary-data) from the publication: *Closing the Gaps in Pediatric Laboratory Reference Intervals: A CALIPER Database of 40 Biochemical Markers in a Healthy and Multiethnic Population of Children*.
### New data
For new data use the [CALIPER-Dataset](https://github.com/SandraKla/Zlog_AdRI/blob/master/data/CALIPER.csv) as template with the columns:
For new data use the [CALIPER-Dataset](https://github.com/SandraKla/Zlog_AdRI/blob/main/data/CALIPER.csv) as template with the columns:
* **CODE**: Name of the analyte ("Calcium")
* **LABUNIT**: Unit of the analyte ("mmol/L")
Expand Down
43 changes: 33 additions & 10 deletions app.R
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,9 @@ ui <- dashboardPage(
"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")
),
uiOutput("dataset_file"),
actionButton('reset', 'Reset Input', icon = icon("trash")),

conditionalPanel(condition = "input.tabselected == 'Table'",
selectInput(
"sex",
Expand Down Expand Up @@ -187,11 +183,38 @@ server <- function(input, output, session) {

##################################### Reactive Expressions ######################################

values <- reactiveValues(upload_state = NULL)

observeEvent(input$dataset_file, {
values$upload_state <- 'uploaded'
})

observeEvent(input$reset, {
values$upload_state <- 'reset'
})

dataset_input <- reactive({
if (is.null(values$upload_state)) {
return(NULL)
} else if (values$upload_state == 'uploaded') {
return(input$dataset_file)
} else if (values$upload_state == 'reset') {
return(NULL)
}
})

output$dataset_file <- renderUI({
input$reset ## Create a dependency with the reset button
fileInput("dataset_file","Upload CSV File:", accept = c("text/csv", "text/comma-separated-values,text/plain", ".csv"), multiple = FALSE)
})

get_data_file <- reactive({

input$dataset_file

saving <-
if(!is.null(input$data_table)){
dataset_original <- read.csv(input$data_table[["datapath"]],na.strings="", fileEncoding="latin1")
if(!is.null(dataset_input())){
dataset_original <- read.csv(dataset_input()[["datapath"]], na.strings="", fileEncoding="latin1")
}else{
dataset_original <- read.csv("data/CALIPER.csv",na.strings="", fileEncoding="latin1")
}
Expand Down Expand Up @@ -309,7 +332,7 @@ server <- function(input, output, session) {

##################################### Observe Events ############################################

observeEvent(input$data_table, {
observeEvent(input$dataset_file, {
updateSelectInput(session, "parameter", choices = zlog_data()[,1])
})

Expand Down
2 changes: 1 addition & 1 deletion docs/guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

### Load new data

For new data use the [CALIPER-Dataset](https://github.com/SandraKla/Zlog_AdRI/blob/master/data/CALIPER.csv) as template with the columns:
For new data use the [CALIPER-Dataset](https://github.com/SandraKla/Zlog_AdRI/blob/main/data/CALIPER.csv) as template with the columns:

* **CODE**: Name of the analyte ("Calcium")
* **LABUNIT**: Unit of the analyte ("mmol/L")
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/table.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 4e41a64

Please sign in to comment.