简体   繁体   English

使用 Python 内联修改 Hl7 消息。

[英]Modify Hl7 messages inline using Python.

I need to be able to either modify some text within existing Hl7 message (mostly PID and OBX segments), or create a copy Hl7 message from the existing message, but alter some of the fields based on some criteria (drop PHI strings)我需要能够修改现有 Hl7 消息(主要是 PID 和 OBX 段)中的某些文本,或者从现有消息创建副本 Hl7 消息,但根据某些条件更改某些字段(删除 PHI 字符串)

The OBX segment is used to transmit a single observation or observation fragment. OBX 段用于传输单个观察或观察片段。 It represents the smallest indivisible unit of a report.它代表报告的最小不可分割单元。 Its mission is to carry information about observations in report messages.它的任务是在报告消息中携带有关观察的信息。

HL7 messages should not be modified once received or sent or "copied" .一旦收到或发送或“复制”,HL7 消息不应被修改 Each HL7 message indicates a movement of a transaction where several actors interact.每个 HL7 消息都表示多个参与者交互的事务的移动。

The HL7 messages must be generated from an episode that must be notified to other systems, in this case, it must be generated and sent or received and processed. HL7 消息必须从必须通知其他系统的情节生成,在这种情况下,必须生成并发送或接收和处理。

You can check the next library ( python-hl7 ) as it is useful for parsing.您可以检查下一个库 ( python-hl7 ),因为它对解析很有用。

Use hl7apy.使用 hl7apy。 docs文档

from hl7apy.parser import parse_message

hl7 = "your hl7 message"
message = parse_message(hl7)

// you can modify whatever you want
message.MSH.MSH_3.value = "your value"

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

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