Skip to content

Commit

Permalink
Merge pull request #107 from dfe-analytical-services/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
rmbielby authored Oct 9, 2024
2 parents a0c7644 + 7103908 commit 5dc71c2
Show file tree
Hide file tree
Showing 28 changed files with 1,438 additions and 1,116 deletions.
29 changes: 15 additions & 14 deletions .hooks/pre-commit.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env Rscript
cat("Running commit hooks...",fill=TRUE)
cat("Running commit hooks...", fill = TRUE)
shhh <- suppressPackageStartupMessages # It's a library, so shhh!
shhh(library(dplyr))
shhh(library(xfun))
Expand All @@ -16,12 +16,12 @@ cat("Contents of the .gitignore file:")
print(ign_files)

# Run a pass through the .gitignore files and look for any issues
if(ncol(ign_files)>1){
if (ncol(ign_files) > 1) {
cat("ERROR: It looks like you've got commas in the .gitignore. Please correct the .gitignore file and try again.")
error_flag <- TRUE
} else {
for(i in 1:nrow(ign_files)){
if(grepl(' ',ign_files$filename[i])){
for (i in 1:nrow(ign_files)) {
if (grepl(" ", ign_files$filename[i])) {
cat("ERROR: It looks like you've got spaces in filenames in the .gitignore. Please rename your files if they contain spaces and update the .gitignore file accordingly.")
error_flag <- TRUE
}
Expand All @@ -41,25 +41,24 @@ for (file in current_files$files) {
} else {
file_status <- (log_files %>% filter(filename == file))$status
if (!file_status %in% c("published", "Published", "reference", "Reference", "dummy", "Dummy")) {
if (!file %in% ign_files$filename & !grepl("unpublished",file)) {
if (!file %in% ign_files$filename & !grepl("unpublished", file)) {
cat("Error:", file, "is not logged as published or reference data in datafiles_log.csv and is not found in .gitignore.\n\n")
cat("If the file contains published or reference data then update its entry in datafiles_log.csv.\n\n")
cat("If the file contains unpublished data then add it to the .gitignore file.\n\n")
error_flag <- TRUE
}
else {
cat(file,"is recorded in the logfile as unpublished data and in .gitignore and so will not be included as part of the commit.\n\n")
} else {
cat(file, "is recorded in the logfile as unpublished data and in .gitignore and so will not be included as part of the commit.\n\n")
}
}
}
}

if(grepl('G-Z967JJVQQX', htmltools::includeHTML(("google-analytics.html"))) &
!(toupper(Sys.getenv("USERNAME")) %in% c("CFOSTER4", "CRACE", "LSELBY","RBIELBY", "JMACHIN"))){
cat("Cleaning out the template's Google Analytics tag.",fill=TRUE)
if (grepl("G-Z967JJVQQX", htmltools::includeHTML(("google-analytics.html"))) &
!(toupper(Sys.getenv("USERNAME")) %in% c("CFOSTER4", "CRACE", "LSELBY", "RBIELBY", "JMACHIN"))) {
cat("Cleaning out the template's Google Analytics tag.", fill = TRUE)
gsub_file("google-analytics.html", pattern = "G-Z967JJVQQX", replacement = "G-XXXXXXXXXX")
gsub_file("ui.R", pattern = "Z967JJVQQX", replacement = "XXXXXXXXXX")
system2(command = "git", args=c("add","google-analytics.html"))
system2(command = "git", args = c("add", "google-analytics.html"))
}

if (error_flag) {
Expand All @@ -68,7 +67,7 @@ if (error_flag) {
}

tidy_output <- dfeshiny::tidy_code()
if(any(tidy_output)){
if (any(tidy_output)) {
error_flag <- TRUE
}

Expand All @@ -81,7 +80,9 @@ if (error_flag) {
cat("\n")

cat("\n2. Rebuilding manifest.json...", fill = TRUE)
if (system.file(package = "git2r") == "") {renv::install("git2r")}
if (system.file(package = "git2r") == "") {
renv::install("git2r")
}
shhh(library(git2r))
if (system.file(package = "rsconnect") != "" & system.file(package = "git2r") != "") {
if (!any(grepl("manifest.json", git2r::status()))) {
Expand Down
23 changes: 11 additions & 12 deletions R/data_sources.R
Original file line number Diff line number Diff line change
@@ -1,24 +1,23 @@
data_sources_tab <- function() {
tabPanel(
value = "data_sources",
"Data Sources",
"Data sources",
gov_main_layout(
br(),
gov_row(
h2("Data sources"),
p("Most data included in the dashboard is children’s social care statistics published by DfE and available on", a(href = "https://explore-education-statistics.service.gov.uk/", "Explore Education Statistics.", target = "_blank", style = "font-family: GDS Transport, arial, sans-serif; font-size :19px;"), " The publications include:"),
tags$ul(
tags$li(a(href = "https://explore-education-statistics.service.gov.uk/find-statistics/children-looked-after-in-england-including-adoptions", "Children looked after in England including adoptions (last updated: 25 April 2024) (Opens in a new tab).", target = "_blank", style = "font-family: GDS Transport, arial, sans-serif; font-size :19px;")),
tags$li(a(href = "https://explore-education-statistics.service.gov.uk/find-statistics/characteristics-of-children-in-need", "Children in need (last updated: 26 October 2023) (Opens in a new tab).", target = "_blank", style = "font-family: GDS Transport, arial, sans-serif; font-size :19px;")),
tags$li(a(href = "https://fingertips.phe.org.uk/profile/child-health-profiles/data#page/3/gid/1938133230/ati/502/iid/90284/age/26/sex/4/cat/-1/ctp/-1/yrr/1/cid/4/tbm/1/page-options/car-do-0", "Public health data explorer (last updated: 08 May 2024) (Opens in a new tab).", target = "_blank", style = "font-family: GDS Transport, arial, sans-serif; font-size :19px;")),
tags$li(a(href = "https://explore-education-statistics.service.gov.uk/find-statistics/children-s-social-work-workforce", "Children's social work workforce (last updated: 29 February 2024) (Opens in a new tab).", target = "_blank", style = "font-family: GDS Transport, arial, sans-serif; font-size :19px;")),
tags$li(a(href = "https://www.ons.gov.uk/datasets/TS021/editions/2021/versions/3", "ONS - Census, Ethnic groups (last updated: 28 March 2023) (Opens in a new tab).", target = "_blank", style = "font-family: GDS Transport, arial, sans-serif; font-size :19px;")),
tags$li(a(href = "https://www.ons.gov.uk/peoplepopulationandcommunity/populationandmigration/populationestimates/datasets/populationestimatesforukenglandandwalesscotlandandnorthernireland", "Estimates of the population for the UK, England, Wales, Scotland, and Northern Ireland (last updated: 26 March 2024) (Opens in a new tab).", target = "_blank", style = "font-family: GDS Transport, arial, sans-serif; font-size :19px;")),
tags$li(a(href = "https://www.gov.uk/government/statistics/childrens-social-care-data-in-england-2023", "Children’s social care data in England 2023 (last updated: 8 September 2023) (Opens in a new tab).", target = "_blank", style = "font-family: GDS Transport, arial, sans-serif; font-size :19px;")),
tags$li(a(href = "https://www.gov.uk/government/statistics/local-authority-revenue-expenditure-and-financing-england-2022-to-2023-individual-local-authority-data-outturn", "Local authority revenue expenditure and financing England: 2022 to 2023 (last updated: 14 February 2024) (Opens in a new tab).", target = "_blank", style = "font-family: GDS Transport, arial, sans-serif; font-size :19px;")),
tags$li(a(href = "https://assets.publishing.service.gov.uk/media/606458acd3bf7f0c8d06b7e2/Childrens_services_statistical_neighbour_benchmarking_tool_-_LGR_Version__April_2021_.xlsx", "Children's services statistical neighbour benchmarking tool (last updated: April 2021) (Opens in a new tab).", target = "_blank", style = "font-family: GDS Transport, arial, sans-serif; font-size :19px;")),
tags$li(a(href = "https://explore-education-statistics.service.gov.uk/find-statistics/outcomes-for-children-in-need-including-children-looked-after-by-local-authorities-in-england", "Outcomes for Children in Need including Children Looked After (last updated 18 April 2024) (Opens in a new tab).", target = "_blank", style = "font-family: GDS Transport, arial, sans-serif; font-size :19px;")),
tags$li(a(href = "https://assets.publishing.service.gov.uk/media/650c373752e73c000d942609/Childrens_social_care_in_England_2023_underlying_data.ods", "Ofsted Leadership ratings (Opens in a new tab).", target = "_blank", style = "font-family: GDS Transport, arial, sans-serif; font-size :19px;"))
tags$li(a(href = "https://explore-education-statistics.service.gov.uk/find-statistics/children-looked-after-in-england-including-adoptions", "Children looked after in England including adoptions (last updated: 25 April 2024) (opens in a new tab).", target = "_blank", style = "font-family: GDS Transport, arial, sans-serif; font-size :19px;")),
tags$li(a(href = "https://explore-education-statistics.service.gov.uk/find-statistics/characteristics-of-children-in-need", "Children in need (last updated: 26 October 2023) (opens in a new tab).", target = "_blank", style = "font-family: GDS Transport, arial, sans-serif; font-size :19px;")),
tags$li(a(href = "https://fingertips.phe.org.uk/profile/child-health-profiles/data#page/3/gid/1938133230/ati/502/iid/90284/age/26/sex/4/cat/-1/ctp/-1/yrr/1/cid/4/tbm/1/page-options/car-do-0", "Public health data explorer (last updated: 08 May 2024) (opens in a new tab).", target = "_blank", style = "font-family: GDS Transport, arial, sans-serif; font-size :19px;")),
tags$li(a(href = "https://explore-education-statistics.service.gov.uk/find-statistics/children-s-social-work-workforce", "Children's social work workforce (last updated: 29 February 2024) (opens in a new tab).", target = "_blank", style = "font-family: GDS Transport, arial, sans-serif; font-size :19px;")),
tags$li(a(href = "https://www.ons.gov.uk/datasets/TS021/editions/2021/versions/3", "ONS - Census, Ethnic groups (last updated: 28 March 2023) (opens in a new tab).", target = "_blank", style = "font-family: GDS Transport, arial, sans-serif; font-size :19px;")),
tags$li(a(href = "https://www.ons.gov.uk/peoplepopulationandcommunity/populationandmigration/populationestimates/datasets/populationestimatesforukenglandandwalesscotlandandnorthernireland", "Estimates of the population for the UK, England, Wales, Scotland, and Northern Ireland (last updated: 26 March 2024) (opens in a new tab).", target = "_blank", style = "font-family: GDS Transport, arial, sans-serif; font-size :19px;")),
tags$li(a(href = "https://www.gov.uk/government/statistics/childrens-social-care-data-in-england-2023", "Children’s social care data in England 2023 (last updated: 8 September 2023) (opens in a new tab).", target = "_blank", style = "font-family: GDS Transport, arial, sans-serif; font-size :19px;")),
tags$li(a(href = "https://www.gov.uk/government/statistics/local-authority-revenue-expenditure-and-financing-england-2022-to-2023-individual-local-authority-data-outturn", "Local authority revenue expenditure and financing England: 2022 to 2023 (last updated: 14 February 2024) (opens in a new tab).", target = "_blank", style = "font-family: GDS Transport, arial, sans-serif; font-size :19px;")),
tags$li(a(href = "https://assets.publishing.service.gov.uk/media/606458acd3bf7f0c8d06b7e2/Childrens_services_statistical_neighbour_benchmarking_tool_-_LGR_Version__April_2021_.xlsx", "Children's services statistical neighbour benchmarking tool (last updated: April 2021) (opens in a new tab).", target = "_blank", style = "font-family: GDS Transport, arial, sans-serif; font-size :19px;")),
tags$li(a(href = "https://explore-education-statistics.service.gov.uk/find-statistics/outcomes-for-children-in-need-including-children-looked-after-by-local-authorities-in-england", "Outcomes for children in need including children looked after (last updated 18 April 2024) (opens in a new tab).", target = "_blank", style = "font-family: GDS Transport, arial, sans-serif; font-size :19px;"))
)
)
)
Expand Down
2 changes: 1 addition & 1 deletion R/enabler1_page.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
enabler1_tab <- function() {
tabPanel(
value = "enabler1_page",
"Multi-Agency",
"Multi-agency",
gov_main_layout(
gov_row(
column(
Expand Down
31 changes: 17 additions & 14 deletions R/enabler2_page.R
Original file line number Diff line number Diff line change
Expand Up @@ -62,22 +62,21 @@ enabler2_tab <- function() {
column(
width = 4,
value_box(
title = "Share of total spend on Children's services",
title = "Share of total local authority spend on children's services",
value = htmlOutput("total_spending_txt")
)
),
column(
width = 4,
value_box(
title = "Average per child spend",
title = "Average per capita (of all children in a local authority) spend on children’s services",
value = htmlOutput("avg_spend_per_child")
)
),
column(
width = 4,
value_box(
title = "Share of total spend on Children's services
minus CLA",
title = "Share of children’s services spend not on CLA",
value = htmlOutput("spend_minus_cla_txt")
)
),
Expand All @@ -89,20 +88,20 @@ enabler2_tab <- function() {
),
accordion(
accordion_panel(
"Share of local authority total spend on Children’s Services, and per child spend",
"Share of local authority total spend on children’s services, and per child spend",
gov_row(
h2("Share of local authority total spend on Children’s Services, and per child spend"),
p("This metric provides contextual information on the resource prioritisation within each Local Authority."),
h2("Share of local authority total spend on children’s services, and per child spend"),
p("This metric provides contextual information on the resource prioritisation within each local authority."),
# extra dropdown for choice to view per child spend or share of spending
div(
class = "input_box",
style = "min-height:100%; height = 100%; overflow-y: visible",
p("This domain contains two levels of data: Share of total spend on children's services and spend per child on children's services"),
p("This domain contains two levels of data: Share of total LA spend on children's services and average per capita (of all children in a local authority) spend on children's services"),
p("Use the dropdown below to select which level of spending data you would like to see in the charts below:"),
selectizeInput(
inputId = "spending_choice",
label = "Select a spending level:",
choices = c("Share of total spend on children's services", "Spend per child on children's services"),
choices = c("Share of total local authority spend on children's services", "Spend per child on children's services"),
selected = NULL,
multiple = FALSE,
options = NULL,
Expand All @@ -129,8 +128,8 @@ enabler2_tab <- function() {
help_text = (
tags$ul(
tags$li("Share of spend is calculated by taking total children’s services expenditure divided by total local authority expenditure"),
tags$li("Average per child spend is calculated based on", a(href = "https://www.ons.gov.uk/peoplepopulationandcommunity/populationandmigration/populationestimates/bulletins/populationestimatesforenglandandwales/mid2022#:~:text=We%20estimate%20the%20population%20of,mid%2D1962%20(1.0%25)", "ONS published mid-2022 population estimates", target = "_blank"), "for children aged 0 to 17 years and total children’s services expenditure."),
tags$li("Average per child spend has been rounded to the nearest whole number."),
tags$li("Average per capita (of all children in a local authority) spend on children’s services is calculated based on", a(href = "https://www.ons.gov.uk/peoplepopulationandcommunity/populationandmigration/populationestimates/bulletins/populationestimatesforenglandandwales/mid2022#:~:text=We%20estimate%20the%20population%20of,mid%2D1962%20(1.0%25)", "ONS published mid-2022 population estimates", target = "_blank"), "for children aged 0 to 17 years and total children’s services expenditure."),
tags$li("Average per capita (of all children in a local authority) spend on children’s services has been rounded to the nearest whole number."),
tags$li("Spending data is based on the RO3 and RSX data files from the", a(href = "https://www.gov.uk/government/statistics/local-authority-revenue-expenditure-and-financing-england-2022-to-2023-individual-local-authority-data-outturn", "Local authority revenue expenditure and financing England: 2022 to 2023 individual local authority data – outturn", target = "_blank")),
tags$br(),
p(
Expand All @@ -156,9 +155,10 @@ enabler2_tab <- function() {
),
),
accordion_panel(
"Share of Children and Young People Services spend minus spend on CLA",
"Share of children’s services spend not on CLA",
gov_row(
h2("Share of Children and Young People Services spend minus spend on CLA by region"),
h2("Share of children’s services spend not on CLA by region"),
p("Prioritising funding and resources that help families early helps children and young people thrive. This metric looks at the resource prioritisation between early and later statutory intervention."),
plotlyOutput("plot_spend_excl_cla_region"),
br(),
details(
Expand Down Expand Up @@ -186,7 +186,7 @@ enabler2_tab <- function() {
)
),
gov_row(
h2("Share of Children and Young People Services spend minus spend on CLA by local authority"),
h2("Share of children’s services spend not on CLA by local authority"),
radioGroupButtons(
"spending2_stats_toggle",
label = NULL,
Expand Down Expand Up @@ -275,6 +275,9 @@ enabler2_tab <- function() {
)
)
),
fluidRow(
p("The culture of leadership drives effective and efficient practice. Ofsted rating for leadership provides a summary judgement of the assessed culture and practice of leadership within each authority."),
)
),
accordion(
accordion_panel(
Expand Down
Loading

0 comments on commit 5dc71c2

Please sign in to comment.