REDCap: A Tool for Collecting Clinical Trials Data

In the course of my day job I tend to get drawn into interesting niche projects because of my Linux expertise. Recall that the Mothership (that corporate entity located somewhere on the East coat which pays me fairly well to work for them) is *shudder* a Windows shop, primarily.

However, Open Source Software is making not-too-subtle encroachments into even this bastion of All Windows All The Time. I got a call one day a couple of weeks ago from a semi-stressed project leader who at the suggestion of the client was being encouraged to use an application built entirely out of open source components. We have it running on a virtual Linux server. It’s called REDCap, and was developed by Vanderbilt University. Basically, it is a web-based interface to an underlying mysql engine. It is a highly specialized database tool developed specifically to support data collection for clinical studies.

Understand, REDCap is built entirely from open source components, but it is not FOSS. In order to be allowed to use it, you must join the REDCap Consortium. Nothing wrong with that, I assure you. In fact, I’m quite pleased to see pressure coming down from the government client encouraging (translated: We’re making you an offer you can’t refuse...) their contractors to take advantage of certain open source products.

 What is it that makes REDCap special? Good question. After tinkering with our REDCap install for about a week now, I can say that it is a very well designed, tight system which serves a very specific purpose (data collection for clinical studies), and serves it well. Plus it provides a simple, yet flexible API to allow the users of it to get info in and out of the REDCap databases. Using the provided API, it turns out to be a snap to develop php scripts that allow the system integrator to interface REDCap with other running systems. Even those running *shudder* Windows.

Sorry about the *shudder* thing. Can’t help myself.

Anyhow, as I was saying, using fairly simple php scripts, it is easy to get data into and out of the REDCap repository. Here’s one small example of how to export data out of a REDCap database:



  // Export Screening Data

# the class that performs the API call

# arrays to contain elements you want to filter results by
# example: array('item1', 'item2', 'item3');
$records = array();
$events = array();
$fields = array();
$forms = array();

# an array containing all the elements that must be submitted to the API
$data = array('content' => 'record', 'type' => 'flat', 'format' => 'csv', 'records' => $records, 'events' => $events, 
	      'fields' => $fields, 'forms' => $forms, 'token' => '59E3E2981CDCB7D1BF1817C8024BD51B'); // Doug

# create a new API request object
$request = new RestCallRequest("", 'POST', $data);

# initiate the API request

/********* Handle the return from the API *********/
# OPTION 1: for testing purposes and small datasets you can just output the data to screen

# get the content type of the data being returned
$response = $request->getResponseInfo();
$type = explode(";", $response['content_type']);
$contentType = $type[0];

# set the content type of page
//header("Content-type: $contentType; charset=utf-8");

#print the data to the screen
//echo $request->getResponseBody();

# the following line will print out the entire HTTP request object 
# good for testing purposes to see what is sent back by the API and for debugging
//echo '<pre>' . print_r($request, true) . '</pre>';

# OPTION 2: save the output to a file

$the_date = getdate();
//print_r ($the_date);

$month = $the_date['mon'];
$year = $the_date['year'];
$day = $the_date['mday'];
$minutes = $the_date['minutes'];
$hours = $the_date['hours'];
$seconds = $the_date['seconds'];
$path = "/usr/local/redcap/output/";

$filename = $path . "Screening_Data-" . $month . "-" . $day . "-" . $year . "-" . 
  $hours . "." . $minutes . "." . $seconds  . ".csv";

file_put_contents($filename, $request->getResponseBody())


What might not be obvious from this example is that access control is accomplished via a token system that allows the REDCap administrator to easily manage access permissions to the system. Bottom line: REDCap is good stuff. That fact that it is sort of being shoved down the throats of certain Windows shops is a small added bonus.

The developers of REDCap have requested that we cite their work whenever we use it.



Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Thanks for this. I'm looking

Vinh Nguyen's picture

Thanks for this. I'm looking for a data collection tool as a front-end (data entry) to a database. My institution is supposedly a member of the consortium, but I don't know if that means everyone at the institution could get a copy and use it. I really wish it was open source. I emailed the man in charge and hopefully I'll be able to get a copy to test out.

I [posted]( on stack overflow to seek software similar to this. Does anyone know of other software (preferably open source and supports SSL) that can collect data via the web into a database? I'd also like to have username and passwords (only designated people can fill out forms). [LimeSurvey]( looks promising, but I don't think the user has access to how tables, questions, and answers are named in the database. After data collection, data will be manipulated and extracted from the SQL side of things, so having control how they're named or which table/columns data gets stored is important.

I'm open to suggestions. Thanks!

Contact this person

Doug.Roberts's picture


I recommend that you contact Paul Harris, paul.a.harris@Vanderbilt.Edu with your request.


Thanks Doug, I did

Vinh Nguyen's picture

Thanks Doug, I did ("contacted man in charge"). Was just wondering if you or others are aware of similar software out there, that's all.


xado7525's picture

Excellent post I made several things clear. Congratulations and thanks for all this information really useful. I visit several blogs daily to always take new ideas for my site, and I must say that this is a really nice blog. It's really a pleasure reading your articles Thanks


John H.'s picture

Cool. Wonder how the users like it. (Who care about users...)

Good question

Doug.Roberts's picture

The user community is relatively small, maybe in the low thousands, and distributed world-wide, and apparently growing. Some of the users within my company are a bit resentful that they have to use a Linux-based product because they only know Windows, but it is possible to integrate the REDCap system fairly seamlessly with their other Windows applications using tools like Samba and the API for exporting csv data. After using it for a while in production I think they will grow to appreciate REDCap. The project goes "live" next month, so we will see.


More info

LabThug's picture

I was responsible for initially setting up REDCap at my Academic Medical Center (which is also on the East Coast). The consortium is world-wide, yes, but we count users by institutions and haven't quite reached the thousands. You can get more info about it here:

While I do applaud you for using it to beachhead Linux into your organization, I'm somewhat surprised that you didn't suggest running it on the WAMP environment. There's many of us who do (not my site though), and we are quite happy to assist newcomers through the mailing list and weekly calls.

In addition to the main REDCap components, there's also a survey system to collect patient/end user info. Right now, they're separate, but they're going to merge them together in the next release. There's also a way to share forms between studies/institutions, and import data from external source systems.

Anyway, thanks for the review! I'll share it with the rest of us :-)

You're welcome

Doug.Roberts's picture

REDCap is a nice product, and I don't mind saying so. Also, on the project call last Friday I heard about the plans to merge REDCap Survey with REDCap in an upcoming release, and I think that is a great idea.

Re: WAMP -- Shhhh, I'm a Linux guy. My company doesn't need to know about that other environment for running REDCap. I was not the person in my company who made the decision to run it on a virtual Linux machine, but I am quite happy that they did.