In a recent study involving several hundreds patients, we decided to offer patients the ability to collect their diary data using their own smart phones instead of the traditional paper diary. The patients who decided to participate in the study downloaded the app to their smart phone or could use their desktop to access the application.
The apps were developed for iPhones and Androids with a reminder function that notified them when to report their symptoms. The data was then transferred to OpenClinica using the RESTful web services immediately upon entry. The patients ID and pin code were tested before data was added to the database to avoid any illegitimate entries.
About 80% of the patients decided to use the electronic diary – 65% using iPhones and 35% using various Android devices. They could also download the app to iPads or other tablets and if they preferred, they could use the application on desktops.
Of the patients who used the traditional method of reporting diary data on paper, 2.5 times more patients failed to report at scheduled time points compared to the patients using the app.
The app recorded the date and time automatically. When using paper, you can never be sure that the diary has not been completed at the time listed.
The addition of simple edit checks mitigated data entry errors, greatly contributing to the increased quality of the data.
It further reduced the manpower needed to manually enter data on to the eCRF and enabled us to monitor the patients in real-time and contact them if anything went wrong.
Although the patient population was relatively young, in this part of the world, even elderly patients are likely to use smart phones or desktops and would to be willing to use electronic data capture (EDC) for reporting diary data. The easy configuration of web services in OpenClinica and the ability to query data upon arrival made it an easy task to set up and validate the study.
OpenClinica’s web services layer provides a powerful mechanism for programmatic data interchange between OpenClinica and other systems. Below are the first two videos in a series of tutorials on working with web services. The videos are created by Hiro Honshuku, including the background music! Thanks Hiro!
If you’re an OpenClinica administrator somewhere, the chances are good somebody has asked you: “Can OpenClinica handle HL7 messaging?”
“No, it doesn’t,” you’ve said.
You probably said that with a sigh of relief because HL7 is a byzantine data exchange standard whose complexity keeps an army of consultants employed and drives neophytes like myself to madness. The HL7 2.X specification uses eye-fatiguing pipes (“|”) and hats (“^”) as delimiters and has been referred to by experts as the “non-standard standard” (see this). Unfortunately, it is also the lingua franca of health-care messaging currently, and will likely continue to be for a long time to come.
So, it is with a heavy sense of resignation that we here at Geneuity are taking up the challenge to make OpenClinica fluent in HL7. As a contract clinical laboratory, we are particularly interested in having OpenClinica able to digest HL7 ORU messages that convey lab results. This article details our first pass at the problem.
Our approach is shown in Figure 1. It makes use of Mirth and a new web service in OpenClinica developed by Geneuity called EventDataInsert. As shown, an HL7 message containing a lab result is sent by TCP to a Mirth channel which is configured to transform it into a SOAP message palatable to EventDataInsert. EventDataInsert reads the message and then sees if the specimen has already been accessioned into OpenClinica. If so, it inserts the data into the underlying database and signals a successful entry. If not, it does nothing and signals a rejection. These signals are transmitted back to Mirth which issues a standard HL7 acknowledgment (ACK) message coded with either ‘AA’ for ‘Application Accept’ or ‘AR’ for ‘Application Reject’. It is the responsibility of whoever (or whatever) sent the HL7 message in the first place to follow up when a lab result is rejected.
To develop this strategy, we used several tools. To generate HL7 test messages, we utilized the HL7 generator (freely available here) made by the people responsible for the ELINCS initiative. To send and receive HL7 messages to and from Mirth via TCP, we used Netcat, another freely available utility.
And there you have it! Of course, the HL7 standard covers much more than the delivery of lab results, but this exercise is most relevant to our concerns and represents an important first step in making OpenClinica talk the talk when it comes to HL7.
Figure 1: HL7 Strategy for OpenClinica
First, a HL7 message conveying lab results is sent to a Mirth channel listening for TCP requests. Mirth parses the message and transforms it into a SOAP message which it then hands off to the EventDataInsert webservice listening within OpenClinica. EventDataInsert looks to see if the specimen to which the lab result pertains has been accessioned into OpenClinica’s underlying database. If so, it inserts the results and signals back to Mirth that fact. If not, it enters nothing and signals back to Mirth that it did nothing. Mirth digests these signals and sends back to the sender an appropriately configured ACK message via TCP.
Channels are the heart and soul of a MirthConnect installation. A channel is user defined and has a source and a destination. A source may be a flat file residing on a remote server or a web service call or a database query or even another channel—whatever you like, it doesn’t matter. A destination may be to write a PDF document, email somebody an attachment or enter data into a database. Again, whatever!
To illustrate, say you want to poll a database and generate a weekly report. No sweat! Using MirthConnect’s easy-to-use drag-and-drop template-based editor, define a channel with a database reader as a source, and a document writer as a destination, fill in details like user names, passwords and machine names, define which database fields you want to retrieve and how you want to display the data, and you’re done! MirthConnect’s daemon handles the rest based on your channel’s configuration.
Once defined, a channel can be exported as XML for later import into another MirthConnect installation. This is all done with the point and a click of a mouse.
At Geneuity, we use MirthConnect to get data in and out of OpenClinica. Originally, we used custom JAVA code to do this. But once we found MirthConnect, we quickly realized we were reinventing the wheel. Why do that?
Here’s a concrete example. Consider the very simple CRF from a mock OpenClinica installation shown in Figure 1. It has three groups of items: accessioning, results and reportage. When a specimen arrives at Geneuity, the lab tech looks up the patient and event pairing in the subject matrix as specified by the requisition and types into the CRF the accession number, the receipt date and any shipping deviations. This is done by hand and is indicated as step 1 of Figure 2.
Then, as shown in step 2 of Figure 2, the tech tests the specimen at the testing platform. In step 3, the platform spits out the data whereupon a collection of MirthConnect channels operating in tandem parses the results, transforms them into SOAP messages and sends them to the EventDataInsertEndpoint web service feature of OpenClinica for upload into the CRF fields designated ‘Assay date’ and ‘Analyte concentration’.
After the tech reviews the data and marks it complete, another collection of channels polls the database for results newly marked complete, generates and delivers PDF reports of the corresponding data (step 4) and then reports back to OpenClinica (step 5) via EventDataInsert the details of the reportage, including status, time and any errors (see the third and last item grouping labeled ‘REPORTAGE’ in Figure 1).
The scenario outlined above requires NO CUSTOM CODE beyond the channel configurations and these are encapsulated and standardized by design. As such, you don’t need an army of coders on staff to develop and maintain them.
Both OpenClinica and MirthConnect are great as standalone products. Linked together, however, they really sizzle.
Figure 1: A simple CRF from a mock OpenClinica installation
As mentioned previously, we at Geneuity Clinical Research Services are big fans of OpenClinica and are even more so now with the upcoming release of version 3.0 with its new web services capability. This article describes how we exploit this new feature to help automate entry of lab results, a particularly important topic given that we do lots of batch testing of specimens and oftentimes test the same specimen for many different analytes.
Prior to 3.0, you had three options when it came to CRF data entry. The first was to log into OpenClinica’s web interface and manually enter your data. This was no problem so long as you didn’t have lots and lots of data. But we did.
Alternatively, you could upload a flat file of your data as long as it was formatted in XML and associated with the appropriate subject id’s and visit descriptions. Assembling this file wasn’t trivial though and manually looking up each specimen’s subject and event nearly defeated the purpose of the procedure, which was to save time and effort.
Finally, you could do what we did: write custom code to automate the job. Lab data is amenable to this sort of approach because it is always tagged with something called an accession number that uniquely identifies it. When designing CRF’s, we always make sure to include a field for the event’s accession number, and when a specimen first arrives through our door the first thing we do is to log into OpenClinica and enter the specimen’s accession number in the appropriate event’s CRF. Because the number is unique to the study, this entry effectively tags the event and provides a ‘hook’ inside the database so that the event_crf_id of any data item subsequently annotated with the accession number can be easily looked up using a database query like so: ‘SELECT event_crf_id FROM item_data WHERE value = ‘<accession_number>’. This, in turn, gives you the requisite information to insert the lab data thusly: ‘INSERT INTO item_data VALUES (‘event_crf_id’, ‘value’ …’ provided you also know the item_id.
To implement this strategy, we wrote custom servlets that operated within the context of our OpenClinica installations. More recently, we configured MirthConnect channels to do the same. They worked well and data entry was greatly expedited, but the coding was complex and had to be refactored over and over again for each study and for every CRF change. While helpful, this strategy wasn’t sustainable in the long run.
Luckily, the latest version of OpenClinica provides a way out. It incorporates the Spring WS Framework which allows programmers to write something called a ‘web service.’ A web service digests and acts upon XML data sent to it on an on-demand basis over a network. The source need not be a human being uploading data on a web form, but, more usefully, it can be, say, a clinical testing platform automatically spitting out HL7 messages. This, of course, is ideal in our case. So we wrote a web service called ‘EventDataInsert’ that parses XML containing lab data values annotated with accession numbers and item names, looks up the corresponding event_crf_id’s and item_id’s, and inserts the data into item_data accordingly. The service is generic enough so that it doesn’t have to be refactored for each and every study, but it does make some critical assumptions. Namely, it assumes that both accession numbers and item names are unique. So care has to be taken to ensure both these preconditions are met.
The power of EventDataInsert doesn’t just lie in the fact that it handles inserts on an unattended basis, but also in that, like most web services, it requires only simple XML as input. The latter makes the source of the data irrelevant as long as it can be correctly mapped and transformed into XML. We often use MirthConnect to do this, using it’s easy-to-use graphical interface to configure channels between incoming raw data and OpenClinica’s web-service interfaces.
The figure below shows a typical deployment of OpenClinica at Geneuity. MirthConnect is used not only to get data into OpenClinica but also to generate canned PDF reports of the results. This scenario works for us and gets easier and easier to maintain as OpenClinica evolves new electronic data capture features and makes old ones ever more robust.