Download presentation
Presentation is loading. Please wait.
Published byFranklin Dalton Modified over 6 years ago
1
REDCap Integration Reducing complexity for researchers using both REDCap and a complex treatment allocation algorithm Allan Walker (Edinburgh Clinical Trials Unit) Garry Milne (Edinburgh Clinical Trials Unit)
2
The problem REDCap provides a randomisation module that is limited – it doesn’t support dynamic treatment allocation mechanisms such as minimisation. We want to avoid researchers having to use two systems – REDCap (eCRF) and a Randomisation system
3
The problem Got this… Want this…
4
Restating of the problem
We need a way of gluing our REDCap project to our Randomisation service such that: Our Randomisation Service can access the data it needs to perform a randomisation in real time. Our researchers can view the result of the randomisation immediately. Our researchers don’t need to be aware the randomisation service is separate.
5
Final Solution in action
Demonstrate the final solution.
6
REDCap Interactions required for the solution
Our ‘Glue’ needs to be able to Pull data from REDCap to feed to our Randomisation Service. Push data into REDCap. Specifically the allocated treatment determined by our Randomisation Service. Randomisation process to be triggered by the researcher inside REDCap.
7
REDCap Features leveraged
Data Entry Triggers REDCap will ‘post’ a message to a web page of your choosing every time any user clicks the Save button in your project. Available via the ‘Additional Customizations’ button in Project setup.
8
REDCap Features leveraged
REDCap API Programmatically access the REDCap back-end Pull data from and push data into are both allowed. Access is given via a ‘secret token’ granted to an individual account. This account can then be used to interact with the REDCap back-end by passing the token as part of the communication with REDCap.
9
Prepare the REDCap project
Solution Structure Prepare the REDCap project Add the account to use the API. Generate the API token for this account. Tell REDCap which page to trigger when the researcher saves data – this is our ‘Glue’ page.
10
Prepare the ‘Glue’ page.
Solution structure Prepare the ‘Glue’ page. Security checks Https (SSL) being used? Is the request coming from our REDCap server? Practical checks Has the participant been randomised already? Is the data needed for randomisation available?
11
Glue Page Logic Flow Chart 1
Does the request come from our REDCap server? End No Has the REDCap user just requested a randomisation? Yes Has the participant already been randomised? No
12
Glue Page Logic Flow Chart 2
Pull required data from REDCap Has the data needed for randomisation been recorded in REDCap? No End Yes Allocate a treatment via the Randomisation Service Push the treatment allocation into REDCap End
13
REDCap API How-To discovery
REDCap provides API documentation. Easy to find from the main REDCap screen. REDCap also provides an API testing environment called the ‘API playground’ has examples for many different programming languages including php, Java and R but not C# (which we use)! So here’s what we used…
14
C# Code for communicating with REDCap
Make the request: HttpWebRequest request = HttpWebRequest.CreateHttp(url); request.Method = "POST"; request.KeepAlive = true; request.AllowAutoRedirect = false; request.Accept = "application/json"; request.ContentType = "application/x-www-form-urlencoded"; ASCIIEncoding encoding = new ASCIIEncoding(); string stringData = "token=" + APIKey + "&content=record&format=json&records="+ record +"&forms=participant_details,randomisation&fields=dominant_aetiology_liver"; byte[] data = encoding.GetBytes(stringData); request.ContentLength = data.Length; Stream newStream = request.GetRequestStream(); newStream.Write(data, 0, data.Length); newStream.Close();
15
C# Code for communicating with REDCap
Receive the response: HttpWebResponse response = (HttpWebResponse)request.GetResponse(); Encoding enc = System.Text.Encoding.GetEncoding(1252); StreamReader loResponseStream = new StreamReader(response.GetResponseStream(), enc); //Get the necessary values from the Redcap response var serializer = new System.Web.Script.Serialization.JavaScriptSerializer(); dynamic jObject = serializer.Deserialize<dynamic>(loResponseStream.ReadToEnd()); System.Collections.Generic.Dictionary<string, object> redid = jObject[0];
16
REDCap has good points but also limitations.
Summary REDCap has good points but also limitations. If using REDCap for a project it is possible to extend the features of the project using the REDCap API. We’ve shown how this can be achieved using a randomisation service as an example.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.