pydesrap_stroke
Reproducible analytical pipeline (RAP) for Python 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 (12.3%) to scientific vocabulary
Repository
Reproducible analytical pipeline (RAP) for Python discrete-event simulation (DES) implementing the Stroke Capacity Planning Model from Monks et al. 2016.
Basic Info
Statistics
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 2
- Releases: 1
Metadata Files
README.md
This repository provides a reproducible analytical pipeline (RAP) that implements a real-life stroke service capacity planning model in python. 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 locally:
git clone https://github.com/pythonhealthdatascience/pydesrap_stroke.git
cd pydesrap_stroke
Set up the Python environment using conda (recommended):
conda env create --file environment.yaml
conda activate
There is also a requirements.txt file which can be used to set up the environment with virtualenv, but this won't fetch a specific version of Python - so please note the version listed in environment.yaml.
How to run
The simulation code is provided as a package within simulation/. There are notebooks executing the model and analysing the results in notebooks/.
To run the model with base parameters once or with replications:
``` from simulation import Param, Runner
param = Param() runner = Runner(param=param)
singleresult = runner.runsingle(run=0) represults = runner.runreps() ```
Example altering the model parameters:
``` from simulation import Param, Runner
Modify the number of replications
param = Param(numberofruns=10) runner = Runner(param=param) represults = runner.runreps() ```
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 Python:
- 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 notebooks/analysis.ipynb.
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.ipynb) is 10 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.
Community
Curious about contributing? Check out the contributing guidelines to learn how you can help.
Citation
For this applied example, please cite either:
Heather, A. Monks, T. (2025). Stroke capacity planning model: python DES RAP. GitHub. https://github.com/pythonhealthdatascience/pydesrap_stroke.
Heather, A. Monks, T. (2025). Stroke capacity planning model: python DES RAP. Zenodo. https://doi.org/10.5281/zenodo.15574906.
A CITATION.cff file is also provided.
Contributors:
Amy Heather - developed the repository.
Tom Monks - peer review of the repository.
Licence
MIT Licence. See LICENSE 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: python 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'
- given-names: Thomas
family-names: Monks
email: t.m.w.monks@exeter.ac.uk
affiliation: University of Exeter
orcid: 'https://orcid.org/0000-0003-2631-4481'
repository-code: >-
https://github.com/pythonhealthdatascience/pydesrap_stroke
abstract: >-
Reproducible analytical pipeline (RAP) for python discrete-event simulation
(DES) implementing the Stroke Capacity Planning Model from Monks et al. 2016.
license: MIT
version: '0.1.0'
date-released: '2025-06-02'
GitHub Events
Total
- Issues event: 7
- Delete event: 2
- Issue comment event: 5
- Push event: 11
- Pull request event: 3
- Create event: 3
Last Year
- Issues event: 7
- Delete event: 2
- Issue comment event: 5
- Push event: 11
- Pull request event: 3
- Create event: 3
Committers
Last synced: 6 months ago
Top Committers
| Name | Commits | |
|---|---|---|
| amyheather | a****2@e****k | 80 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 5 months ago
All Time
- Total issues: 6
- Total pull requests: 5
- Average time to close issues: 10 days
- Average time to close pull requests: less than a minute
- Total issue authors: 1
- Total pull request authors: 1
- Average comments per issue: 0.33
- Average comments per pull request: 0.0
- Merged pull requests: 5
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 6
- Pull requests: 5
- Average time to close issues: 10 days
- Average time to close pull requests: less than a minute
- Issue authors: 1
- Pull request authors: 1
- Average comments per issue: 0.33
- Average comments per pull request: 0.0
- Merged pull requests: 5
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- amyheather (10)
- TomMonks (2)
Pull Request Authors
- amyheather (6)
Top Labels
Issue Labels
Pull Request Labels
Dependencies
- ipykernel ==6.29.5
- jinja2 ==3.1.5
- joblib ==1.4.2
- kaleido ==0.2.1
- nbconvert ==7.16.6
- nbformat ==5.10.4
- nbqa ==1.9.0
- numpy ==2.2.2
- pandas ==2.2.3
- pip ==25.0
- plotly_express ==0.4.1
- pylint ==3.3.4
- pytest ==8.3.4
- pytest-xdist ==3.6.1
- rich ==13.9.4
- sim-tools ==0.8.0
- simpy ==4.1.1
- actions/checkout v4 composite
- actions/setup-python v4 composite
- actions/checkout v4 composite
- actions/setup-python v4 composite
- ipykernel 6.29.5.*
- jinja2 3.1.5.*
- joblib 1.4.2.*
- nbconvert 7.16.6.*
- nbformat 5.10.4.*
- nbqa 1.9.0.*
- numpy 2.2.2.*
- pandas 2.2.3.*
- pip 25.0.*
- plotly_express 0.4.1.*
- pylint 3.3.4.*
- pytest 8.3.4.*
- pytest-xdist 3.6.1.*
- python 3.13.1.*
- rich 13.9.4.*
- simpy 4.1.1.*