diff --git a/.gitignore b/.gitignore index 6056c31..fcc3440 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ .Ruserdata *.DS_Store *.dcf +.Renviron diff --git a/DESCRIPTION b/DESCRIPTION index a550343..7c46235 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,10 +1,11 @@ Package: acorn Type: Package Title: A Dashboard for ACORN AMR Data -Version: 2.6.0 +Version: 2.6.1 Authors@R: c(person(given = "Olivier", family = "Celhay", email = "olivier.celhay@gmail.com", - role = c("aut", "cre"), comment = c(ORCID = "https://orcid.org/0000-0002-2971-9110")), + role = c("aut", "cre"), + comment = c(ORCID = "https://orcid.org/0000-0002-2971-9110")), person(given = "Paul", family = "Turner", email = "Pault@tropmedres.ac", role = c("aut"))) diff --git a/inst/acorn/app.R b/inst/acorn/app.R index b88f1ab..475292d 100644 --- a/inst/acorn/app.R +++ b/inst/acorn/app.R @@ -1,4 +1,4 @@ -app_version <- "2.6.0" # Make sure that the app version is identical in DESCRIPTION +app_version <- "2.6.1" # Make sure that the app version is identical in DESCRIPTION session_start_time <- format(Sys.time(), "%Y-%m-%d_%HH%M") # IMPORTANT: ensure that there is a match between the calls below and: @@ -43,13 +43,14 @@ choices_datamanagement <- c("Generate and load .acorn
from clinical and la "Load .acorn
from local file", "Info on
loaded .acorn") -code_sites <- c("Run Demo", - "Upload Local .acorn", - readr::read_csv( - file = "./www/data/ACORN2_site_codes.csv", - show_col_types = FALSE) |> - pull(site_code) -) +site_choices <- readr::read_csv( + file = "./www/data/ACORN2_site_codes.csv", + show_col_types = FALSE) |> + shinyWidgets::prepare_choices( + label = site_code, + value = site_code, + group_by = country + ) aware <- read.csv( file = "./www/data/AWaRe_WHO_2021.csv") |> @@ -229,7 +230,12 @@ ui <- page( div(class = "well", h5(class = "text_center", i18n$t("Please log in")), div(class = "text-center", i18n$t("(To log out, close the app.)")), - pickerInput("cred_site", "", choices = code_sites, selected = "Run Demo"), + shinyWidgets::virtualSelectInput( + "cred_site", + "", + site_choices, + hasOptionDescription = TRUE + ), conditionalPanel("input.cred_site != 'Run Demo' && input.cred_site != 'Upload Local .acorn'", div( textInput("cred_user", tagList(icon("user"), i18n$t("User")), placeholder = "enter user name"), passwordInput("cred_password", tagList(icon("unlock-alt"), i18n$t("Password")), placeholder = "enter password") diff --git a/inst/acorn/www/data/ACORN2_site_codes.csv b/inst/acorn/www/data/ACORN2_site_codes.csv index 998e6f8..06b616c 100644 --- a/inst/acorn/www/data/ACORN2_site_codes.csv +++ b/inst/acorn/www/data/ACORN2_site_codes.csv @@ -1,4 +1,4 @@ -site_code,country,city,site_name,lat,lon,acorn_network,comment +site_code,country,city,site_name,lat,lon,acorn_network,comment KH001,Cambodia,Siem Reap,Angkor Hospital for Children,13.3579855,103.8567,TRUE, GH001,Ghana,Accra,Korle-Bu Teaching Hospital,5.5372605,-0.22683187,TRUE, GH002,Ghana,Accra,37 Military Hospital,5.588754786,-0.18410816,TRUE, @@ -18,4 +18,5 @@ NG002,Nigeria,Ife,"Obafemi Awolowo University Teaching Hospital, Ife",7.49053224 NG003,Nigeria,Igbo-ora,Ibarapa Rural lab,7.447033504,3.276880573,FALSE, VN001,Vietnam,Hanoi,National Hospital for Tropical Diseases,21.00231646,105.8389495,TRUE, VN002,Vietnam,Hue,Hue Central Hospital (Bệnh viện Trung Ương Huế),16.4626133,107.5879476,FALSE, -VN003,Vietnam,Ho Chi Minh City,Children's Hospital 2 (Bệnh viện Nhi Đồng 2),10.7810848,106.702319,FALSE, \ No newline at end of file +VN003,Vietnam,Ho Chi Minh City,Children's Hospital 2 (Bệnh viện Nhi Đồng 2),10.7810848,106.702319,FALSE, +PH001,Philippine,Manila,Philippine General Hospital,,,FALSE, \ No newline at end of file diff --git a/misc/create_encrypted_credentials.R b/misc/create_encrypted_credentials.R index b9ac952..dd2bb43 100644 --- a/misc/create_encrypted_credentials.R +++ b/misc/create_encrypted_credentials.R @@ -1,36 +1,41 @@ -creds <- readxl::read_excel("/Users/olivier/Documents/Projets/ACORN/Data/ACORN2_cred.xlsx", - sheet = "cred") |> - filter(!is.na(site)) +# INSTRUCTIONS: +# - use the R commands below to generate one .rds file per line in ACORN2_cred.xlsx +# - add encrypted_cred_XXX_YYY.rds to the S3 "shared-acornamr" folder +# - rename encrypted_cred_demo.rds into encrypted_cred_demo_demo.rds +# - add encrypted_cred_demo.rds to the app "www/cred" folder + +dir <- "/Users/olivier/Documents/Consultances/ACORN/Data" + +creds <- readxl::read_excel( + path = glue::glue("{dir}/ACORN2_cred.xlsx"), + sheet = "cred") |> + dplyr::filter( + !is.na(site) + ) for (i in 1:nrow(creds)) { user <- creds[i, ] cred <- serialize( - object = list(site = user$site, - user = user$user, - # REDCap - redcap_access = user$redcap_access, - redcap_uri = user$redcap_uri, - redcap_f01f05_api = user$redcap_f01f05_api, - redcap_hai_api = user$redcap_hai_api, - # AWS S3 - aws_access = user$aws_access, - aws_bucket = user$aws_bucket, - aws_region = user$aws_region, - aws_key = user$aws_key, - aws_secret = user$aws_secret + object = list( + site = user$site, + user = user$user, + # REDCap + redcap_access = user$redcap_access, + redcap_uri = user$redcap_uri, + redcap_f01f05_api = user$redcap_f01f05_api, + redcap_hai_api = user$redcap_hai_api, + # AWS S3 + aws_access = user$aws_access, + aws_bucket = user$aws_bucket, + aws_region = user$aws_region, + aws_key = user$aws_key, + aws_secret = user$aws_secret ), connection = NULL) encrypted_cred <- openssl::aes_cbc_encrypt(cred, key = openssl::sha256(charToRaw(user$pwd))) - saveRDS(encrypted_cred, glue::glue("/Users/olivier/Documents/Projets/ACORN/Data/ACORN2_creds/encrypted_cred_{user$site}_{user$user}.rds")) + saveRDS(encrypted_cred, glue::glue("{dir}/ACORN2_creds/encrypted_cred_{user$site}_{user$user}.rds")) } -# Instructions: -# encrypted_cred_XXX_YYY.rds files should be added to the "shared-acornamr" folder -# "encrypted_cred_demo.rds" should be added to the "www/cred" folder. -# "shared_acornamr_key.rds" and "share-acornamr_sec.rds" should be added to the "www/cred" folder. -# They can be generated with the commands: -# saveRDS("COPY_KEY_HERE", file = "/Users/olivier/Documents/Projets/ACORN/Data/ACORN2_creds/shared_acornamr_key.rds") -# saveRDS("COPY_SECRET_HERE", file = "/Users/olivier/Documents/Projets/ACORN/Data/ACORN2_creds/shared_acornamr_sec.rds") diff --git a/renv.lock b/renv.lock index 3bdf478..67fb46a 100644 --- a/renv.lock +++ b/renv.lock @@ -349,10 +349,10 @@ }, "commonmark": { "Package": "commonmark", - "Version": "1.8.0", + "Version": "1.9.0", "Source": "Repository", "Repository": "CRAN", - "Hash": "2ba81b120c1655ab696c935ef33ea716", + "Hash": "d691c61bff84bd63c383874d2d0c3307", "Requirements": [] }, "cpp11": { @@ -955,12 +955,12 @@ }, "markdown": { "Package": "markdown", - "Version": "1.1", + "Version": "1.6", "Source": "Repository", "Repository": "CRAN", - "Hash": "61e4a10781dd00d7d81dd06ca9b94e95", + "Hash": "c0e8495f796d73f2d2e1a8c6964d67e8", "Requirements": [ - "mime", + "commonmark", "xfun" ] }, @@ -1690,10 +1690,10 @@ }, "xfun": { "Package": "xfun", - "Version": "0.31", + "Version": "0.39", "Source": "Repository", "Repository": "CRAN", - "Hash": "a318c6f752b8dcfe9fb74d897418ab2b", + "Hash": "8f56e9acb54fb525e66464d57ab58bcb", "Requirements": [] }, "xml2": {