Skip to content

Commit 3b59d73

Browse files
authored
Merge pull request #21 from pythonhealthdatascience/dev
Dev
2 parents 8d1089e + 1ace19e commit 3b59d73

19 files changed

+354
-52
lines changed

CITATION.cff

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,15 @@ authors:
1414
email: a.heather2@exeter.ac.uk
1515
affiliation: University of Exeter
1616
orcid: 'https://orcid.org/0000-0002-6596-3479'
17+
- given-names: Tom
18+
family-names: Monks
19+
email: t.m.w.monks@exeter.ac.uk
20+
affiliation: University of Exeter Medical School
21+
orcid: http://orcid.org/0000-0003-2631-4481
1722
repository-code: >-
1823
https://github.com/pythonhealthdatascience/rdesrap_stroke
1924
abstract: >-
2025
Reproducible analytical pipeline (RAP) for R discrete-event simulation (DES)
2126
implementing the Stroke Capacity Planning Model from Monks et al. 2016.
22-
version: 0.2.0
23-
date-released: '2025-08-12'
27+
version: 0.3.0
28+
date-released: '2025-11-07'

CODE_OF_CONDUCT.md

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
# Contributor Covenant Code of Conduct
2+
3+
## Our Pledge
4+
5+
We as members, contributors, and leaders pledge to make participation in our
6+
community a harassment-free experience for everyone, regardless of age, body
7+
size, visible or invisible disability, ethnicity, sex characteristics, gender
8+
identity and expression, level of experience, education, socio-economic status,
9+
nationality, personal appearance, race, caste, color, religion, or sexual
10+
identity and orientation.
11+
12+
We pledge to act and interact in ways that contribute to an open, welcoming,
13+
diverse, inclusive, and healthy community.
14+
15+
## Our Standards
16+
17+
Examples of behavior that contributes to a positive environment for our
18+
community include:
19+
20+
- Demonstrating empathy and kindness toward other people
21+
- Being respectful of differing opinions, viewpoints, and experiences
22+
- Giving and gracefully accepting constructive feedback
23+
- Accepting responsibility and apologizing to those affected by our mistakes,
24+
and learning from the experience
25+
- Focusing on what is best not just for us as individuals, but for the overall
26+
community
27+
28+
Examples of unacceptable behavior include:
29+
30+
- The use of sexualized language or imagery, and sexual attention or advances of
31+
any kind
32+
- Trolling, insulting or derogatory comments, and personal or political attacks
33+
- Public or private harassment
34+
- Publishing others' private information, such as a physical or email address,
35+
without their explicit permission
36+
- Other conduct which could reasonably be considered inappropriate in a
37+
professional setting
38+
39+
## Enforcement Responsibilities
40+
41+
Community leaders are responsible for clarifying and enforcing our standards of
42+
acceptable behavior and will take appropriate and fair corrective action in
43+
response to any behavior that they deem inappropriate, threatening, offensive,
44+
or harmful.
45+
46+
Community leaders have the right and responsibility to remove, edit, or reject
47+
comments, commits, code, wiki edits, issues, and other contributions that are
48+
not aligned to this Code of Conduct, and will communicate reasons for moderation
49+
decisions when appropriate.
50+
51+
## Scope
52+
53+
This Code of Conduct applies within all community spaces, and also applies when
54+
an individual is officially representing the community in public spaces.
55+
Examples of representing our community include using an official email address,
56+
posting via an official social media account, or acting as an appointed
57+
representative at an online or offline event.
58+
59+
## Enforcement
60+
61+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
62+
reported to the community leaders responsible for enforcement at
63+
[INSERT CONTACT METHOD].
64+
All complaints will be reviewed and investigated promptly and fairly.
65+
66+
All community leaders are obligated to respect the privacy and security of the
67+
reporter of any incident.
68+
69+
## Enforcement Guidelines
70+
71+
Community leaders will follow these Community Impact Guidelines in determining
72+
the consequences for any action they deem in violation of this Code of Conduct:
73+
74+
### 1. Correction
75+
76+
**Community Impact**: Use of inappropriate language or other behavior deemed
77+
unprofessional or unwelcome in the community.
78+
79+
**Consequence**: A private, written warning from community leaders, providing
80+
clarity around the nature of the violation and an explanation of why the
81+
behavior was inappropriate. A public apology may be requested.
82+
83+
### 2. Warning
84+
85+
**Community Impact**: A violation through a single incident or series of
86+
actions.
87+
88+
**Consequence**: A warning with consequences for continued behavior. No
89+
interaction with the people involved, including unsolicited interaction with
90+
those enforcing the Code of Conduct, for a specified period of time. This
91+
includes avoiding interactions in community spaces as well as external channels
92+
like social media. Violating these terms may lead to a temporary or permanent
93+
ban.
94+
95+
### 3. Temporary Ban
96+
97+
**Community Impact**: A serious violation of community standards, including
98+
sustained inappropriate behavior.
99+
100+
**Consequence**: A temporary ban from any sort of interaction or public
101+
communication with the community for a specified period of time. No public or
102+
private interaction with the people involved, including unsolicited interaction
103+
with those enforcing the Code of Conduct, is allowed during this period.
104+
Violating these terms may lead to a permanent ban.
105+
106+
### 4. Permanent Ban
107+
108+
**Community Impact**: Demonstrating a pattern of violation of community
109+
standards, including sustained inappropriate behavior, harassment of an
110+
individual, or aggression toward or disparagement of classes of individuals.
111+
112+
**Consequence**: A permanent ban from any sort of public interaction within the
113+
community.
114+
115+
## Attribution
116+
117+
This Code of Conduct is adapted from the
118+
[Contributor Covenant](https://www.contributor-covenant.org/), version 2.1,
119+
available at
120+
<https://www.contributor-covenant.org/version/2/1/code_of_conduct/>.
121+
122+
Community Impact Guidelines were inspired by
123+
[Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/inclusion).
124+
125+
For answers to common questions about this code of conduct, see the FAQ at
126+
<https://www.contributor-covenant.org/faq/>. Translations are available at
127+
<https://www.contributor-covenant.org/translations/>.

CONTRIBUTING.md

Lines changed: 116 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,124 @@
11
# Contributing
22

3-
🎉 Thank you for checking out our project! 🎉
3+
Thank you for your interest in contributing! 🤗
44

5-
This file contains guidelines on how to get in touch with us and potentially contribute towards this repository.
5+
This file covers:
66

7-
## Email
7+
* 🐞 Workflow for bug reports, feature requests and documentation improvements
8+
* 🚀 Workflow for code contributions (bug fixes, enhancements)
9+
* 🛠️ Development and testing
10+
* 📦 Updating the package
11+
* 🤝 Code of conduct
812

9-
You can contact the researchers on this project using the provided email addresses in `CITATION.cff`.
13+
<br>
1014

11-
## Suggesting changes
15+
## 🐞 Workflow for bug reports, feature requests and documentation improvements
1216

13-
If you spot an issue, you are welcome to raise this either by:
17+
Before opening an issue, please search [existing issues](https://github.com/pythonhealthdatascience/rdesrap_stroke/issues) to avoid duplicates. If an issue exists, you can add a comment with additional details and/or upvote (👍) the issue. If there is not an existing issue, please open one and provide as much detail as possible.
1418

15-
* Using **GitHub Issues**.
16-
* **Forking** the repository, make your changes and submit a pull request for review.
19+
* **For feature requests or documentation improvements**, please describe your suggestion clearly.
20+
* **For bugs**, include:
21+
* Steps to reproduce.
22+
* Expected and actual behaviour.
23+
* Environment details (operating system, R version, dependencies).
24+
* Relevant files (e.g. problematic `.qmd` files).
25+
26+
### Handling bug reports (for maintainers):
27+
28+
* Confirm reproducibility by following the reported steps.
29+
* Label the issue appropriately (e.g. `bug`).
30+
* Request additional information if necessary.
31+
* Link related issues or pull requests.
32+
* Once resolved, close the issue with a brief summary of the fix.
33+
34+
<br>
35+
36+
## 🚀 Workflow for code contributions (bug fixes, enhancements)
37+
38+
1. Fork the repository and clone your fork.
39+
40+
2. Create a new branch for your feature or fix:
41+
42+
```{.bash}
43+
git checkout -b my-feature
44+
```
45+
46+
3. Make your changes and commit them with clear, descriptive messages using the [conventional commits standard](https://www.conventionalcommits.org/en/v1.0.0/).
47+
48+
4. Push your branch to your fork:
49+
50+
```{.bash}
51+
git push origin my-feature
52+
```
53+
54+
5. Open a pull request against the main branch. Describe your changes and reference any related issues.
55+
56+
<br>
57+
58+
## 🛠️ Development and testing
59+
60+
### Dependencies
61+
62+
Set up the R environment using `renv` (recommended):
63+
64+
```{.r}
65+
renv::init()
66+
renv::restore()
67+
```
68+
69+
If you encounter issues restoring the exact environment, you can install dependencies from `DESCRIPTION` and generate your own lock file:
70+
71+
```{.r}
72+
renv::init()
73+
renv::install()
74+
renv::snapshot()
75+
```
76+
77+
Some packages (e.g. `igraph`) may require system libraries. For example, for Ubuntu:
78+
79+
```{.bash}
80+
sudo apt install build-essential gfortran
81+
sudo apt install libglpk-dev libxml2-dev
82+
```
83+
84+
<br>
85+
86+
### Tests
87+
88+
Run tests:
89+
90+
```{.r}
91+
devtools::test()
92+
```
93+
94+
Compute test coverage:
95+
96+
```{.r}
97+
devtools::test_coverage()
98+
```
99+
100+
<br>
101+
102+
### Linting
103+
104+
```{.r}
105+
lintr::lint_dir()
106+
```
107+
108+
<br>
109+
110+
## 📦 Updating the package
111+
112+
If you are a maintainer and need to publish a new release:
113+
114+
1. Update `NEWS.md`.
115+
116+
2. Update the version number in `DESCRIPTION`, `CITATION.cff` and `CITATION`, and update the date in `CITATION.cff`.
117+
118+
3. Create a release on GitHub, which will automatically archive to Zenodo.
119+
120+
<br>
121+
122+
## 🤝 Code of conduct
123+
124+
Please be respectful and considerate. See the [code of conduct](https://github.com/pythonhealthdatascience/rdesrap_stroke/blob/main/CODE_OF_CONDUCT.md) for details.

DESCRIPTION

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
Package: simulation
22
Type: Package
33
Title: Simulation
4-
Version: 0.1.0
4+
Version: 0.3.0
55
Authors@R: c(
66
person(
77
"Amy", "Heather",
88
email = "a.heather2@exeter.ac.uk",
99
role = c("aut", "cre")
10+
),
11+
person(
12+
"Tom", "Monks",
13+
email = "t.m.w.monks@exeter.ac.uk",
14+
role = c("ctb")
1015
)
1116
)
1217
URL: https://github.com/pythonhealthdatascience/rdesrap_stroke

NAMESPACE

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ importFrom(dplyr,group_by)
2626
importFrom(dplyr,mutate)
2727
importFrom(dplyr,rowwise)
2828
importFrom(dplyr,ungroup)
29+
importFrom(future,availableCores)
2930
importFrom(future,multisession)
3031
importFrom(future,plan)
3132
importFrom(future,sequential)
@@ -46,7 +47,16 @@ importFrom(simmer,simmer)
4647
importFrom(simmer,timeout)
4748
importFrom(simmer,trajectory)
4849
importFrom(simmer,wrap)
50+
importFrom(stats,rbeta)
51+
importFrom(stats,rbinom)
52+
importFrom(stats,rchisq)
4953
importFrom(stats,rexp)
54+
importFrom(stats,rgamma)
55+
importFrom(stats,rgeom)
5056
importFrom(stats,rlnorm)
57+
importFrom(stats,rnorm)
58+
importFrom(stats,rpois)
59+
importFrom(stats,rt)
60+
importFrom(stats,runif)
5161
importFrom(stats,setNames)
5262
importFrom(utils,capture.output)

NEWS.md

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
# Stroke capacity planning model: R DES RAP 0.3.0
2+
3+
Introduces a code of conduct and new test, and includes improvements to documentation, contributor and parameter use.
4+
5+
## New features
6+
7+
* Add `CODE_OF_CONDUCT.md`.
8+
* Add test for model with no arrivals.
9+
10+
## Other changes
11+
12+
* Greatly improved/expanded `CONTRIBUTING.md`.
13+
* Add Tom to `CITATION.cff` and `DESCRIPTION`.
14+
* Corrections to docstrings (e.g., add missing `@importFrom`).
15+
* `verbose` is local parameter in `model` rather than part of `param` list.
16+
* Improvements to `README.md`.
17+
118
# Stroke capacity planning model: R DES RAP 0.2.0
219

320
Introduces `DistributionRegistry` with JSON-based parameters, replacing individual parameter functions and CSV. Also add test coverage, add file path check, and documentation and dependency management updates.
@@ -26,4 +43,4 @@ Introduces `DistributionRegistry` with JSON-based parameters, replacing individu
2643
* Reproduction of paper results (`rmarkdown/analysis.Rmd`).
2744
* Other RMarkdown files to generate results for tests, demonstrate logging, and how parameters can be loaded from a csv (`rmarkdown/`).
2845
* Back, functional and unit tests (`tests/`).
29-
* Other features include continuous integration (tests and linting), checklists, R environment, and other metadata.
46+
* Other features include continuous integration (tests and linting), checklists, R environment, and other metadata.

R/add_patient_generator.R

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
#' arrival intervals (e.g., \code{param$asu_arrivals$stroke = 10}).
1919
#'
2020
#' @importFrom simmer add_generator
21-
#' @importFrom stats rexp
2221
#'
2322
#' @return The modified Simmer environment with the new patient generator added.
2423
#' @export

R/create_asu_trajectory.R

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
#'
1616
#' @importFrom simmer branch get_attribute log_ release seize set_attribute
1717
#' @importFrom simmer timeout trajectory
18-
#' @importFrom stats rlnorm
1918
#'
2019
#' @return Simmer trajectory object. Defines patient journey logic through the
2120
#' healthcare system.

R/create_rehab_trajectory.R

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
#'
1616
#' @importFrom simmer get_attribute log_ release seize set_attribute timeout
1717
#' @importFrom simmer trajectory
18-
#' @importFrom stats rlnorm
1918
#'
2019
#' @return Simmer trajectory object. Defines patient journey logic through the
2120
#' healthcare system.

R/distribution_registry.R

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,11 @@
1313
#' at any time, use `register()`.
1414
#'
1515
#' @docType class
16+
#'
1617
#' @importFrom R6 R6Class
18+
#' @importFrom stats rbeta rbinom rchisq rexp rgeom rgamma rlnorm rnorm rpois
19+
#' @importFrom stats rt runif
20+
#'
1721
#' @export
1822

1923
DistributionRegistry <- R6Class("DistributionRegistry", list( # nolint: object_name_linter

0 commit comments

Comments
 (0)