Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
2e45ebc
Added basic API fetch functions and latest release reactive text
rmbielby Jan 30, 2025
623f6bf
Created sqid lookup list
rmbielby Jan 30, 2025
32d8ebf
Updating reasons API query and simplifying headline title
rmbielby Feb 3, 2025
1333922
Adding headline bullets in neater structure
rmbielby Feb 3, 2025
14e76f6
Cleaning up unordered lists on info panel and external links
rmbielby Feb 3, 2025
e728a42
Updates for api access
rmbielby Feb 6, 2025
7722b12
Switched headline bullets to draw data from the API
rmbielby Feb 10, 2025
705c29c
Updated packages
rmbielby Feb 10, 2025
c527e28
Added API branch as dev deploy
rmbielby Feb 10, 2025
289312f
Merge branch 'eesp/connect-eesyapi' into eesp/main-conflict-free
rmbielby Feb 10, 2025
326d28c
Merge pull request #122 from dfe-analytical-services/eesp/main-confli…
rmbielby Feb 10, 2025
31f7c4a
Fixing bugs and laying work to skip double react on shifting between …
rmbielby Feb 10, 2025
a5d182c
Updating chart title and text to work dynamically off API data
rmbielby Feb 10, 2025
6349d2d
Created plotting link up for api
rmbielby Feb 10, 2025
b0b66b6
Chart mop-up
rmbielby Feb 11, 2025
1fa6639
Clean up chart labels
rmbielby Feb 11, 2025
24c3741
Clean out print statements
rmbielby Feb 11, 2025
21f0970
Merge pull request #126 from dfe-analytical-services/eesp/eesyapi-hea…
rmbielby Feb 11, 2025
e1018ec
Removing rogue non-standard characters
rmbielby Feb 11, 2025
077821d
Chart font settings
rmbielby Feb 11, 2025
bc47a29
Updating to latest eesyapi update that converts geographic_level in o…
rmbielby Feb 11, 2025
ee0fb9e
Switching fonts
rmbielby Feb 11, 2025
7523b89
Checking available fonts
rmbielby Feb 11, 2025
392cf62
Setting plot font to something that exists on the host
rmbielby Feb 11, 2025
77fa1c3
Updated reasons chart and value boxes to use API data
rmbielby Feb 26, 2025
49b4fc1
Clearing out discontinued value box code
rmbielby Feb 26, 2025
dd10bb9
Switched reasons tables to API data
rmbielby Feb 26, 2025
dc50329
terra release today that GA can't reach
rmbielby Feb 26, 2025
a05e4bf
Created api map data reactive
rmbielby Feb 27, 2025
d312641
Updated map to use API data
rmbielby Feb 27, 2025
c899150
Bit of overdue code tidy-up removing some of the old reactives that a…
rmbielby Feb 27, 2025
ccf725f
Little bit more clean up
rmbielby Feb 27, 2025
855de3d
Updated table to draw on API data
rmbielby Mar 3, 2025
9a9ac25
Updated dashboard to run off dev data sources
rmbielby Mar 4, 2025
03d4435
Updated code to fit current draft publication files
rmbielby Mar 4, 2025
0250246
Added persistent absence line
rmbielby Mar 4, 2025
e478483
Fixed bug on map chart
rmbielby Mar 4, 2025
abf0ad4
Updated some formatting on the reasons tab and fixed value boxes
rmbielby Mar 4, 2025
4de66b2
Switching API to prod data
rmbielby Mar 6, 2025
8bad49d
Added short term time_period_end fix for Feb half term - need a bette…
rmbielby Mar 6, 2025
59cba76
Adjusting default fonts on charts
rmbielby Mar 11, 2025
ecf57ea
Updated automated tests to use new central workflow
rmbielby Mar 11, 2025
1d560d4
Added trello card creation on new prs
rmbielby Mar 11, 2025
5874017
Registered and fixed to Noto Sans
rmbielby Mar 11, 2025
7068f37
Bit of package clean up
rmbielby Mar 11, 2025
6df4326
Reverting Matrix back to 1.7-2 due to deploy issue
rmbielby Mar 11, 2025
ff19a64
Cleaning out some old code and packages
rmbielby Mar 11, 2025
34a57fc
More redundant code culling, plus updating value box theme
rmbielby Mar 11, 2025
9ebafcc
Cleared out some redundant reactives
rmbielby Mar 11, 2025
b2d1bf4
Pulling school submission numbers from API
rmbielby Mar 11, 2025
133f286
Updating front page with API school numbers
rmbielby Mar 12, 2025
cbf500a
Removing use of this publication text
rmbielby Mar 12, 2025
2af11cd
Set up CI with Azure Pipelines
rmbielby Mar 18, 2025
5cafcc0
Resolving some merge conflicts
rmbielby Mar 18, 2025
5328b0f
Merge branch 'eesp/connect-eesyapi' into azure-pipelines
rmbielby Mar 18, 2025
1bd0d6a
Updated branch with eesyapi development
rmbielby Mar 18, 2025
419ab0b
Reverting curl and httr2 due to pipeline fail
rmbielby Mar 18, 2025
7ca228c
Adding pp appID
rmbielby Mar 18, 2025
feca9a3
Updating manifest and commit hooks
rmbielby Mar 19, 2025
e3831d1
Fixed curl to 5.2.3 and httr2 to 1.0.6 for benefit of internal deploy
rmbielby Mar 19, 2025
80b3e72
Adding rsconnect appid, renv check and constraining pa api call to la…
rmbielby Mar 19, 2025
6d253cf
Added messaging to .Rprofile
rmbielby Mar 19, 2025
ca4b2f2
Simplifying .Rprofile as it seems to be causing issues on rsconnect
rmbielby Mar 19, 2025
fa3f22b
Restoring renv initialisation to .Rprofile
rmbielby Mar 19, 2025
230f156
Added sys info to .Rprofile
rmbielby Mar 19, 2025
a886244
Tests update
rmbielby Mar 19, 2025
dbef7f4
Merge pull request #131 from dfe-analytical-services/azure-pipelines
rmbielby Mar 19, 2025
83a6b6e
Update lintr.yml
rmbielby Mar 19, 2025
13ab6d9
Update lintr.yml
rmbielby Mar 19, 2025
64ccd86
Update lintr.yml
rmbielby Mar 19, 2025
30dcd78
Added tracking for navlist and tabset
rmbielby Apr 23, 2025
e24de6b
Switched latest weeks data to choose latest data query based on what'…
rmbielby May 1, 2025
f6a47f7
Updated renv snapshot
rmbielby May 2, 2025
5a5454d
Removed left join of filter items and filter columns in sqid lookup c…
rmbielby May 8, 2025
825c8d4
Updated test snapshots and switched number of school code to adapt to…
rmbielby May 8, 2025
234d183
[email protected] + [email protected]
rmbielby May 8, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 5 additions & 10 deletions .Rprofile
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,12 @@

cat("Sourcing .Rprofile.", fill = TRUE)

print(Sys.info())
source("renv/activate.R")
renv::status()

# Run UI tests ------------------------------------------------------------

run_tests_locally <- function() {
library(shinytest2)
Sys.unsetenv("HTTP_PROXY")
test_app()
# Install commit-hooks locally
if (file.exists(".git")) {
statusWriteCommit <- file.copy(".hooks/pre-commit.R", ".git/hooks/pre-commit", overwrite = TRUE)
}


# Install commit-hooks locally
statusWriteCommit <- file.copy(".hooks/pre-commit.R", ".git/hooks/pre-commit", overwrite = TRUE)
message("End of .Rprofile")
9 changes: 9 additions & 0 deletions .github/workflows/automatedTests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
on:
push:
branches:
- main
pull_request:

jobs:
automated-tests:
uses: dfe-analytical-services/dfeshiny/.github/workflows/automated_tests_template.yaml@main
12 changes: 12 additions & 0 deletions .github/workflows/create-trello-ticket.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: Trello PR card
on:
pull_request_target:
types:
- opened

jobs:
create-card:
uses: dfe-analytical-services/dfeshiny/.github/workflows/create_trello_card_template.yaml@new-feature/trello-pr-workflow
secrets:
TRELLO_API_KEY: '${{ secrets.TRELLO_API_KEY }}'
TRELLO_API_TOKEN: '${{ secrets.TRELLO_API_TOKEN }}'
1 change: 1 addition & 0 deletions .github/workflows/deploy-shiny.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
branches:
- main
- development
- eesp/connect-eesyapi
pull_request:
branches:
- main
Expand Down
10 changes: 1 addition & 9 deletions .github/workflows/lintr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,9 @@ on:

name: lintr

permissions:
contents: read

jobs:
lintr:
runs-on: ubuntu-latest

permissions:
contents: read # for checkout to fetch code
security-events: write # for github/codeql-action/upload-sarif to upload SARIF results

container:
image: ghcr.io/dfe-analytical-services/dfe-r-base:latest
options: --user root
Expand All @@ -33,7 +25,7 @@ jobs:
- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true

- name: Restore renv snapshot
shell: Rscript {0}
run: |
Expand Down
41 changes: 0 additions & 41 deletions .github/workflows/shiny-tests.yaml

This file was deleted.

23 changes: 18 additions & 5 deletions .hooks/pre-commit.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
cat("Running commit hooks...", fill = TRUE)
shhh <- suppressPackageStartupMessages # It's a library, so shhh!
shhh(library(dplyr))
shhh(library(dfeshiny))
shhh(library(xfun))

shhh(library(dfeshiny))

error_flag <- FALSE

Expand All @@ -29,8 +28,6 @@ if (ncol(ign_files) > 1) {
}
}



suffixes <- "xlsx$|dat$|csv$|tex$|pdf$"

current_files <- data.frame(files = list.files("./", recursive = TRUE)) %>%
Expand Down Expand Up @@ -69,7 +66,7 @@ if (error_flag) {
quit(save = "no", status = 1, runLast = FALSE)
}

tidy_output <- tidy_code()
tidy_output <- dfeshiny::tidy_code()
if (any(tidy_output)) {
error_flag <- TRUE
}
Expand All @@ -80,4 +77,20 @@ if (error_flag) {
quit(save = "no", status = 1, runLast = FALSE)
}

cat("\n")

cat("\n2. Rebuilding manifest.json...", fill = TRUE)
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()))) {
rsconnect::writeManifest()
git2r::add(path = "manifest.json")
}
cat("...manifest.json rebuilt\n")
}
cat("\n")

# End of hooks
364 changes: 100 additions & 264 deletions R/dashboard_panels.R

Large diffs are not rendered by default.

76 changes: 76 additions & 0 deletions R/fetch_data.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# fetch sqid lookup creates a lookup list of IDs for each filter and indicator entry
fetch_sqid_lookup <- function(
dataset_id,
version = NULL,
ees_environment = "test",
verbose = FALSE) {
meta <- eesyapi::get_meta(
dataset_id,
ees_environment = ees_environment,
verbose = verbose
)
sqid_lookup <- list(
filters = filter_item_sqid_list(meta$filter_items),
indicators = indicator_sqid_list(meta$indicators)
)
return(sqid_lookup)
}

indicator_sqid_list <- function(indicator_meta) {
indicator_list <- as.list(
indicator_meta |>
pull(col_id)
)
names(indicator_list) <- indicator_meta |>
pull(col_name)
return(indicator_list)
}


filter_item_sqid_sublist <- function(col_name_ref, filter_lookup) {
filter_list <- as.list(
filter_lookup |> filter(col_name == col_name_ref) |> pull(item_id)
)
names(filter_list) <- filter_lookup |>
filter(col_name == col_name_ref) |>
pull(item_label) |>
str_replace_all(" ", "") |>
str_replace_all("\\(", "_") |>
str_replace_all("\\)", "") |>
tolower()
return(filter_list)
}

filter_item_sqid_list <- function(filter_lookup) {
col_names <- filter_lookup |>
pull(col_name) |>
unique()
filter_list <- lapply(col_names, filter_item_sqid_sublist, filter_lookup)
names(filter_list) <- col_names
return(filter_list)
}

geography_query <- function(
input_geographic_level,
input_region_name,
input_la_name) {
message(input_geographic_level, input_region_name, input_la_name)
query <- "National"
if (input_geographic_level == "Regional") {
reg_code <- dfeR::fetch_regions() |>
dplyr::filter(region_name == input_region_name) |>
dplyr::pull(region_code)
query <- c(query, paste0("REG|code|", reg_code))
} else if (input_geographic_level == "Local authority") {
reg_code <- region_la_lookup |>
dplyr::filter(la_name == input_la_name) |>
dplyr::pull(region_code)
query <- c(query, paste0("REG|code|", reg_code))
la_code <- dfeR::fetch_las() |>
dplyr::filter(la_name == input_la_name) |>
dplyr::pull(new_la_code)
query <- c(query, paste0("LA|code|", la_code))
}

return(query)
}
119 changes: 0 additions & 119 deletions R/gov_colours.R
Original file line number Diff line number Diff line change
@@ -1,43 +1,5 @@
# Script to take government approved colour schemes for the app, from: https://github.com/ukgovdatascience/govstyle/blob/master/R/GVA.R

# Create a palette

gov_cols <- c(
purple = "#2E358B",
pink = "#D53880",
mellow_red = "#DF3034",
yellow = "#FFBF47",
turquoise = "#28A197",
mauve = "#6F72AF",
baby_pink = "#F499BE",
orange = "#F47738",
green = "#006435",
light_blue = "#2B8CC4",
fuschia = "#912B88",
red = "#B10E1E",
brown = "#B58840",
grass_green = "#85994B",
govuk_blue = "#005EA5"
)

gov_cols_2 <- c(
"#2E358B",
"#D53880",
"#DF3034",
"#FFBF47",
"#28A197",
"#6F72AF",
"#F499BE",
"#F47738",
"#006435",
"#2B8CC4",
"#912B88",
"#B10E1E",
"#B58840",
"#85994B",
"#005EA5"
)

# https://meyerweb.com/eric/tools/color-blend/#FFBF47:B10E1E:3:hex gov red to yellow

map_gov_colours <- c(
Expand Down Expand Up @@ -66,84 +28,3 @@ check_pal <- function(
labels = names(x)
)
}

# Create a theme

theme_gov <- function(
base_size = 12,
base_colour = "gray40",
axes = "x") {
if (!axes %in% c("n", "x", "y", "xy")) {
stop("axes must be one of 'n', 'x', 'y', or 'xy'")
}

## Set x and y axis colour

x_col <- "white"
y_col <- "white"

if (axes == "x") {
x_col <- base_colour
y_col <- "white"
}

if (axes == "y") {
x_col <- "white"
y_col <- base_colour
}

if (axes == "xy") {
x_col <- base_colour
y_col <- base_colour
}

theme(
legend.position = "none",

## Adjust tick marks

axis.ticks = ggplot2::element_blank(),
# axis.ticks = element_line(colour = "gray40"),
# axis.ticks.y = element_blank(),
# axis.ticks.length = grid::unit( -2, "mm"),

## Adjust the axis lines

axis.line = ggplot2::element_line(colour = base_colour),
axis.line.x = ggplot2::element_line(colour = x_col),
axis.line.y = ggplot2::element_line(colour = y_col),

## Set the overall text attributes

text = ggplot2::element_text(
face = "plain", colour = base_colour, size = base_size,
hjust = 0.5, vjust = 0.5, angle = 0, lineheight = 0.8
),
axis.text = ggplot2::element_text(colour = base_colour),
plot.title = ggplot2::element_text(face = "bold", hjust = 1, colour = "black", vjust = -2.5),

## Axis title attributes. Adjustments of

axis.title.y = ggplot2::element_text(hjust = 1, vjust = 1),
axis.title.x = ggplot2::element_text(hjust = 1, vjust = 0),

## Background attributes (currently all blank)

panel.background = ggplot2::element_blank(),
panel.grid.major = ggplot2::element_blank(),
panel.grid.minor = ggplot2::element_blank(),

## Adjust the margin around the plot. This is highly sensitive to plot, so
## probably needs to be set on a plot by plot basis.

# plot.margin = grid::unit(c(0,5,5,-30), "mm"),

## Strip attributes for facet grid and facet wrap

strip.background = ggplot2::element_blank(),
strip.text = ggplot2::element_text(color = "black", face = "bold", size = base_size + 1),
strip.text.x = ggplot2::element_text(),
strip.text.y = ggplot2::element_text(angle = -90),
complete = FALSE
)
}
Loading