I can't dive deep into your problem, but understand this:

when the message arrives as string into your application, it is parsed from string to a java class by HAPI, BEFORE hapi calls the processmessage() function. So anything you do there is not going to help you.  (you would not use PipeParser yourself for incoming messages, but to send out a message from a self-created string; .setDefaultObx2Type("ST") thus only helps you in case outgoing messages. But maybe you can apply it to the pipeparser of the context where you create the server, in EnableDeviceListener?)


In enableDeviceListener, you do
HL7Service hl7Server = context.newServer(PORT_NUMBER, useSecureConnection);

//No Validation

context.setValidationContext((ValidationContext) ValidationContextFactory.noValidation());

Maybe the order is wrong. Try to swap the lines, so that the context is correctly set BEFORE you create a server. Does that help?

success,
Martin




On 24/11/2020 19:02, Dasari, Penchalaiah via Hl7api-devel wrote:

Thank you Martin for the inputs.

Yes, it is issue with OBX-2 datatype filed, I tested through my stand alone program by supplying OBX-2 data type as ST.

p.getParserConfiguration().setDefaultObx2Type("ST");//ISSUE

However, on the fly I have a listener which starts listening once my server started. In this case my changes are not getting effected and facing the same issue. And also I tried to disable my validations, either way my issue is not yet resolved.

Following way I am trying to capture HL7 message and further to process:

1) My health device is producing HL 2.3, and also I am using hapi2.3 jars as maven dependencies. following is my MSH:

*MSH|^~\&|ABAXIS, INC.^piccolo xpress^3.1.37^0000P26854||||20201121161056||ORU^R01||P|2.3|*

2)I tried with disabling validations. And also I supplied ST for OBX2 type. Still I am getting the same issue.

//No Validation

/context/.setValidationContext((ValidationContext) ValidationContextFactory./noValidation/());

p.getParserConfiguration().setDefaultObx2Type("ST");//ISSUE

3)My listener will start as soon as the server starts and it waits for the message to receive and process further. I kept my validation disabling in my listener class and next level also.. Following is my snippet:

*Listener.java*

public class VitalsDeviceListener {

       private static final Logger log = LoggerFactory.getLogger(VitalsDeviceListener.class);

    // change this to whatever your port number is

    private static final int PORT_NUMBER = 54000;

    // In HAPI, almost all things revolve around a context object

    private static HapiContext context = new DefaultHapiContext();

@SuppressWarnings("unchecked")

       public static void enableDeviceListener(String[] args) throws Exception {

        try {

boolean useSecureConnection = false; // are you using TLS/SSL?

            HL7Service hl7Server = context.newServer(PORT_NUMBER, useSecureConnection);

//No Validation

context.setValidationContext((ValidationContext) ValidationContextFactory.noValidation());

            // You can set up routing rules for your HL7 listener by extending the

            // AppRoutingData class like this

hl7Server.registerApplication(new RegistrationEventRoutingData(), new *MessageHandlingAndACK*());

hl7Server.startAndWait();

log.info("Listener is started, waiting for client message:" + "\n");

        } catch (Exception e) {

e.printStackTrace();

        }

    }

}

This listener forwards the message to MessageHandlingAndACK class. In this class also again I am disabling validation and ST supply to OBX2.

*public**class*MessageHandlingAndACK *implements*_ReceivingApplication_ {

*private**static**final*Logger */log/*= LoggerFactory./getLogger/(MessageHandlingAndACK.*class*);

*private**static*HapiContext /context/= *new*DefaultHapiContext();

@Override

*public**boolean*canProcess(Message message) {

*return**true*;

}

@Override

*public*Message processMessage(Message receivedMessage, _Map_ metaData)

*throws*ReceivingApplicationException, HL7Exception {

***//No Validation***

***/context/**.setValidationContext((ValidationContext) ValidationContextFactory./noValidation/());***

***//context.getParserConfiguration().setValidating(false);***

*Parser **p**= **/context/**.getPipeParser();***

***p**.getParserConfiguration().setDefaultObx2Type(**"ST"**);**//ISSUE1: _Piccolo_ not sending mandatory data type for OBX***

***//Message hapiMsg = p.parse(receivedMessage.toString());***

**

String receivedEncodedMessage= p.encode(receivedMessage);

*/log/*.info("****Incoming message:\n"+ receivedEncodedMessage+ "\n\n");

*try*{

*/log/*.info("****ACK message from server:\n"+ receivedMessage.generateACK());

*return*receivedMessage.generateACK();

} *catch*(IOException e) {

*throw**new*HL7Exception(e);

}

}

}

After doing this changes also, I am getting the same issue. I am not sure whether I am applying my changes at right place or not.  I tested this code with sample client, but it is failing with actual health device. Please provide your valuable inputs.

Thanks,

Dasari

*From:* Martin Fleurke <martin.fleu...@portavita.nl>
*Sent:* Tuesday, November 24, 2020 12:53 AM
*To:* hl7api-devel@lists.sourceforge.net
*Subject:* Re: [HAPI-devel] Need Help in - To use correct version of Hapi Library

CAUTION:This email originated from outside of the organization. Do NOT click links or open attachments unless you recognize the sender and know the content is safe.

The error message is a bit unclear

(

ca.uhn.hl7v2.HL7Exception: A datatype for OBX-

must be specified in 5-

.

               at ca.uhn.hl7v2.parser.FixFieldDataType.fix(FixFieldDataType.java:165)

at ca.uhn.hl7v2.parser.FixFieldDataType.fixOBX5(FixFieldDataType.java:123))

but I think it is not related to OBX-5 (as that is the VALUE field, which is filled in in your message. You highlighted OBX-4)

Instead I think it's about OBX-2, the DataType field, which is empty.

Wbr

Martin

On 23/11/2020 18:58, Dasari, Penchalaiah via Hl7api-devel wrote:

    Hi Martin,

    Thanks for your inputs.

    Yes, I am using hapi-2.3 base jar and hapi-structires-23. My
    device is sending following way the MSH &  OBX segments :-

    *MSH Segment:*

    MSH|^~\&|XYZ, INC.^3.1.37^0000A1234||||20201121161056||ORU^R01||P|2.3|

    *OBX segment:*

    **

    OBX|1||2345-7^^LN^Glucose SerPl-mCnc||99|mg/dL|73 to
    118|N|||F||||||Patient|

    OBX|2||3094-0^^LN^BUN SerPl-mCnc||13|mg/dL|7 to 22|N|||F||||||Patient|

    You mean OBX-5 (the highlighted portion) is empty? If this is
    correct, I need to check with my health device provider.

    Thanks,

    Dasari

    *From:* Martin Fleurke <martin.fleu...@portavita.nl>
    <mailto:martin.fleu...@portavita.nl>
    *Sent:* Monday, November 23, 2020 12:48 AM
    *To:* hl7api-devel@lists.sourceforge.net
    <mailto:hl7api-devel@lists.sourceforge.net>
    *Subject:* Re: [HAPI-devel] Need Help in - To use correct version
    of Hapi Library

    CAUTION:This email originated from outside of the organization. Do
    NOT click links or open attachments unless you recognize the
    sender and know the content is safe.

    Hi,

    It looks more like a bad message coming in. You should be able to
    see the message when logging ca.uhn.hl7v2.raw[.inbound]

    The error says that a required data field (OBX-5) is empty.
    Solution is to let the sender fill it in.

    Is the incoming message a hl7v2.3 message? If it is an other
    version then also include the corresponding hapi-structures-v2X

    Wbr

    Martin

    On 20/11/2020 23:50, Dasari, Penchalaiah via Hl7api-devel wrote:

        Hello Team,

        I am trying to receive a message from one our health device by
        using library (2.3 v).  Getting following issue. I am not sure
        which version of Hapi Library do I need to use

        To get rid out of this error. Please help me on this issue..

        2020-11-20 13:01:03.230 ERROR 17384 --- [  hapi-worker-8]
        c.u.h.p.impl.ApplicationRouterImpl       : Attempting to send
        error message to remote system.

        ca.uhn.hl7v2.HL7Exception: A datatype for OBX-

        must be specified in 5-

        .

        at
        ca.uhn.hl7v2.parser.FixFieldDataType.fix(FixFieldDataType.java:165)

        at
        ca.uhn.hl7v2.parser.FixFieldDataType.fixOBX5(FixFieldDataType.java:123)

        at ca.uhn.hl7v2.parser.PipeParser.parse(PipeParser.java:401)

        at ca.uhn.hl7v2.parser.PipeParser.parse(PipeParser.java:1169)

        at ca.uhn.hl7v2.parser.PipeParser.doParse(PipeParser.java:226)

        at
        ca.uhn.hl7v2.parser.GenericParser.doParse(GenericParser.java:245)

        at ca.uhn.hl7v2.parser.Parser.parse(Parser.java:212)

        at ca.uhn.hl7v2.parser.GenericParser.parse(GenericParser.java:253)

        at
        
ca.uhn.hl7v2.protocol.impl.ApplicationRouterImpl.processMessage(ApplicationRouterImpl.java:138)

        at
        
ca.uhn.hl7v2.protocol.impl.ApplicationRouterImpl.processMessage(ApplicationRouterImpl.java:105)

        at ca.uhn.hl7v2.app.Responder.processMessage(Responder.java:91)

        at ca.uhn.hl7v2.app.Receiver$Grunt.run(Receiver.java:127)

        at
        java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)

        at java.util.concurrent.FutureTask.run(FutureTask.java:266)

        at
        
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)

        at
        
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)

        at java.lang.Thread.run(Thread.java:748)


_______________________________________________
Hl7api-devel mailing list
Hl7api-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/hl7api-devel

Reply via email to