EzDevInfo.com

hapi

Server Framework for Node.js hapi.js

HAPI v2.0 Hl7 message

I am trying to use HAPI to create HL7 message and send the HL7 message over MLLP (using PAM profile). I need to use HAPI v2.0 to create the HL7 message, I am unable to find any documentation/examples for HAPI v2.0. Where can I find HAPI 2.0 resources?


Source: (StackOverflow)

RSP_K21 (Find Candidates Response) not working in Hapi 2.6

Seems the mailing list isn't very active so I figure I'll try here as well.

In 2.5 and lower versions of Hapi, you could get multiple repetitions of the RSP_K21_QUERY_RESPONSE from RSP_K21. However, in 2.6, you can only get one. The 2.6 spec still indicates you should be able to return multiple responses. How can I replicate the previous functionality or am I stuck at 2.5?


Source: (StackOverflow)

Advertisements

Can we use serversocket to listen incoming messages in Hapi?

Is it possible to add serversocket implementation to listen the incoming traffic of HL7 messages in Hapi? Currently, i start a sample server to listen all incoming message. I would like to create a serversocket to listen messages and when the application responds, i would like to send back taht as ack/nack response to client.. How can i do that?


Source: (StackOverflow)

HL7 version 3 parsing

I was parsing HL7 version 2.x messages through HAPI. Now I want to parse HL7 version 3 messages, which are in XML format. HAPI does not support HL7 version 3, so how can I do this?


Source: (StackOverflow)

HL7 segments order

I'm parsing SIU S14 with the following segments order: MSH SCH PID PV1 RGS AIL AIS

and although it parses without error, I can't retrieve data from AIS segment. But when I move AIS segement before AIL, everything seems to work fine. So does segments order matter in HL7?


Source: (StackOverflow)

Why do we use ConformanceProfile in Hl7(Hapi)?

Why do we use the ConformanceProfile in Hl7 parsers? As well as what is the difference between using,DefaultValidation and No Validation in HapiContext? If i use, NoValidation and If my message has invalid tags it should parse or fail?


Source: (StackOverflow)

Need to parse HL7 message

I need to parse HL7 message ,firstly ,validate the message and then parse.

 XMLParser xmlParser = new DefaultXMLParser();

 //encode message in XML 
 String hl7MessageInXML = null;
 try {
        hl7MessageInXML = xmlParser.encode(message);
 } catch (HL7Exception e) {
    e.printStackTrace();
 }

Source: (StackOverflow)

What is meaning of LAB-n in LAB TF

Currently we are working on Laboratory domain.
The Laboratory domain embraces many profiles and each profiles consist of lots of actors.
Where LAB TF mentioned LAB-n several times.

In example:

  1. LAB-1~5 (5)
  2. LAB-21~23 (3)
  3. LAB-26~31 (6)
  4. LAB-51 (1)
  5. LAB-61~62 (2)

What are they actually?
Machine, Device, Actor or anything else?
What are they use for?


Source: (StackOverflow)

HAPI: Hl7 Parser do not separate the segment of the Hl7 message

I'm getting started to Hl7 using HAPI API. I have an Hl7 test message (picked up from a real case) and I want to read the field of the various segment (MSH, PID, PV1, etc.) The problem is that the Parser do not split the message in segments, but put all the message in the MSH segment. I tried both the PipeParser and the GenericParser. The message is an ORU_R01 message, version 2.3.1 (I used the debug and the getVersion() method to get those information)

Here is the test class

    import java.io.IOException;

import ca.uhn.hl7v2.DefaultHapiContext;
import ca.uhn.hl7v2.HL7Exception;
import ca.uhn.hl7v2.HapiContext;
import ca.uhn.hl7v2.model.Message;
import ca.uhn.hl7v2.model.v231.group.ORU_R01_PIDPD1NK1NTEPV1PV2;
import ca.uhn.hl7v2.model.v231.group.ORU_R01_PIDPD1NK1NTEPV1PV2ORCOBRNTEOBXNTECTI;
import ca.uhn.hl7v2.model.v231.message.ORU_R01;
import ca.uhn.hl7v2.model.v231.segment.MSH;
import ca.uhn.hl7v2.model.v231.segment.PID;
import ca.uhn.hl7v2.parser.Parser;

public class Hl7EncodeTester 
{
    public static void main (String[] args) throws HL7Exception, IOException
    {
        String msg = "MSH|^~\\&|REPO|BCS|THE|Theorema|201412170140||ORU^R01|20140012620415|P|2.3.1||||||||PID|||711697^^^^PI^PRIAMO~RSSMHL69B15B081W^^^^NN||ROSSINI^MICHELE||19690215|F|||VIA^POMPEI^6^ASSO^CO^22063||031700239|||M||RSSMHL69B15B081W|300CP102||||ASSO|||100|||||PV1|||265^INRCA Ospedale^^959^^^0310^^||||||||||||||||||||||||||||||||||||||||||||||||||OBR|1||2014047190|69^RADIOLOGIA||||201412162247||||||||||||0310692014047190||201412162247|||||||||||||||OBX|1|FT|20140001988995||REFERTO FORMATO P7M BASE64 ||||||F|||20141216||CFmedicorefertante^CognomeMedicoRefertante^NomeMedicoRefertante||||TXA|1||multipart|||20141216|||||CFmedicorefertante^^^^^^^^^^^^COMPILATORE||||2014047190||AU|||||||NTE|1|O||";
        HapiContext context = new DefaultHapiContext();
//      Parser p = context.getPipeParser();
        Parser p = context.getGenericParser();
        Message adt = p.parse(msg);
        ORU_R01 oruMsg = (ORU_R01) adt;
        System.out.println("ORU_RO1 message = " + oruMsg.encode());
        MSH msh = oruMsg.getMSH();
        System.out.println("MSH segment = " + msh.encode());
        ORU_R01_PIDPD1NK1NTEPV1PV2ORCOBRNTEOBXNTECTI segment1 = 
                            oruMsg.getPIDPD1NK1NTEPV1PV2ORCOBRNTEOBXNTECTI();
        ORU_R01_PIDPD1NK1NTEPV1PV2 segment2= segment1.getPIDPD1NK1NTEPV1PV2();
        PID pid = segment2.getPID();
        System.out.println("Patient Name = " + pid.getPatientName(0).getXpn2_GivenName().getValue());
    }
}

This is the console output:

ORU_RO1 message = MSH|^~\&|REPO|BCS|THE|Theorema|201412170140||ORU^R01|20140012620415|P|2.3.1||||||||PID|||711697^^^^PI^PRIAMO~RSSMHL69B15B081W^^^^NN||ROSSINI^MICHELE||19690215|F|||VIA^POMPEI^6^ASSO^CO^22063||031700239|||M||RSSMHL69B15B081W|300CP102||||ASSO|||100|||||PV1|||265^INRCA Ospedale^^959^^^0310||||||||||||||||||||||||||||||||||||||||||||||||||OBR|1||2014047190|69^RADIOLOGIA||||201412162247||||||||||||0310692014047190||201412162247|||||||||||||||OBX|1|FT|20140001988995||REFERTO FORMATO P7M BASE64 ||||||F|||20141216||CFmedicorefertante^CognomeMedicoRefertante^NomeMedicoRefertante||||TXA|1||multipart|||20141216|||||CFmedicorefertante^^^^^^^^^^^^COMPILATORE||||2014047190||AU|||||||NTE|1|O

MSH segment = MSH|^~\&|REPO|BCS|THE|Theorema|201412170140||ORU^R01|20140012620415|P|2.3.1||||||||PID|||711697^^^^PI^PRIAMO~RSSMHL69B15B081W^^^^NN||ROSSINI^MICHELE||19690215|F|||VIA^POMPEI^6^ASSO^CO^22063||031700239|||M||RSSMHL69B15B081W|300CP102||||ASSO|||100|||||PV1|||265^INRCA Ospedale^^959^^^0310||||||||||||||||||||||||||||||||||||||||||||||||||OBR|1||2014047190|69^RADIOLOGIA||||201412162247||||||||||||0310692014047190||201412162247|||||||||||||||OBX|1|FT|20140001988995||REFERTO FORMATO P7M BASE64 ||||||F|||20141216||CFmedicorefertante^CognomeMedicoRefertante^NomeMedicoRefertante||||TXA|1||multipart|||20141216|||||CFmedicorefertante^^^^^^^^^^^^COMPILATORE||||2014047190||AU|||||||NTE|1|O
Patient Name = null

The whole message and the MSH segment I obtained are the same, I cannot split the message in segments (there are supposed to be: MSH, PID, PV1, OBR, OBX, TXA and NTE) Someone knows a solution to my problem?


Source: (StackOverflow)

Implementing a Hl7 parser listener to java

Background

I'm writing a medical record app for a friend who is a Doctor. I was told to write a listener in the app that awaits HL7 messages. That way a hospital can send out HL7 messages and my listener will catch them. So I came to the HAPI site and viewed this example. What I understand from it is that it's creating a server to listen for a message.

I'm developing this in Eclipse using JSF 2.0 on Tomcat 7.0. Where does one normally put this kind of listener in a project with JSF? I've tried searching online for this answer and found nothing!

My question

I know this code goes inside a class. When the class gets called the socket will be "turned on" and it's going to wait for a response. So I want to call this class as soon as the project is deployed. How is that done? How do I call that class only once (when the app is starting) in order to turn on the listener?

Any and all help is greatly appreciated! And if I'm not being clear on something let me know!


Source: (StackOverflow)

How to modify HAPI validation rules for phone numbers?

The following dependencies are being used from the maven central repository in this example:

<!-- provides HAPI library -->
<dependency>
  <groupId>ca.uhn.hapi</groupId>
  <artifactId>hapi-base</artifactId>
  <version>2.2</version>
</dependency>
<!-- provides HAPI library message version -->
<dependency>
  <groupId>ca.uhn.hapi</groupId>
  <artifactId>hapi-structures-v22</artifactId>
  <version>2.2</version>
</dependency>

<!-- provides ByteString -->
<dependency>
  <groupId>com.typesafe.akka</groupId>
  <artifactId>akka-actor_2.10</artifactId>
  <version>2.3.3</version>
</dependency>

Here is an example of my parsing code, written in scala:

  import akka.util.ByteString
  import ca.uhn.hl7v2.model.Message
  import ca.uhn.hl7v2.model.v22.datatype.{CM_PAT_ID, ST, TN, TSComponentOne}
  import ca.uhn.hl7v2.model.v22.segment.{EVN, MRG, PID}
  import ca.uhn.hl7v2.parser.CanonicalModelClassFactory
  import ca.uhn.hl7v2.{DefaultHapiContext, ErrorCode, HL7Exception}

  lazy val parser = {
    val context = new DefaultHapiContext()
    context.setModelClassFactory(new CanonicalModelClassFactory("2.2"))
    context.getGenericParser
  }

  def parseHL7Message(message: ByteString) = Try[Message] { 
    val msg: String = message.utf8String.trim
    parser.parse(msg) 
  }

This code can successfully parse the following HL7 message.

"MSH|^~\\&|XXXX|S|XXXXXX|S|201410280931||ADT^A31|123456|P|2.2\r" +
"EVN|A31|201410280930\r" +
"PID|||9999999^^^S^MR~88888888^^^^PI||xxxx^xxxxxxxxx||11111111||||||(123)456-7890\r" +
"PV1\r"

However, when a phone number with an extension is supplied in the message, the hapi parser fails to parse the message. Here is an example of the input message I am trying to parse with an extension in the phone number:

"MSH|^~\\&|XXXX|S|XXXXXX|S|201410280931||ADT^A31|123456|P|2.2\r" +
"EVN|A31|201410280930\r" +
"PID|||9999999^^^S^MR~88888888^^^^PI||xxxx^xxxxxxxxx||11111111||||||(123)456-7890 1\r" +
"PV1\r"

Trying to parse this message fails with the following error message:

ca.uhn.hl7v2.validation.ValidationException: Validation failed: Primitive value '(123)456-7890 1' requires to be empty or a US phone number at PID-13

I read everything I could find at http://hl7api.sourceforge.net/index.html to look for documentation on how to modify the validation rules but have not found anything useful.

An example would be most appreciated, but even pointing to the proper documentation, or a simple working example project will be sufficient.

How can the validation rules used by the HAPI parser be configured to allow a phone number extension to be included in a valid US phone number in the PID-13 field?

EDIT

With a little more searching, through this hapi developer mailing list thread, I figured out how to disable validation altogether. Here is an example:

  lazy val parser = {
    val context = new DefaultHapiContext()
    context.setModelClassFactory(new CanonicalModelClassFactory("2.2"))
    context.setValidationContext(new NoValidation)
    context.getGenericParser
  }

But if possible, I would like to continue validating the messages. If I have to disable validation I guess that will have to work, but I'd prefer to specify that validation remain turned on, but that phone numbers can include extensions.


Source: (StackOverflow)

HAPI and ClassNotFoundException: com.sun.org.apache.xerces.internal.dom.DOMXSImplementationSourceImpl

I had a standalone batch application, which ran HAPI to create HL7 files. I changed the entrypoint of the system to be a CXF web service, and it is actually working. But when it starts up, I get the following:

15:40:42,859 INFO  [ca.uhn.hl7v2.VersionLogger] (ServerService Thread Pool -- 52) HAPI version is: 2.2
15:40:42,860 INFO  [ca.uhn.hl7v2.VersionLogger] (ServerService Thread Pool -- 52) Default Structure libraries found for HL7 versions 2.5, 
15:40:42,861 WARN  [ca.uhn.hl7v2.VersionLogger] (ServerService Thread Pool -- 52) Error occured while trying to retrieve a DOMImplementation.: java.lang.RuntimeException: java.lang.ClassNotFoundException: com.sun.org.apache.xerces.internal.dom.DOMXSImplementationSourceImpl from [Module "deployment.fileMonitor-1.0-SNAPSHOT.war:main" from Service Module Loader]
    at ca.uhn.hl7v2.util.XMLUtils.getDOMImpl(XMLUtils.java:55) [hapi-base-2.2.jar:]
    at ca.uhn.hl7v2.VersionLogger.checkDOMImplementation(VersionLogger.java:44) [hapi-base-2.2.jar:]
    at ca.uhn.hl7v2.VersionLogger.init(VersionLogger.java:36) [hapi-base-2.2.jar:]
    at ca.uhn.hl7v2.DefaultHapiContext.<init>(DefaultHapiContext.java:126) [hapi-base-2.2.jar:]
    at ca.uhn.hl7v2.DefaultHapiContext.<init>(DefaultHapiContext.java:112) [hapi-base-2.2.jar:]
    at ca.uhn.hl7v2.DefaultHapiContext.<init>(DefaultHapiContext.java:103) [hapi-base-2.2.jar:]
    at ca.uhn.hl7v2.parser.Parser.<init>(Parser.java:71) [hapi-base-2.2.jar:]
    at ca.uhn.hl7v2.parser.PipeParser.<init>(PipeParser.java:92) [hapi-base-2.2.jar:]
    at org.apache.camel.component.hl7.HL7MLLPConfig.<init>(HL7MLLPConfig.java:38) [camel-hl7-2.12.0.redhat-610379.jar:2.12.0.redhat-610379]
...
    at org.w3c.dom.bootstrap.DOMImplementationRegistry.newInstance(DOMImplementationRegistry.java:182) [rt.jar:1.7.0_45]
    at ca.uhn.hl7v2.util.XMLUtils.getDOMImpl(XMLUtils.java:52) [hapi-base-2.2.jar:]
    ... 40 more

16:24:32,180 WARN  [ca.uhn.hl7v2.VersionLogger] (ServerService Thread Pool -- 51) XML parsing and encoding as well as working with Conformance Profiles will fail.

It's some sort of clash between HAPI's XML and CXF's XML libs, but I have tried a few things, and nothing is getting rid of this error. Anyone seen this before?


Source: (StackOverflow)

Hapi Conversion from HL7 2.31 to HL7 2.5

Hapi includes a parser function that can parse specific HL7 version to alternate versions:

HapiContext context = new DefaultHapiContext();
        CanonicalModelClassFactory mcf = new CanonicalModelClassFactory("2.5");
        context.setModelClassFactory(mcf);
        PipeParser parser = context.getPipeParser();
        parser.getParserConfiguration().setIdGenerator(new InMemoryIDGenerator());

        context.getParserConfiguration().setValidating(false);

        ADT_AXX axx = null;

        try {
            axx = (ADT_AXX) parser.parse(message.toString());
        }
        catch (HL7Exception e) {
            log.warn("Exception parsing to AXX");
            e.printStackTrace();
        }

In version 2.31 Attending doctors are messaged in PV1.7-9. In 2.5 there is a ROL segment which holds this information. My issue is that the Hapi parser does not seem to parse PV1.7.9 into ROL. I don't think this is the correct behaviour? Any support guidance appreciated?


Source: (StackOverflow)

Read HL7 message without prescribing message type or event type or version

I need to read an HL7, pipe-delimited message into a custom Java structure that represents the message structure. I need to do all this without using any message type, event type, or version specific methods or classes, because I need this code to work no matter what kind of HL7 message is read. I don't want to write a reader for every different message and event type. I need to get all the segments and subfields. I have looked at HAPI a lot to see if it has a prebuilt solution for this problem, but I have found nothing.

Is there anyway to extend a HAPI class or iterate over the underlying message structure that HAPI creates from a parser to solve this problem?

Also, any good resources on HAPI would be appreciated.


Source: (StackOverflow)

How can I parse HL7 message starting with FHS

How can I parse a HL7 message starting with FHS to XML:

FHS|^~\&|Medical-Objects|Eli MOA Test Cap
BHS|^~\&|Medical-Objects|Eli MOA Test Cap
MSH|^~\&|MODemoSoftware|Eli MOA Test Cap^51675B57-9C95-4278-B52E-3FE5EEB6B3EE^GUID|||20121127180300|Eli MOA Test Cap (Capricorn)|ORU^R01|201211271803520050|P|2.3.1|||||||en
PID|1|HB117056|ABC123^^^MODemo^MC~401114835T^^^^PEN~401114835T||TEST^Patient||20010101|F||4^Non-indigenous|10/102 Wises Road^^Maroochydore^^4558||0754566000
PV1|1||AE\R\HBH^^^HBH&Medical Objects Demo Hospital&MODemoSoftware|||||0000000Y^REFERRING^Provider^^^DR^^^AUSHICPR^L^^^UPIN|UP3123000QW^CONSULTING^Provider^^^DR^^^AUSHICPR^L^^^UPIN
ORC|RE|589113676^MODemoSoftware|589113676^Eli MOA Test Cap^51675B57-9C95-4278-B52E-3FE5EEB6B3EE^GUID||IP||^^^20121127^^URGENT|||||0000000Y^REFERRING^Provider^^^DR^^^AUSHICPR^L^^^UPIN

Source: (StackOverflow)