From bf2a4548c66f7c220a95062ba4d0b0ead4831e8b Mon Sep 17 00:00:00 2001 From: Rich Bielby Date: Fri, 27 Oct 2023 13:41:05 +0100 Subject: [PATCH 01/11] Added dfeshiny to the load out --- global.R | 1 + renv.lock | 21 +++++++++++++++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/global.R b/global.R index f871889..3b4759e 100644 --- a/global.R +++ b/global.R @@ -27,6 +27,7 @@ shhh(library(metathis)) shhh(library(shinyalert)) shhh(library(shinytest2)) shhh(library(rstudioapi)) +shhh(library(dfeshiny)) # shhh(library(shinya11y)) # Functions --------------------------------------------------------------------------------- diff --git a/renv.lock b/renv.lock index b51d85d..7d47fe9 100644 --- a/renv.lock +++ b/renv.lock @@ -405,6 +405,23 @@ ], "Hash": "6b9602c7ebbe87101a9c8edb6e8b6d21" }, + "dfeshiny": { + "Package": "dfeshiny", + "Version": "0.1.0", + "Source": "GitHub", + "RemoteType": "github", + "RemoteHost": "api.github.com", + "RemoteUsername": "dfe-analytical-services", + "RemoteRepo": "dfeshiny", + "RemoteRef": "main", + "RemoteSha": "907ea793b644929e47ac164fcb11fdaea037a434", + "Requirements": [ + "shiny", + "shinyGovstyle", + "styler" + ], + "Hash": "4491ff843932cf885c1b1fa9142f0fa6" + }, "diffobj": { "Package": "diffobj", "Version": "0.3.5", @@ -1142,7 +1159,7 @@ }, "shiny": { "Package": "shiny", - "Version": "1.7.5", + "Version": "1.7.5.1", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -1172,7 +1189,7 @@ "withr", "xtable" ], - "Hash": "438b99792adbe82a8329ad8697d45afe" + "Hash": "5ec01cc255f2138fc2f0dc74d2b1a1a1" }, "shinyGovstyle": { "Package": "shinyGovstyle", From 740ea6d06a5f45112b24cbb8a908d13a47c6e0af Mon Sep 17 00:00:00 2001 From: Rich Bielby Date: Fri, 27 Oct 2023 13:42:15 +0100 Subject: [PATCH 02/11] Removed tidy code functions from repo as provided by dfeshiny now --- .Rprofile | 6 ------ global.R | 19 ------------------- 2 files changed, 25 deletions(-) diff --git a/.Rprofile b/.Rprofile index d012a5c..4583f7f 100644 --- a/.Rprofile +++ b/.Rprofile @@ -12,12 +12,6 @@ cat("Sourcing .Rprofile.", fill = TRUE) source("renv/activate.R") -# Tidy code function -tidy_code <- function() { - source("global.r") - tidy_code_function() -} - # Function to run tests run_tests_locally <- function() { Sys.unsetenv("http_proxy") diff --git a/global.R b/global.R index 3b4759e..6cce262 100644 --- a/global.R +++ b/global.R @@ -46,25 +46,6 @@ cs_num <- function(value) { format(value, big.mark = ",", trim = TRUE) } -# tidy_code_function ------------------------------------------------------------------------------- -# Code to tidy up the scripts. - -tidy_code_function <- function() { - message("----------------------------------------") - message("App scripts") - message("----------------------------------------") - app_scripts <- eval(styler::style_dir(recursive = FALSE)$changed) - message("R scripts") - message("----------------------------------------") - r_scripts <- eval(styler::style_dir("R/")$changed) - message("Test scripts") - message("----------------------------------------") - test_scripts <- eval(styler::style_dir("tests/", filetype = "r")$changed) - script_changes <- c(app_scripts, r_scripts, test_scripts) - return(script_changes) -} - - # Source scripts --------------------------------------------------------------------------------- # Source any scripts here. Scripts may be needed to process data before it gets to the server file. From a430695703422b58bdeb3525aad8b40e2652fcf5 Mon Sep 17 00:00:00 2001 From: Rich Bielby Date: Fri, 27 Oct 2023 14:42:20 +0100 Subject: [PATCH 03/11] renv update and using standard_panel function from dfeshiny --- .Rprofile | 18 -------- R/standard_panels.R | 48 ------------------- global.R | 1 + renv.lock | 109 ++++++++++++++++++++++++++++---------------- ui.R | 6 ++- 5 files changed, 75 insertions(+), 107 deletions(-) diff --git a/.Rprofile b/.Rprofile index 4583f7f..45d58ef 100644 --- a/.Rprofile +++ b/.Rprofile @@ -12,23 +12,5 @@ cat("Sourcing .Rprofile.", fill = TRUE) source("renv/activate.R") -# Function to run tests -run_tests_locally <- function() { - Sys.unsetenv("http_proxy") - Sys.unsetenv("https_proxy") - source("global.r") - # message("================================================================================") - # message("== testthat ====================================================================") - # message("") - # testthat::test_dir("tests/testthat") - # message("") - message("================================================================================") - message("== shinytest2 ==================================================================") - message("") - shinytest2::test_app() - message("") - message("================================================================================") -} - # Install commit-hooks locally statusWriteCommit <- file.copy(".hooks/pre-commit.R", ".git/hooks/pre-commit", overwrite = TRUE) diff --git a/R/standard_panels.R b/R/standard_panels.R index d0d8223..d979739 100644 --- a/R/standard_panels.R +++ b/R/standard_panels.R @@ -38,51 +38,3 @@ a11y_panel <- function() { ) } -support_links <- function() { - tabPanel( - "Support and feedback", - gov_main_layout( - gov_row( - column( - width = 12, - h1("Support and feedback"), - h2("Give us feedback"), - p( - "This dashboard is a new service that we are developing. If you have any feedback or suggestions for improvements, please submit them using our ", - a( - href = "https://forms.office.com", - "feedback form", .noWS = c("after") - ), "." - ), - p( - "If you spot any errors or bugs while using this dashboard, please screenshot and email them to ", - a(href = "mailto:statistics.development@education.gov.uk", "statistics.development@education.gov.uk", .noWS = c("after")), "." - ), - h2("Find more information on the data"), - p( - "The data used to produce the dashboard, along with methodological information can be found on ", - a(href = "https://explore-education-statistics.service.gov.uk/", "Explore Education Statistics", .noWS = c("after")), - "." - ), - h2("Contact us"), - p( - "If you have questions about the dashboard or data within it, please contact us at ", - a(href = "mailto:statistics.development@education.gov.uk", "statistics.development@education.gov.uk", .noWS = c("after")) - ), - h2("See the source code"), - p( - "The source code for this dashboard is available in our ", - a(href = "https://github.com/dfe-analytical-services/shiny-template", "GitHub repository", .noWS = c("after")), - "." - ) - ), - column( - 12, - h2("Use of cookies"), - textOutput("cookie_status"), - actionButton("remove", "Reset cookie consent"), - ) - ) - ) - ) -} diff --git a/global.R b/global.R index 6cce262..61c9d70 100644 --- a/global.R +++ b/global.R @@ -27,6 +27,7 @@ shhh(library(metathis)) shhh(library(shinyalert)) shhh(library(shinytest2)) shhh(library(rstudioapi)) +shhh(library(bslib)) shhh(library(dfeshiny)) # shhh(library(shinya11y)) diff --git a/renv.lock b/renv.lock index 7d47fe9..bf044d5 100644 --- a/renv.lock +++ b/renv.lock @@ -25,7 +25,7 @@ }, "DT": { "Package": "DT", - "Version": "0.29", + "Version": "0.30", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -38,7 +38,7 @@ "magrittr", "promises" ], - "Hash": "02f42b77a951a5ea7c891ef5c187d774" + "Hash": "dffb4d94a00be1b4a4507e53ab95bd90" }, "MASS": { "Package": "MASS", @@ -264,7 +264,7 @@ }, "checkmate": { "Package": "checkmate", - "Version": "2.2.0", + "Version": "2.3.0", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -272,7 +272,7 @@ "backports", "utils" ], - "Hash": "ca9c113196136f4a9ca9ce6079c2c99e" + "Hash": "ed4275b13c6ab74b89a31def0b6bf835" }, "chromote": { "Package": "chromote", @@ -372,13 +372,13 @@ }, "curl": { "Package": "curl", - "Version": "5.0.2", + "Version": "5.1.0", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "R" ], - "Hash": "511bacbfa153a15251166b463b4da4f9" + "Hash": "9123f3ef96a2c1a93927d828b2fe7d4c" }, "data.table": { "Package": "data.table", @@ -407,20 +407,20 @@ }, "dfeshiny": { "Package": "dfeshiny", - "Version": "0.1.0", + "Version": "0.1.1", "Source": "GitHub", "RemoteType": "github", - "RemoteHost": "api.github.com", "RemoteUsername": "dfe-analytical-services", "RemoteRepo": "dfeshiny", "RemoteRef": "main", - "RemoteSha": "907ea793b644929e47ac164fcb11fdaea037a434", + "RemoteSha": "437c6e4c60b5eb9c1f55333588b65110d47b7ba2", + "RemoteHost": "api.github.com", "Requirements": [ "shiny", "shinyGovstyle", "styler" ], - "Hash": "4491ff843932cf885c1b1fa9142f0fa6" + "Hash": "b3f1cac9ab18652447e842b04f702959" }, "diffobj": { "Package": "diffobj", @@ -484,18 +484,18 @@ }, "evaluate": { "Package": "evaluate", - "Version": "0.21", + "Version": "0.22", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "R", "methods" ], - "Hash": "d59f3b464e8da1aef82dc04b588b8dfb" + "Hash": "66f39c7a21e03c4dcb2c2d21d738d603" }, "fansi": { "Package": "fansi", - "Version": "1.0.4", + "Version": "1.0.5", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -503,7 +503,7 @@ "grDevices", "utils" ], - "Hash": "1d9e7ad3c8312a192dea7d3db0274fde" + "Hash": "3e8583a60163b4bc1a80016e63b9959e" }, "farver": { "Package": "farver", @@ -555,7 +555,7 @@ }, "ggplot2": { "Package": "ggplot2", - "Version": "3.4.3", + "Version": "3.4.4", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -576,7 +576,7 @@ "vctrs", "withr" ], - "Hash": "85846544c596e71f8f46483ab165da33" + "Hash": "313d31eff2274ecf4c1d3581db7241f9" }, "globals": { "Package": "globals", @@ -628,7 +628,7 @@ }, "htmltools": { "Package": "htmltools", - "Version": "0.5.6", + "Version": "0.5.6.1", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -641,7 +641,7 @@ "rlang", "utils" ], - "Hash": "a2326a66919a3311f7fbb1e3bf568283" + "Hash": "1e12fe667316a76508898839ecfb2d00" }, "htmlwidgets": { "Package": "htmlwidgets", @@ -660,7 +660,7 @@ }, "httpuv": { "Package": "httpuv", - "Version": "1.6.11", + "Version": "1.6.12", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -671,7 +671,7 @@ "promises", "utils" ], - "Hash": "838602f54e32c1a0f8cc80708cefcefa" + "Hash": "c992f75861325961c29a188b45e549f7" }, "httr": { "Package": "httr", @@ -759,7 +759,7 @@ }, "lattice": { "Package": "lattice", - "Version": "0.21-8", + "Version": "0.22-5", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -770,7 +770,7 @@ "stats", "utils" ], - "Hash": "0b8a6d63c8770f02a8b5635f3c431e6b" + "Hash": "7c5e89f04e72d6611c77451f6331a091" }, "lazyeval": { "Package": "lazyeval", @@ -883,13 +883,13 @@ }, "openssl": { "Package": "openssl", - "Version": "2.1.0", + "Version": "2.1.1", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "askpass" ], - "Hash": "273a6bb4a9844c296a459d2176673270" + "Hash": "2a0dc8c6adfb6f032e4d4af82d258ab5" }, "pillar": { "Package": "pillar", @@ -919,6 +919,24 @@ ], "Hash": "b762f8f7d305f7eb0bab96eb1a3c782a" }, + "pkgbuild": { + "Package": "pkgbuild", + "Version": "1.4.2", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "R6", + "callr", + "cli", + "crayon", + "desc", + "prettyunits", + "processx", + "rprojroot" + ], + "Hash": "beb25b32a957a22a5c301a9e441190b3" + }, "pkgconfig": { "Package": "pkgconfig", "Version": "2.0.3", @@ -931,9 +949,9 @@ }, "pkgload": { "Package": "pkgload", - "Version": "1.3.2.1", + "Version": "1.3.3", "Source": "Repository", - "Repository": "RSPM", + "Repository": "CRAN", "Requirements": [ "R", "cli", @@ -942,16 +960,17 @@ "fs", "glue", "methods", + "pkgbuild", "rlang", "rprojroot", "utils", "withr" ], - "Hash": "a7f498a1b2a4a6816148e498509f6e1d" + "Hash": "903d68319ae9923fb2e2ee7fa8230b91" }, "plotly": { "Package": "plotly", - "Version": "4.10.2", + "Version": "4.10.3", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -979,7 +998,7 @@ "vctrs", "viridisLite" ], - "Hash": "6c00a09ba7d34917d9a3e28b15dd74e3" + "Hash": "56914cc61df53f2d0283d5498680867e" }, "praise": { "Package": "praise", @@ -988,6 +1007,16 @@ "Repository": "CRAN", "Hash": "a555924add98c99d2f411e37e7d25e9f" }, + "prettyunits": { + "Package": "prettyunits", + "Version": "1.2.0", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R" + ], + "Hash": "6b01fc98b1e86c4f705ce9dcfd2f57c7" + }, "processx": { "Package": "processx", "Version": "3.8.2", @@ -1369,9 +1398,9 @@ }, "testthat": { "Package": "testthat", - "Version": "3.1.10", + "Version": "3.2.0", "Source": "Repository", - "Repository": "RSPM", + "Repository": "CRAN", "Requirements": [ "R", "R6", @@ -1395,7 +1424,7 @@ "waldo", "withr" ], - "Hash": "6f403dc49295610a3a67ea1a9ca64346" + "Hash": "877508719fcb8c9525eccdadf07a5102" }, "tibble": { "Package": "tibble", @@ -1457,23 +1486,23 @@ }, "tinytex": { "Package": "tinytex", - "Version": "0.46", + "Version": "0.48", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "xfun" ], - "Hash": "0c41a73214d982f539c56a7773c7afa5" + "Hash": "8f96d229b7311beb32b94cf413b13f84" }, "utf8": { "Package": "utf8", - "Version": "1.2.3", + "Version": "1.2.4", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "R" ], - "Hash": "1fe17157424bb09c48a8b3b550c753bc" + "Hash": "62b65c52671e6665f803ff02954446e9" }, "uuid": { "Package": "uuid", @@ -1487,7 +1516,7 @@ }, "vctrs": { "Package": "vctrs", - "Version": "0.6.3", + "Version": "0.6.4", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -1497,7 +1526,7 @@ "lifecycle", "rlang" ], - "Hash": "d0ef2856b83dc33ea6e255caf6229ee2" + "Hash": "266c1ca411266ba8f365fcc726444b87" }, "viridisLite": { "Package": "viridisLite", @@ -1541,7 +1570,7 @@ }, "withr": { "Package": "withr", - "Version": "2.5.0", + "Version": "2.5.1", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -1550,7 +1579,7 @@ "graphics", "stats" ], - "Hash": "c0e49a9760983e81e55cdd9be92e7182" + "Hash": "d77c6f74be05c33164e33fbc85540cae" }, "xfun": { "Package": "xfun", diff --git a/ui.R b/ui.R index 9faa259..71d6728 100644 --- a/ui.R +++ b/ui.R @@ -128,7 +128,11 @@ ui <- function(input, output, session) { dashboard_panel(), homepage_panel(), a11y_panel(), - support_links() + support_panel( + team_email='statistics.development@education.gov.uk', + repo_name = 'shiny-template', + form_url = 'https://forms.office.com' + ) ), tags$script( src = "script.js" From 69dc8c7e4459edcc571c2a0b9c8859fd46edad19 Mon Sep 17 00:00:00 2001 From: Rich Bielby Date: Fri, 27 Oct 2023 16:03:32 +0100 Subject: [PATCH 04/11] Update to tidy code GitHub actions workflow --- .github/workflows/tidyCode.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tidyCode.yaml b/.github/workflows/tidyCode.yaml index 72fafe8..f64bc3b 100644 --- a/.github/workflows/tidyCode.yaml +++ b/.github/workflows/tidyCode.yaml @@ -58,7 +58,7 @@ jobs: run: | source("global.R") - codeChecks <- tidy_code_function() + codeChecks <- tidy_code() if(any(is.na(codeChecks))) { stop("There is a breaking error in the code.") From 735d1722bcff8335233df0f9d8a7cb7246d6fd9d Mon Sep 17 00:00:00 2001 From: Rich Bielby Date: Mon, 30 Oct 2023 08:26:30 +0000 Subject: [PATCH 05/11] tidying --- ui.R | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ui.R b/ui.R index 71d6728..f7be4bf 100644 --- a/ui.R +++ b/ui.R @@ -129,10 +129,10 @@ ui <- function(input, output, session) { homepage_panel(), a11y_panel(), support_panel( - team_email='statistics.development@education.gov.uk', - repo_name = 'shiny-template', - form_url = 'https://forms.office.com' - ) + team_email = "statistics.development@education.gov.uk", + repo_name = "shiny-template", + form_url = "https://forms.office.com" + ) ), tags$script( src = "script.js" From 7eb4f13f6ec8be5bf01efa26e10feb0a09c21670 Mon Sep 17 00:00:00 2001 From: Rich Bielby Date: Mon, 30 Oct 2023 08:55:14 +0000 Subject: [PATCH 06/11] tidying --- R/standard_panels.R | 1 - 1 file changed, 1 deletion(-) diff --git a/R/standard_panels.R b/R/standard_panels.R index d979739..95a135b 100644 --- a/R/standard_panels.R +++ b/R/standard_panels.R @@ -37,4 +37,3 @@ a11y_panel <- function() { ) ) } - From 9c59fe10cf832357dffe36374cc3e217ab4f6a00 Mon Sep 17 00:00:00 2001 From: Cam Race <52536248+cjrace@users.noreply.github.com> Date: Thu, 2 Nov 2023 13:26:43 +0000 Subject: [PATCH 07/11] update cran mirror to new renv default --- renv.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/renv.lock b/renv.lock index bf044d5..a49b5c3 100644 --- a/renv.lock +++ b/renv.lock @@ -4,7 +4,7 @@ "Repositories": [ { "Name": "CRAN", - "URL": "http://cran.rstudio.com" + "URL": "https://packagemanager.posit.co/cran/latest" } ] }, From bdee89135b15dc294bfdb46a98865376daa46373 Mon Sep 17 00:00:00 2001 From: Rich Bielby Date: Thu, 2 Nov 2023 15:13:21 +0000 Subject: [PATCH 08/11] Restoring run_tests_locally() --- .Rprofile | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/.Rprofile b/.Rprofile index 45d58ef..30e6e0c 100644 --- a/.Rprofile +++ b/.Rprofile @@ -12,5 +12,26 @@ cat("Sourcing .Rprofile.", fill = TRUE) source("renv/activate.R") +library(dfeshiny) + +# Function to run tests +run_tests_locally <- function() { + Sys.unsetenv("http_proxy") + Sys.unsetenv("https_proxy") + source("global.r") + # message("================================================================================") + # message("== testthat ====================================================================") + # message("") + # testthat::test_dir("tests/testthat") + # message("") + message("================================================================================") + message("== shinytest2 ==================================================================") + message("") + shinytest2::test_app() + message("") + message("================================================================================") +} + # Install commit-hooks locally statusWriteCommit <- file.copy(".hooks/pre-commit.R", ".git/hooks/pre-commit", overwrite = TRUE) + From 4b2cde0578c7f400fb824078dea17809f5a0f15b Mon Sep 17 00:00:00 2001 From: Rich Bielby Date: Thu, 2 Nov 2023 17:03:01 +0000 Subject: [PATCH 09/11] Added conditional dfeshiny package load to .Rprofile --- .Rprofile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.Rprofile b/.Rprofile index 30e6e0c..16f30bc 100644 --- a/.Rprofile +++ b/.Rprofile @@ -12,7 +12,7 @@ cat("Sourcing .Rprofile.", fill = TRUE) source("renv/activate.R") -library(dfeshiny) +if(system.file(package='dfeshiny')!=''){library(dfeshiny)} else {warning("dfeshiny package is not installed, please run renv::restore() to set up the necessary package environment")} # Function to run tests run_tests_locally <- function() { From a5599ad3ca5f2c27016f856a716e3ebc9ef4928c Mon Sep 17 00:00:00 2001 From: Rich Bielby Date: Thu, 2 Nov 2023 17:06:16 +0000 Subject: [PATCH 10/11] tidy code --- .Rprofile | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.Rprofile b/.Rprofile index 16f30bc..d406891 100644 --- a/.Rprofile +++ b/.Rprofile @@ -12,7 +12,11 @@ cat("Sourcing .Rprofile.", fill = TRUE) source("renv/activate.R") -if(system.file(package='dfeshiny')!=''){library(dfeshiny)} else {warning("dfeshiny package is not installed, please run renv::restore() to set up the necessary package environment")} +if (system.file(package = "dfeshiny") != "") { + library(dfeshiny) +} else { + warning("dfeshiny package is not installed, please run renv::restore() to set up the necessary package environment") +} # Function to run tests run_tests_locally <- function() { @@ -34,4 +38,3 @@ run_tests_locally <- function() { # Install commit-hooks locally statusWriteCommit <- file.copy(".hooks/pre-commit.R", ".git/hooks/pre-commit", overwrite = TRUE) - From e43b965bc78ba20016b54a131d7eaffdb4f9d84f Mon Sep 17 00:00:00 2001 From: Rich Bielby Date: Tue, 7 Nov 2023 13:23:09 +0000 Subject: [PATCH 11/11] Quietened af_colours --- R/dfe_resources.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/dfe_resources.R b/R/dfe_resources.R index 0604aea..49ca6f2 100644 --- a/R/dfe_resources.R +++ b/R/dfe_resources.R @@ -7,4 +7,4 @@ # 2023-09-21: update made to change hex codes to AF colours package # guidance here: https://best-practice-and-impact.github.io/afcolours/ -gss_colour_pallette <- afcolours::af_colours("categorical", colour_format = "hex", n = 6) +suppressMessages(gss_colour_pallette <- afcolours::af_colours("categorical", colour_format = "hex", n = 6))