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

StringIndexOutOfBoundsException is thrown while converting NTE segments with additional dash #512

Open
quake1997 opened this issue Oct 20, 2023 · 0 comments
Labels

Comments

@quake1997
Copy link

Describe the bug

When hl7 msg contains NTE segments with additional dash (-), StringIndexOutOfBoundsException exception is thrown while calling HL7ToFHIRConverter::convert. Issue related to changes implemented within https://github.com/LinuxForHealth/hl7v2-fhir-converter/pull/305/files#diff-c5d8954d3bc36408229772e082eb4fc36125a89c9e858fa22ec36aaa27c3c493R170

To Reproduce

@Test
void shouldCreateBundleResource() {
   HL7ToFHIRConverter ftv = new HL7ToFHIRConverter();
   String hl7message = "MSH|^~\\&||Test System|||20210917110100||OML^O21^OML_O21|||2.6\r"
                + "PID|1||7659afb9-0dfc-d744-1f40-5b9314807108^^^^MR||Feeney^Sam^^^^^L|||M||||||||\r"
                + "ORC|NW|8125550e-04db-11ec-a9a8-086d41d421ca^^ID^UUID||||||||||\r"
                + "OBR|1|8125550e-04db-11ec-a9a8-086d41d421ca^^ID^UUID||58410-2^CBC panel - Blood by Automated count^LN||||||||||||\r"
                + "NTE|1|L|Test Range:\r"
                + "NTE|2|L|Test1 and Test: 10 - 12\r"
                + "DG1|1||A013^Paratyphoid fever C^I10C|||A|||||||||1\r";
        
     assertNotNull(ftv.convert(hl7message));
 }

Expected behavior
FHIR bundle resource is created correctly

@quake1997 quake1997 changed the title StringIndexOutOfBoundsException is thrown while converting NTE segment with additional dash StringIndexOutOfBoundsException is thrown while converting NTE segments with additional dash Oct 20, 2023
ssharma5 pushed a commit to ssharma5/hl7v2-fhir-converter that referenced this issue Aug 22, 2024
…while converting NTE segments with additional dash.

Added fail-safe check for last index in substring method.
ssharma5 pushed a commit to ssharma5/hl7v2-fhir-converter that referenced this issue Aug 22, 2024
…while converting NTE segments with additional dash.

Added fail-safe check for last index in substring method.

Added test.
ssharma5 added a commit to ssharma5/hl7v2-fhir-converter that referenced this issue Aug 22, 2024
…while converting NTE segments with additional dash.

Added fail-safe check for last index in substring method.

Signed-off-by: Shubham Sharma <[email protected]>
LisaWellman pushed a commit that referenced this issue Aug 26, 2024
…ng NTE segments with additional dash.

Added fail-safe check for last index in substring method.

Signed-off-by: Shubham Sharma <[email protected]>
jack-h-wang added a commit to CDCgov/hl7v2-fhir-converter that referenced this issue Dec 5, 2024
…while converting NTE segments with additional dash. (#18)

Added fail-safe check for last index in substring method.

Signed-off-by: Shubham Sharma <[email protected]>
Co-authored-by: Shubham Sharma <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants