Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rewriting HL7 messages fails #55

Open
tomunger opened this issue Feb 22, 2023 · 1 comment
Open

Rewriting HL7 messages fails #55

tomunger opened this issue Feb 22, 2023 · 1 comment

Comments

@tomunger
Copy link

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.

@tomunger
Copy link
Author

tomunger commented Mar 9, 2023

I've submitted a pull request 54 with the changes I made

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant