Skip to content

Rewriting HL7 messages fails #55

@tomunger

Description

@tomunger

I'm working on a project that modifies HL7 messages and have run into a couple bugs. Your documentation say that the library may eventually contain the ability to create HL7.

  1. Modifying a field to greater depth fails
MSH|^~\\&|field|rep1~rep2|

A call to

seg.assign_field("NewRep", 3, 1)

Will fail because the field object contains a string, not a repetition. The desired behavior is to replace the sting with a repetition containing the new value.

I have a fix for this.

  1. Added fields are not escaped.

Fields get added through Segment.assign_fields(). My first thought was to add escaping to this method. However, this breaks several tests that construct HL7 message. It does not appear to break parsing, but it does break creation of ACK messages.

I'm not sure what a fix for this should be. Candidates:

  • All code that adds fields call escape() explicitly.
  • Code alternate to assign_fields() that escapes the value before writing.

If given some guidance, I'll implement that fix and then offer a pull request.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions