Notes for developers
Source:DEVELOPERS.md
Configuration
All in inst/config/:
-
tidy_data_sources.yml- current version and download url per dataset, read byget_*() -
raw_<name>.yml- source urls per NHS Digital publication, read only when rebuilding data -
shiny_app_datasets.yml- what shows up in the Shiny app’s dataset picker
Building the data
Each data-raw/<name>.R script downloads the source files from NHS Digital, cleans them, and writes a parquet file to data-raw/. Run one script directly, or just build-data to rebuild everything (this takes some time as it downloads the data).
Publishing a new version
- Add the new year’s source url to
inst/config/raw_<name>.yml, then rundata-raw/<name>.R(orjust build-data) to rebuild the parquet indata-raw/ - Add a new entry at the top of the dataset’s list in
tidy_data_sources.yml, with a placeholder url -
just release <dataset> <version> "<notes>"- uploads the parquet as a GitHub release - Copy the real download url from the release page over the placeholder
Adding a new dataset
- Write
data-raw/<name>.Randinst/config/raw_<name>.yml, following the existing pattern - Add an entry to
tidy_data_sources.yml. Setpublicationto theraw_<name>.ymlbase name andvarianttousageorbreakdowns.get_raw_source_periods()reads both. - Export a
get_<name>()function inR/get-data.R -
just releaseto publish it - Add it to
shiny_app_datasets.ymlif it should appear in the app
Dataset names follow <source>_<coding system>. hesapc_icd10 means HES Admitted Patient Care, ICD-10. gp_snomed means GP, SNOMED CT. If a dataset has no single coding system, like QOF registers, use a short content word instead: qof_registers.
Running the app locally
run_app() downloads and caches data like any other user. Run cache_clear() first if you want to test against data you just published.
Deploying
just deploy copies the released parquet for every dataset into inst/app-data/ (this is gitignored), then deploys to Posit Connect Cloud. This means the hosted app reads data straight off disk and never calls GitHub at runtime, so a restart doesn’t need to download anything first. just deploy deploys the main app, just deploy beta deploys a separate beta app. The first time you deploy from a machine, you need to link your Posit Connect Cloud account by running rsconnect::connectCloudUser().