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

Defaulting to standard delimiters is surprising #64

Open
kvudata opened this issue May 17, 2024 · 1 comment
Open

Defaulting to standard delimiters is surprising #64

kvudata opened this issue May 17, 2024 · 1 comment

Comments

@kvudata
Copy link

kvudata commented May 17, 2024

https://github.com/johnpaulett/python-hl7/blob/6d85f25d678e366d2617690d4ee1216bb8027db1/hl7/parser.py#L351-LL370

  • The current parser behavior is to fill in any missing MSH-2 delimiters with the standard ones

According to the HL7 2.3 spec though

At any given site, the subset of the possible delimiters may be limited by negotiations between applications. This
implies that the receiving applications will use the agreed upon delimiters, as they appear in the Message Header
segment (MSH), to parse the message.

So it should be valid to use less delimiters. The issue is that by assuming the standard delimiters, python-hl7 will incorrectly split fields when parsing if a standard delimiter character (such as "&") is used in the content.

@kvudata
Copy link
Author

kvudata commented May 17, 2024

I think the ideal behavior would be to raise an error if there aren't 4 delimiters, and provide a way for callers to specify the delimiters to fallback to (so they can opt in to the existing behavior if they want).

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