简体   繁体   中英

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)

The OBX segment is used to transmit a single observation or observation fragment. 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" . Each HL7 message indicates a movement of a transaction where several actors interact.

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.

You can check the next library ( python-hl7 ) as it is useful for parsing.

Use 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"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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