简体   繁体   English

HAPI在HL7 Z段上窒息

[英]HAPI chokes on HL7 Z-segments

I'm trying to use HAPI to parse HL7 (v2.3) messages generated by an external system. 我正在尝试使用HAPI来解析外部系统生成的HL7(v2.3)消息。 These messages include custom Z segments, including the second segment of the message (between MSH and EVN). 这些消息包括自定义Z段,包括消息的第二段(在MSH和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. 问题是,对于在遇到第一个Z段之后解析的任何段,HAPI将生成消息结构,但该结构中的所有数据都为空。 So, I'll still have an EVN segment object, but it won't have any data in it. 所以,我仍然会有一个EVN段对象,但它不会有任何数据。

I've tried: 我试过了:

  • Nothing, just parse the message with out-of-the-box HAPI, and ignore this segment 没什么,只是用开箱即用的HAPI解析消息,并忽略这个段
  • Extending HAPI by creating my own ADT message classes (extending the default classes) connecting in the Z segment with: 通过在Z段中创建我自己的ADT消息类(扩展默认类)来扩展HAPI:
    • addNonstandardSegment() addNonstandardSegment()
    • add() with a custom implementation of AbstractSegment add()与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. 我目前的解决方法是在HAPI获取之前预先解析消息并删除此段,但这绝对是错误的方法。 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. 事实证明,由于不合适的Z段(下面有更多内容),EVN对象在内部编目为“EVN2”,并且正在添加第二个空白EVN。我不太确定为什么代码以这种方式表现,但我会在HAPI项目的问题报告中加以说明。

The workaround is to alter the extension of the ADT message. 解决方法是更改​​ADT消息的扩展名。 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. 我不得不在我的子类构造函数中扩展它并使用this.add()添加Z段,而是必须复制原始的ADT_A *类并修改其init()方法,以正确的顺序添加Z段类作为预期信息。

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. 顺便说一句,我之前提到的解决方法可以使用子类解析器来完成,该解析器对于修复损坏的消息是有效的 - 只是不是这个,因为它本身并没有“破坏”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM