简体   繁体   English

使用Chameleon Python API的Segment Iterator对象遍历HL7消息

[英]Iterating through HL7 message using Segment Iterator Object of Chameleon Python API

I am generating HL7 messages using Interfaceware Iguana and Chameleon. 我正在使用Interfaceware Iguana和Chameleon生成HL7消息。 This is my first experience with Python, so this question may be immature. 这是我第一次使用Python,因此这个问题可能还不成熟。 I am trying to iterate through message using Segment Iterator Object. 我正在尝试使用Segment Iterator Object遍历消息。

current_segment = environment.input_segment_iterator()  
current_segment.apply_transform()
output = current_segment.output()
if current_segment.move_next('OBX'):
    log('OBX setId is ' + current_segment.field(1).value );

I have written this script in global post process equation window, but it always gives me an error saying 我已经在全局后期处理方程式窗口中编写了此脚本,但是它总是给我一个错误提示

RuntimeError: Invalid iterator must be reset before being used while calling apply_transform
while executing the outgoing post process equation for the project.

I have seen many examples of using iterator, and all follow same pattern. 我已经看到了许多使用迭代器的示例,并且都遵循相同的模式。 How do I reset this iterator, and why is this invalid? 如何重置此迭代器,为什么无效?

After doing some research work, I discovered that I cannot use input_segment_iterator in the post process equation window, but in transformation window. 经过一些研究工作,我发现不能在post process方程式窗口中使用input_segment_iterator ,而是在transformation窗口中使用。 Now I am able to see changes I make to script using the Test Mapping feature of Chameleon. 现在,我可以看到使用Chameleon的“ Test Mapping功能对脚本所做的更改。 But how can I configure this change to be implemented on each message which I generate using this vmd ? 但是,如何配置此更改以在使用此vmd生成的每条消息上实施?

I think someone working with INTERFACEWARE Chameleon and Iguana products could easily help me out. 我认为使用INTERFACEWARE Chameleon和Iguana产品的人员可以轻松帮助我。

Not much of an Iguana person, But what I believe is you are missing this 鬣蜥的人不多,但我相信你错过了这个

current_segment.reset() after you are done iterating through OBX, so that it sets the current segment to MSH. 在完成对OBX的迭代之后,使用current_segment.reset() ,以便将当前段设置为MSH。

You can see sample usage on this page . 您可以在此页面上查看示例用法。

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

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