Closed r1b closed 3 years ago
We figured out the problem here - we needed to set the type of OBX_5 at runtime to match OBX_2 like so:
obx_5 = Field("OBX_5", datatype="TX")
obx_5.value = TX("foobar^baz")
print(f.to_er7()) # "foobar\S\baz
# now add the field to the observation
obx.add(obx_5)
If you don't explicitly define the type of obx_5, e.g doing something like this:
obx.obx_5 = "foobar^baz"
then the type of obx_5 is 'varies' and the caret will not be escaped.
This could be a nice documentation item but otherwise the behavior of hl7apy seems correct, closing accordingly.
We find that the caret (
^
) is not escaped in fields of typevaries
when using version 2.3. All other reserved characters appear to be escaped - is this the expected behavior?e.g: