dutch translations

This commit is contained in:
dr. M.S. (Matthijs) Berends 2021-11-16 12:21:55 +01:00
parent 224b678ce3
commit 2271c24b19
5 changed files with 122 additions and 57 deletions

1
.gitignore vendored
View File

@ -4,3 +4,4 @@
.Ruserdata .Ruserdata
*.Rproj *.Rproj
.DS_Store .DS_Store
bk_2019.rds

View File

@ -18,7 +18,17 @@ library(cleaner)
library(scales) library(scales)
library(ggiraph) library(ggiraph)
specialties <- read_csv("specialties.csv") 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 %>% specialties <- specialties %>%
mutate(specialty_shiny = if_else(specialty != "Outpatients", paste0(specialty, " (", str_replace_all(specialism, ";", ", "), ")"), "Outpatients"), mutate(specialty_shiny = if_else(specialty != "Outpatients", paste0(specialty, " (", str_replace_all(specialism, ";", ", "), ")"), "Outpatients"),
@ -37,13 +47,13 @@ radar_data <- radar_data %>%
mutate(specialty = if_else(is.na(specialty), "NO SPECIALTY GIVEN", specialty), mutate(specialty = if_else(is.na(specialty), "NO SPECIALTY GIVEN", specialty),
specialty_shiny = if_else(is.na(specialty_shiny), "NO SPECIALTY GIVEN", specialty_shiny), specialty_shiny = if_else(is.na(specialty_shiny), "NO SPECIALTY GIVEN", specialty_shiny),
name = mo_name(mo), name = mo_name(mo),
FLC = OXAC) %>% FLC = OXA) %>%
left_join(pathogens) left_join(pathogens)
lab_ab <- c("CFCC", "CFCL", "CFOC", "CFSC", "CFTC", "COCL", "GEHI", "QUDA") # lab_ab <- c("CFCC", "CFCL", "CFOC", "CFSC", "CFTC", "COCL", "GEHI", "QUDA")
radar_data <- radar_data %>% radar_data <- radar_data %>%
select_at(vars(!contains(lab_ab))) %>% # select_at(vars(!contains(lab_ab))) %>%
rename_if(is.rsi, function(x) ifelse(is.na(suppressWarnings(as.ab(x))), rename_if(is.rsi, function(x) ifelse(is.na(suppressWarnings(as.ab(x))),
x, x,
suppressWarnings(as.ab(x)))) %>% suppressWarnings(as.ab(x)))) %>%
@ -52,12 +62,13 @@ radar_data <- radar_data %>%
radar_data <- radar_data %>% radar_data <- radar_data %>%
mutate(CRO = if_else(is.na(CRO) & !is.na(CTX), CTX, CRO)) mutate(CRO = if_else(is.na(CRO) & !is.na(CTX), CTX, CRO))
suppressMessages(
radar_data_first <- radar_data %>% radar_data_first <- radar_data %>%
filter_first_isolate(col_patient_id = "patientid", episode_days = 365) %>% filter_first_isolate(col_patient_id = "patientid", episode_days = 365, info = FALSE) %>%
mutate(mo = as.mo(mo, Becker = TRUE)) mutate(mo = as.mo(mo, Becker = TRUE))
)
intrinsic_info <- intrinsic_resistant %>% intrinsic_info <- AMR::intrinsic_resistant %>%
mutate(mo = as.mo(microorganism), mutate(mo = as.mo(microorganism),
intrinsic_r = TRUE) intrinsic_r = TRUE)

View File

@ -72,14 +72,14 @@ server <- function(input, output, session) {
width = NULL, width = NULL,
height = 500, height = 500,
tabPanel( tabPanel(
title = "Positive & negative cultures", title = trnslt("Positive & negative cultures"),
div( div(
style = "position: absolute; left: 0.5em; bottom: 0.5em;", style = "position: absolute; left: 0.5em; bottom: 0.5em;",
dropdown( dropdown(
radioGroupButtons( radioGroupButtons(
inputId = "box2.1_group", inputId = "box2.1_group",
label = "Select group", label = trnslt("Select group"),
choiceNames = c("All", "Year", "Gender", "Department", "Specialty", "Specialty code", "ICU status", "Clinical status", "Outward status"), choiceNames = c(trnslt("All"), trnslt("Year"), trnslt("Gender"), trnslt("Department"), trnslt("Specialty"), trnslt("Specialty code"), trnslt("ICU status"), trnslt("Clinical status"), trnslt("Outward status")),
choiceValues = c("group_all", "year", "gender", "department", "specialty", "specialism", "is_icu", "is_clinical", "is_outward"), choiceValues = c("group_all", "year", "gender", "department", "specialty", "specialism", "is_icu", "is_clinical", "is_outward"),
selected = "group_all", selected = "group_all",
direction = "vertical", direction = "vertical",
@ -92,7 +92,7 @@ server <- function(input, output, session) {
div( div(
style = "position: absolute; right: 3.5em; bottom: 0.5em;", style = "position: absolute; right: 3.5em; bottom: 0.5em;",
dropdown( dropdown(
downloadButton(outputId = "down_box_pos_neg", label = "Download plot"), downloadButton(outputId = "down_box_pos_neg", label = trnslt("Download plot")),
size = "xs", size = "xs",
icon = icon("download", class = "opt"), icon = icon("download", class = "opt"),
up = TRUE up = TRUE
@ -111,8 +111,8 @@ server <- function(input, output, session) {
dropdown( dropdown(
radioGroupButtons( radioGroupButtons(
inputId = "box2.3_group", inputId = "box2.3_group",
label = "Select group", label = trnslt("Select group"),
choiceNames = c("All", "Year", "Gender", "Department", "Specialty", "Specialty code", "ICU status", "Clinical status", "Outward status"), choiceNames = c(trnslt("All"), trnslt("Year"), trnslt("Gender"), trnslt("Department"), trnslt("Specialty"), trnslt("Specialty code"), trnslt("ICU status"), trnslt("Clinical status"), trnslt("Outward status")),
choiceValues = c("group_all", "year", "gender", "department", "specialty", "specialism", "is_icu", "is_clinical", "is_outward"), choiceValues = c("group_all", "year", "gender", "department", "specialty", "specialism", "is_icu", "is_clinical", "is_outward"),
selected = "group_all", selected = "group_all",
direction = "vertical" direction = "vertical"
@ -127,12 +127,12 @@ server <- function(input, output, session) {
dropdown( dropdown(
sliderTextInput( sliderTextInput(
inputId = "box2.4_top", inputId = "box2.4_top",
label = "Use slider to select by count", label = trnslt("Use slider to select by count"),
choices = seq(0, n_distinct(radar_data$mo), 10), choices = seq(0, n_distinct(radar_data$mo), 10),
selected = c(0, 10) selected = c(0, 10)
), ),
size = "xs", size = "xs",
label = "Select top ...", label = trnslt("Select top ..."),
up = TRUE) up = TRUE)
), ),
div( div(
@ -140,13 +140,13 @@ server <- function(input, output, session) {
dropdown( dropdown(
radioGroupButtons( radioGroupButtons(
inputId = "box2.3_pathogen", inputId = "box2.3_pathogen",
label = "Select pathogen group", label = trnslt("Select pathogen group"),
choiceNames = c("all", "definite", "probable", "improbable"), choiceNames = c("all", "definite", "probable", "improbable"),
choiceValues = c(0, 1, 2, 3), choiceValues = c(0, 1, 2, 3),
selected = 0 selected = 0
), ),
size = "xs", size = "xs",
label = "Pathogens", label = trnslt("Pathogens"),
up = TRUE up = TRUE
)), )),
div( div(
@ -154,13 +154,13 @@ server <- function(input, output, session) {
dropdown( dropdown(
selectInput( selectInput(
inputId = "box2.5_search", inputId = "box2.5_search",
label = "Search and select isolates", label = trnslt("Search and select isolates"),
choices = mo_fullname(unique(radar_data$mo)[which(!is.na(unique(radar_data$mo)))]), choices = mo_fullname(unique(radar_data$mo)[which(!is.na(unique(radar_data$mo)))]),
multiple = TRUE multiple = TRUE
), ),
size = "xs", size = "xs",
label = "Search isolates", label = trnslt("Search isolates"),
up = TRUE up = TRUE
)), )),
div( div(
@ -173,13 +173,13 @@ server <- function(input, output, session) {
selected = 365 selected = 365
), ),
size = "xs", size = "xs",
label = "Define first isolate guidelines", label = trnslt("Define first isolate guidelines"),
up = TRUE up = TRUE
)), )),
div( div(
style = "position: absolute; right: 3.5em; bottom: 0.5em;", style = "position: absolute; right: 3.5em; bottom: 0.5em;",
dropdown( dropdown(
downloadButton(outputId = "down_box_patho", label = "Download plot"), downloadButton(outputId = "down_box_patho", label = trnslt("Download plot")),
size = "xs", size = "xs",
icon = icon("download", class = "opt"), icon = icon("download", class = "opt"),
up = TRUE up = TRUE
@ -193,14 +193,14 @@ server <- function(input, output, session) {
) )
), ),
tabPanel( tabPanel(
title = "First isolates per episode", title = trnslt("First isolates per episode"),
div( div(
style = "position: absolute; left: 0.5em; bottom: 0.5em;", style = "position: absolute; left: 0.5em; bottom: 0.5em;",
dropdown( dropdown(
radioGroupButtons( radioGroupButtons(
inputId = "box2.2_group", inputId = "box2.2_group",
label = "Select group", label = trnslt("Select group"),
choiceNames = c("All", "Year", "Gender", "Department", "Department type", "Specialty", "ICU status", "Clinical status", "Outward status"), choiceNames = c(trnslt("All"), trnslt("Year"), trnslt("Gender"), trnslt("Department"), trnslt("Department type"), trnslt("Specialty"), trnslt("ICU status"), trnslt("Clinical status"), trnslt("Outward status")),
choiceValues = c("group_all", "year", "gender", "department", "type_dept", "specialism", "is_icu", "is_clinical", "is_outward"), choiceValues = c("group_all", "year", "gender", "department", "type_dept", "specialism", "is_icu", "is_clinical", "is_outward"),
selected = "group_all", selected = "group_all",
direction = "vertical" direction = "vertical"
@ -325,7 +325,7 @@ server <- function(input, output, session) {
ggplot(aes(name, value, fill = name, tooltip = value)) + ggplot(aes(name, value, fill = name, tooltip = value)) +
geom_col_interactive(colour = "black") + geom_col_interactive(colour = "black") +
scale_fill_manual(values = c("white", "lightgrey", "darkred")) + scale_fill_manual(values = c("white", "lightgrey", "darkred")) +
labs(x = "", y = "Count", fill = "", title = "Number of positive & negative blood culture tests") + labs(x = "", y = trnslt("Count"), fill = "", title = trnslt("Number of positive & negative blood culture tests")) +
theme_minimal() + theme_minimal() +
theme(text = element_text(family = "Arial"), theme(text = element_text(family = "Arial"),
legend.title = element_blank(), legend.title = element_blank(),
@ -355,7 +355,12 @@ server <- function(input, output, session) {
patho_plot <- reactive({ patho_plot <- reactive({
mo_search <- c("none", as.mo(input$box2.5_search)) if (!is.null(input$box2.5_search)) {
mos <- as.mo(input$box2.5_search)
} else {
mos <- character(0)
}
mo_search <- c("none", mos)
top_10 <- data_select() %>% top_10 <- data_select() %>%
filter(!is.na(mo)) %>% filter(!is.na(mo)) %>%
@ -391,7 +396,7 @@ server <- function(input, output, session) {
} else { } else {
c(0, max(patho_plot %>% count(mo) %>% pull(n))) c(0, max(patho_plot %>% count(mo) %>% pull(n)))
}) + }) +
labs(x = "", y = "Count", title = "Number of first isolates detected") + labs(x = "", y = trnslt("Count"), title = trnslt("Number of first isolates detected")) +
coord_flip() + coord_flip() +
theme_minimal() + theme_minimal() +
theme(text = element_text(family = "Arial"), theme(text = element_text(family = "Arial"),
@ -429,13 +434,16 @@ server <- function(input, output, session) {
test_plot <- reactive({ test_plot <- reactive({
radar_data %>% radar_data %>%
mutate(first_14 = first_isolate(radar_data, episode_days = 14, col_patient_id = "patientid"), mutate(first_14 = first_isolate(col_mo = "mo", col_date = "date", col_patient_id = "patientid",
first_30 = first_isolate(radar_data, episode_days = 30, col_patient_id = "patientid"), episode_days = 14, info = FALSE),
first_60 = first_isolate(radar_data, episode_days = 60, col_patient_id = "patientid")) %>% first_30 = first_isolate(col_mo = "mo", col_date = "date", col_patient_id = "patientid",
episode_days = 30, info = FALSE),
first_60 = first_isolate(col_mo = "mo", col_date = "date", col_patient_id = "patientid",
episode_days = 60, info = FALSE)) %>%
group_by_at(input$box2.2_group) %>% group_by_at(input$box2.2_group) %>%
summarise("14 days" = sum(first_14, na.rm = TRUE), summarise("14 days" = sum(first_14, na.rm = TRUE),
"30 days" = sum(first_30, na.rm = TRUE), "30 days" = sum(first_30, na.rm = TRUE),
"60 days" = sum(first_60, na.rm = TRUE)) %>% "60 days" = sum(first_60, na.rm = TRUE))
pivot_longer(cols = c("14 days", "30 days", "60 days")) pivot_longer(cols = c("14 days", "30 days", "60 days"))
}) })
@ -444,7 +452,7 @@ server <- function(input, output, session) {
test_plot() %>% test_plot() %>%
ggplot(aes(value, name)) + ggplot(aes(value, name)) +
geom_col(colour = "black", fill = "lightgrey") + geom_col(colour = "black", fill = "lightgrey") +
labs(x = "Count", y = "Episode", title = "Number of first isolates per episode") + labs(x = trnslt("Count"), y = trnslt("Episode"), title = trnslt("Number of first isolates per episode")) +
theme_minimal() + theme_minimal() +
theme(text = element_text(family = "Arial"), theme(text = element_text(family = "Arial"),
legend.title = element_blank(), legend.title = element_blank(),
@ -477,14 +485,14 @@ server <- function(input, output, session) {
width = NULL, width = NULL,
height = 500, height = 500,
tabPanel( tabPanel(
title = "Resistance profile", title = trnslt("Resistance profile"),
div( div(
style = "position: absolute; left: 0.5em; bottom: 0.5em;", style = "position: absolute; left: 0.5em; bottom: 0.5em;",
dropdown( dropdown(
radioGroupButtons( radioGroupButtons(
inputId = "box1.2_group", inputId = "box1.2_group",
label = "Select group", label = trnslt("Select group"),
choiceNames = c("All", "Year", "Gender", "Department", "Specialty", "Specialty code", "ICU status", "Clinical status", "Outward status"), choiceNames = c(trnslt("All"), trnslt("Year"), trnslt("Gender"), trnslt("Department"), trnslt("Specialty"), trnslt("Specialty code"), trnslt("ICU status"), trnslt("Clinical status"), trnslt("Outward status")),
choiceValues = c("mo", "year", "gender", "department", "specialty", "specialism", "is_icu", "is_clinical", "is_outward"), choiceValues = c("mo", "year", "gender", "department", "specialty", "specialism", "is_icu", "is_clinical", "is_outward"),
selected = "mo", selected = "mo",
direction = "vertical" direction = "vertical"
@ -497,7 +505,7 @@ server <- function(input, output, session) {
div( div(
style = "position: absolute; right: 3.5em; bottom: 0.5em;", style = "position: absolute; right: 3.5em; bottom: 0.5em;",
dropdown( dropdown(
downloadButton(outputId = "down_box_res_prop", label = "Download plot"), downloadButton(outputId = "down_box_res_prop", label = trnslt("Download plot")),
size = "xs", size = "xs",
icon = icon("download", class = "opt"), icon = icon("download", class = "opt"),
up = TRUE, up = TRUE,
@ -525,7 +533,7 @@ server <- function(input, output, session) {
) )
), ),
tabPanel( tabPanel(
title = "Combination therapy", title = trnslt("Combination therapy"),
withSpinner( withSpinner(
girafeOutput("comb_plot", height = 400), girafeOutput("comb_plot", height = 400),
type = 4, type = 4,
@ -538,11 +546,11 @@ server <- function(input, output, session) {
label = "HANDLE WITH CARE", label = "HANDLE WITH CARE",
radioGroupButtons( radioGroupButtons(
inputId = "comb", inputId = "comb",
label = HTML("Please read the documentation before interpreting results and modifying underlying algorithm", label = HTML(trnslt("Please read the documentation before interpreting results and modifying underlying algorithm"),
as.character(actionLink(inputId = "action_link", label = "(click here)", onclick = 'window.open("https://msberends.github.io/AMR/reference/proportion.html#combination-therapy")'))), as.character(actionLink(inputId = "action_link", label = trnslt("(click here)"), onclick = 'window.open("https://msberends.github.io/AMR/reference/proportion.html#combination-therapy")'))),
justified = TRUE, justified = TRUE,
width = 150, width = 150,
choiceNames = c("Only all tested", "All"), choiceNames = c(trnslt("Only all tested"), trnslt("All")),
choiceValues = c(TRUE, FALSE), choiceValues = c(TRUE, FALSE),
size = "xs", size = "xs",
direction = "vertical" direction = "vertical"
@ -555,7 +563,7 @@ server <- function(input, output, session) {
div( div(
style = "position: absolute; right: 3.5em; bottom: 0.5em;", style = "position: absolute; right: 3.5em; bottom: 0.5em;",
dropdown( dropdown(
downloadButton(outputId = "down_box_comb_prop", label = "Download plot"), downloadButton(outputId = "down_box_comb_prop", label = trnslt("Download plot")),
size = "xs", size = "xs",
icon = icon("download", class = "opt"), icon = icon("download", class = "opt"),
up = TRUE, up = TRUE,
@ -715,7 +723,7 @@ server <- function(input, output, session) {
isolate_prop_plot <- reactive({ isolate_prop_plot <- reactive({
if (class(try(isolate_prop_data())) == "try-error") { if (class(try(isolate_prop_data())) == "try-error") {
ggplot(data.frame(), aes(x = 1, y = 1, label = "No tests available")) + ggplot(data.frame(), aes(x = 1, y = 1, label = trnslt("No tests available"))) +
geom_text(size = 5, colour = "red", fontface = "bold", family = "Arial") + geom_text(size = 5, colour = "red", fontface = "bold", family = "Arial") +
theme_void() theme_void()
} else { } else {
@ -974,8 +982,8 @@ server <- function(input, output, session) {
list("copy", list( list("copy", list(
extend = "collection", extend = "collection",
buttons = c("csv", "excel", "pdf"), buttons = c("csv", "excel", "pdf"),
text = "Download")), text = trnslt("Download"))),
lengthMenu = list( c(10, 20, -1), c(10, 20, "All")) , lengthMenu = list( c(10, 20, -1), c(10, 20, trnslt("All"))) ,
pageLength = -1, pageLength = -1,
columnDefs = list(list(className = 'dt-right', targets = "_all")))) columnDefs = list(list(className = 'dt-right', targets = "_all"))))
} }

45
translations.txt Normal file
View File

@ -0,0 +1,45 @@
en nl
(click here) (klik hier)
14 days 14 dagen
30 days 30 dagen
60 days 60 dagen
About RadaR2 Over RadaR2
All Alles
All patients Alle patiënten
All specialties selected Alle specialismen
Clinical status Klinische status
Combination therapy Combinatietherapie
Copy Kopiëren
Count Aantal
Define first isolate guidelines Eerste isolaatalgoritme definiëren
Department Afdeling
Department type Afdelingtype
Download Downloaden
Download plot Plot downloaden
Episode Episode
Episode selected Geselecteerde episode
First isolates Eerste isolaten
First isolates per episode Eerste isolaten per episode
Gender Geslacht
ICU status IC-status
No tests available Geen data beschikbaar
Number of first isolates detected Number of first isolates detected
Number of first isolates per episode Number of first isolates per episode
Number of positive & negative blood culture tests Number of positive & negative blood culture tests
Only all tested Alleen alle geteste
Outward status Poli-status
Pathogens Pathogenen
Please read the documentation before interpreting results and modifying underlying algorithm Please read the documentation before interpreting results and modifying underlying algorithm
Positive & negative cultures Positive & negative cultures
Resistance profile Resistantieprofiel
Search and select isolates Isolaten zoeken en selecteren
Search isolates Isolaten zoeken
Select departments Selecteer afdelingen
Select group Groep selecteren
Select pathogen group Pathogeengroep selecteren
Select specialties Selecteer specialisme
Select top ... Top ... selecteren
Specialty Specialisme
Specialty code Specialismecode
Use slider to select by count Use slider to select by count
Year Jaar

16
ui.R
View File

@ -1,17 +1,17 @@
ui <- dashboardPagePlus( ui <- dashboardPage(
title = "RadaR", title = "RadaR2",
skin = "black", collapse_sidebar = TRUE, sidebar_background = "light", skin = "black",
# HEADER ------------------------------------------------------------------ # HEADER ------------------------------------------------------------------
dashboardHeader( dashboardHeader(
title = span(img(src = "radar.png", height = 30), strong("RadaR 2.0")), title = span(img(src = "radar.png", height = 30), strong("RadaR2")),
titleWidth = 500, titleWidth = 500,
tags$li( tags$li(
a( a(
strong("About RadaR"), strong(trnslt("About RadaR2")),
height = 40, height = 40,
href = "https://www.jmir.org/2019/6/e12843/", href = "https://www.jmir.org/2019/6/e12843/",
title = "", title = "",
@ -28,16 +28,16 @@ ui <- dashboardPagePlus(
menuItem(icon = icon("check-square"), menuItem(icon = icon("check-square"),
materialSwitch( materialSwitch(
inputId = "allInput", inputId = "allInput",
label = "All specialties selected", label = trnslt("All specialties selected"),
value = TRUE, value = TRUE,
status = "danger")), status = "danger")),
menuItem(icon = icon("user-nurse"), menuItem(icon = icon("user-nurse"),
checkboxGroupInput(inputId = "specialtyInput", checkboxGroupInput(inputId = "specialtyInput",
label = "Select specialties", label = trnslt("Select specialties"),
choices = sort(unique(radar_data$specialty_shiny)))), choices = sort(unique(radar_data$specialty_shiny)))),
menuItem(icon = icon("hospital"), menuItem(icon = icon("hospital"),
checkboxGroupInput(inputId = "departmentInput", checkboxGroupInput(inputId = "departmentInput",
label = "Select departments" , label = trnslt("Select departments"),
choices = sort(unique(radar_data$department)))) choices = sort(unique(radar_data$department))))
) )
), ),