This topic contains 1 reply, has 2 voices, and was last updated by  lev 1 year, 6 months ago.

Looping issue.

  • This segment may not be present in every message and if it is present, may contain more than 1 NTE within the ObrGrp. The NTE segment is included in the vmd as an optional repeating segment under the group ‘ObrGrp’.

    for i=1,#msgIn.ObrGrp do
    msgOut.ObrGrp[1].OBR:mapTree(msgIn.ObrGrp[i].OBR)
    –NTE segments may repeat, so Loop through them
    for j=1,#msgIn.ObrGrp[i].NTE do
    msgOut.ObrGrp[1].NTE[j]:mapTree(msgIn.ObrGrp[i].NTE[j])
    — DG1 segments may repeat, so loop through them
    for j=1,#msgIn.ObrGrp[i].DG1 do
    msgOut.ObrGrp[1].DG1[j]:mapTree(msgIn.ObrGrp[i].DG1[j])
    end
    queue.push{data=msgOut:S()}
    msgOut:remove(“ObrGrp”) — reset the structure for the next iteration
    end
    end
    end

    2 Issues with it:
    1. If there is no NTE segment, the message is ignored.
    2. The message translates if the NTE segment is present, but if there is more than one NTE – the first message includes all the segments and OBR|1 and leaves out NTE|2. The second outbound message, it leaves out OBR|2 and NTE|1. Basically a repeat of 1 and 2 in messages 3 and 4, except it is for OBR|2 and NTE|2.

    Example for issue 2:
    Inbound:
    MSH|^~\&|TESTSYSTEM|TESTSYSTEM|TOTESTSYSTEM|Imaging|20160415203730||ORM^O01|201604152037462|T|2.3
    PID|1|d7980233-39f6|||Duck^Daffy||19420402|M|||52 West Unit Drive^^Sneads^FL^32460-4165|||||||123456789
    PV1|1|O|FL0XX1^55^^APAL&FL00001
    ORC|NW|2016041501001|||||||20160416023631|Electronic||1891929857^ABANO^JOHN||^^^^^^8507180577|20160416000000
    OBR|1|2016041501001||3117^FOOT LT 3V*|R||201604160000|||||||||1891929857^ABANO^JOHN|||||||||||||||^Non-Ambulatory – Fall Risk/Fell|||||||||||||73630
    NTE|1||THIS IS A TEST ORDER.\X0A\THIS IS A TEST ORDER.
    NTE|2||THIS IS A TEST ORDER.\X0A\THIS IS A TEST ORDER TEST TEST TEST.
    DG1|1|||Pain in Ankle
    DG1|2|||Pain in Foot
    OBR|2|2016041501001||3063^ANKLE LT 3V*|R||201604160000|||||||||1891929857^ABANO^JOHN|||||||||||||||^Non-Ambulatory – Fall Risk/Fell|||||||||||||73610
    NTE|1||THIS IS A TEST ORDER.\X0A\THIS IS A TEST ORDER.
    NTE|2||THIS IS A TEST ORDER.\X0A\THIS IS A TEST ORDER TEST TEST TEST.
    DG1|1|||Pain in Ankle
    DG1|2|||Pain in Foot

    Outbound:
    Mesage 1:
    MSH|^~\&|TESTSYSTEM|TESTSYSTEM|TOTESTSYSTEM|Imaging|20160415203730||ORM^O01|201604152037462|T|2.3|
    PID|1|d7980233-39f6|||Duck^Daffy||19420402|M|||52 West Unit Drive^^Sneads^FL^32460-4165|
    PV1|1|O|FL0XX1^55^^APAL&FL00001|Schryver Medical FL Corrections|
    IN1|1||CENTURION MASTER|||||||||||||Duck~Daffy~||19420402||||||||||||||||||DIRECT BILL|
    ORC|NW|2016041501001|||||||20160416023631|Electronic||1891929857^ABANO^JOHN||^^^^^^8507180577|20160416000000|
    OBR|1|2016041501001||3117^FOOT LT 3V*|R||201604160000|||||||||1891929857^ABANO^JOHN|||||||||||||||^Non-Ambulatory – Fall Risk/Fell|||||||||||||73630|
    NTE|1||THIS IS A TEST ORDER.\X0A\THIS IS A TEST ORDER.|
    DG1|1|||Pain in Ankle|
    DG1|2|||Pain in Foot|

    Mesage 2:
    MSH|^~\&|TESTSYSTEM|TESTSYSTEM|TOTESTSYSTEM|Imaging|20160415203730||ORM^O01|201604152037462|T|2.3|
    PID|1|d7980233-39f6|||Duck^Daffy||19420402|M|||52 West Unit Drive^^Sneads^FL^32460-4165|
    PV1|1|O|FL0XX1^55^^APAL&FL00001|Schryver Medical FL Corrections|
    IN1|1||CENTURION MASTER|||||||||||||Duck~Daffy~||19420402||||||||||||||||||DIRECT BILL|
    ORC|NW|2016041501001|||||||20160416023631|Electronic||1891929857^ABANO^JOHN||^^^^^^8507180577|20160416000000|
    NTE|2||THIS IS A TEST ORDER.\X0A\THIS IS A TEST ORDER TEST TEST TEST.|
    DG1|1|||Pain in Ankle|
    DG1|2|||Pain in Foot|

    Message 3:
    MSH|^~\&|TESTSYSTEM|TESTSYSTEM|TOTESTSYSTEM|Imaging|20160415203730||ORM^O01|201604152037462|T|2.3|
    PID|1|d7980233-39f6|||Duck^Daffy||19420402|M|||52 West Unit Drive^^Sneads^FL^32460-4165|
    PV1|1|O|FL0XX1^55^^APAL&FL00001|Schryver Medical FL Corrections|
    IN1|1||CENTURION MASTER|||||||||||||Duck~Daffy~||19420402||||||||||||||||||DIRECT BILL|
    ORC|NW|2016041501001|||||||20160416023631|Electronic||1891929857^ABANO^JOHN||^^^^^^8507180577|20160416000000|
    OBR|2|2016041501001||3063^ANKLE LT 3V*|R||201604160000|||||||||1891929857^ABANO^JOHN|||||||||||||||^Non-Ambulatory – Fall Risk/Fell|||||||||||||73610|
    NTE|1||THIS IS A TEST ORDER.\X0A\THIS IS A TEST ORDER.|
    DG1|1|||Pain in Ankle|
    DG1|2|||Pain in Foot|

    Message 4:
    MSH|^~\&|TESTSYSTEM|TESTSYSTEM|TOTESTSYSTEM|Imaging|20160415203730||ORM^O01|201604152037462|T|2.3|
    PID|1|d7980233-39f6|||Duck^Daffy||19420402|M|||52 West Unit Drive^^Sneads^FL^32460-4165|
    PV1|1|O|FL0XX1^55^^APAL&FL00001|Schryver Medical FL Corrections|
    IN1|1||CENTURION MASTER|||||||||||||Duck~Daffy~||19420402||||||||||||||||||DIRECT BILL|
    ORC|NW|2016041501001|||||||20160416023631|Electronic||1891929857^ABANO^JOHN||^^^^^^8507180577|20160416000000|
    NTE|2||THIS IS A TEST ORDER.\X0A\THIS IS A TEST ORDER TEST TEST TEST.|
    DG1|1|||Pain in Ankle|
    DG1|2|||Pain in Foot|

    Hello Tony. Did you have a chance to check reference articles in our online Wiki? In particular, to resolve current question, Segment Grammar need to be declared in vmd file taking advantage of ‘Groups’, ‘Optional’, and ‘Repeating’ properties. Respective properties will be selected for these Segments to indicate whether they can be missing (‘optional’) and/or multiple (‘repeating’). Please feel free to use Support channel for detailed answer.

You must be logged in to reply to this topic.