|
From: James A. <jam...@gm...> - 2022-06-16 13:49:28
|
Hi Greg,
Unfortunately I think you probably have the wrong list.
This mailing list is for HAPI HL7v2, which is a Java (not JavaScript)
library.
Cheers,
James
On Wed, Jun 15, 2022 at 11:55 AM White, Gregory (GE Healthcare) <
Gre...@me...> wrote:
> Greetings all,
>
>
>
> I am somewhat new to Javascript and very new to HAPI so please forgive the
> naiveté of my question…
>
>
>
> I am trying to develop Javascript code for use in a Rhapsody engine that
> will handle (loop through) multiple OBR/OBX groupings in an ORU_R01 message
> (HL7 v2.6). My goal is to add an OBX segment to each group if/when an OBX
> exists where OBX-3 = 2907 within the group. My code only seems to work on
> the first OBR/OBX group. In my troubleshooting I have found that using
> hapiMessageIn.numberOfSegmentRepeats only seems to work if the segment
> identified comes consecutively. For example with a message like…
>
>
>
> MSH…
>
> PID…
>
> PV1…
>
> OBR|1|…
>
> OBX|1|…
>
> OBX|2|…
>
> OBX|3|ST|2907|…
>
> OBR|2|…
>
> OBX|1|…
>
> OBX|2|…
>
> OBX|3|…
>
> OBX|4|ST|2907|…
>
>
>
> …the countobr value from the following code block is 1, and the countobx
> value is 3.
>
>
>
> …
>
> var obr_exist = hapiMessageIn.segmentExists("OBR", 0);
>
> if (obr_exist == true) {
>
> var countobr = hapiMessageIn.numberOfSegmentRepeats("OBR");
>
> // Loop through each OBR
>
> for (var r = 0; r < hapiMessageIn.numberOfSegmentRepeats("OBR");
> r++) {
>
>
>
> // Get the OBX segment count
>
> var obx_exist = hapiMessageIn.segmentExists("OBX", 0);
>
> if (obx_exist == true) {
>
> var countobx =
> hapiMessageIn.numberOfSegmentRepeats("OBX");
>
> // Loop through each OBX and look for OBX-3.1 = 2907
>
> for (var x = 0; x <
> hapiMessageIn.numberOfSegmentRepeats("OBX"); x++) {
>
> ….
>
> }
>
> }
>
> }
>
> …
>
>
>
> With the countobr only being equal to 1 it never loops through/processes
> the second OBR/OBX grouping and therefore the output message will have the
> added OBX segment only in the first OBR/OBX group, like…
>
>
>
> MSH…
>
> PID…
>
> PV1…
>
> OBR|1|…
>
> OBX|1|…
>
> OBX|2|…
>
> OBX|3|ST|2907|…
>
> OBX|4|… (added OBX segment)
>
> OBR|2|…
>
> OBX|1|…
>
> OBX|2|…
>
> OBX|3|…
>
> OBX|4|ST|2907|…
>
> (no added OBX segment)
>
>
>
> Is there an issue with my syntax/use of the numberOfSegmentRepeats that
> may be causing this? Is there a better method you can propose to handle
> this scenario?
>
>
>
> Thanks in advance for your review and any suggestions you may have to
> resolve this issue.
>
>
>
> *Upcoming OOO dates: June 27- July 15 (PTO)*
>
> * July 25 - 28 (Training) *
>
> * Aug 4 - 8 (PTO)*
>
>
>
> *Gregory A. White*
> Interface Integration Engineer, Mural
>
> GE Healthcare
>
> T. +1 561 889 5673
>
>
> _______________________________________________
> Hl7api-devel mailing list
> Hl7...@li...
> https://lists.sourceforge.net/lists/listinfo/hl7api-devel
>
|