NHS National Services Scotland transforming publications toolkit

The NHS National Services Scotland (NSS) Transforming Publishing Team has created a toolkit of templates, guides and resources to support the modernisation of both the back end production of statistical products (Reproducible Analytical Pipelines) and the user-facing output of statistical products to a digital platform (Transformed Publications). These tools will also be helpful when moving from a proprietary software such as SPSS or SAS, to an open source software such as R for any statistical analyses. If you have any questions about this toolkit then please contact the team at and they would be delighted to help.

The original version of this toolkit is on GitHub. Sections of it that are relevant to all RAP projects are republished and slightly adapted here.

Reproducible Analytical Pipelines

Reproducible Analytical Pipelines are a way to introduce a robust, efficient and reproducible work flow when carrying out data analysis. They have traditionally been applied to statistical publications, but the principles are relevant to any analysis.

Guidance and templates

  • This Reproducible Analytical Pipelines paper (PDF, 293KB) explains what they are, how to assess whether your work is suitable to ‘RAP’ and details several levels of code maturity and RAP which can be selected depending on a number of factors, such as the skill in your team or the available IT infrastructure.
  • The PHI R Style Guide is for analysts to follow when writing any R code, to make it consistent, readable, shareable and reusable. You might like to adopt or adapt it in your own department.
  • PHI uses a recommended R project structure when writing R code to ensure a sensible workflow and structure. An R project which follows the recommended structure can be created from within RStudio using the new phiproject package.
  • Templates like the National Statistic publication templates can be used to automate PDF reports using Rmarkdown.

Further resources

  • This app contains a range of resources for R, such as links to online training and cheatsheets, and information about internal R user groups.
  • The Transforming Publishing team also has a resources area, with useful resources on technical issues such as version control.
  • There is GitHub guidance on workflow and security when using git for version control.

Examples of transformed publications

Public Health Scotland (PHS) has developed a new web-based way of releasing statistical publications to our users and has now released two publications in this format: Acute Hospital Activity and Beds and Psychiatric Inpatient Activity. This new design has been developed with users at the heart of the process, and incorporates elements of static text, D3 charts, RShiny dashboards and open data.

User engagement

It is vital that users are part of the development, or re-development, of a statistical publication so that their needs are met. This means involving users before, during and after development.

Transforming output

There is a blank RShiny template to use when starting to build a new app or dashboard to ensure you have a sensible workflow and structure.

Here are examples of PHS’s existing RShiny dashboards for good practice in terms of both coding and design: