简体   繁体   English

如何使用Python-HL7工具验证HL7消息?

[英]How to validate HL7 message using Python-HL7 tool?

I am using Python-HL7 tool. 我正在使用Python-HL7工具。

After receiving message from server, I want to validate the message and send back acknowledge message if message received is valid or not. 在收到来自服务器的消息后,我想验证消息并在收到的消息有效时发回确认消息。

hl7.ishl7() method only does a cursory check and does not fully validate the message. hl7.ishl7()方法只进行粗略检查并且不完全验证消息。 How can I actually validate the message? 我怎样才能真正验证消息?

Parsing and Validating are two different things. 解析和验证是两回事。 You mentioned hl7.ishl7() which just parse the HL7 message. 你提到了hl7.ishl7()hl7.ishl7()解析HL7消息。

Following is from documentation : 以下是来自文档

 hl7.ishl7(line) 

Determines whether a line looks like an HL7 message. 确定是否看起来像HL7消息。 This method only does a cursory check and does not fully validate the message. 此方法仅进行粗略检查,并不完全验证消息。

Many HL7 tool kits (in other languages I know) provide feature for validating the message; 许多HL7工具包(我知道的其他语言)提供验证消息的功能; but apparently, this specific toolkit does not. 但显然,这个特定的工具包没有。

Validating the HL7 message may be personal choice as well in addition to specifications. 除了规范之外,验证HL7消息也可以是个人选择。 Generally, you should first parse the message (using hl7.ishl7(line) ) and then should implement validation code on your own. 通常,您应首先解析消息(使用hl7.ishl7(line) ),然后应自行实现验证代码。 This way, you may include the validations specific to your application/need. 这样,您可以包含特定于您的应用程序/需求的验证。

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

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