why the output from BOTS doesn't preserve the order of out.put

81 views
Skip to first unread message

Bing Yu

unread,
Aug 18, 2021, 8:04:48 PM8/18/21
to Bots Open Source EDI Translator
Here is my mapping script for 837P

sbr02 = lin.get({'BOTSID':'HEA','f15_6_RELATIONSHIP':None})  
            if sbr02 == "18":
                out.put({'BOTSID':'ST'},{'BOTSID':'HL','HL01':'2','HL02':'1','HL03':'22','HL04':'0'})
            else:   
                sbr02 = ""
                out.put({'BOTSID':'ST'},{'BOTSID':'HL','HL01':'2','HL02':'1','HL03':'22','HL04':'1'}) 
           # out.put({'BOTSID':'ST'},{'BOTSID':'HL','HL01':'2','HL02':'1','HL03':'22','HL04':'0'})
            out.put({'BOTSID':'ST'},{'BOTSID':'HL','HL01':'2'},({'BOTSID':'SBR','SBR01':'P','SBR02':sbr02,'SBR03':lin.get({'BOTSID':'HEA','RCL_Member_Num':None}),'SBR09':'BL'}))
            out.put({'BOTSID':'ST'},{'BOTSID':'HL','HL01':'2'},({'BOTSID':'NM1','NM101':'IL','NM102':'1','NM103':lin.get({'BOTSID':'HEA','PatLName':None})}))
            out.put({'BOTSID':'ST'},{'BOTSID':'HL','HL01':'2'},({'BOTSID':'NM1','NM101':'IL','NM102':'1','NM104':lin.get({'BOTSID':'HEA','PatFName':None})}))
            out.put({'BOTSID':'ST'},{'BOTSID':'HL','HL01':'2'},({'BOTSID':'NM1','NM101':'IL','NM102':'1','NM108':'MI','NM109':lin.get({'BOTSID':'HEA','f15_1A':None})}))            
            out.put({'BOTSID':'ST'},{'BOTSID':'HL','HL01':'2'},{'BOTSID':'NM1','NM101':'IL'},({'BOTSID':'N3','N301':lin.get({'BOTSID':'HEA','f15_5_ADDRESS':None})}))
            out.put({'BOTSID':'ST'},{'BOTSID':'HL','HL01':'2'},{'BOTSID':'NM1','NM101':'IL'},({'BOTSID':'N4','N401':lin.get({'BOTSID':'HEA','f15_5_CITY':None})}))
            out.put({'BOTSID':'ST'},{'BOTSID':'HL','HL01':'2'},{'BOTSID':'NM1','NM101':'IL'},({'BOTSID':'N4','N402':lin.get({'BOTSID':'HEA','f15_5_STATE':None})}))
            out.put({'BOTSID':'ST'},{'BOTSID':'HL','HL01':'2'},{'BOTSID':'NM1','NM101':'IL'},({'BOTSID':'N4','N403':lin.get({'BOTSID':'HEA','f15_5_ZIP':None})}))
            out.put({'BOTSID':'ST'},{'BOTSID':'HL','HL01':'2'},{'BOTSID':'NM1','NM101':'IL'},({'BOTSID':'DMG','DMG01':'D8'}))
            out.put({'BOTSID':'ST'},{'BOTSID':'HL','HL01':'2'},{'BOTSID':'NM1','NM101':'IL'},({'BOTSID':'DMG','DMG02':lin.get({'BOTSID':'HEA','f15_3_DATE':None})}))
            out.put({'BOTSID':'ST'},{'BOTSID':'HL','HL01':'2'},{'BOTSID':'NM1','NM101':'IL'},({'BOTSID':'DMG','DMG03':lin.get({'BOTSID':'HEA','f15_3_SEX':None})}))
            
            #LOOP 2010BB PAYER NAME
            out.put({'BOTSID':'ST'},{'BOTSID':'HL','HL01':'2'},({'BOTSID':'NM1','NM101':'PR','NM102':'2','NM103':lin.get({'BOTSID':'HEA','f15_0_1':None})}))
            #out.put({'BOTSID':'ST'},{'BOTSID':'HL','HL01':'2'},({'BOTSID':'NM1','NM101':'PR','NM102':'2','NM108':'PI','NM109':out.ta_info['topartner']}))
            out.put({'BOTSID':'ST'},{'BOTSID':'HL','HL01':'2'},({'BOTSID':'NM1','NM101':'PR','NM102':'2','NM108':'PI','NM109':PayerID})) #per HCSC EDI email 10/2/18
            out.put({'BOTSID':'ST'},{'BOTSID':'HL','HL01':'2'},{'BOTSID':'NM1','NM101':'PR'},({'BOTSID':'N3','N301':lin.get({'BOTSID':'HEA','f15_0_2':None})}))
            out.put({'BOTSID':'ST'},{'BOTSID':'HL','HL01':'2'},{'BOTSID':'NM1','NM101':'PR'},({'BOTSID':'N4','N401':lin.get({'BOTSID':'HEA','Carrier_City':None})}))
            out.put({'BOTSID':'ST'},{'BOTSID':'HL','HL01':'2'},{'BOTSID':'NM1','NM101':'PR'},({'BOTSID':'N4','N402':lin.get({'BOTSID':'HEA','Carrier_State':None})}))
            out.put({'BOTSID':'ST'},{'BOTSID':'HL','HL01':'2'},{'BOTSID':'NM1','NM101':'PR'},({'BOTSID':'N4','N403':lin.get({'BOTSID':'HEA','Carrier_Zip':None})}))
            #supplemental billing info below    
            #out.put({'BOTSID':'ST'},{'BOTSID':'HL','HL01':'2'},{'BOTSID':'NM1','NM101':'PR'},({'BOTSID':'REF','REF01':'G2','REF02':lin.get({'BOTSID':'HEA','f15_33_B':None})}))
            if sbr02 != "18":
                out.put({'BOTSID':'ST'},{'BOTSID':'HL','HL01':'2','HL02':'2','HL03':'23','HL04':'0'})
                out.put({'BOTSID':'ST'},{'BOTSID':'HL','HL01':'2'},{'BOTSID':'PAT','PAT01':lin.get({'BOTSID':'HEA','f15_6_RELATIONSHIP':None})}) #PAT*19
                out.put({'BOTSID':'ST'},{'BOTSID':'HL','HL01':'2'},({'BOTSID':'NM1','NM101':'QC','NM102':'1','NM103':lin.get({'BOTSID':'HEA','InsLName':None})}))
                out.put({'BOTSID':'ST'},{'BOTSID':'HL','HL01':'2'},({'BOTSID':'NM1','NM101':'QC','NM102':'1','NM104':lin.get({'BOTSID':'HEA','InsFName':None})}))
                #out.put({'BOTSID':'ST'},{'BOTSID':'HL','HL01':'2'},({'BOTSID':'NM1','NM101':'QC','NM102':'1','NM108':'MI','NM109':lin.get({'BOTSID':'HEA','f15_1A':None})}))            
                out.put({'BOTSID':'ST'},{'BOTSID':'HL','HL01':'2'},{'BOTSID':'NM1','NM101':'QC'},({'BOTSID':'N3','N301':lin.get({'BOTSID':'HEA','f15_5_ADDRESS':None})}))
                out.put({'BOTSID':'ST'},{'BOTSID':'HL','HL01':'2'},{'BOTSID':'NM1','NM101':'QC'},({'BOTSID':'N4','N401':lin.get({'BOTSID':'HEA','f15_5_CITY':None})}))
                out.put({'BOTSID':'ST'},{'BOTSID':'HL','HL01':'2'},{'BOTSID':'NM1','NM101':'QC'},({'BOTSID':'N4','N402':lin.get({'BOTSID':'HEA','f15_5_STATE':None})}))
                out.put({'BOTSID':'ST'},{'BOTSID':'HL','HL01':'2'},{'BOTSID':'NM1','NM101':'QC'},({'BOTSID':'N4','N403':lin.get({'BOTSID':'HEA','f15_5_ZIP':None})}))
                out.put({'BOTSID':'ST'},{'BOTSID':'HL','HL01':'2'},{'BOTSID':'NM1','NM101':'QC'},({'BOTSID':'DMG','DMG01':'D8'}))
                out.put({'BOTSID':'ST'},{'BOTSID':'HL','HL01':'2'},{'BOTSID':'NM1','NM101':'QC'},({'BOTSID':'DMG','DMG02':lin.get({'BOTSID':'HEA','f15_3_DATE':None})}))
                out.put({'BOTSID':'ST'},{'BOTSID':'HL','HL01':'2'},{'BOTSID':'NM1','NM101':'QC'},({'BOTSID':'DMG','DMG03':lin.get({'BOTSID':'HEA','f15_3_SEX':None})}))

the value of sbr02 from input file = 19 and my output result is like

HL*2*1*22*1~
SBR*P**WIfdsfkdsjfdsM******BL~
PAT*19~
NM1*IL*1*mylastname*myfirstname****MI*111111~
N3*111 N MAIN ST~
N4*CHXXXX*TX*5xxxxxx~
DMG*D8*20201220*F~
NM1*PR*2*XXXXXX*****PI*11111~
N3*PO BOX 11111~
N4*XXXX*XX*45512~
NM1*QC*1*XXXX*XXX~
N3*38 N MAIN ST~
N4*XXXX*XXX*53141452~
DMG*D8*2020101010*F~

But I expect the output should be like this, 

HL*2*1*22*1~
SBR*P**WIfdsfkdsjfdsM******BL~
NM1*IL*1*mylastname*myfirstname****MI*111111~
N3*111 N MAIN ST~
N4*CHXXXX*TX*5xxxxxx~
DMG*D8*20201220*F~
NM1*PR*2*XXXXXX*****PI*11111~
N3*PO BOX 11111~
N4*XXXX*XX*45512~
HL*2*2*23*0~ (the position of this line even further down)
PAT*19~
NM1*QC*1*XXXX*XXX~
N3*38 N MAIN ST~
N4*XXXX*XXX*53141452~
DMG*D8*2020101010*F~

I don't know  why PAT*19~ is right after SBR segment ?

MY question what controls the order of output  ?
I know it is grammar but how and why ? 

Thanks.

 

Eppye Bots

unread,
Aug 18, 2021, 8:13:13 PM8/18/21
to 'Chuck Turco' via Bots Open Source EDI Translator
output is as in grammar.

the looping of HLs is not done right.
see attachemtn for correct looping of HLs. It is not a 837, but 856 with HL looping.
should give you idea of how to do correct HL looping.


kind regards, Henk-Jan Ebbers


--
You received this message because you are subscribed to the Google Groups "Bots Open Source EDI Translator" group.
To unsubscribe from this group and stop receiving emails from it, send an email to botsmail+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/botsmail/39a1a063-b962-463f-b6c5-db4df64b15c2n%40googlegroups.com.
asn_xml2x12.txt

Bing Yu

unread,
Aug 18, 2021, 9:18:09 PM8/18/21
to Bots Open Source EDI Translator
Henk-Jan Ebbers,

Thanks ! will take a look ...

Bing

Thank you for your time.
Reply all
Reply to author
Forward
0 new messages