{"id":29860358,"url":"https://github.com/pythonhealthdatascience/rdesrap_stroke","last_synced_at":"2025-07-30T03:19:29.689Z","repository":{"id":302082429,"uuid":"1011098001","full_name":"pythonhealthdatascience/rdesrap_stroke","owner":"pythonhealthdatascience","description":"Reproducible analytical pipeline (RAP) for R discrete-event simulation (DES) implementing the Stroke Capacity Planning Model from Monks et al. 2016.","archived":false,"fork":false,"pushed_at":"2025-07-10T15:14:55.000Z","size":67120,"stargazers_count":1,"open_issues_count":3,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-07-10T17:43:09.610Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pythonhealthdatascience.png","metadata":{"files":{"readme":"README.md","changelog":"NEWS.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":"CITATION.cff","codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-06-30T09:49:02.000Z","updated_at":"2025-07-04T08:29:32.000Z","dependencies_parsed_at":"2025-06-30T13:59:01.451Z","dependency_job_id":null,"html_url":"https://github.com/pythonhealthdatascience/rdesrap_stroke","commit_stats":null,"previous_names":["pythonhealthdatascience/rdesrap_stroke"],"tags_count":0,"template":false,"template_full_name":"pythonhealthdatascience/rdesrap_mms","purl":"pkg:github/pythonhealthdatascience/rdesrap_stroke","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pythonhealthdatascience%2Frdesrap_stroke","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pythonhealthdatascience%2Frdesrap_stroke/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pythonhealthdatascience%2Frdesrap_stroke/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pythonhealthdatascience%2Frdesrap_stroke/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pythonhealthdatascience","download_url":"https://codeload.github.com/pythonhealthdatascience/rdesrap_stroke/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pythonhealthdatascience%2Frdesrap_stroke/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267803475,"owners_count":24146518,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-30T02:00:09.044Z","response_time":70,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-07-30T03:19:28.881Z","updated_at":"2025-07-30T03:19:29.678Z","avatar_url":"https://github.com/pythonhealthdatascience.png","language":"R","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\n# Stroke capacity planning model: R DES RAP\n\n\u003c!-- badges: start --\u003e\n![R 4.4.1](https://img.shields.io/badge/-R_4.4.1-276DC2?\u0026logo=r\u0026logoColor=white)\n![MIT Licence](https://img.shields.io/badge/Licence-MIT-green.svg?\u0026labelColor=gray)\n[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.15863376.svg)](https://doi.org/10.5281/zenodo.15863376)\n[![R-CMD-check](https://github.com/pythonhealthdatascience/rdesrap_stroke/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/pythonhealthdatascience/rdesrap_stroke/actions/workflows/R-CMD-check.yaml)\n[![Lint](https://github.com/pythonhealthdatascience/rdesrap_stroke/actions/workflows/lint.yaml/badge.svg)](https://github.com/pythonhealthdatascience/rdesrap_stroke/actions/workflows/lint.yaml)\n[![ORCID](https://img.shields.io/badge/ORCID_Amy_Heather-0000--0002--6596--3479-A6CE39?\u0026logo=orcid\u0026logoColor=white)](https://orcid.org/0000-0002-6596-3479)\n\u003c!-- badges: end --\u003e\n\u003c/div\u003e\n\n\u003cbr\u003e\n\n## Repository overview\n\nThis 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:\n\n\u003e 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](https://doi.org/10.1186/s12913-016-1789-4). PMID: 27688152; PMCID: PMC5043535.\n\nModel diagram:\n\n![](images/stroke_rehab_design.png)\n\n\u003cbr\u003e\n\n## Installation\n\nClone the repository:\n\n```{.r}\ngit clone https://github.com/pythonhealthdatascience/rdesrap_stroke.git\ncd rdesrap_stroke\n```\n\nSet up the R environment using `renv` (recommended):\n\n```{.r}\nrenv::init()\nrenv::restore()\n```\n\nIf you encounter issues restoring the exact environment, you can install dependencies from `DESCRIPTION` and generate your own lock file:\n\n```{.r}\nrenv::init()\nrenv::install()\nrenv::snapshot()\n```\n\n\u003cbr\u003e\n\n## How to run\n\nThe simulation code is in the `R/` folder as a local package. There are files executing the model and analysing the results in `rmarkdown/`.\n\n**Install the local package:**\n\n```{.r}\ndevtools::install()  # Needed if running in parallel\ndevtools::load_all()  # Sufficient if running sequentially\n\nlibrary(simulation)\n```\n\n**Run a single simulation:**\n\n```{.r}\nparam \u003c- create_parameters(number_of_runs = 1L)\nsingle_results \u003c- runner(param = param)\n```\n\n**Run multiple replications:**\n\n```{.r}\nparam \u003c- create_parameters(number_of_runs = 5L)\nsingle_results \u003c- runner(param = param)\n```\n\n**Run all analyses (from command line):**\n\n```{.r}\nbash run_rmarkdown.sh\n```\n\n**Run tests:**\n\n```{.r}\ndevtools::test()\n```\n\n**Lint code:**\n\n```{.r}\nlintr::lint_dir()\n```\n\n### Generating the results from the article\n\nThe original study used Simul8. Each of the outputs from that article have been replicated in this repository using R:\n\n* Figure 1. Simulation probability density function for occupancy of an acute stroke unit.\n* Figure 3. Simulated trade-off between the probability that a patient is delayed and the no. of acute beds available.\n* Table 2. Likelihood of delay. Current admissions versus 5% more admissions.\n* Table 3. Results of pooling of acute and rehab beds.\n* Supplementary Table 1. Likelihood of delay. Current admissions versus No Complex neurological patients.\n* Supplementary Table 3. Likelihood of delay. Current admissions versus ring fenced acute stroke beds.\n\nTo generate these, simply execute `rmarkdown/analysis.Rmd`.\n\n**Examples**\n\n**Figure 1**\n\nOriginal:\n\n![](docs/article/fig1.png)\n\nFrom this repository:\n\n![](outputs/figure1_asu.png)\n\n**Figure 3**\n\nOriginal:\n\n![](docs/article/fig3.png)\n\nFrom this repository:\n\n![](outputs/figure3_asu.png)\n\n\u003cbr\u003e\n\n## Run time and machine specification\n\nThe 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.\n\nThe 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.\n\n\u003cbr\u003e\n\n## Citation\n\nIf you use this repository, please cite either the GitHub repository or Zenodo:\n\n\u003e Heather, A. (2025). Stroke capacity planning model: R DES RAP. GitHub. https://github.com/pythonhealthdatascience/rdesrap_stroke.\n\u003e\n\u003e Heather, A. (2025). Stroke capacity planning model: R DES RAP. Zenodo. https://doi.org/10.5281/zenodo.15863376.\n\n**Contributors:**\n\n**Amy Heather** - developed the repository.\n\n* [![ORCID](https://img.shields.io/badge/ORCID-0000--0002--6596--3479-A6CE39?style=for-the-badge\u0026logo=orcid\u0026logoColor=white)](https://orcid.org/0000-0002-6596-3479)\n* [![GitHub](https://img.shields.io/badge/GitHub-amyheather-181717?style=for-the-badge\u0026logo=github\u0026logoColor=white)](https://github.com/amyheather)\n\n\u003cbr\u003e\n\n## Licence\n\nMIT Licence. See `LICENSE.md` for details.\n\n\u003cbr\u003e\n\n## Acknowledgements\n\nThis repository was developed with thanks to a few others sources. These are acknowledged throughout in the relevant scipts, and also summarised here:\n\n**TODO**\n\n\u003cbr\u003e\n\n## Funding\n\nThis 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](https://gtr.ukri.org/projects?ref=MR%2FZ503915%2F1)].\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpythonhealthdatascience%2Frdesrap_stroke","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpythonhealthdatascience%2Frdesrap_stroke","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpythonhealthdatascience%2Frdesrap_stroke/lists"}