crs4 / hl7apy

Python library to parse, create and handle HL7 v2 messages.
http://crs4.github.io/hl7apy/
MIT License
215 stars 85 forks source link

<CRLF> at the end of a file with find_groups=false will throw a "Segment not found" error #101

Open AwfulMoo opened 2 years ago

AwfulMoo commented 2 years ago

When attempting to parse a message, with find_groups=False, files with "\r\n" on the final line will fail as the final segment will be "\n", which is then stripped to "".

This causes an key not found exception when attempting to retrieve the element name for that "segment".

HL7 spec version used: 2.3.1 Message type: ORU_R01

svituz commented 4 months ago

You'll need to replace the sequence '\n\'r' to '\r' before parsing the message with the library