You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+2-234Lines changed: 2 additions & 234 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,11 +16,6 @@ Learn more about the OHDSI approach to cohort building in the [cohorts chapter o
16
16
17
17
# Installation
18
18
19
-
Capr can be installed via:
20
-
21
-
```r
22
-
# install.packages("Capr")
23
-
```
24
19
25
20
Users can install the current development version of Capr from [GitHub](https://github.com/) with:
26
21
@@ -29,246 +24,19 @@ Users can install the current development version of Capr from [GitHub](https://
29
24
devtools::install_github("ohdsi/Capr")
30
25
```
31
26
32
-
# How to Use
33
-
34
-
## Examples
35
-
36
-
Capr uses many defaults that match the defaults in Atlas. Creating a simple cohort is a single line of code. As an example we will define a cohort of new users of diclofenac described in the [Book of OHDSI.](https://ohdsi.github.io/TheBookOfOhdsi/SuggestedAnswers.html#Cohortsanswers)
37
-
38
-
### Simple diclofenac cohort
39
-
40
-
```r
41
-
library(Capr)
42
-
43
-
# Define concepts sets with cs()
44
-
diclofenac<- cs(descendants(1124300))
45
-
46
-
ch<- cohort(
47
-
entry= entry(drugEra(diclofenac))
48
-
)
49
-
50
-
ch
51
-
#> Formal class 'Cohort' [package "Capr"] with 4 slots
52
-
#> ..@ entry :Formal class 'CohortEntry' [package "Capr"] with 5 slots
53
-
#> ..@ attrition:Formal class 'CohortAttrition' [package "Capr"] with 2 slots
54
-
#> ..@ exit :Formal class 'CohortExit' [package "Capr"] with 2 slots
55
-
#> ..@ era :Formal class 'CohortEra' [package "Capr"] with 3 slots
56
-
```
57
-
58
-
### Adding more complexity
59
-
60
-
We can make more complex cohorts by adding a window of continuous observation and a custom cohort exit. The following information was added to the diclofenac cohort:
61
-
62
-
- Ages 16 or older
63
-
- With at least 365 days of continuous observation prior to exposure
64
-
- With cohort exit defined as discontinuation of exposure (allowing for a 30-day gap)
#> Formal class 'Cohort' [package "Capr"] with 4 slots
77
-
#> ..@ entry :Formal class 'CohortEntry' [package "Capr"] with 5 slots
78
-
#> ..@ attrition:Formal class 'CohortAttrition' [package "Capr"] with 2 slots
79
-
#> ..@ exit :Formal class 'CohortExit' [package "Capr"] with 2 slots
80
-
#> ..@ era :Formal class 'CohortEra' [package "Capr"] with 3 slots
81
-
```
82
-
83
-
### Adding cohort attrition
84
-
85
-
Users can also add attrition to the cohort by specifying inclusion and exclusion criteria to modify the cohort entry. The following exclusion criteria were added to the diclofenac cohort:
86
-
87
-
- Without prior exposure to any NSAID (Non-Steroidal Anti-Inflammatory Drug)
Users can build valid cohorts with minimal concept information, only supplying a concept id and name. The example below shows the minimal concept set input for Capr.
However, when saving cohorts it is helpful to fill in the concept details. This requires a live connection to an OMOP CDM database that includes the vocabularies used in the cohort definition.
Once a Capr cohort has been constructed, the user can generate this cohort definition on an OMOP CDM connection. It is suggested to use [CohortGenerator](https://github.com/OHDSI/CohortGenerator) and [CirceR](https://github.com/OHDSI/CirceR) to generate Capr cohorts on a database.
209
-
210
-
## Building Capr Templates
211
-
212
-
A Capr cohort template is a function that always returns a Capr cohort. It can accept arguments that can be used to parameterize any part of a cohort definition. Capr cohort templates are the recommended approach for building large numbers of similar cohorts in R.
213
-
214
-
```r
215
-
216
-
# A Capr cohort template is a function that returns a cohort
0 commit comments