crs4 / hl7apy

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

Datatype None is not correct for NTE.NTE_3 (it must be None) #107

Closed funkybunchofoats closed 1 year ago

funkybunchofoats commented 1 year ago

I'm passing a string to an NTE_3 field: NTE_3=NTE.add_field('NTE_3') NTE_3.value='big long string'

and get the following error when I validate the segment: Datatype None is not correct for NTE.NTE_3 (it must be None)

the string in question is: Automated count of immature granulocytes includes metamyelocytes, myelocytes, etc. A manual differential is performed if the result is >0.2 x 10^9/L

Is it the carat? Sometimes when populating it gives it a type, other times it does not.

svituz commented 1 year ago

Hi @funkybunchofoats it is indeed caret's fault. It parses the value and creates two components for the field. You need to escape the caret with the component sequence \S\

NTE_3.value = "Automated count of immature granulocytes includes metamyelocytes, myelocytes, etc. A manual differential is performed if the result is >0.2 x 10\\S\\9/L"
funkybunchofoats commented 1 year ago

@svituz Thanks! that did the trick.