Skip to content

OBX-5 children with a name are not included in .to_er7() #144

@anewftw12

Description

@anewftw12

Hello,

I'm experiencing unexpected behavior when populating an OBX segment. Specifically, when I add data to an OBX segment like this:

from hl7apy.core import Message

m = Message()
m.obx.obx_5.datatype = 'ED'
m.obx.obx_5.ed_1 = ''
m.obx.obx_5.ed_2 = 'IM'
m.obx.obx_5.ed_3 = 'JPEG'
m.obx.obx_5.ed_4 = 'Base64'
m.obx.obx_5.ed_5 = 'SomeData'

The resulting OBX message is:

OBX|||||

However, when I remove the child names using the following code:

from hl7apy.core import Message

m = Message()
m.obx.obx_5.datatype = 'ED'
m.obx.obx_5.ed_1 = ''
m.obx.obx_5.ed_2 = 'IM'
m.obx.obx_5.ed_3 = 'JPEG'
m.obx.obx_5.ed_4 = 'Base64'
m.obx.obx_5.ed_5 = 'SomeData'
for child in m.obx.obx_5.children:
    child.name = None

I get the expected output:

OBX|||||^IM^JPEG^Base64^SomeData

This seems like a workaround that shouldn't be necessary.

Expected Behavior: The first example should produce the expected OBX message with the populated data, without needing to manually remove child names.

Could you please confirm if this is an unintended behavior or if there's something I'm overlooking? I'd appreciate any guidance on how to resolve this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions