74 lines
2.3 KiB
R
74 lines
2.3 KiB
R
# 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")
|
|
|
|
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 = OXAC) %>%
|
|
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))
|
|
|
|
|
|
radar_data_first <- radar_data %>%
|
|
filter_first_isolate(col_patient_id = "patientid", episode_days = 365) %>%
|
|
mutate(mo = as.mo(mo, Becker = TRUE))
|
|
|
|
intrinsic_info <- 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)
|
|
}
|
|
)
|
|
} |