Skip to content
forked from OHDSI/Capr

Cohort definition Application Programming in R fork for PHEMS project

License

Notifications You must be signed in to change notification settings

thehyve/Capr-PHEMS

 
 

Repository files navigation

Capr

codecov.io Build Status

Capr is part of HADES

Introduction

The goal of Capr, pronounced 'kay-pr' like the edible flower, is to provide a language for expressing OHDSI Cohort definitions in R code. OHDSI defines a cohort as "a set of persons who satisfy one or more inclusion criteria for a duration of time" and provides a standardized approach for defining them (Circe-be). Capr exposes the standardized approach to cohort building through a programmatic interface in R which is particularly helpful when creating a large number of similar cohorts. Capr version 2 introduces a new user interface designed for readability with the goal that Capr code being a human readable description of a cohort while also being executable on an OMOP Common Data Model.

This package has been extended under the name Capr-PHEMS for the PHEMS consortium to facilitate the cohort building process via a template script and specific configurations, as well as providing extra functionality to enable querying the frequency of concept sets on a person and record level and to enable checking the standardness of concepts in a set or list of concepts, thereby making identification of non-standard concepts much more straightforward.

Learn more about the OHDSI approach to cohort building in the cohorts chapter of the Book of OHDSI.

Installation

Users can install the current development version of Capr from GitHub with:

# install.packages("devtools")
devtools::install_github("ohdsi/Capr")

For Capr-PHEMS, it is recommended to clone the repo and work from the template script cohortCapr.R, whilst using the Capr-PHEMS.Rproj as the project.

Getting started with Capr-PHEMS

Prerequisites

Please make sure you have the following:

  • R version >= 4.4.0
  • RStudio >= 2024.04.2

1a. Clone the repo:

git clone https://github.com/thehyve/Capr-PHEMS.git

1b. Install CaprPHEMS:

devtools::install_local("<relative_path_to_local_repo">)
  1. Navigate to ./inst/config/. Here you will find two sample configuration files; config-sample.yml and connection_config-sample.yml

  2. Copy these files using:

cp config-sample.yml config.yml

and

cp connection_config-sample.yml connection_config.yml

and fill in your configuration details.

4a. Open RStudio and verify renv >= 1.0.7 is installed by calling packageVersion("renv"). If not installed, call install.packages("renv)

4b. In the top-right "Project" dropdown menu, select "Open Project" and open ./CaprPHEMS.Rproj

4c. .Rprofile will be sourced when opening the project; this will trigger renv::init() to initialize the environment. When prompted whether to use a DESCRIPTION file for dependency discovery, select option 1 to use the DESCRIPTION file. Next, you may be prompted the project already has a lockfile with another set of options. Here also select option 1 to restore the project from the lockfile. This will install all required packages to the environment. Your renv is now activated.

  1. Run inst/scripts/main.R. This will save all the by The Hyve requested files to your device under inst/extdata/standardness for non-standard concept checks or inst/extdata/countoccurrences for the countOccurrences function. Please confirm these saved results may be shared prior to sharing.

To better understand the functions and what they require and produce, the user may take a look at extras/Capr-PHEMS_examples.Rmd (or extras/pdf_vignettes/Capr-PHEMS_examples.Rmd). Examples with sample data are provided along with executable code in this MD script.

User Documentation

Documentation can be found on the package website.

PDF versions of the documentation are also available:

Support

Contributing

Read here how you can contribute to this package.

License

Capr is licensed under Apache License 2.0

Development

Capr is being developed in R Studio. Capr-PHEMS is beind developed in R Studio.

Acknowledgements

  • The original Capr package is maintained by Martin Lavallee and Adam Black
  • Guidance and support for the original development of Capr came from Lee Evans and LTS Computing LLC
  • Additional scripts and templates specific to Capr-PHEMS are maintained by Guus Wilmink

About

Cohort definition Application Programming in R fork for PHEMS project

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • R 99.3%
  • Other 0.7%