Skip to content

Commit 8d3c32c

Browse files
authored
Merge branch 'main' into add_results_tracking
2 parents 2465868 + 92e168b commit 8d3c32c

File tree

13 files changed

+460
-121
lines changed

13 files changed

+460
-121
lines changed

.github/workflows/codecov.yaml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: CodeCov
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
9+
jobs:
10+
run:
11+
runs-on: ubuntu-latest
12+
13+
defaults:
14+
run:
15+
shell: bash -l {0}
16+
17+
steps:
18+
- uses: actions/checkout@v5
19+
20+
- name: Install the latest version of uv
21+
uses: astral-sh/setup-uv@v6
22+
with:
23+
version: "latest"
24+
activate-environment: true
25+
26+
- name: Install dependencies
27+
run: uv pip install -e ".[dev]"
28+
29+
- name: Generate Report
30+
run: uv run pytest --cov=. tests/unit --ignore=tests --cov-branch --cov-report xml:coverage.xml
31+
32+
- name: Upload Coverage to Codecov
33+
uses: codecov/codecov-action@v5
34+
with:
35+
token: ${{ secrets.CODECOV_TOKEN }}

.gitignore

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,14 @@ venv.bak/
8686

8787
# Data
8888
data/*
89+
*.xlsx
90+
*.xls
91+
*.csv
92+
*.parquet
8993

9094
# VSCode settings
91-
.vscode/settings.json
95+
.vscode/settings.json
96+
97+
# Python
98+
build/
99+
*.egg-info/

README.md

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# Renal capacity model
22

3+
<!-- badges: start -->
4+
5+
[![Project Status: WIP – Initial development is in progress, but there has not yet been a stable, usable release suitable for the public.](https://www.repostatus.org/badges/latest/wip.svg)](https://www.repostatus.org/#wip)
6+
[![codecov](https://codecov.io/gh/The-Strategy-Unit/renal-capacity-model/graph/badge.svg?token=lr1OaInPCf)](https://codecov.io/gh/The-Strategy-Unit/renal-capacity-model)
7+
8+
<!-- badges: end -->
9+
310
Repository with Python code for the Renal Capacity Model, an open source implementation of the Discrete Event Simulation (DES) [Renal Services model created in collaboration with the Midlands Renal Operational Delivery Network (MRODN)](https://github.com/The-Strategy-Unit/renal-services).
411

512
⚠️ **Please note that the code in this repository is still in development**
@@ -12,10 +19,40 @@ Although not essential, the instructions will assume you have this installed.
1219
To install the package:
1320

1421
1. Clone the repository to your local machine. Open the repository.
15-
2. Run `uv pip install .`
22+
2. Run `uv pip install -e .`
1623

1724
## Running the model
1825

1926
Once installed, set the configuration for your model run in `config.py`.
2027

21-
Run the model using `uv run renal_capacity_model/main.py`
28+
Run the model using `uv run renal_capacity_model/main.py`. This runs a full trial.
29+
30+
To run a single model run, use `uv run renal_capacity_model/model.py`
31+
32+
## Information for developers
33+
34+
### Testing
35+
36+
There are two types of tests for the model:
37+
38+
- Unit tests, which run automatically as part of the pytest testing suite. These check the
39+
behaviour of the individual elements of code to ensure they behave as expected using strict
40+
testing criteria.
41+
- Validation tests, which are excluded from the pytest testing suite. These are manually
42+
run and require users to view results and use their own judgment to check validity.
43+
44+
To run the unit tests:
45+
46+
- `uv run pytest`
47+
48+
Check code unit testing coverage using:
49+
50+
- `uv run coverage run -m pytest`
51+
52+
View the code unit testing coverage report using:
53+
54+
- `uv run coverage report`
55+
56+
To run the validation tests:
57+
58+
- `uv run tests/validation/validation_test_file.py`

pyproject.toml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,22 @@ description = "Discrete Event Simulation renal services model"
55
readme = "README.md"
66
requires-python = ">=3.12"
77
dependencies = [
8+
"coverage>=7.10.7",
89
"matplotlib>=3.10.3",
910
"numpy>=2.3.1",
1011
"pandas>=2.3.1",
12+
"pytest>=8.4.2",
13+
"pytest-cov>=7.0.0",
1114
"simpy>=4.1.1",
1215
]
16+
17+
[tool.pytest.ini_options]
18+
addopts = "--ignore=tests"
19+
testpaths = ["tests/unit"]
20+
21+
[tool.coverage.run]
22+
omit=["tests/*"]
23+
24+
[tool.coverage.report]
25+
exclude_also = ['if __name__ == .__main__.:',
26+
'if self.config.trace:']

renal_capacity_model/main.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
Module for running the experiment
33
"""
44

5-
from trial import Trial
6-
from config import Config
5+
from renal_capacity_model.trial import Trial
6+
from renal_capacity_model.config import Config
77

88

99
def main(config):

0 commit comments

Comments
 (0)