Git Product home page Git Product logo

hapi-hl7v2's People

Contributors

dependabot[bot] avatar jamesagnew avatar kbalthaser avatar lalithe avatar mrdnctrk avatar nathandoef avatar ohr avatar sumeetchhetri avatar tadgh avatar thopap avatar tynergjs avatar winfriedgerlach avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

hapi-hl7v2's Issues

Missing items when using PopulatedVisitor

Hello,
When i was working on issue #31 I also noticed that the PopulatedVisitor used in test stops too early to get all populated items, in deed when dealing with this segment
PID|1||CIPNUM^^^CAEX^CIP^^^^EX&&ES-EX~CIPTWO||DUMAS^VICTOR HUGO|ZAPATA|19740325|1
CAEX info never visited.
Regards,

OBR-21 (FillerField2) is not parsed properly.

I've a HL7 message of type ORU_R01,

String msg = "MSH|^~\\&|ULTRA_V3.1|DOR|Web Portal|Web Portal|201809261039||ORU^R01|231671052|P|2.3.1|||AL|AL|AU\r" + "PID||123456|123456^^^^UR~7998437^^^^ULTRAREL||FALLENI^ZANE||19999999|F|||BLD 2 31 BAIRD STREET^^POIUYTR^IUY^2600||^^^^^^0856565314\r" + "PV1||O|SSH^SUNSHINE ACC|||||7654339L^TREW^ABCDE^^TCPL^DR^CAROLINE SPRINGS COMM. HEALTH CENTRE^LEVEL 1, 13-15 LAKE ST^^CAROLINE SPRINGS^IUY^3023^875432416\r" + "ORC|RE||14-35126352-RCF-0||R\r" + "OBR|1||14-35126352-RCF-0|RCF^RED CELL FOLATE (RCF)^ULTRA^DORCAM||20131212|201402241145|||SSH||||201402241754||2475619L^WONG^TRICIA^^TCPL^DR|||||CAM^false^^MBI,BFO,GHB,FES,FBE|201809261039||CH|F||^^^20131212^^R\r" + "OBX|1|NM|14731-4^ Red cell Folate :^LN||2455|nmol/L|> 630||||F|||201809261039|CAM";

When I'm trying to parse this message using ca.uhn.hl7v2.parser.Parser, it is not able to parse OBR-21 field properly. You see in the original message, the value at OBR-21 is CAM^false^^MBI,BFO,GHB,FES,FBE. However, the parser returns only CAM. As being a custom field, I was hoping it will return the value as it is and should not really worry about the separator (^).
Does anyone know is this an expected behavior?

ClassCastException when encoding segment from GenericMessage

I think I’ve found a bug in HAPI v2.3 when I try to encode a segment from a GenericMessage. I’ve put together
a simple test that demonstrates the issue (source pasted below).

This may seem like a strange thing to do, but we use this technique quite extensively during testing. It allows us to write JUnit tests for the mapping of a single segment and assert on that rather than having to always assert on the entire message value. The messages we use can get rather large, and it’s much easier to figure out whats wrong when we can test the mapping of the segments one at a time.

Please let me know how I should proceed in getting this issue corrected (or if I’m doing something wrong). Also, if there is a workaround, I’d really like to know about it.

public class HapiBugTest {
static final String TEST_DATA =
"MSH|^~\&|JCAPS|EPIC|AXIS|AXIS|201710190911||ADT^A08|7119|D|2.3" + '\r'
+ "EVN|A08||201710190911|201710190911" + '\r'
+ "PID|||4490749^^^MRN||KAL^STORM||19890623|F" + '\r';

HapiContext genericHapiContext;
Message genericMessage;

@Before
public void setUp() throws Exception {
    genericHapiContext = new DefaultHapiContext(
        new ParserConfiguration(),
        ValidationContextFactory.noValidation(),
        new GenericModelClassFactory());

    genericMessage = genericHapiContext.getPipeParser().parse(TEST_DATA);

    assertThat(genericMessage, instanceOf(GenericMessage.class));
}

@Test
public void testEncodeGenericMessage() throws Exception {
    assertThat(genericMessage.encode(), equalTo(TEST_DATA));
}

@Test
public void testEncodeSegmentFromGenericMessage() throws Exception {
    Segment evn = (Segment)genericMessage.get("EVN");

    assertThat(evn.encode(), equalTo("EVN|A08||201710190911|201710190911"));
}

}

SimpleServer after two exceptions it stops managing new connections

*Context of the application
There is an initial server that communicates HL7 messages to another server (SHL7), this second server is in charge of communicating the HL7 messages to a web application. Due to the type of communication that HAPI manages, we choose to create an intermediate application (SHL7) whose only task is to receive the messages in a specific IP and port and transform them to an HTTP call (POST) that the web application understands.

Due to the architecture designed to transform the messages, some errors are generated that the SHL7 server must manage. The most common errors are that the HTTP call does not work correctly (Ex: response 500). Here's how these errors are handled:

Message ack;
try {
	if(response != null && response.getStatusLine().getStatusCode() == 204) {
		ack = theMessage.generateACK();
		log.info("CORRECTO: " + ack.toString());
	} else {
		ack = theMessage.generateACK(AcknowledgmentCode.AE, new HL7Exception("There was a problem in the target server!!"));
		log.info("ERROR: " + ack.toString());
	}
} catch (IOException e) {
	throw new ReceivingApplicationException(e);
}
return ack;

*Problem
The problem is that when the SHL7 server has two communications with AcknowledgmentCode.AE or that the transformation code throws an exception (ReceivingApplicationException, Exception, etc), the SHL7 server no longer manages the other communications, it accepts them in the connection queue , but it no longer executes the message transformation code (own class Ex: RadiologiaReceiverApplication). The only solution now is to restart the SHL7 server but I don't like.

The following log is when the new requests arrive to the server and it does not execute the message transformation code:

2017-12-28 12:34:20.388  INFO 1 --- [hapi-worker-1] ca.uhn.hl7v2.app.SimpleServer            : Accepted connection from 167.69.0.110:59237 on local port 4556
2017-12-28 12:34:20.389  INFO 1 --- [hapi-worker-1] u.h.c.RadiologiaConnectionListener       : New connection received: /167.69.0.110
2017-12-28 12:34:30.449  INFO 1 --- [hapi-worker-21] ca.uhn.hl7v2.llp.MllpDecoderState        : End of input stream reached.
2017-12-28 12:34:30.449  INFO 1 --- [hapi-worker-21] ca.uhn.hl7v2.llp.MllpDecoderState        : SocketException on read() attempt.  Socket appears to have been closed: End of input stream reached before message starts
2017-12-28 12:34:30.449  INFO 1 --- [hapi-worker-21] ca.uhn.hl7v2.app.Receiver                : SocketException: closing Connection from 167.69.0.110:59237, will no longer read messages with this Receiver: End of input stream reached before message starts
2017-12-28 12:34:30.896  INFO 1 --- [hapi-worker-2] u.h.c.RadiologiaConnectionListener       : Lost connection from: /167.69.0.110
2017-12-28 12:35:30.860  INFO 1 --- [hapi-worker-1] ca.uhn.hl7v2.app.SimpleServer            : Accepted connection from 167.69.0.110:52502 on local port 4556
2017-12-28 12:35:30.860  INFO 1 --- [hapi-worker-1] u.h.c.RadiologiaConnectionListener       : New connection received: /167.69.0.110
2017-12-28 12:35:40.920  INFO 1 --- [hapi-worker-23] ca.uhn.hl7v2.llp.MllpDecoderState        : End of input stream reached.
2017-12-28 12:35:40.922  INFO 1 --- [hapi-worker-23] ca.uhn.hl7v2.llp.MllpDecoderState        : SocketException on read() attempt.  Socket appears to have been closed: End of input stream reached before message starts
2017-12-28 12:35:40.923  INFO 1 --- [hapi-worker-23] ca.uhn.hl7v2.app.Receiver                : SocketException: closing Connection from 167.69.0.110:52502, will no longer read messages with this Receiver: End of input stream reached before message starts
2017-12-28 12:35:41.410  INFO 1 --- [hapi-worker-2] u.h.c.RadiologiaConnectionListener       : Lost connection from: /167.69.0.110

I do not know if the problem is that the communication socket of the previous connections has not been closed correctly or another problem ... However, I do not know exactly how the HL7Service class manages the connections.

Accumulating unnecessary runtime shutdown hooks in some use-cases

In one of my applications, I had a use-case of creating new context objects each time I need a client connection. Each context uses the default executor. The context objects are not closed because I do not want to shutdown and recreate the executor each time. After a while, I've noticed that it was accumulating a lot of runtime shutdown hooks, which are not getting garbage-collected.

In DefaultHapiContext, when the executor is not set, the default executor is assigned and a hook is added to the runtime with Runtime.getRuntime().addShutdownHook(). In the extreme case, the accumulation of these hooks can lead to an out-of-memory issue. One idea is to move the addShutdownHook() call to the DefaultExecutorService class. This will keep existing behavior the same for the most part, but avoid adding unnecessary shutdown hooks in some cases, and will have that call closer to where we actually create the executor.

In my application, I have worked around this by calling setExecutorService() explicitly so to avoid the addShutdownHook() call. Other workarounds here can be to use my own executor or to change my application, but it'll be nice if we can fix this in the HAPI library. Thanks!

I'm using hapi-base version 2.2.

Testpanel fails to launch on Java 11

$ java -jar hapi-testpanel-2.3-jar-with-dependencies.jar

16:50:51,619 INFO [main] Home:47 - hapi.home is set to /home/j/Hentet/hapi-testpanel-2.3/.
Gtk-Message: 16:50:51.906: Failed to load module "canberra-gtk-module"
Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException
at ca.uhn.hl7v2.testpanel.App.main(App.java:60)
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.JAXBException
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
... 1 more

This is because it needs to be recompiled to Java 11, I think.

Is there a builded version.

Hello,

sorry for using this way for my question, but I'm new to GitHub.

Where can i find the builded Version of Hapi for the latest release (Jun 23, 2017)?

On Sourceforce (https://sourceforge.net/projects/hl7api/files/latest...) seems to be the version of March 4, 2014.

Or will there no jars anymore? You wrote about difficulties in the building process.

Thank you, best regards

Thea

OSX Installers fail to launch

OSX 10.12.5 reports:
“hapi-testpanel-2.0.1” is damaged and can’t be opened. You should eject the disk image.

This also occurs with 2.0 installer

RDF, RDT how to use?

How does one construct a message containing rows and columns similar to this example message?

MSH|^&~\|PIMS|Gen Hosp|PCR||199811210300-0800||RTB^K42^RTB_K13|9950|P|2.3||||||||
QAK|Q010|OK|Q42^Tabular Dispense History^HL7nnn|4
QPD|Q42^Tabular Dispense History^HL7nnn|Q0010|555444222111^^^MPI^MR||19980531|19990531|
RDF|7|PatientId^CX^20~PatientName^XPN^48~OrderControlCode^ID^2~ MedicationDispensed^CE^100~DispenseDate^TS^26~QuantityDispensed^NM^20~ OrderingProvider^XCN^120
RDT|555444222111^^^MPI^MR|Everyman^Adam|RE|525440345^Verapamil Hydrochloride 120 mg TAB^NDC |199805291115-0700|100|77^Hippocrates^Harold^H^III^DR^MD
RDT|555444222111^^^MPI^MR|Everyman^Adam|RE|00182196901^VERAPAMIL HCL ER TAB 180MG ER^NDC |19980821-0700|100|77^Hippocrates^Harold^H^III^DR^MD
RDT|555444222111^^^MPI^MR|Everyman^Adam|RE|00172409660^BACLOFEN 10MG TABS^NDC |199809221415-0700|10|88^Semmelweis^Samuel^^^DR^MD
RDT|555444222111^^^MPI^MR|Everyman^Adam|RE|00054384163^THEOPHYLLINE 80MG/15ML SOLN^NDC|199810121145-0700|10|99^Lister^Lenora^^^DR^MD

Wrong error message for varies fields (e.g. OBX-2/OBX-5)

In case of a varies field, there is a field defined which specify the value type. E.g. OBX-2 specify the data type used in OBX-5.

In case OBX-2 is missing, hapi throws a error, but the error message is corrupt, due to a invalid message format. Current output is:
ca.uhn.hl7v2.HL7Exception - A datatype for OBX- must be specified in 5- .] ca.uhn.hl7v2.HL7Exception: A datatype for OBX- must be specified in 5- .

No way to catch an LLPException

As far as I can tell, there's no way to catch an LLPException — is there anything that I'm missing, or some way I can help introduce a way to catch these?

The longer version is that I'm running an HL7Service to accept and consume HL7 messages sent from my institution's EMR, and have a very occasional situation where the message's framing itself has an issue and causes HAPI to throw an exception. An example is as such:

ca.uhn.hl7v2.llp.LLPException: MLLP protocol violation - Expected byte '11' in state START but was '115'
	at ca.uhn.hl7v2.llp.MllpDecoderState.read(MllpDecoderState.java:137) ~[hl7interface-prod.jar:na]
	at ca.uhn.hl7v2.llp.MllpDecoder.getMessage(MllpDecoder.java:63) ~[hl7interface-prod.jar:na]
	at ca.uhn.hl7v2.llp.Hl7DecoderReader.getMessage(Hl7DecoderReader.java:84) ~[hl7interface-prod.jar:na]
	at ca.uhn.hl7v2.llp.MinLLPReader.getMessage(MinLLPReader.java:33) ~[hl7interface-prod.jar:na]
	at ca.uhn.hl7v2.app.Receiver.handle(Receiver.java:63) ~[hl7interface-prod.jar:na]
	at ca.uhn.hl7v2.concurrent.Service.run(Service.java:205) [hl7interface-prod.jar:na]
	at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) [na:1.8.0_121]
	at java.util.concurrent.FutureTask.run(Unknown Source) [na:1.8.0_121]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [na:1.8.0_121]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [na:1.8.0_121]
	at java.lang.Thread.run(Unknown Source) [na:1.8.0_121]

So far as I can tell, there's no way for my application to catch these, though — they occur inside the Runnable thread process, and not within any class in which the exception handler that I define in my HL7Service (the handler class in HL7Service.setExceptionHandler(handler)). So instead, they just end up emitting info to my log file, and they cause the server to terminate the client connection.

Of course, I can catch the dropped client connection (using a ConnectionListener configured on the HL7Service), but that catches all closed client connections, which isn't the same as being able to catch the specific situation where the connection is terminated because of an invalidly-framed HL7 message.

Thoughts?

Add a common way to create a system wide HapiContext

When creating messages in an environment that requires a specific HapiContext, eg one with custom validation or custom message classes/structures it becomes quite onerous to have to manage the building of a HapiContext.

It would be nice to use the same technique that is used by Slf4j in that they API uses a default (simple logger) logger but it is easy to include another implementation on the classpath and Slf4j picks that implementation up.

We do this in our environment for our own custom classes. This is because our own custom classes have a default constructor that uses a static initializer for the context eg:

public class SIMPLE_ADT extends AbstractMessage {
private static final HapiContext HAPI_CONTEXT = SystemHapiContext.getHapiContext();

public SIMPLE_ADT() throws HL7Exception {
    this(HAPI_CONTEXT.getModelClassFactory());
}

public SIMPLE_ADT(ModelClassFactory factory) throws HL7Exception {
    super(factory);
    this.setParser(HAPI_CONTEXT.getPipeParser());
    addSegments();
}

.... addSegments code removed for brevity
}

The SystemHapiContext is large so is included at the end of this text. It uses the same trick as is done in Slf4j, it requires a special build stage that compiles against a stub ca.uhn.hl7v2.config.ApplicationContext but then does not include that class file in the release of what would be Hapi-Base jar.

This means that if you wanted to create a supplimentary jar configured as NoValidation, UkValidation, UsValidation etc etc then it is easy to swap in the appropriate default configured context.

This is the same way that Slf4j swaps in the appropriate implementations for Log4j or CommonsLogging etc.

Content of SystemHapiContext:

import ca.uhn.hl7v2.DefaultHapiContext;
import ca.uhn.hl7v2.HapiContext;
import ca.uhn.hl7v2.model.Varies;
import ca.uhn.hl7v2.parser.CanonicalModelClassFactory;
import ca.uhn.hl7v2.parser.ModelClassFactory;
import ca.uhn.hl7v2.validation.builder.support.NoValidationBuilder;
import org.slf4j.helpers.Util;

import java.io.IOException;
import java.net.URL;
import java.util.Enumeration;
import java.util.LinkedHashSet;
import java.util.Set;

/**

  • @author MillsMi

  • Date: 3/11/2020

  • Time: 3:07 pm
    */
    public class SystemHapiContext {

    private static final String DEFAULT_CONTEXT_CLASS = "ca/uhn/hl7v2/config/ApplicationContext.class";
    private static final String DEFAULT_HL7_VERSION = "2.4";

    /**

    • Create a HapiContext for this application.
    • This will first check to see if there is an application specific hapi context otherwise it will default to
    • assuming that a context for the DEFAULT HL7 VERSION is required
    • @return The appropriate context to use...
      */
      public static HapiContext getHapiContext() {
      Set staticContexts = findPossibleContexts();
      if (staticContexts.isEmpty()) {
      return getHapiContext(DEFAULT_HL7_VERSION);
      } else if (staticContexts.size() == 1) {
      // NOTE: ApplicationContext is not a class that should be packaged with this module, this block should
      // only be executed if AND ONLY IF there is an ApplicationContext available.
      return ca.uhn.hl7v2.config.ApplicationContext.getContext();
      } else {
      String contextUrls = "";
      for (Object staticContext : staticContexts) {
      URL url = (URL) staticContext;
      contextUrls += "\n" + url.toString();
      }
      throw new IllegalStateException("You may only have a single ApplicationContext class on the classpath, you have: " + contextUrls);
      }
      }

    /**

    • Find all classes on the classpath that match the DEFAULT_CONTEXT_CLASS (could occur multiple times when importing jars).
    • It is important that we DO NOT continue with an application that has multiple defined static contexts,
    • there should be only one context per application (standalone or transformation), if a static context
    • has been imported in another jar then that situation should be resolved.
    • @return all possible classes that are DEFAULT_CONTEXT_CLASS implementations
      */
      private static Set findPossibleContexts() {
      // use Set instead of list in order to deal with bug #138
      // LinkedHashSet appropriate here because it preserves insertion order during iteration
      Set staticLoggerBinderPathSet = new LinkedHashSet();
      try {
      ClassLoader classLoader = SystemHapiContext.class.getClassLoader();
      Enumeration paths;
      if (classLoader == null) {
      paths = ClassLoader.getSystemResources(DEFAULT_CONTEXT_CLASS);
      } else {
      paths = classLoader
      .getResources(DEFAULT_CONTEXT_CLASS);
      }
      while (paths.hasMoreElements()) {
      URL path = (URL) paths.nextElement();
      staticLoggerBinderPathSet.add(path);
      }
      } catch (IOException ioe) {
      Util.report("Error getting resources from path", ioe);
      }
      return staticLoggerBinderPathSet;
      }

    // Package protected for testing.... should not be used outside of this module....
    static HapiContext getHapiContext(String hl7Version) {
    final CanonicalModelClassFactory canonicalModelClassFactory = new CanonicalModelClassFactory(hl7Version);
    return getHapiContext(canonicalModelClassFactory);
    }

    public static HapiContext getHapiContext(final ModelClassFactory canonicalModelClassFactory) {
    // Set global validation here (example below)
    System.setProperty(Varies.DEFAULT_OBX2_TYPE_PROP, "ST");
    System.setProperty(Varies.INVALID_OBX2_TYPE_PROP, "ST");

     HapiContext hapiContext = new DefaultHapiContext();
     hapiContext.setModelClassFactory(canonicalModelClassFactory);
     hapiContext.setValidationRuleBuilder(new NoValidationBuilder());
    
     return hapiContext;
    

    }

}

Add bom module

Add a hapi-bom module to be imported for maven dependency management

message.get("ZBE") throws HL7Exception or gives an empty results

I use the hapi-Version 2.3.
I try to access a non standard segment over the described steps in
https://hapifhir.github.io/hapi-hl7v2/devbyexample.html
especially from https://hapifhir.github.io/hapi-hl7v2/xref/ca/uhn/hl7v2/examples/CustomModelClasses.html
Segment zpiGenericSegment = (Segment) message.get("ZBE");
// here I got ca.uhn.hl7v2.HL7Exception: ZBE does not exist in the group ca.uhn.hl7v2.model.v25.message.ADT_A01

With a local single java main program it works fine, but in the context of the jboss application server I got this error...

When I add before message.addNonstandardSegment("ZBE");
I got no exception, but the field content is always null.
String firstPetName = zpiGenericSegment.getField(1, 0).encode();
[[Varies[]], [], [], [Varies[]], null, null, null, null, null, null]

But, when I use the terser to retrieve the content,
String content = terser.get("/.ZBE-1-1");
...
that works.
What is wrong here?

documentation still points to sourceforge for testpanel

Its very hard to find the 2.3 release of the testpanel.

https://hapifhir.github.io/hapi-hl7v2/hapi-testpanel/install.html refers to sourceforge everywhere
Also, on sourceforge, the 2.0/2.1 releases are still present so it looks like there is no newer version.

At the bottom of the page it says 'This help document is not yet complete. Want to help finish it? Get in touch with James Agnew. ' but the link to James Agnew is incorrect (half github, half sourceforge), so it's hard to report problems with the page.

Acceptance criteria

  • documentation links are correct
  • sourceforge does not contain the old versions, or also contains the new version, or points to it.

Avoid to throw an NPE in DefaultHapiContext#close

DefaultHapiContext implements the Closeable interface, so it is asking to be closed under any circumstances. However it is possible to generate a NullPointerException while closing it if no executorService has been set and no DefaultExecutorService has been created (yet) (as happens during one of my TestCases). The Java Compiler will emit a Warning if you do not close the context and a try-close will throw a NullPointerException, both results seem undesireable.

The easiest implementation would be to check executorService for null in close and avoid calling shutdownNow on it, but we could also decide to return false in DefaultExecutorService#isDefaultService if executorService is null with the same effect.

I am not sure which implementation would be more correct.

GenericMessage types cannot be encoded to XML (illegal characters)

If you attempt to use the DefaultXmlParser to encode a Message which is a GenericMessage, it will fail with a org.w3c.dom.DOMException.

This is due to the presence of a $ within the ClassName of an instantiated GenericMessage. Ex: GenericMessage$V23.

Sample Test:

/**
     * <p>
     *     Attempt to parse a {@link ca.uhn.hl7v2.model.GenericMessage}.  These objects have `$` in their class name, ex: `GenericMessage$V21`.
     *     The {@link DefaultXMLParser} will attempt to use the class name when constructing the {@link Document} when encoding.  The `$` is
     *     not a valid character within an element name.
     * </p>
     * <p>
     *     Construct a {@link GenericMessage} for each available version, and call {@link DefaultXMLParser#encode(Message)} on the message.
     *     We expect that a valid {@link Document} is returned, as the `$` is stripped out.
     * </p>
     */
	@Test
    public void test_encode_GenericMessage() throws Exception {

	    DefaultXMLParser xmlParser = new DefaultXMLParser();

        for (Version version : Version.values()) {

            Class<? extends Message> c = GenericMessage.getGenericMessageClass(version.getVersion());
            Message m = c.getConstructor(ModelClassFactory.class).newInstance(new GenericModelClassFactory());

            Document d = xmlParser.encodeDocument(m);
            Assert.assertNotNull(d);
            Assert.assertEquals("GenericMessage" + version.name(), d.getDocumentElement().getTagName());
        }
    }

Will be submitting a PR with a workaround.

unit test info

There are unit tests with names such as test1714219, test17142192 in ParserTest.java I suspect they are old issue numbers from an old bug tracking system, but I cannot understand what they are testing because there isn't enough information in the test itself.

I was wondering if those old tickets could be viewed somewhere for context?

Unit Tests - are they up to date?

I was looking at EscapeTest.java speficically the test Line 87

MSH|^~\&|ULTRA|TML|OLIS|OLIS|200911231509||ORU|5951|T|2.3
PID|||7005728^^^TML^MR||LEIGHTON^RACHEL^DIAMOND||19310313|F|||200 ANYWHERE ST^^TORONTO^ON^M6H 2T9||(416)888-8888||||||1014071185^KR
PV1|1||OLIS||||OLIST^BLAKE^DONALD^THOR^^^^^921379^^^^OLIST|||||||||^N
ORC|RE||T09-106575-CHO-0^^OLIS_Site_ID^ISO|||||||||OLIST^BLAKE^DONALD^THOR^^^^L^921379
OBR|0||T09-106575-CHO-0^^OLIS_Site_ID^ISO|CHO^CHOLESTEROL (SERUM)^HL79901 literal|||200911231455|||||||200911231455||OLIST^BLAKE^DONALD^THOR^^^^L^921379||10015716|10015716|T09-106575|MOHLTC|200911231509||B1|F||1^^^200911231455^^R
NTE|1|L|\.br\                  Lipid - Target Levels for Treatment \.br\\.br\  ****************************************************************\.br\  \F\  Risk   \F\                  \F\                                 \F\\.br\  \F\ Level   \F\ 10-year CAD risk \F\         Recommendations         \F\\.br\  \F\---------\F\------------------\F\---------------------------------\F\\.br\  \F\         \F\                  \F\Treatment targets:               \F\\.br\  \F\High*    \F\      >=20%       \F\ Primary:   LDL-C    <2.0 mmol/L \F\\.br\  \F\         \F\                  \F\ Secondary: TC/HDL-C <4.0        \F\\.br\  \F\---------\F\------------------\F\---------------------------------\F\\.br\  \F\         \F\                  \F\Treat when:                      \F\\.br\  \F\Moderate \F\    10 - 19 %     \F\            LDL-C    >=3.5 mmol/L\F\\.br\  \F\         \F\                  \F\         or TC/HDL-C >=5.0       \F\\.br\  \F\---------\F\------------------\F\---------------------------------\F\\.br\  \F\         \F\                  \F\Treat when:                      \F\\.br\  \F\Low      \F\      <10%        \F\            LDL-C    >=5.0 mmol/L\F\\.br\  \F\         \F\                  \F\         or TC/HDL-C >=6.0       \F\\.br\****************************************************************\.br\  Notes:\.br\  *  10-year coronary artery disease (CAD) risk is accessed by\.br\     Framingham risk estimate tables.\.br\  *  *High risk includes CAD, peripheral artery disease, cerebro-\.br\     vascular disease (CVD) and most patients with chronic kidney\.br\     disease or established diabetes mellitus.\.br\  *  The patient must have been fasting for at least 12 hours prior\.br\     to taking ablood sample.\.br\  *  Calculation:  LDL-C (mmol/L) = Chol - (HDL-C + 0.46 x TG).\.br\     Calculation is invalid if TG exceed 4.5 mmol/L.\.br\  Ref:  McPherson R et al. Can J Cardiol. 2006 Sep;22(11):913-27
OBX|1|NM|Z049107^Cholesterol-serum^L||2.30|mmol/L|||||F|||200911231508|STP
OBX|2|FT|Z101068^Tech Comment^L||Lab STP||||||F|||200911231508|STP

I took the example message and pasted it into Hapi Test Panel V2.3 but it says the message is unknow, so how could this test pass? or does it even, im struggling to run this unit test.

image

HAPI testpanel open file throws exception

Hi,

When I try to open a HL7 file (2.4), I get the following exception.

14:44:15,496 INFO [AWT-EventQueue-0] Hl7V2MessageCollection:900 - About to set source message for collection
14:44:15,500 INFO [AWT-EventQueue-0] Hl7V2MessageCollection:277 - Found ER7 message
14:44:15,505 INFO [AWT-EventQueue-0] Hl7V2MessageBase:256 - About to parse message
14:44:15,517 INFO [AWT-EventQueue-0] VersionLogger:39 - HAPI version is: 2.1-alpha1
14:44:15,575 INFO [AWT-EventQueue-0] Hl7V2MessageBase:272 - Done parsing message
14:44:15,576 INFO [AWT-EventQueue-0] Hl7V2MessageCollection:917 - Firing message change event
14:44:15,577 INFO [AWT-EventQueue-0] Hl7V2MessageCollection:928 - Done setting source message for collection
14:44:15,653 INFO [AWT-EventQueue-0] Hl7V2MessageEditorPanel:123 - Registered syntaxKit
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException

$ java -version
java version "1.8.0_121"
Java(TM) SE Runtime Environment (build 1.8.0_121-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.121-b13, mixed mode)

CommonTS.getGMTOffset works differently on Centos/openjdk

A simple test case of parsing a message with a date time field that does not contain a timezone should result in -99 being the result of calling getGMTOffset.

This is what happens when run on Windows.

When this test is run in our production environment the result is 0, ie GMT.

The production environment is Centos 7 with JDK 1.8.0_171.

You should be able to replicate this functionality with a CentOs VM running on Windows.

HL7Exception thrown when attempting to parse XML that HAPI encoded.

This issue appears to have started with HAPI 2.2, and continues to be present in 2.3, and 2.4-SNAPSHOT

Workflow:

PipeParse message --> Encode Message to XML using DefaultXmlParser --> Parse resultant Document with DefaultXmlParser back to a Message.

When doing the final parse step, an HL7Exception is thrown with message "Namespace URI must be urn:hl7-org:v2xml". Sample test case which illustrates the issue:

/**
     * <p>
     *     Test to ensure that we can parse an XML document that we ourselves have encoded.   Starting with a known Pipe message,
     *     parse it, encode it to XML, and then attempt to parse that resultant XML back to a {@link Message}.  The expectation is that we
     *     can parse our own XML.
     * </p>
     */
	@Test
    public void test_ParseEncodedXml() throws Exception {

        // Create a context
        HapiContext context = new DefaultHapiContext();
        context.getParserConfiguration().setValidating(false);

        XMLParser xp = context.getXMLParser();

        InputStream str = getClass().getClassLoader().getResourceAsStream("ca/uhn/hl7v2/parser/adt_a03.txt");
        Hl7InputStreamMessageIterator iter = new Hl7InputStreamMessageIterator(str, context);
        while (iter.hasNext()) {

            Message msg = iter.next();
            Document dom = xp.encodeDocument(msg);

            // We would expect to be able to parse this document back to a Message, as we encoded it.
            Message outmsg = xp.parseDocument(dom, msg.getVersion());
            outmsg.printStructure();
        }
    }

( kbalthaser@42e13d8 )

Binary?

I can't find any binary versions of HAPI HL7v2 2.3 in the Downloads section of the website, nor I'm able to build from sources.

Could you provide a binary as well, please?

Connection Discarded in HL7ConnectionListner when TLS/SSL enabled for HL7Service

I have used the below code to start the service for Inbound message. But ConnectionListener discarded the connection when I use context.newServer(55555, true). It is working fine if I use context.newServer(55555, false).
ValidationContext validationCtx = ValidationContextFactory.noValidation();
HapiContext context = new DefaultHapiContext(validationCtx);
HL7Service service = context.newServer(55555, true);
ReceivingApplication handler = new HL7MessageHandler(); //HL7MessageHandler implements ReceivingApplication
service.registerApplication("", "", handler);
service.registerConnectionListener(new HL7ConnectionListner());
service.startAndWait();

javax.swing.text.AbstractDocument$DefaultDocumentEventUndoableWrapper cannot be cast to java.desktop/javax.swing.text.AbstractDocument$DefaultDocumentEvent

I'm trying to run the Test API with Java 10, and there seems to be a incompatibility with JAVA >= 9 in the code.

Error:

17:39:16,015 ERROR [AWT-EventQueue-0] Controller:504 - java.desktop/javax.swing.text.AbstractDocument$DefaultDocumentEventUndoableWrapper cannot be cast to java.desktop/javax.swing.text.AbstractDocument$DefaultDocumentEvent
java.lang.ClassCastException: java.desktop/javax.swing.text.AbstractDocument$DefaultDocumentEventUndoableWrapper cannot be cast to java.desktop/javax.swing.text.AbstractDocument$DefaultDocumentEvent
at jsyntaxpane.CompoundUndoMan.undoableEditHappened(CompoundUndoMan.java:61)
at java.desktop/javax.swing.text.AbstractDocument.fireUndoableEditUpdate(AbstractDocument.java:293)
at java.desktop/javax.swing.text.AbstractDocument.handleInsertString(AbstractDocument.java:761)
at java.desktop/javax.swing.text.AbstractDocument.insertString(AbstractDocument.java:716)
at java.desktop/javax.swing.text.PlainDocument.insertString(PlainDocument.java:131)
at java.desktop/javax.swing.text.DefaultEditorKit.read(DefaultEditorKit.java:274)
at java.desktop/javax.swing.JEditorPane.setText(JEditorPane.java:1428)
at ca.uhn.hl7v2.testpanel.ui.editor.Hl7V2MessageEditorPanel.updateMessageEditor(Hl7V2MessageEditorPanel.java:893)
at ca.uhn.hl7v2.testpanel.ui.editor.Hl7V2MessageEditorPanel.setMessage(Hl7V2MessageEditorPanel.java:732)
at ca.uhn.hl7v2.testpanel.controller.Controller.setLeftSelectedItem(Controller.java:815)
at ca.uhn.hl7v2.testpanel.controller.Controller.addMessage(Controller.java:218)
at ca.uhn.hl7v2.testpanel.ui.AddMessageDialog$1.actionPerformed(AddMessageDialog.java:240)
at java.desktop/javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1967)
at java.desktop/javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2308)
at java.desktop/javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:405)
at java.desktop/javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:262)
at java.desktop/javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:270)
at java.desktop/java.awt.Component.processMouseEvent(Component.java:6589)
at java.desktop/javax.swing.JComponent.processMouseEvent(JComponent.java:3342)
at java.desktop/java.awt.Component.processEvent(Component.java:6354)
at java.desktop/java.awt.Container.processEvent(Container.java:2261)
at java.desktop/java.awt.Component.dispatchEventImpl(Component.java:4966)
at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2319)
at java.desktop/java.awt.Component.dispatchEvent(Component.java:4798)
at java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4914)
at java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Container.java:4543)
at java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Container.java:4484)
at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2305)
at java.desktop/java.awt.Window.dispatchEventImpl(Window.java:2772)
at java.desktop/java.awt.Component.dispatchEvent(Component.java:4798)
at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:772)
at java.desktop/java.awt.EventQueue.access$600(EventQueue.java:97)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:715)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:87)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:97)
at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:745)
at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:743)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:87)
at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:742)
at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:117)
at java.desktop/java.awt.WaitDispatchSupport$2.run(WaitDispatchSupport.java:190)
at java.desktop/java.awt.WaitDispatchSupport$4.run(WaitDispatchSupport.java:235)
at java.desktop/java.awt.WaitDispatchSupport$4.run(WaitDispatchSupport.java:233)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.desktop/java.awt.WaitDispatchSupport.enter(WaitDispatchSupport.java:233)
at java.desktop/java.awt.Dialog.show(Dialog.java:1070)
at java.desktop/java.awt.Component.show(Component.java:1674)
at java.desktop/java.awt.Component.setVisible(Component.java:1621)
at java.desktop/java.awt.Window.setVisible(Window.java:1031)
at java.desktop/java.awt.Dialog.setVisible(Dialog.java:1005)
at ca.uhn.hl7v2.testpanel.controller.Controller.addMessage(Controller.java:182)
at ca.uhn.hl7v2.testpanel.ui.TestPanelWindow$17.actionPerformed(TestPanelWindow.java:512)
at java.desktop/javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1967)
at java.desktop/javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2308)
at java.desktop/javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:405)
at java.desktop/javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:262)
at java.desktop/javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:270)
at java.desktop/java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:297)
at java.desktop/java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:297)
at java.desktop/java.awt.Component.processMouseEvent(Component.java:6589)
at java.desktop/javax.swing.JComponent.processMouseEvent(JComponent.java:3342)
at java.desktop/java.awt.Component.processEvent(Component.java:6354)
at java.desktop/java.awt.Container.processEvent(Container.java:2261)
at java.desktop/java.awt.Component.dispatchEventImpl(Component.java:4966)
at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2319)
at java.desktop/java.awt.Component.dispatchEvent(Component.java:4798)
at java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4914)
at java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Container.java:4543)
at java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Container.java:4484)
at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2305)
at java.desktop/java.awt.Window.dispatchEventImpl(Window.java:2772)
at java.desktop/java.awt.Component.dispatchEvent(Component.java:4798)
at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:772)
at java.desktop/java.awt.EventQueue.access$600(EventQueue.java:97)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:715)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:87)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:97)
at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:745)
at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:743)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:87)
at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:742)
at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
17:39:16,149 INFO [pool-1-thread-1] Prefs:741 - Syncing user preferences to disk
17:39:16,150 INFO [pool-1-thread-1] Prefs:748 - Done synchronizing user prefs (756 chars)

Reference:
https://netbeans.org/bugzilla/show_bug.cgi?id=270142

Tested with:

hapi-testpanel-2.3
openSUSE 15.0
java-10-openjdk-headless-10.0.2.0-lp150.2.3.2.x86_64

Also, had to modify the launching script like this:

`--- testpanel.sh-orig 2018-11-04 17:36:03.481017719 -0300
+++ testpanel.sh 2018-11-04 17:36:12.545258777 -0300
@@ -1,3 +1,3 @@
#!/bin/sh

-java -jar hapi-testpanel-2.3-jar-with-dependencies.jar
+java --add-modules java.xml.bind -jar hapi-testpanel-2.3-jar-with-dependencies.jar`

Otherwise, I get:

java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException

Symlink capable linux bundle launch script

Hello,

I noticed that launching testpanel.sh from a symlink fails because jar is not found.
I modified the script as this:

#!/bin/sh
DIR="$(dirname "$(readlink -f "$0")")"
java -jar "$DIR/hapi-testpanel-2.0.1-jar-with-dependencies.jar"

Now, the script can be launched from anywhere, even in a desktop launcher.

Can you apply this little improvement please ?

HL7overHttp Content-Type question

We are currently implementing an HL7 over Http implementation with one of our vendors, and we're using your HL7overHttp implementation. On your site is stated for HL7overHttp that the 'Content-Type' for https://hapifhir.github.io/hapi-hl7v2/hapi-hl7overhttp/specification.html#a2.4_Content_Type_and_Character_Set should be 'x-application/hl7-v2+er7' but the examples on the same page say 'application/hl7-v2+er7' but your code returns 'application/hl7-v2' https://hapifhir.github.io/hapi-hl7v2/hapi-hl7overhttp/xref/ca/uhn/hl7v2/hoh/encoder/EncodingStyle.html which one of those three is the rigth one.

Missing ADT_A04 structure in hapi-structures-v251

We are using the hapi-structures-v251 module in a testing framework we are creating and we want to create ADT_A04 messages. But it seems that there are a number of missing structures in the library including ADT_A04.

UCanAccess

I had to access an MDB file for another project and used UCanAccess to support this on Linux. It worked great for read-write access to a file used by a relatively old version of Access (maybe ~2003). I saw your note on the homepage and wonder if it would solve your platform problem.

Feel free to close if you've already explored it. I may be able to answer some questions, but I used this in a Python project (using a bridge to Java) so I don't have reference code or anything.

Where is the generated source code?

Hi I can't find the output of the source generator in the repository i.e. Generated Messages, Segments, DataTypes etc
I can see the base DataTypes is there any reason they are not in the repository?

Where can they be viewed?

Xml parsing fails if xml message has several namespaces and urn:hl7-org:v2xml is not the first

The problem appeared when we updated the library from ver 2.1 to 2.3

Unit test to reveal the problem:

private boolean isPipeAndHat = false;
private static final String testMsg = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
        "<ACK xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns=\"urn:hl7-org:v2xml\">\n" +
        "  <MSH>\n" +
        "    <MSH.1>|</MSH.1>\n" +
        "    <MSH.2>^~\\&amp;</MSH.2>\n" +
        "    <MSH.3>\n" +
        "      <HD.1/>\n" +
        "    </MSH.3>\n" +
        "    <MSH.4>\n" +
        "      <HD.1/>\n" +
        "    </MSH.4>\n" +
        "    <MSH.5>\n" +
        "      <HD.1/>\n" +
        "    </MSH.5>\n" +
        "    <MSH.6>\n" +
        "      <HD.1/>\n" +
        "    </MSH.6>\n" +
        "    <MSH.7>\n" +
        "      <TS.1>20210525111033.506+0200</TS.1>\n" +
        "    </MSH.7>\n" +
        "    <MSH.9>\n" +
        "      <CM_MSG.1>ACK</CM_MSG.1>\n" +
        "      <CM_MSG.2/>\n" +
        "    </MSH.9>\n" +
        "    <MSH.10>396990</MSH.10>\n" +
        "    <MSH.11>\n" +
        "      <PT.1>D</PT.1>\n" +
        "    </MSH.11>\n" +
        "    <MSH.12>2.3</MSH.12>\n" +
        "    <MSH.13/>\n" +
        "  </MSH>\n" +
        "  <MSA>\n" +
        "    <MSA.1>AA</MSA.1>\n" +
        "    <MSA.2>396990</MSA.2>\n" +
        "    <MSA.3>The Observation message has been saved successfully.</MSA.3>\n" +
        "    <MSA.4/>\n" +
        "    <MSA.5/>\n" +
        "    <MSA.6>\n" +
        "      <CE_0357>\n" +
        "        <CE_0357.1/>\n" +
        "        <CE_0357.2>The Observation message has been saved successfully.</CE_0357.2>\n" +
        "        <CE_0357.3/>\n" +
        "        <CE_0357.4/>\n" +
        "        <CE_0357.5/>\n" +
        "        <CE_0357.6/>\n" +
        "      </CE_0357>\n" +
        "    </MSA.6>\n" +
        "  </MSA>\n" +
        "</ACK>\n";

@Test
void testParser() {
    GenericParser myParser = null;
    LOG.info("new GenericParser()");
    myParser = new GenericParser();
    if (isPipeAndHat) {
        LOG.info("setPipeParserAsPrimary()");
        myParser.setPipeParserAsPrimary();
    } else {
        LOG.info("setXMLParserAsPrimary()");
        myParser.setXMLParserAsPrimary();
    }
    try {
        LOG.info("Parsing "+testMsg);
        myParser.parse(testMsg);
        LOG.info("Parsing done");
    } catch (Exception e) {
        LOG.info("Parser error",e);
        fail();
    }
}

Looks like the buggy code is on
https://github.com/hapifhir/hapi-hl7v2/blob/v2.3/hapi-base/src/main/java/ca/uhn/hl7v2/parser/XMLParser.java
lines 755 - 762.

HL7 over HTTP binary wrapper

Hello. Recently I found Hl7overHTTP and I wanted to try it out. Unfortunately when I downloaded it I could not find anywhere where I could download the source for the binary wrapper locations. Is there somewhere in this repository that has this source? Is there documentation on running HoH without these binary wrappers (plain Java)?

Thanks!

  • Josh

ADT_AXX missing

I started using v2.8.1 in my project from v2.6, and it appears that ADT_AXX is no longer in the library. It was not mentioned being removed in the changelog for release 2.3. I found it was commented out on Aug 19 in 056d260

<!--
<execution>
<id>superstructure_adt</id>
<goals>
<goal>superstructuregen</goal>
</goals>
<configuration>
<targetDirectory>${basedir}/target/generated-sources/superstructuregen</targetDirectory>
<targetStructureName>ADT_AXX</targetStructureName>
<version>${gen.version}</version>
<structures>
<structure>ADT_A[0-9]{2}</structure>
</structures>
</configuration>
</execution>-->

I think this is a pretty important feature. Was this a mistake, or is it deliberately no longer a part of HAPI?

Catch BindException on SimpleServer.startAndWait()

I'm trying to catch the binding exception when the MLLP Server is started on a port already in use, in order to react to this error, but I'm affraid that is currently impossible.

Looking at the code, in SimpleServer, the startupLatch.await() is executed just after the start() method of the Service class but, as the AcceptorThread is launch in an other thread (by definition), the startupLatch.countDown() of the SimpleServer is called before the end of execution of the afterStartup() of the acceptor thread (which is causing the BindException).

In other words, in a normal context, if i write this wanted snippet :

`

this.simpleServer.startAndWait();

Throwable startingException = this.simpleServer.getServiceExitedWithException();
if (startingException != null) {
// do something
}`

The getServiceExitedWithException() is always null. The only solution for now is to wait for x ms and in this case the exception is filled.

Am I missing something or is there an other way to do it ?

Thanks

HL7overHttp

In the class 'AbstractHl7OverHttpDecoder'
method
'private String readLine(InputStream theInputStream, boolean theFirstLine)'
in the return statement
'return WHITESPACE_PATTERN.matcher(retVal.toString()).replaceAll(" ").trim();'
the result is trimmed this gives problems in the code class 'Hl7OverHttpResponseDecoder'
in the method 'readActionLineAndDecode' code
' String statusPart = firstLine.substring(9);
int spaceIdx = statusPart.indexOf(' ');
if (spaceIdx == -1) {
throw new DecodeException("Invalid response line, no space after status code. Line is: " + firstLine);
}
because the last ' ' is removed by the trim in the readLine, so always an error is thrown.
Removing the trim solves the problem for me.

Unable to use Visitor or Terser API to read/parse repeated field

Hello,

I'm using your great library to parse dynamically HL7 v2 messages and I've got issues when I want to use Terser or when i use Visitor on repeated field. I can't use repetition number to filter repeted filed value such as multiple PID references.

Regards,

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.