Official Statistics on Scotland's Peatlands 2026: Methodology Report

Data sources and methodology accompanying Official Statistics on Scotland's Peatlands 2026.


BioSS QA – Codebase

Peatland statistics codebase: quality assurance review summary

Sonia Mitchell, Biomathematics and Statistics Scotland

2026-10-01

This summary sets out the findings of a quality assurance review of the peatland statistics codebase. The review follows Government Analysis Function guidance, including Quality Assurance of Code for Analysis and Research (the “Duck Book”). The statistical methods and the published figures are reviewed separately, and are not covered here. The codebase consists of two pipelines, run in sequence:

  • the processing pipeline, which downloads, checks and processes the input data
  • the charts and tables pipeline, which produces the published charts and tables

Both pipelines were set up and run using the supplied code and data. The review assessed:

  • the installation instructions, and the packages, data and hardware needed to run each pipeline
  • the errors and warnings produced, and how easily they can be diagnosed
  • the documentation of the input data, processed data and outputs
  • the structure, documentation, testing and style of the code
  • the run time and efficiency of the processing pipeline

Overall assessment

Using automated pipelines to produce the statistics reduces the risk of manual error and makes them easier to update. The processing pipeline is of a high standard: well structured, clearly written and well documented, and new datasets can be added largely by changing its settings. The charts and tables pipeline has more scope for improvement, mainly in its setup and documentation. Most of the recommendations are minor, and fall into six areas:

  • Setup: fuller installation instructions, and changes so the charts and tables pipeline can run as supplied
  • Accuracy of published charts: some chart values are set in the code rather than taken from the data, so could become out of date
  • Performance: the processing pipeline’s settings and some of its steps could be more efficient
  • Reproducibility: recording software versions and keeping copies of downloaded data, so results can be reproduced in future
  • Documentation: fuller information on data sources, licences and settings, to support future users and maintainers
  • Code quality: removing unused code, applying a consistent style and extending the automated tests, to ease maintenance

Priorities

No issues were identified that are known to affect the published figures. Before the next publication, the chart values set in the code and two charts that omit some data points should be checked, and the charts and tables pipeline made easier to set up. The other recommendations, detailed in the full report, can be addressed over time.

Back to top