rdesrap_stroke
Reproducible analytical pipeline (RAP) for R discrete-event simulation (DES) implementing the Stroke Capacity Planning Model from Monks et al. 2016.
Science Score: 77.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
✓DOI references
Found 8 DOI reference(s) in README -
✓Academic publication links
Links to: zenodo.org -
✓Committers with academic emails
1 of 1 committers (100.0%) from academic institutions -
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (13.5%) to scientific vocabulary
Repository
Reproducible analytical pipeline (RAP) for R discrete-event simulation (DES) implementing the Stroke Capacity Planning Model from Monks et al. 2016.
Basic Info
- Host: GitHub
- Owner: pythonhealthdatascience
- License: other
- Language: R
- Default Branch: main
- Size: 64.8 MB
Statistics
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
- Releases: 1
Metadata Files
README.md
Repository overview
This repository provides a reproducible analytical pipeline (RAP) that implements a real-life stroke service capacity planning model in R. It serves as a practical example, fully reproducible and aligned with RAP principles, based on the following study:
Monks T, Worthington D, Allen M, Pitt M, Stein K, James MA. A modelling tool for capacity planning in acute and community stroke services. BMC Health Serv Res. 2016 Sep 29;16(1):530. doi: 10.1186/s12913-016-1789-4. PMID: 27688152; PMCID: PMC5043535.
Model diagram:

Installation
Clone the repository:
{.r}
git clone https://github.com/pythonhealthdatascience/rdesrap_stroke.git
cd rdesrap_stroke
Set up the R environment using renv (recommended):
{.r}
renv::init()
renv::restore()
If you encounter issues restoring the exact environment, you can install dependencies from DESCRIPTION and generate your own lock file:
{.r}
renv::init()
renv::install()
renv::snapshot()
How to run
The simulation code is in the R/ folder as a local package. There are files executing the model and analysing the results in rmarkdown/.
Install the local package:
```{.r} devtools::install() # Needed if running in parallel devtools::load_all() # Sufficient if running sequentially
library(simulation) ```
Run a single simulation:
{.r}
param <- create_parameters(number_of_runs = 1L)
single_results <- runner(param = param)
Run multiple replications:
{.r}
param <- create_parameters(number_of_runs = 5L)
single_results <- runner(param = param)
Run all analyses (from command line):
{.r}
bash run_rmarkdown.sh
Run tests:
{.r}
devtools::test()
Compute test coverage:
{.r}
devtools::test_coverage()
Lint code:
{.r}
lintr::lint_dir()
Generating the results from the article
The original study used Simul8. Each of the outputs from that article have been replicated in this repository using R:
- Figure 1. Simulation probability density function for occupancy of an acute stroke unit.
- Figure 3. Simulated trade-off between the probability that a patient is delayed and the no. of acute beds available.
- Table 2. Likelihood of delay. Current admissions versus 5% more admissions.
- Table 3. Results of pooling of acute and rehab beds.
- Supplementary Table 1. Likelihood of delay. Current admissions versus No Complex neurological patients.
- Supplementary Table 3. Likelihood of delay. Current admissions versus ring fenced acute stroke beds.
To generate these, simply execute rmarkdown/analysis.Rmd.
Examples
Figure 1
Original:

From this repository:

Figure 3
Original:

From this repository:

Run time and machine specification
The run time for this analysis (notebooks/analysis.Rmd) is 1m 38s seconds. This was on an Intel Core i7-12700H, 32GB RAM, Ubuntu 24.04.1.
The other notebooks generate results for tests and illustrate other functionality (e.g. importing parameters from csv, running with logs), and these just take a second or two.
Citation
If you use this repository, please cite either the GitHub repository or Zenodo:
Heather, A. (2025). Stroke capacity planning model: R DES RAP. GitHub. https://github.com/pythonhealthdatascience/rdesrap_stroke.
Heather, A. (2025). Stroke capacity planning model: R DES RAP. Zenodo. https://doi.org/10.5281/zenodo.15863376.
Contributors:
Amy Heather - developed the repository.
Licence
MIT Licence. See LICENSE.md for details.
Funding
This project was developed as part of the project STARS: Sharing Tools and Artefacts for Reproducible Simulations. It is supported by the Medical Research Council [grant number MR/Z503915/1].
Owner
- Name: pythonhealthdatascience
- Login: pythonhealthdatascience
- Kind: organization
- Repositories: 1
- Profile: https://github.com/pythonhealthdatascience
Citation (CITATION.cff)
# This CITATION.cff file was generated with cffinit.
# Visit https://bit.ly/cffinit to generate yours today!
cff-version: 1.2.0
title: >-
Stroke capacity planning model: R DES RAP
message: >-
If you use this software, please cite it using the
metadata from this file.
type: software
authors:
- given-names: Amy
family-names: Heather
email: a.heather2@exeter.ac.uk
affiliation: University of Exeter
orcid: 'https://orcid.org/0000-0002-6596-3479'
repository-code: >-
https://github.com/pythonhealthdatascience/rdesrap_stroke
abstract: >-
Reproducible analytical pipeline (RAP) for R discrete-event simulation (DES)
implementing the Stroke Capacity Planning Model from Monks et al. 2016.
version: 0.2.0
date-released: '2025-08-12'
GitHub Events
Total
- Issues event: 6
- Delete event: 4
- Issue comment event: 3
- Push event: 33
- Pull request event: 9
- Create event: 7
Last Year
- Issues event: 6
- Delete event: 4
- Issue comment event: 3
- Push event: 33
- Pull request event: 9
- Create event: 7
Committers
Last synced: 5 months ago
Top Committers
| Name | Commits | |
|---|---|---|
| amyheather | a****2@e****k | 46 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 5 months ago
Dependencies
- actions/checkout v4 composite
- r-lib/actions/check-r-package v2 composite
- r-lib/actions/setup-pandoc v2 composite
- r-lib/actions/setup-r v2 composite
- r-lib/actions/setup-r-dependencies v2 composite
- actions/checkout v4 composite
- r-lib/actions/setup-r v2 composite
- r-lib/actions/setup-r-dependencies v2 composite
- simmer * imports
- lintr * suggests
- testthat >= 3.0.0 suggests