We hope you'll join us for our 4/23 webinar on using data tables to apply reference ranges and AE codes in OC4. For more information and to register, visit https://register.gotowebinar.com/register/2882170018956684555

HL7 messaging

Happy New Year to everybody!!!

We are interested to implement a system to handle HL7 messaging as it has been mentioned previously in the OpenClinica blog.

Does anyone have experience with that? Geneuity developed a new web service called EventDataInsert. How is it implemented? Is it available in OpenClinica last versions?

Thank you very much in advance


  • toskriptoskrip Posts: 279 ✭✭✭

    in my experience it is much more reasonable to use existing software called communication engine or healthcare integration service bus and setup communication channels that map HL7 messages to OC specific web services. There is an open source product called mirth connect which we are using in production to handle such software integration in HL7 environment:



  • estupenduestupendu Posts: 14
    Thanks Tomas!

    Yes. We thought to use Mirth to connect Labs with OC but we need to add the data to our project. We thought to use the EventDataInsert web service developed by Geneuity but we don't know how implement it and how to configure the Mirth channel (destination). Or if there is another way to add the data to our project
  • toskriptoskrip Posts: 279 ✭✭✭
    The article from OC blog regarding EventDataInsert is quite old. I think that Geneuity did not open sourced that specific web service. OC has already set of web services that you can use to accomplish similar result. For data import you would need to use this one:


    (Note: these is one of SOAP web services this means that you need to deploy additional war: OpenClinica-ws)

    The difficult part is to format the data to conform the ODM of specific study. People from TraIT have been using OC web services with Mirth. You can find all what you need in this github repository:


    They use it to import data from csv files but it is not difficult to setup channel that is listening to HL7 and executing OC SOAP. What may be problematic is that HL7 data may not have all the information that you need for data import (because of differences between RIM and ODM data model). You may need to hardcode some values or if you need to have this more generic create study specific data mappings.

    For data import to OC you need to have StudyOID, StudySubjectOID, StudyEventOID, (RepeatKey - for repeating events), FormOID, ItemGroupOID, ItemDefinitionOID.

    Most of OIDs are readable from study metadata however StudySubjectOID and RepeatKey (for repeating events) you would need to query from OC using different web services.

    The alternative way (if you do not handle all the complexity in Mirth) is to have separate application that will communicate with OC and expose set of web services which Mirth will use to report the HL7 data that was received.

    Maybe if you specify in more detail what exactly you are trying to do I can recommend you which way to go. These are important aspects:
    - do you need this just for one study or are you planning to use it in multiple studies
    - do you have a standard CRF definition (that is not changing) for data that you want to import
    - is the CRF in non-repeating event only or you want to support repeating events
    - do you have multiple item groups in your CRF for data that you want to import
    - do you have repeating groups data that you want to import
    - do you use the same patient identifiers in OC and the system that produces HL7 message

    Basically you have to take it step by step:
    1. being able to receive and use data from HL7 message
    2. being able to create correct ODM data for import into OC
    3. being able to execute the import of ODM data into OC (for this the subject has to exists and the events has to be scheduled)



  • estupenduestupendu Posts: 14
    Thank you Tomas for the extensive and very useful explanation.

    We want to import laboratory data for only one project and we want to include all laboratory values in only one non-repeating event.

    Our idea is to create a grid in this event to include any laboratory data. The fields will be: data analysis, type of analysis (hematology, biochemistry...), parameter, value, units, low normal value, high normal value. We think that these fields will cover the inclusion of any laboratory value. We thought to use the same patient identifier in OC and the system that produces HL7 message.


  • toskriptoskrip Posts: 279 ✭✭✭
    Ok, one more follow up question... the HL7 messages will be received continously over long period of time right? That way the gird will be automatically expanding with every HL7 message about a new row.

    Here are additional notes that should be considered:
    > StudySubjectID
    Even if you use the same study subject ID in OC and HL7 system producing messages... be aware that for data import you need StudySubjectOID... maybe you have seen it in OC because normaly it looks like "SS_StudySubjectID". If you will have just one study in OC instance than you can guarantee that StudySubjectID is actually unique and for import purposes you can simply construct StudySubjectOID with just prefixing with "SS_". However if there is a chance that you are going to have multiple studies in OC and possibility of having subjects with the same StudySubjectID enrolled in mutliple studies, that this strategy will not work because if OC finds out that subject with specific StudySubjectID already exists in diferent study, it will enroll such subject into new study with no problem but it will generate for him StudySubjectOID that will look like "SS_StudySubjectIDrandomInteger", which is not predictable so in order to run import for such StudySubject you need to first obtain his OID from OC with RestfullURL call (which complicates the whole setup).

    > Adding new row into a grid
    When running and import for rows in a grid you need to specify ItemGroupRepeatKey property in your import ODM XML. However you are going to continuosly adding rows over a time (if I undertood it right). This would mean that before adding a new row you need to find out how many rows already exist. Which would again mean another RestfullURL call on OC to get a clinical data of the study subject. On the other hand if your situation is that you will receive the HL7 message for one subject only once, and it will contain all the rows that you want to insert, than you can skip this and start counting rows from 1.

    Otherwise it looks managable. You have one study, one event... so you can pretty much hardcode StudyOID, StudyEventOID, FormOID, ItemGroupOID and ItemOIDs (as there is a fixed number of columns in a grid row).


  • estupenduestupendu Posts: 14
    This is an special and complex project. We will install an OC only for this project. This will allow us to better control all issues (OIDs...).

    You are right. The HL7 messages will be received continuously over long period of time. We are going to continuously adding rows over a time and we will need to know how many rows already exist. As you suggest we will do another RestfullURL call on OC to know them. Unfortunately we have never used a RestfullURL call and even less in Mirth. Can this be done with a SQL statement?

    In relation to StudySubjectOID, the Study Subject ID will be unique and random numbers will not appear in the OID. One more problem solved...


  • toskriptoskrip Posts: 279 ✭✭✭
    Sure SQL will work (you need to look to OC DB relational model to design proper SQL request), although I would still preffer REST call as this is the supported way of programatically getting clinical data from OC. The nice thing about Mirth is that you can import custom java libraries that you can afterwards use in transformer step. E.g. you can import Apache HttpClient.jar. And perform HTTP requests to OC RESTful lURLs. Here is the snippet regarding the import of custom jar:

    to do RESTfull URL call to OC you need two HTTP requests performed within the same session.

    The first one is to authenticate yourself. And the second one will obtain the data.

    The first one should be POST request to OC base URL + "/j_spring_security_check" with provided j_username and j_password parameters.

    The second one should be GET request to OC base URL + "/rest/clinicaldata/json/view/StudyOID/StudySubjectOID/*/*"

    This will give you JSON formated Study metadata as well as clinical data of specific subject, you can parse this, navigate proper repeating group and determine the last repeat key to work with.

    Note: I did not tried this personally with Mirth (actually I am Mirth beginner as well), but I don't see the reason why it should not work, if I get some free time this month I may try it out...

  • estupenduestupendu Posts: 14
    Thank you Tomas for your support!!!

    We will try to implement your suggestions.
Sign In or Register to comment.