Closed nguyenvpd closed 6 years ago
Hi @nguyenvpd, you're right, the problem is with that split. I'll mark it as a bug and I'll try to fix this ASAP, since it make it impossible to use version 2.3 messages. Thank you, Vittorio
I've fixed the bug in version 1.3.1
Trying to parse this message:
found here: https://github.com/aws-samples/aws-big-data-blog/blob/master/aws-blog-mirth-healthcare-hub/samples/hl7-siu-s12.txt
fails with
hl7apy.exceptions.ChildNotValid: <Component CM_MSG_1 (MESSAGE_TYPE) of type ID> is not a valid child for <Field MSH_9 (MESSAGE_TYPE) of type CM_MSG>
It looks like this is due to this method: https://github.com/crs4/hl7apy/blob/v1.3.0/hl7apy/core.py#L89 where we try to
parent, index = child_name.split("_")
on a name that will actually have 3 values after the.split()
. Examples of those here: https://github.com/crs4/hl7apy/blob/v1.3.0/hl7apy/v2_3/datatypes.py#L94It may be worth doing something like this in that method instead: