-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathREADME.qmd
More file actions
75 lines (49 loc) · 2.68 KB
/
Copy pathREADME.qmd
File metadata and controls
75 lines (49 loc) · 2.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
---
format:
gfm
---
<!-- README.md is generated from the README.qmd file.
Please edit that file and re-render in R `....` -->
# kaplan-meier-function
This is the code and configuration for `kaplan-meier-function`, an R reusable action for the OpenSAFELY framework.
This action uses the Kaplan-Meier estimator to calculate the cumulative incidence of an event over time, from a given origin date, possibly stratified by an exposure variable and/or a subgroup variable. Event times may be censored.
There is EXPERIMENTAL support for statistical disclosure control in the action, with further assurance tests and methodological explanations pending.
We recommend comparing rounded KM estimates to the unrounded KM estimates (prior to release) to ensure that the rounded estimates are a sensible approximation.
Additional arguments provide control over smoothing, maximum follow-up duration, plotting, and other options -- a full list of available arguments is given below.
## Usage
This action should be specified in the `project.yaml` file of your OpenSAFELY study repository, where you should replace `[version]`
with [the latest tag](https://github.com/opensafely-actions/kaplan-meier-function/tags),
e.g., `v0.0.1`. Note that no space is allowed between `kaplan-meier-function:` and `[version]`.
The arguments to the action are specified using the flags style, i.e., `--argname=argvalue`. The available arguments to this action are as follows:
```{r, echo=FALSE, comment = '', linewidth=80}
source_lines <- function(file, lines) {
source(textConnection(readLines(file)[lines]))
}
# Note: in the following command the last line should be the line that
# creates the opt_parser object using OptionParser(...)
source_lines("analysis/km.R", 48:107)
optparse::print_help(opt_parser)
```
For example, the relevant action in the `project.yaml` file might look something like this:
```yaml
my_kaplan_meier_function_action:
run: kaplan-meier-function:v0.0.14
--df_input=cohort.arrow
--df_output=output/km
...# more arguments here
outputs:
highly_sensitive:
estimates: output/estimates.*arrow
contrasts: output/contrasts.*arrow
plots: output/plot.png
...
```
For a more complete example of the arguments this action uses, see [this repo's `project.yaml` file](./project.yaml).
The main script for this action is [`analyis/km.R`](./analysis/km.R).
# About the OpenSAFELY framework
The OpenSAFELY framework is a Trusted Research Environment (TRE) for electronic
health records research in the NHS, with a focus on public accountability and
research quality.
Read more at [OpenSAFELY.org](https://opensafely.org).
# Licences
As standard, research projects have a MIT license.