xlate / staedi

StAEDI - Streaming API for EDI: Java library featuring a reader/parser, writer/generator, and validation
Apache License 2.0
123 stars 35 forks source link

HL Segment is not interpreted correctly by ReaderService #441

Closed NandaBalakrishnan closed 5 months ago

NandaBalakrishnan commented 5 months ago

Hi @MikeEdgar , we are attempting to parse order status 870 EDI. Reader service failed to interpret this segment 'HL*2**I~' as Item level instead of that it is interpreting as order level segment. HL order and HL items are under 2 different loop and it can be identified by HL03 element (O- order & I- item).

Is there any parameter in schema to differentiate these segments or how it can be handled in reader service implementation?

Sample EDI File


REF*MM*789087~
N1*ST**1294*71324~
HL*1**O~ ---> LoopHL order Level
PRF*12345661***20220124~
ISR*LL~
REF*KK*9999999999204165003~
HL*2**I~ ---> LoopHL Item level
PO1*1~
ISR*QQ~
QTY*34*1~
CTT*2~
SE*13*0001~```

Could you please help me on this ?
MikeEdgar commented 5 months ago

@NandaBalakrishnan are you using an implementation schema? This test case below shows a similar case where the HL segments are differentiated.

https://github.com/xlate/staedi/blob/645a266fc85a56841f50c076df4474002b93d0cf/src/test/resources/x12/005010X222/837_loop1000_only.xml#L49-L89

Brinderjit commented 5 months ago

Hi @MikeEdgar, I am having a similar issue where the parser does not differentiate the parent and child HL. Even if discrimnator enum value is T, parser does not detect the end of child HL_HL_HL_LOOP. Schema is as below.

T LS I LS
MikeEdgar commented 5 months ago

@Brinderjit , please see how the HL segments are declared in the implementation schema example I posted earlier [1]. The HL loops should not be nested in the schema. Although they are nested based on the level numbers in the HL elements and should be interpreted that way when reading EDI data, the loops are peers (at the same level) in the schema.

[1] https://github.com/xlate/staedi/blob/645a266fc85a56841f50c076df4474002b93d0cf/src/test/resources/x12/005010X222/837_loop1000_only.xml

Brinderjit commented 5 months ago

Hi @MikeEdgar, Thank you for responding. I changed the schema and made HL loops at same level but still parser think all the loops as first loop. Below is my schema. I used levelIdPosition and parentIdPosition combination. Am I doing something wrong?


<schema xmlns="http://xlate.io/EDISchema/v4">
    <transaction>
        <sequence>
            <segment type="BSN" minOccurs="1" maxOccurs="1"/>
            <segment type="DTM" minOccurs="1" maxOccurs="1"/>
            <loop code="HL_LOOP" minOccurs="1" maxOccurs="2147483647" levelIdPosition="1" parentIdPosition="2">
                <sequence>
                    <segment type="HL"  minOccurs="1" maxOccurs="1"/>
                    <segment type="TD1" minOccurs="1" maxOccurs="3"/>
                    <segment type="TD5" minOccurs="1" maxOccurs="1"/>
                    <segment type="TD3" minOccurs="1" maxOccurs="1"/>
                    <segment type="TD4" minOccurs="0" maxOccurs="1"/>
                    <segment type="REF" minOccurs="1" maxOccurs="1"/>
                    <segment type="DTM" minOccurs="1" maxOccurs="1"/>
                    <loop code="N1_LOOP" minOccurs="1" maxOccurs="3">
                        <sequence>
                            <segment type="N1" minOccurs="1" maxOccurs="3"/>
                        </sequence>
                    </loop>
                </sequence>
            </loop>
            <loop code="HL_HL_LOOP" minOccurs="1" maxOccurs="2147483647"  levelIdPosition="1" parentIdPosition="2">
                <sequence>
                    <segment type="HL"  minOccurs="1" maxOccurs="1"/>
                    <segment type="LIN" minOccurs="1" maxOccurs="1"/>
                    <segment type="REF" minOccurs="1" maxOccurs="1"/>
                </sequence>
            </loop>
            <loop code="HL_HL_HL_LOOP"  minOccurs="1" maxOccurs="2147483647" levelIdPosition="1" parentIdPosition="2">
                <sequence>
                    <segment type="HL"  minOccurs="1" maxOccurs="1"/>
                    <segment type="LIN" minOccurs="1" maxOccurs="1"/>
                    <segment type="SN1" minOccurs="1" maxOccurs="1"/>
                    <segment type="MEA" minOccurs="1" maxOccurs="1"/>
                    <segment type="REF" minOccurs="1" maxOccurs="1"/>
                </sequence>
            </loop>
            <segment type="CTT" minOccurs="1" maxOccurs="1"/>
        </sequence>
    </transaction>
    <implementation>
        <sequence>
            <segment type="BSN" minOccurs="1" maxOccurs="1"/>
            <segment type="DTM" minOccurs="1" maxOccurs="1"/>
            <loop code="HL_LOOP" type="HL_LOOP" minOccurs="1" maxOccurs="1">
                <sequence>
                    <segment type="HL" code="HL_S" minOccurs="1" maxOccurs="1" discriminator="3" title="Shipment Hierarchical Level">
                        <sequence>
                            <element position="1" minOccurs="1"/>
                            <element position="2"/>
                            <element position="3" minOccurs="1" title="Entity Identifier Code">
                                <enumeration>
                                    <value title="Shipment">S</value>
                                </enumeration>
                            </element>
                        </sequence>
                    </segment>
                    <segment type="TD1" minOccurs="1" maxOccurs="3"/>
                    <segment type="TD5" minOccurs="1" maxOccurs="1"/>
                    <segment type="TD3" minOccurs="1" maxOccurs="1"/>
                    <segment type="TD4" minOccurs="0" maxOccurs="1"/>
                    <segment type="REF" minOccurs="1" maxOccurs="1"/>
                    <segment type="DTM" minOccurs="1" maxOccurs="1"/>
                    <loop code="N1_LOOP" type="N1_LOOP" minOccurs="1" maxOccurs="3">
                        <sequence>
                            <segment type="N1" minOccurs="1" maxOccurs="3"/>
                        </sequence>
                    </loop>
                </sequence>
            </loop>
            <loop code="HL_HL_LOOP" type="HL_HL_LOOP" minOccurs="1" maxOccurs="2147483647" discriminator="3" >
                <sequence>
                    <segment type="HL" code="HL_T" minOccurs="1" maxOccurs="1" discriminator="3" title="Tare/Pallet Hierarchical Level">
                        <sequence>
                            <element position="1" minOccurs="1"/>
                            <element position="2" minOccurs="1"/>
                            <element position="3" minOccurs="1" title="Entity Identifier Code">
                                <enumeration>
                                    <value title="Shipping Tare">T</value>
                                </enumeration>
                            </element>
                        </sequence>
                    </segment>
                    <segment type="LIN" minOccurs="1" maxOccurs="1"/>
                    <segment type="REF" minOccurs="1" maxOccurs="1"/>
                </sequence>
            </loop>
            <loop code="HL_HL_HL_LOOP" type="HL_HL_HL_LOOP" minOccurs="1" maxOccurs="2147483647" discriminator="3">
                <sequence>
                    <segment type="HL" code="HL_I" minOccurs="1" maxOccurs="1" discriminator="3" title="Item Hierarchical Level">
                        <sequence>
                            <element position="1" minOccurs="1"/>
                            <element position="2" minOccurs="1"/>
                            <element position="3" minOccurs="1" title="Entity Identifier Code">
                                <enumeration>
                                    <value title="Item">I</value>
                                </enumeration>
                            </element>
                        </sequence>
                    </segment>
                    <segment type="LIN" minOccurs="1" maxOccurs="1"/>
                    <segment type="SN1" minOccurs="1" maxOccurs="1"/>
                    <segment type="MEA" minOccurs="1" maxOccurs="1"/>
                    <segment type="REF" minOccurs="1" maxOccurs="1"/>
                </sequence>
            </loop>
            <segment type="CTT" minOccurs="1" maxOccurs="1"/>
        </sequence>
    </implementation>
    <segmentType name="BSN">
        <sequence>
            <element position="1" type="BSN01" minOccurs="1"/>
            <element position="2" type="BSN02" minOccurs="1"/>
            <element position="3" type="BSN03" minOccurs="1"/>
            <element position="4" type="BSN04" minOccurs="1"/>
        </sequence>
    </segmentType>
    <elementType name="BSN01" minLength="2" maxLength="2" base="string"/>
    <elementType name="BSN02" minLength="8" maxLength="8" base="string"/>
    <elementType name="BSN03" minLength="8" maxLength="8" base="date"/>
    <elementType name="BSN04" minLength="4" maxLength="4" base="time"/>
    <segmentType name="DTM">
        <sequence>
            <element type="DTM01" minOccurs="1"/>
            <element type="DTM02" minOccurs="1"/>
            <element type="DTM03" minOccurs="1"/>
        </sequence>
    </segmentType>
    <elementType name="DTM01" minLength="3" maxLength="3" base="string"/>
    <elementType name="DTM02" minLength="8" maxLength="8" base="date"/>
    <elementType name="DTM03" minLength="4" maxLength="4" base="time"/>
    <segmentType name="N1">
        <sequence>
            <element position="1" type="N101" minOccurs="1"/>
            <element position="2" type="CPP001"/>
            <element position="3" type="N103" minOccurs="1"/>
            <element position="4" type="N104" minOccurs="1"/>
        </sequence>
    </segmentType>
    <elementType name="N101" minLength="2" maxLength="2" base="string"/>
    <elementType name="N103" minLength="1" maxLength="2" base="string"/>
    <elementType name="N104" minLength="2" maxLength="8" base="string"/>
    <segmentType name="HL">
        <sequence>
            <element position="1" type="HL01" minOccurs="1"/>
            <element position="2" type="HL02"/>
            <element position="3" type="HL03" minOccurs="1"/>
        </sequence>
    </segmentType>
    <elementType name="CPP001" base="string"/>
    <elementType name="HL01" minLength="1" maxLength="12" base="string"/>
    <elementType name="HL02" minLength="1" maxLength="12" base="string"/>
    <elementType name="HL03" minLength="1" maxLength="2" base="string"/>
    <segmentType name="TD1">
        <sequence>
            <element position="1" type="TD101"/>
            <element position="2" type="TD102"/>
            <element position="3" type="CPP001"/>
            <element position="4" type="CPP001"/>
            <element position="5" type="CPP001"/>
            <element position="6" type="TD106"/>
            <element position="7" type="TD107"/>
            <element position="8" type="TD108"/>
        </sequence>
    </segmentType>
    <elementType name="TD101" minLength="3" maxLength="5" base="string"/>
    <elementType name="TD102" minLength="1" maxLength="7" base="numeric"/>
    <elementType name="TD106" minLength="1" maxLength="2" base="string"/>
    <elementType name="TD107" minLength="1" maxLength="10" base="decimal"/>
    <elementType name="TD108" minLength="2" maxLength="2" base="string"/>
    <segmentType name="TD5">
        <sequence>
            <element position="1" type="CPP001"/>
            <element position="2" type="TD502" minOccurs="1"/>
            <element position="3" type="TD503" minOccurs="1"/>
            <element position="4" type="CPP001"/>
            <element position="5" type="TD505"/>
        </sequence>
    </segmentType>
    <elementType name="TD502" minLength="1" maxLength="2" base="string"/>
    <elementType name="TD503" minLength="4" maxLength="4" base="string"/>
    <elementType name="TD505" minLength="1" maxLength="35" base="string"/>
    <segmentType name="TD3">
        <sequence>
            <element position="1" type="TD301" minOccurs="1"/>
            <element position="2" type="CPP001"/>
            <element position="3" type="TD303" minOccurs="1"/>
        </sequence>
    </segmentType>
    <elementType name="TD301" minLength="2" maxLength="2" base="string"/>
    <elementType name="TD303" minLength="1" maxLength="10" base="string"/>
    <segmentType name="TD4">
        <sequence>
            <element position="1" type="TD401"/>
        </sequence>
    </segmentType>
    <elementType name="TD401" minLength="2" maxLength="3" base="string"/>
    <segmentType name="REF">
        <sequence>
            <element type="REF01" minOccurs="1"/>
            <element type="REF02" minOccurs="1"/>
        </sequence>
    </segmentType>
    <elementType name="REF01" minLength="2" maxLength="3" base="string"/>
    <elementType name="REF02" minLength="1" maxLength="16" base="string"/>
    <segmentType name="LIN">
        <sequence>
            <element position="1" type="CPP001"/>
            <element position="2" type="LIN02" minOccurs="1"/>
            <element position="3" type="LIN03" minOccurs="1"/>
            <element position="4" type="LIN04" minOccurs="0"/>
            <element position="5" type="LIN05" minOccurs="0"/>
            <element position="6" type="LIN06" minOccurs="0"/>
            <element position="7" type="LIN07" minOccurs="0"/>
            <element position="8" type="LIN08" minOccurs="0"/>
            <element position="9" type="LIN09" minOccurs="0"/>
            <element position="10" type="LIN10" minOccurs="0"/>
            <element position="11" type="LIN11" minOccurs="0"/>
            <element position="12" type="LIN12" minOccurs="0"/>
            <element position="13" type="LIN13" minOccurs="0"/>
            <element position="14" type="LIN14" minOccurs="0"/>
            <element position="15" type="LIN15" minOccurs="0"/>
            <element position="16" type="LIN16" minOccurs="0"/>
            <element position="17" type="LIN17" minOccurs="0"/>
            <element position="18" type="LIN18" minOccurs="0"/>
            <element position="19" type="LIN19" minOccurs="0"/>
            <element position="20" type="LIN20" minOccurs="0"/>
            <element position="21" type="LIN21" minOccurs="0"/>
            <element position="22" type="LIN22" minOccurs="0"/>
            <element position="23" type="LIN23" minOccurs="0"/>
            <element position="24" type="LIN24" minOccurs="0"/>
            <element position="25" type="LIN25" minOccurs="0"/>
            <element position="26" type="LIN26" minOccurs="0"/>
            <element position="27" type="LIN27" minOccurs="0"/>
            <element position="28" type="LIN28" minOccurs="0"/>
            <element position="29" type="LIN29" minOccurs="0"/>
        </sequence>
    </segmentType>
    <elementType name="LIN02" minLength="2" maxLength="2" base="string"/>
    <elementType name="LIN03" minLength="1" maxLength="29" base="string"/>
    <elementType name="LIN04" minLength="2" maxLength="2" base="string"/>
    <elementType name="LIN05" minLength="1" maxLength="16" base="string"/>
    <elementType name="LIN06" minLength="1" maxLength="2" base="string"/>
    <elementType name="LIN07" minLength="1" maxLength="12" base="string"/>
    <elementType name="LIN08" minLength="2" maxLength="2" base="string"/>
    <elementType name="LIN09" minLength="1" maxLength="6" base="string"/>
    <elementType name="LIN10" minLength="2" maxLength="2" base="string"/>
    <elementType name="LIN11" minLength="1" maxLength="6" base="string"/>
    <elementType name="LIN12" minLength="2" maxLength="2" base="string"/>
    <elementType name="LIN13" minLength="5" maxLength="10" base="string"/>
    <elementType name="LIN14" minLength="2" maxLength="2" base="string"/>
    <elementType name="LIN15" minLength="10" maxLength="10" base="string"/>
    <elementType name="LIN16" minLength="2" maxLength="2" base="string"/>
    <elementType name="LIN17" minLength="2" maxLength="2" base="string"/>
    <elementType name="LIN18" minLength="2" maxLength="2" base="string"/>
    <elementType name="LIN19" minLength="10" maxLength="10" base="string"/>
    <elementType name="LIN20" minLength="2" maxLength="2" base="string"/>
    <elementType name="LIN21" minLength="2" maxLength="2" base="string"/>
    <elementType name="LIN22" minLength="2" maxLength="2" base="string"/>
    <elementType name="LIN23" minLength="1" maxLength="20" base="string"/>
    <elementType name="LIN24" minLength="2" maxLength="2" base="string"/>
    <elementType name="LIN25" minLength="1" maxLength="16" base="string"/>
    <elementType name="LIN26" minLength="2" maxLength="2" base="string"/>
    <elementType name="LIN27" minLength="1" maxLength="10" base="string"/>
    <elementType name="LIN28" minLength="2" maxLength="2" base="string"/>
    <elementType name="LIN29" minLength="1" maxLength="10" base="string"/>
    <segmentType name="SN1">
        <sequence>
            <element type="CPP001"/>
            <element type="SN102" minOccurs="1"/>
            <element type="SN103" minOccurs="1"/>
        </sequence>
    </segmentType>
    <elementType name="SN102" minLength="1" maxLength="7" base="numeric"/>
    <elementType name="SN103" minLength="2" maxLength="2" base="string"/>
    <segmentType name="MEA">
        <sequence>
            <element type="MEA01" minOccurs="1"/>
            <element type="MEA02" minOccurs="1"/>
            <element type="MEA03" minOccurs="1"/>
            <composite type="MEA04"/>
        </sequence>
    </segmentType>
    <compositeType name="MEA04">
        <sequence>
            <element type="MEA0401" minOccurs="1"/>
        </sequence>
    </compositeType>
    <elementType name="MEA01" minLength="2" maxLength="2" base="string"/>
    <elementType name="MEA02" minLength="1" maxLength="3" base="string"/>
    <elementType name="MEA03" minLength="1" maxLength="10" base="string"/>
    <elementType name="MEA0401" minLength="2" maxLength="2" base="string"/>
    <segmentType name="CTT">
        <sequence>
            <element position="1" type="CTT01" minOccurs="1"/>
            <element position="2" type="CTT02" minOccurs="1"/>
        </sequence>
    </segmentType>
    <elementType name="CTT01" minLength="1" maxLength="6" base="numeric"/>
    <elementType name="CTT02" minLength="1" maxLength="10" base="string"/>
</schema>
MikeEdgar commented 5 months ago

@Brinderjit , the HL loop defined in the <transaction> should be a single loop (i.e. the standard loop). Only in the <implementation> is there a differentiation between the occurrences.

Brinderjit commented 5 months ago

@MikeEdgar I changed the transaction to have only one HL loop and 3 different implementations but still parser does not differentiate between different implementations.


`<schema xmlns="http://xlate.io/EDISchema/v4">
    <transaction>
        <sequence>
            <segment type="BSN" minOccurs="1" maxOccurs="1"/>
            <segment type="DTM" minOccurs="1" maxOccurs="1"/>
            <loop code="HL_LOOP" minOccurs="1" maxOccurs="2147483647" levelIdPosition="1" parentIdPosition="2">
                <sequence>
                    <segment type="HL"  />
                    <segment type="TD1" />
                    <segment type="TD5" />
                    <segment type="TD3" />
                    <segment type="TD4" />
                    <segment type="REF" />
                    <segment type="DTM" />
                    <loop code="N1_LOOP" >
                        <sequence>
                            <segment type="N1" />
                        </sequence>
                    </loop>
                    <segment type="LIN" />
                    <segment type="REF" />
                    <segment type="LIN" />
                    <segment type="SN1" />
                    <segment type="MEA" />
                    <segment type="REF"/>
                </sequence>
            </loop>
            <segment type="CTT" minOccurs="1" maxOccurs="1"/>
        </sequence>
    </transaction>
    <implementation>
        <sequence>
            <segment type="BSN" minOccurs="1" maxOccurs="1"/>
            <segment type="DTM" minOccurs="1" maxOccurs="1"/>
            <loop code="HL_LOOP" type="HL_LOOP" minOccurs="1" maxOccurs="1">
                <sequence>
                    <segment type="HL" code="HL_S" minOccurs="1" maxOccurs="1" discriminator="3" title="Shipment Hierarchical Level">
                        <sequence>
                            <element position="1" minOccurs="1"/>
                            <element position="2"/>
                            <element position="3" minOccurs="1" title="Entity Identifier Code">
                                <enumeration>
                                    <value title="Shipment">S</value>
                                </enumeration>
                            </element>
                        </sequence>
                    </segment>
                    <segment type="TD1" minOccurs="1" maxOccurs="3"/>
                    <segment type="TD5" minOccurs="1" maxOccurs="1"/>
                    <segment type="TD3" minOccurs="1" maxOccurs="1"/>
                    <segment type="TD4" minOccurs="0" maxOccurs="1"/>
                    <segment type="REF" minOccurs="1" maxOccurs="1"/>
                    <segment type="DTM" minOccurs="1" maxOccurs="1"/>
                    <loop code="N1_LOOP" type="N1_LOOP" minOccurs="1" maxOccurs="3">
                        <sequence>
                            <segment type="N1" minOccurs="1" maxOccurs="3"/>
                        </sequence>
                    </loop>
                </sequence>
            </loop>
            <loop code="HL_HL_LOOP" type="HL_LOOP" minOccurs="1" maxOccurs="2147483647" discriminator="3" >
                <sequence>
                    <segment type="HL" code="HL_T" minOccurs="1" maxOccurs="1" discriminator="3" title="Tare/Pallet Hierarchical Level">
                        <sequence>
                            <element position="1" minOccurs="1"/>
                            <element position="2" minOccurs="1"/>
                            <element position="3" minOccurs="1" title="Entity Identifier Code">
                                <enumeration>
                                    <value title="Shipping Tare">T</value>
                                </enumeration>
                            </element>
                        </sequence>
                    </segment>
                    <segment type="LIN" minOccurs="1" maxOccurs="1"/>
                    <segment type="REF" minOccurs="1" maxOccurs="1"/>
                </sequence>
            </loop>
            <loop code="HL_HL_HL_LOOP" type="HL_LOOP" minOccurs="1" maxOccurs="2147483647" discriminator="3">
                <sequence>
                    <segment type="HL" code="HL_I" minOccurs="1" maxOccurs="1" discriminator="3" title="Item Hierarchical Level">
                        <sequence>
                            <element position="1" minOccurs="1"/>
                            <element position="2" minOccurs="1"/>
                            <element position="3" minOccurs="1" title="Entity Identifier Code">
                                <enumeration>
                                    <value title="Item">I</value>
                                </enumeration>
                            </element>
                        </sequence>
                    </segment>
                    <segment type="LIN" minOccurs="1" maxOccurs="1"/>
                    <segment type="SN1" minOccurs="1" maxOccurs="1"/>
                    <segment type="MEA" minOccurs="1" maxOccurs="1"/>
                    <segment type="REF" minOccurs="1" maxOccurs="1"/>
                </sequence>
            </loop>
            <segment type="CTT" minOccurs="1" maxOccurs="1"/>
        </sequence>
    </implementation>
    <segmentType name="BSN">
        <sequence>
            <element position="1" type="BSN01" minOccurs="1"/>
            <element position="2" type="BSN02" minOccurs="1"/>
            <element position="3" type="BSN03" minOccurs="1"/>
            <element position="4" type="BSN04" minOccurs="1"/>
        </sequence>
    </segmentType>
    <elementType name="BSN01" minLength="2" maxLength="2" base="string"/>
    <elementType name="BSN02" minLength="8" maxLength="8" base="string"/>
    <elementType name="BSN03" minLength="8" maxLength="8" base="date"/>
    <elementType name="BSN04" minLength="4" maxLength="4" base="time"/>
    <segmentType name="DTM">
        <sequence>
            <element type="DTM01" minOccurs="1"/>
            <element type="DTM02" minOccurs="1"/>
            <element type="DTM03" minOccurs="1"/>
        </sequence>
    </segmentType>
    <elementType name="DTM01" minLength="3" maxLength="3" base="string"/>
    <elementType name="DTM02" minLength="8" maxLength="8" base="date"/>
    <elementType name="DTM03" minLength="4" maxLength="4" base="time"/>
    <segmentType name="N1">
        <sequence>
            <element position="1" type="N101" minOccurs="1"/>
            <element position="2" type="CPP001"/>
            <element position="3" type="N103" minOccurs="1"/>
            <element position="4" type="N104" minOccurs="1"/>
        </sequence>
    </segmentType>
    <elementType name="N101" minLength="2" maxLength="2" base="string"/>
    <elementType name="N103" minLength="1" maxLength="2" base="string"/>
    <elementType name="N104" minLength="2" maxLength="8" base="string"/>
    <segmentType name="HL">
        <sequence>
            <element position="1" type="HL01" minOccurs="1"/>
            <element position="2" type="HL02"/>
            <element position="3" type="HL03" minOccurs="1"/>
        </sequence>
    </segmentType>
    <elementType name="CPP001" base="string"/>
    <elementType name="HL01" minLength="1" maxLength="12" base="string"/>
    <elementType name="HL02" minLength="1" maxLength="12" base="string"/>
    <elementType name="HL03" minLength="1" maxLength="2" base="string"/>
    <segmentType name="TD1">
        <sequence>
            <element position="1" type="TD101"/>
            <element position="2" type="TD102"/>
            <element position="3" type="CPP001"/>
            <element position="4" type="CPP001"/>
            <element position="5" type="CPP001"/>
            <element position="6" type="TD106"/>
            <element position="7" type="TD107"/>
            <element position="8" type="TD108"/>
        </sequence>
    </segmentType>
    <elementType name="TD101" minLength="3" maxLength="5" base="string"/>
    <elementType name="TD102" minLength="1" maxLength="7" base="numeric"/>
    <elementType name="TD106" minLength="1" maxLength="2" base="string"/>
    <elementType name="TD107" minLength="1" maxLength="10" base="decimal"/>
    <elementType name="TD108" minLength="2" maxLength="2" base="string"/>
    <segmentType name="TD5">
        <sequence>
            <element position="1" type="CPP001"/>
            <element position="2" type="TD502" minOccurs="1"/>
            <element position="3" type="TD503" minOccurs="1"/>
            <element position="4" type="CPP001"/>
            <element position="5" type="TD505"/>
        </sequence>
    </segmentType>
    <elementType name="TD502" minLength="1" maxLength="2" base="string"/>
    <elementType name="TD503" minLength="4" maxLength="4" base="string"/>
    <elementType name="TD505" minLength="1" maxLength="35" base="string"/>
    <segmentType name="TD3">
        <sequence>
            <element position="1" type="TD301" minOccurs="1"/>
            <element position="2" type="CPP001"/>
            <element position="3" type="TD303" minOccurs="1"/>
        </sequence>
    </segmentType>
    <elementType name="TD301" minLength="2" maxLength="2" base="string"/>
    <elementType name="TD303" minLength="1" maxLength="10" base="string"/>
    <segmentType name="TD4">
        <sequence>
            <element position="1" type="TD401"/>
        </sequence>
    </segmentType>
    <elementType name="TD401" minLength="2" maxLength="3" base="string"/>
    <segmentType name="REF">
        <sequence>
            <element type="REF01" minOccurs="1"/>
            <element type="REF02" minOccurs="1"/>
        </sequence>
    </segmentType>
    <elementType name="REF01" minLength="2" maxLength="3" base="string"/>
    <elementType name="REF02" minLength="1" maxLength="16" base="string"/>
    <segmentType name="LIN">
        <sequence>
            <element position="1" type="CPP001"/>
            <element position="2" type="LIN02" minOccurs="1"/>
            <element position="3" type="LIN03" minOccurs="1"/>
            <element position="4" type="LIN04" minOccurs="0"/>
            <element position="5" type="LIN05" minOccurs="0"/>
            <element position="6" type="LIN06" minOccurs="0"/>
            <element position="7" type="LIN07" minOccurs="0"/>
            <element position="8" type="LIN08" minOccurs="0"/>
            <element position="9" type="LIN09" minOccurs="0"/>
            <element position="10" type="LIN10" minOccurs="0"/>
            <element position="11" type="LIN11" minOccurs="0"/>
            <element position="12" type="LIN12" minOccurs="0"/>
            <element position="13" type="LIN13" minOccurs="0"/>
            <element position="14" type="LIN14" minOccurs="0"/>
            <element position="15" type="LIN15" minOccurs="0"/>
            <element position="16" type="LIN16" minOccurs="0"/>
            <element position="17" type="LIN17" minOccurs="0"/>
            <element position="18" type="LIN18" minOccurs="0"/>
            <element position="19" type="LIN19" minOccurs="0"/>
            <element position="20" type="LIN20" minOccurs="0"/>
            <element position="21" type="LIN21" minOccurs="0"/>
            <element position="22" type="LIN22" minOccurs="0"/>
            <element position="23" type="LIN23" minOccurs="0"/>
            <element position="24" type="LIN24" minOccurs="0"/>
            <element position="25" type="LIN25" minOccurs="0"/>
            <element position="26" type="LIN26" minOccurs="0"/>
            <element position="27" type="LIN27" minOccurs="0"/>
            <element position="28" type="LIN28" minOccurs="0"/>
            <element position="29" type="LIN29" minOccurs="0"/>
        </sequence>
    </segmentType>
    <elementType name="LIN02" minLength="2" maxLength="2" base="string"/>
    <elementType name="LIN03" minLength="1" maxLength="29" base="string"/>
    <elementType name="LIN04" minLength="2" maxLength="2" base="string"/>
    <elementType name="LIN05" minLength="1" maxLength="16" base="string"/>
    <elementType name="LIN06" minLength="1" maxLength="2" base="string"/>
    <elementType name="LIN07" minLength="1" maxLength="12" base="string"/>
    <elementType name="LIN08" minLength="2" maxLength="2" base="string"/>
    <elementType name="LIN09" minLength="1" maxLength="6" base="string"/>
    <elementType name="LIN10" minLength="2" maxLength="2" base="string"/>
    <elementType name="LIN11" minLength="1" maxLength="6" base="string"/>
    <elementType name="LIN12" minLength="2" maxLength="2" base="string"/>
    <elementType name="LIN13" minLength="5" maxLength="10" base="string"/>
    <elementType name="LIN14" minLength="2" maxLength="2" base="string"/>
    <elementType name="LIN15" minLength="10" maxLength="10" base="string"/>
    <elementType name="LIN16" minLength="2" maxLength="2" base="string"/>
    <elementType name="LIN17" minLength="2" maxLength="2" base="string"/>
    <elementType name="LIN18" minLength="2" maxLength="2" base="string"/>
    <elementType name="LIN19" minLength="10" maxLength="10" base="string"/>
    <elementType name="LIN20" minLength="2" maxLength="2" base="string"/>
    <elementType name="LIN21" minLength="2" maxLength="2" base="string"/>
    <elementType name="LIN22" minLength="2" maxLength="2" base="string"/>
    <elementType name="LIN23" minLength="1" maxLength="20" base="string"/>
    <elementType name="LIN24" minLength="2" maxLength="2" base="string"/>
    <elementType name="LIN25" minLength="1" maxLength="16" base="string"/>
    <elementType name="LIN26" minLength="2" maxLength="2" base="string"/>
    <elementType name="LIN27" minLength="1" maxLength="10" base="string"/>
    <elementType name="LIN28" minLength="2" maxLength="2" base="string"/>
    <elementType name="LIN29" minLength="1" maxLength="10" base="string"/>
    <segmentType name="SN1">
        <sequence>
            <element type="CPP001"/>
            <element type="SN102" minOccurs="1"/>
            <element type="SN103" minOccurs="1"/>
        </sequence>
    </segmentType>
    <elementType name="SN102" minLength="1" maxLength="7" base="numeric"/>
    <elementType name="SN103" minLength="2" maxLength="2" base="string"/>
    <segmentType name="MEA">
        <sequence>
            <element type="MEA01" minOccurs="1"/>
            <element type="MEA02" minOccurs="1"/>
            <element type="MEA03" minOccurs="1"/>
            <composite type="MEA04"/>
        </sequence>
    </segmentType>
    <compositeType name="MEA04">
        <sequence>
            <element type="MEA0401" minOccurs="1"/>
        </sequence>
    </compositeType>
    <elementType name="MEA01" minLength="2" maxLength="2" base="string"/>
    <elementType name="MEA02" minLength="1" maxLength="3" base="string"/>
    <elementType name="MEA03" minLength="1" maxLength="10" base="string"/>
    <elementType name="MEA0401" minLength="2" maxLength="2" base="string"/>
    <segmentType name="CTT">
        <sequence>
            <element position="1" type="CTT01" minOccurs="1"/>
            <element position="2" type="CTT02" minOccurs="1"/>
        </sequence>
    </segmentType>
    <elementType name="CTT01" minLength="1" maxLength="6" base="numeric"/>
    <elementType name="CTT02" minLength="1" maxLength="10" base="string"/>
</schema>`
NandaBalakrishnan commented 5 months ago

Hello @MikeEdgar Thanks for taking up the question.

we have defined implementation schema as per the example and we are able to segregate the data but is there any way to figure out whether HL segment data are in sequence or we have to do the validation separately ? In the below example HL*2**I is missing.

HL*1**O~ 
HL*3**I~ 
Brinderjit commented 5 months ago

@MikeEdgar I was able to fix the issue. Appreciate your help.

MikeEdgar commented 5 months ago

we have defined implementation schema as per the example and we are able to segregate the data but is there any way to figure out whether HL segment data are in sequence or we have to do the validation separately ?

There isn't any way to configure it to check for gaps in the sequences, no. I could be wrong, but I don't think there's anything in the standard that says they need to be sequential or without gaps. That is more something that is agreed/enforced between trading partners. Like I said, I could be wrong on that though.

MikeEdgar commented 5 months ago

@NandaBalakrishnan did you get the HL validation working (aside from the sequence number check)? Let me know if we can close the issue.

NandaBalakrishnan commented 5 months ago

we are able to do the validation. you can close the issue.

Thank you @MikeEdgar

NandaBalakrishnan commented 5 months ago

Hi @MikeEdgar ,
Do we need to add anything in readerservice to consider implementation schema, as of now it is throwing unexpected segment for all segments?

MikeEdgar commented 5 months ago

@NandaBalakrishnan are you setting both the standard and the implementation schemas on the reader in your code? If you have a small self-contained reproducer/example that would help me determine if there is a bug or something missing in your code.

NandaBalakrishnan commented 5 months ago

Hi Sir,

      I have transaction and implementation in same schema file and I

am setting control and transaction schema in reader service. Do you have any reference to set the implementation schema in reader service. Pls let me know sir.

MikeEdgar commented 5 months ago

@NandaBalakrishnan , what you are doing is correct (control and transaction schemas with the transaction schema including standard + implementation).

NandaBalakrishnan commented 5 months ago

@MikeEdgar , changes are not working in local also, it is throwing unexpected segment errors. It is not able to recognise HL segment in HL loop instead it is considering HL segment part of N1Loop. Can you help on this?

MikeEdgar commented 4 months ago

@NandaBalakrishnan , I'm not sure but possibly an out-of-date schema file? It sounds like an issue with how the app and container image are being built.