Coder Social home page Coder Social logo

redcapr's Introduction

Build Status

REDCapR

We’ve been using R with REDCap’s API since the Fall 2012 and have developed a few functions that we're assembling in an R package: REDCapR.

It was taking us about 50 lines of code to contact REDCap and robustly transform the returned CSV into an R data.frame. The same thing can be done in one line of code with the package's redcap_read() function:

ds <- redcap_read(redcap_uri=uri, token=token)$data

The REDCapR package includes the Bundle of CA Root Certificates from the official cURL site. Your REDCap server's identity is always verified, unless the setting is overridden (or alternative certificates can also be provided).

The redcap_read() function also accepts values for subsetting/filtering the records and fields. The current documentation can be found in the GitHub repository. A vignette has also been started.

#Return only records with IDs of 1 and 4
desired_records <- c(1, 4)
ds_some_rows <- redcap_read(
   redcap_uri = uri, 
   token = token, 
   records = desired_records
)$data

#Return only the fields recordid, first_name, and age
desired_fields <- c("recordid", "first_name", "age")
ds_some_fields <- redcap_read(
   redcap_uri = uri, 
   token = token, 
   fields = desired_fields
)$data

We have completed redcap_write(), but aren't releasing it until appropriate unit/regression/integration tests are written. We first need a way to automate deleting the newly inserted records, so the database's state is cleaned up before subsequent tests.

Once the redcap_write() function is tested and documented, we'll release it on CRAN. In the next few months, we hope to implement everything exposed by the REDCap API. If there's a feature that would help your projects, feel free to post something here in the forums, or create an issue in REDCapR's GitHub repository.

Our group has benefited so much from REDCap and the surrounding community, and we'd like to contribute back. Suggestions, criticisms, and code contributions are welcome. And if anyone is interested in trying a direction that suits them better, we'll be happy to explain the package's internals and help you fork your own version. We have some starting material described in the ./documentation_for_developers/ directory. Also two other libraries exist for communicating with REDCap: redcap and its current fork written for R, and PyCap written for Python.

Thanks, Will Beasley, David Bard, & Thomas Wilson

University of Oklahoma Health Sciences Center, Department of Pediatrics, Biomedical & Behavioral Research Core.

The development version of REDCapR can be installed from GitHub after installing the devtools package.

install.packages("devtools")
devtools::install_github(repo="OuhscBbmc/REDCapR")

redcapr's People

Contributors

wibeasley avatar johnaponte avatar rparrish avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.