-
Notifications
You must be signed in to change notification settings - Fork 86
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
SEGMENT_ENDING_BAR doesn't work with alternate field separators #128
Comments
Glad you found the issue with it, and many thanks for reporting and offering to contribute. I'd probably name it Since we'll be accepting only a single-character string, we need to add a validation for the same. Regarding the In the PR please update Readme, and mention |
SEGMENT_ENDING_BAR replacementI don't think setting a separate character is the correct route because it has to be the same as the field separator to work with HL7 spec. Is this wrong? Maybe a shorter version would be TRAILING_FIELD_SEPARATOR if that's a concern. segmentToString() changeI agree with this possibly being a breaking change. |
Agreed that using a separate character than field-separators violates hl7 standard. Also, we already have a I'd use the word "segment" and avoid "field" as we're essentially separating the segments with this. May be |
I think we need to stick with the 'field' term to relate it to the correct separator character. Also, I did check the spec to see if there was already existing terminology that we could use. But I just found that it actually violates the definition for the field separator.
The the spec doesn't allow for it, although it sounds like quite a few companies use it, so we need to support it. I'm not sure if this is something left over from v1 but it shouldn't have been used by anyone implementing v2. 🫤 After all of that, I think |
That makes sense, but since we're talking about the presence of the separator at the end of a segment, wouldn't Also, since this field does not actually contain the separator but rather true/false, probably |
Fails because the if statement explicitly removes "|".
This can be simply fixed by
substr($x, 0, -1)
but I recommend deprecating the name SEGMENT_ENDING_BAR and variable $segmentEndingBar in favor of SEGMENT_ENDING_FIELD_SEPARATOR and $segmentEndingFieldSeparator.Deprecation would include fallbacks like the following until the next major release.
I would also move the if() statement from the toString() to the segmentToString() so that the setting doesn't get ignored if segmentToString() is called directly.
Please let me know which is the best way to create the PR. The test changes for a #127 fix require this to work.
The text was updated successfully, but these errors were encountered: