Here is my code:
from hl7apy.parser import parse_message hl7 = open("hl7.txt", "r").read() msg = parse_message(hl7) print(msg.children)
result:
[<Segment MSH>]
It shows only the first segment, seems simple but I don’t know what i’m doing wrong.
I’ve tried from a text file, passing the message directly or even with another HL7 message, but always got same results.
Here is the message:
MSH|^~&|SendingAPP|TEST|||20080617143943||ORU^R01|1|P|2.3.1||||||UNICODE PID|1||7393670^^^^MR||Joan^JIang||19900804000000|Female PV1|1||nk^^001 OBR|1||20071207011|00001^Automated Count^99MRC||20080508140600|20080508150616|||John||||20080508150000||||||||||HM||||||||TEST
Here is my message in notepad++ where all characters are shown:
Advertisement
Answer
by disabling find_groups
like this msg = parser.parse_message(hl7, find_groups=False)
My messages are now parsed correctly.
Thx to @sqlab and @badger0053 for help, i was able to make a progression.