HCA-Healthcare / elixir-hl7

An Elixir library for working with HL7 v2.x healthcare data
Apache License 2.0
110 stars 22 forks source link

HL7.Query.number_set_ids/1 corrupts message #60

Open DiogoSL opened 2 months ago

DiogoSL commented 2 months ago

When using the function it falsly fills in many fields with 1's.

Reproduce:

HL7.Examples.nist_immunization_hl7 |> HL7.Query.new |> HL7.Query.number_set_ids |> HL7.Query.to_message |> HL7.Message.raw

Result:

%HL7.InvalidMessage{ raw: "MSH1^\&1Test EHR Application1X6811NIST Test Iz Reg120120701082211VXU^V04^VXU_V041NIST-IZ-020.001P12.5.1111AL1ER\rPID1111252430^^^MAA^MR11Curry^Qiang^Trystan^^^^L11200908191M\rORC1111IZ-783278^NDA11111111157422^RADON^NICHOLAS^^^^^^NDA^L\rRXA111112012081411140^Influenza^CVX10.51mL^MilliLiter [SI Volume Units]^UCUM1100^New immunization record^NIP001111111W1356FE1201212141SKB^GlaxoSmithKline^MVX111CP1A\rRXR111RA^Right Arm^HL70163\rOBX111CE164994-7^Vaccine funding program eligibility category^LN111V03^VFC eligible - Uninsured^HL70064111111F11120120701111VXC40^Eligibility captured at the immunization level^CDCPHINVS\rOBX111CE130956-7^vaccine type^LN12188^Influenza, unspecified formulation^CVX111111F\rOBX111TS129768-9^Date vaccine information statement published^LN12120120702111111F\rOBX111TS129769-7^Date vaccine information statement presented^LN12120120814111111F\rORC1111IZ-783276^NDA\rRXA111112011021411133^PCV 13^CVX199911101^Historical information - source unspecified^NIP001\rORC1111IZ-783282^NDA11111111157422^RADON^NICHOLAS^^^^^^NDA^L\rRXA111112012081411110^DTaP-Hep B-IPV^CVX10.51mL^MilliLiter [SI Volume Units]^UCUM1100^New immunization record^NIP00111111178HH34I1201212141SKB^GlaxoSmithKline^MVX111CP1A\rRXR111LA^Left Arm^HL70163\rOBX111CE164994-7^Vaccine funding program eligibility category^LN111V03^VFC eligible - Uninsured^HL70064111111F11120120701111VXC40^Eligibility captured at the immunization level^CDCPHINVS\rOBX111CE130956-7^vaccine type^LN121107^DTaP^CVX111111F\rOBX111TS129768-9^Date vaccine information statement published^LN12120070517111111F\rOBX111TS129769-7^Date vaccine information statement presented^LN12120120814111111F\rOBX111CE130956-7^vaccine type^LN13189^Polio^CVX111111F\rOBX111TS129768-9^Date vaccine information statement published^LN13120111108111111F\rOBX111TS129769-7^Date vaccine information statement presented^LN13120120814111111F\rOBX111CE130956-7^vaccine type^LN14145^Hep B, unspecified formulation^CVX111111F\rOBX111TS129768-9^Date vaccine information statement published^LN14120120202111111F\rOBX111TS129769-7^Date vaccine information statement presented^LN14120120814111111F\r", header: %HL7.InvalidHeader{ raw: [ "MSH", "1", "^~\&", "Test EHR Application", "X68", "", "NIST Test Iz Reg", "20", "2070", "0822", "", [["VXU", "V04", "VXU_V04"]], "NIST-IZ-020.00", "P", "2.5.", "", "", "", "AL", "ER" ], reason: :invalid_message_type }, created_at: ~U[2024-09-27 10:42:48.165000Z], reason: :invalid_header }

elixir_hl7 version: 0.8.1

mllp version: 0.9.4