<!-- This page was originally created on April 29, 2014. The last edit was version 8 made on July 7, 2014. The page needed to be entered new due to corruption that occurred during an upgrade process when the wiki was upgraded to confluence 5.3. The original author of this page and project is Bastian Weinlich -->
 

GIRI (Generic integration of R into i2b2)

Author: Bastian Weinlich

Short Description

The project follows a similar goal as the "R Engine Cell" of the University of Pavia and rgate (HERON) of the University of Kansas: To make arbitrary R functions available within i2b2. In contrast to these approaches, it is very simple to add new statistical functionality with GIRI. To do so, it is sufficient to write an R script and an optional XML configuration file to add what is known as a "Scriptlet" (a kind of an addon) that comprises one or more R functions. In particular, it is not necessary to implement an i2b2 webclient plugin for every newly added scriptlet individually. The end user simply selects the desired scriptlet from a drop down list from a generic i2b2 webclient plugin and has then several options to customize the input data (e.g. drag and drop patient sets / concepts). Afterwards, he clicks on "View Results" to start computations. The following results page can - depending on the scriptlet - consist of numerical / textual values, tables and plots. Additionally, all data can be exported as files.

Examples

A simple scriptlet could compute two quantiles of age from a previously selected patient set. The end user can define the p values. Here is a step-by-step guide to using the scriptlet:

Specify the input data:

 

 

Afterwards click on "View Results" to start the computation:

 

 

The scriptlet consists of two files that have to be stored on the server where the GIRI Cell is running. The first one is the R script including the following R code:

 

GIRI.output["Lower quantile"] <- quantile(GIRI.patients[[1]]$age_in_years_num, as.numeric(GIRI.input[["p for lower quantile"]]))
GIRI.output["Upper quantile"] <- quantile(GIRI.patients[[1]]$age_in_years_num, as.numeric(GIRI.input[["p for upper quantile"]]))
boxplot(GIRI.patients[[1]]$age_in_years_num, horizontal=T)

 

 

Accessing input and output is possible by using special naming conventions (GIRI.patients, GIRI.input, GIRI.output...). Plots are always displayed.

The second file configures the R scriptlet through XML code:

 

<?xml version="1.0" encoding="UTF-8"?>
<giriconf:Rscriptlet xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:giriconf="http://www.i2b2.org/xsd/cell/giriconf/1.0/">
	<settings>
		<title>Quantiles of age</title>
		<description>Please select a patient set and fill in two values for p.</description>
		<passROutput>false</passROutput>
		<passRErrors>true</passRErrors>
		<plotDescription>Here you can see a boxplot of the patient's ages:</plotDescription>

	</settings>
	<additionalInputs>
		<input>
			<name>p for lower quantile</name>
			<description>Fill in a numeric value between 0.0 and 1.0, e.g. 0.05</description>
			<type>text</type>
			<lines>1</lines>
		</input>
		<input>
			<name>p for upper quantile</name>
			<description>Fill in a numeric value between 0.0 and 1.0, e.g. 0.95</description>
			<type>text</type>
			<lines>1</lines>
		</input>
	</additionalInputs>
	<customOutputs>
		<output>
			<name>Lower quantile</name>
			<description>This is the lower quantile. It descripes the value where (p * number of patients) lies below this value.</description>
		</output>
		<output>
			<name>Upper quantile</name>
			<description>This is the upper quantile. It descripes the value where (p * number of patients) lies above this value.</description>
		</output>
	</customOutputs>
</giriconf:Rscriptlet>

 

Settings, input variables and outputs are defined in this configuration file. For more information about creating scriptlets see the notes for scriptlet developers.

The following slide show depicts a scriptlet that computes a Kaplan Meier plot:

 

 

Downloads

The download package contains the GIRI Cell, the GIRI webclient plugin, install notes, notes for scriptlet developers and example scriptlets. This version is dedicated for i2b2 version 1.7.02 (does not work with 1.7.01!).

giri_i2b2_project_v1.1.zip