REDCap:用于收集临床试验数据的工具

作者:Doug.Roberts

在我的日常工作中,我倾向于因为我的 Linux 专业知识而被拉入有趣的利基项目。 回想一下,母公司(位于东海岸的某个地方,支付我相当不错的工资为他们工作) *不寒而栗* 主要是一家 Windows 商店。

然而,开源软件正在对所有 Windows 所有时间的这个堡垒进行不太微妙的侵蚀。 大约几周前的一天,我接到一位略显压力的项目负责人的电话,他在客户的建议下,被鼓励使用完全由开源组件构建的应用程序。 我们让它在虚拟 Linux 服务器上运行。 它被称为 REDCap,由范德比尔特大学开发。 基本上,它是一个基于 Web 的界面,连接到基础 mysql 引擎。 它是一种高度专业的数据库工具,专门用于支持临床研究的数据收集。

请理解,REDCap 完全由开源组件构建,但它不是 FOSS。 为了被允许使用它,您必须加入 REDCap 联盟。 我向你保证,这没什么不对。 事实上,我很高兴看到政府客户施加压力,鼓励(翻译:我们给你一个你无法拒绝的提议......)他们的承包商利用某些开源产品。

 是什么让 REDCap 如此特别? 好问题。 在摆弄了我们的 REDCap 安装大约一周后,我可以肯定地说,这是一个设计精良、紧密的系统,它服务于一个非常特定的目的(临床研究的数据收集),并且服务得很好。 此外,它还提供了一个简单而灵活的 API,允许其用户进出 REDCap 数据库。 使用提供的 API,结果证明开发 php 脚本以允许系统集成商将 REDCap 与其他运行系统连接非常容易。 甚至包括那些运行 *不寒而栗* Windows 的系统。

对不起,关于 *不寒而栗* 这件事。 忍不住。

无论如何,正如我所说的,使用相当简单的 php 脚本,很容易将数据导入和导出 REDCap 存储库。 这是一个从 REDCap 数据库导出数据的小例子

#!/usr/bin/php

<?php

  //
  // Export Screening Data
  //

# the class that performs the API call
require_once('RestCallRequest.php');

# 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("https://redcap.xxx.org/redcap/api/", 'POST', $data);

# initiate the API request
$request->execute();

/********* 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())

?>

从这个例子中可能不明显的是,访问控制是通过一个令牌系统来实现的,该系统允许 REDCap 管理员轻松管理对系统的访问权限。 底线:REDCap 是好东西。 它有点被塞进某些 Windows 商店的喉咙里这个事实,是一个小的额外奖励。

REDCap 的开发人员已要求我们在使用它时 引用他们的工作

加载 Disqus 评论