English 中文(简体)
HAPI chokes on HL7 Z-segments
原标题:
  • 时间:2010-01-20 16:45:05
  •  标签:
  • java
  • hl7
  • hapi

I m trying to use HAPI to parse HL7 (v2.3) messages generated by an external system. These messages include custom Z segments, including the second segment of the message (between MSH and EVN).

MSH
Z
EVN
...

The problem is that for any segments parsed after encountering this first Z segment, HAPI will generate the message structure but all data in that structure is null. So, I ll still have an EVN segment object, but it won t have any data in it.

I ve tried:

  • Nothing, just parse the message with out-of-the-box HAPI, and ignore this segment
  • Extending HAPI by creating my own ADT message classes (extending the default classes) connecting in the Z segment with:
    • addNonstandardSegment()
    • add() with a custom implementation of AbstractSegment

My current workaround is to pre-parse the message before HAPI gets it and cut out this segment, but this is definitely the wrong approach. Does anyone have ideas on what I should be doing?

最佳回答

Got it. It turns out that, because of the out-of-place Z-segment (more on this below), the EVN object was being cataloged internally as "EVN2" and a second blank EVN was being added in. I m not quite sure why the code behaved this way, but I ll take that up in an issue report in the HAPI project.

The workaround is to alter the extension of the ADT message. Instead of extending it and adding the Z-segment with this.add() in my subclass constructor, I had to copy the original ADT_A* class and modify its init() method to add the Z segment class in the proper order as the expected message.

BTW, the previous workaround I mentioned can be done with a subclassed parser, which is valid for fixing broken messages - just not this one, since it isn t "broken" per se.

问题回答

暂无回答




相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签