This is an R Shiny dashboard that visualises analytics data collected on our explore education statistics platform.
It is deployed via the DfE POSIT Connect subscription internally. There are three environments, all accessible to DfE AD:
- Production - https://rsconnect/rsc/ees-analytics/
- Pre-production - https://rsconnect-pp/rsc/ees-analytics/
- Development - https://rsconnect-pp/rsc/dev-ees-analytics/
Code used to extract source data, process it, and save a permanent store for usage by the analytics dashboard, as well as ad hoc analysis scripts are in a separate GitHub repository - https://github.com/dfe-analytical-services/explore-education-statistics-analytics.
- Installation of R 4.4.2 or higher
- Installation of RTools44 or higher
- R at an intermediate level, DfE R learning resources
- Particularly R Shiny
Old data:
- Access to the MA_SDT_NS_DATA database
Latest data:
- Access the statistics services area of the unity catalog
To set up access to the app, and understand how the app itself is connected to the SQL warehouse on the server, look at:
If you don't have access to the source data, you can still run the dashboard using:
# This makes the app think it's in test mode and will read in the test data in the repo
# instead of connecting to the databases
withr::with_envvar(c(TESTTHAT = "true"), shiny::runApp())
Package control is handled using renv at the top level of the repository.
- Clone or download the repo
- Open the R project in R Studio
- Run
renv::restore()
to install dependencies - Run
install.packages("git2r")
to install the git2r package, ignored by renv to help deployments but necessary for the pre-commit hooks. - Run
shiny::runApp()
to run the dashboard locally
Tests can be run locally by using shinytest2::test_app()
. You should do this regularly to check that the tests are passing against the code you are working on.
The tests use data in the tests/testdata/
folder, to regenerate this data look at the tests/testdata-generator.R
script.
GitHub Actions provide CI by running the automated tests on every pull request into the main branch using the .github/workflows/dashboard-tests.yml
workflow.
If you spot any issues with the application, please flag it in the "Issues" tab of this repository, and label as a bug. Include as much detail as possible to help us diagnose the issue and prepare a suitable remedy.
You can also use the "Issues" tab in GitHub to suggest new features, changes or additions. Include as much detail on why you're making the suggestion and any thinking towards a solution that you have already done.
In general all .R
files will have a usable outline, so make use of that for navigation if in RStudio: Ctrl-Shift-O
.
The function styler::style_dir()
will tidy code according to tidyverse styling using the styler package. Run this regularly as our pre-commit hooks will prevent you committing code that isn't tidied. This function also helps to test the running of the code and for basic syntax errors such as missing commas and brackets.
You should also run lintr::lint_dir()
regularly as lintr will check all pull requests for the styling of the code, it does not style the code for you like styler, but is slightly stricter and checks for long lines, variables not using snake case, commented out code and undefined objects amongst other things.
We have some pre-commit hooks set up to help with code quality. These are controlled by the .hooks/pre-commit.R
file.