RadaR2 app
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

85 lines
2.7 KiB

# WELCOME TO RadaR
#RadaR is licensed under the GNU General Public License (GPL) v2.0 (https://github.com/ceefluz/radar/blob/master/LICENSE)
# LIST OF REQUIRED PACKAGES -----------------------------------------------
library(shiny)
library(shinydashboard)
library(shinydashboardPlus)
library(dashboardthemes)
library(shinyWidgets)
library(shinycssloaders)
library(shinyjs)
library(DT)
library(tidyverse)
library(ggtext)
library(AMR)
library(cleaner)
library(scales)
library(ggiraph)
specialties <- read_csv("specialties.csv", lazy = FALSE)
trsns <- read_tsv("translations.txt", lazy = FALSE)
# to do: make system settings dependent
trnslt <- function(english, new_lang = "nl", file = trsns) {
if (english %in% trsns[, 1, drop = TRUE]) {
trsns[match(english, trsns[, 1, drop = TRUE]), new_lang, drop = TRUE]
} else {
english
}
}
specialties <- specialties %>%
mutate(specialty_shiny = if_else(specialty != "Outpatients", paste0(specialty, " (", str_replace_all(specialism, ";", ", "), ")"), "Outpatients"),
department = if_else(is.na(department), "NO DEPARTMENT GIVEN", department))
specialties <- separate_rows(specialties, specialism, sep = ";")
specialties <- separate_rows(specialties, department, sep = ";")
pathogens <- read_csv("grouping microorganisms.csv")
radar_data <- readRDS("bk_2019.rds")
radar_data <- radar_data %>%
left_join(specialties) %>%
mutate(specialty = if_else(is.na(specialty), "NO SPECIALTY GIVEN", specialty),
specialty_shiny = if_else(is.na(specialty_shiny), "NO SPECIALTY GIVEN", specialty_shiny),
name = mo_name(mo),
FLC = OXA) %>%
left_join(pathogens)
# lab_ab <- c("CFCC", "CFCL", "CFOC", "CFSC", "CFTC", "COCL", "GEHI", "QUDA")
radar_data <- radar_data %>%
# select_at(vars(!contains(lab_ab))) %>%
rename_if(is.rsi, function(x) ifelse(is.na(suppressWarnings(as.ab(x))),
x,
suppressWarnings(as.ab(x)))) %>%
mutate(group_all = 1) # dummy variable to disable grouping
radar_data <- radar_data %>%
mutate(CRO = if_else(is.na(CRO) & !is.na(CTX), CTX, CRO))
suppressMessages(
radar_data_first <- radar_data %>%
filter_first_isolate(col_patient_id = "patientid", episode_days = 365, info = FALSE) %>%
mutate(mo = as.mo(mo, Becker = TRUE))
)
intrinsic_info <- AMR::intrinsic_resistant %>%
mutate(mo = as.mo(microorganism),
intrinsic_r = TRUE)
download_box <- function(exportname, plot) {
downloadHandler(
filename = function() {
paste(exportname, Sys.Date(), ".png", sep = "")
},
content = function(file) {
ggsave(file, plot = plot, device = "png", width = 8)
}
)
}