Click here to Skip to main content
16,016,140 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear All,

My requirement is to validate and parse the x12 format 837 document which is health care claim using C#.net or VB.net.
I am in complete confusion about where to start form.
please help me in this regard.
FYI this is how my x12 837 looks
ISA*00*          *00*          *ZZ*1234           *ZZ*4314207640OO00 *100506*1038*U*00401*000000266*1*P*:~
GS*HC*1234*4314207640*20100506*1038*913948711*X*004010X098A1~
ST*837*000000001~
BHT*0019*00*0000266*20100506*0001*CH~
REF*87*004010X098A1~
NM1*41*2*SUBMITTER NAME*****46*1234~
PER*IC*BILLING CONTACT*TE*9512529400*FX*9512522401~
NM1*40*2*GATEWAYEDI*****46*4314207640OO00~
HL*1**20*1~
NM1*85*2*OFFICE NAME*****XX*NPI NUMBER~
N3*850 MAIN AVENUE~
N4*NEW YORK*NY*10019~
REF*EI*TAX ID~
HL*2*1*22*0~
SBR*P*18*******MB~
NM1*IL*1*MOUSE*MICKEY****MI*00000003T~
N3*1000 AVENUE ~
N4*NEW YORK*NY*55555~
DMG*D8*19001200*M~
NM1*PR*2*MEDICARE PART B*****PI*13202~
N3*PO BOX 100~
N4*YORKTOWN HEIGHTS*NY*10598~
CLM*ACCOUNT NUMBER*108.79***11::1*Y*A*Y*Y*B~
REF*X4*PT-027960-1~
HI*BK:7244~
NM1*DN*1*DOO*SCOOBY****XX*NPI~
NM1*82*1*RABIT*ROGER****XX*NPI~
REF*EI*352230164~
NM1*DQ*1*WHITE*SNOW****XX*NPI~
SBR*S*18*U3859002101**C1****CI~
DMG*D8*19001200*M~
OI***Y*B**Y~
NM1*IL*1*DUCK*DONALD****MI*U3000000~
N3*1779 AVENUE~
N4*NEW YORK*NY*10100~
NM1*PR*2*CIGNA*****PI*62308~
N3*PO BOX 5200~
N4*SCRANTON*PA*18505~
LX*1~
SV1*HC:97110:GP*33.1*UN*1***1~
DTP*472*D8*20100421~
REF*6R*AXZ04211055~
LX*2~
SV1*HC:97140:GP*61.86*UN*2***1~
DTP*472*D8*20100421~
REF*6R*AXZ04211056~
LX*3~
SV1*HC:G0283:GP*13.83*UN*1***1~
DTP*472*D8*20100421~
REF*6R*AXZ04211057~
HL*3*1*22*0~
................


Thanks & Regards
SunilWise
Posted
Comments
OriginalGriff 30-Jun-10 5:21am    
"how to validate this raw data" - There is nothing AFAIK that will validate the data as it stands (true validation will depend on the individual field content, bases on the code at the start of each record, I assume).
But the basic process is pretty simple:
Check each record invidually:
Does it start with an alpha character, and end with '~'?
Split it on '*' and check if the first field is in the "records code" list
Check remaining field content depending on record code.
Without seeing a spec for the file format, that's all I can give you!

1 solution

It looks fairly consistent, and should be pretty easy to parse if you know what the various bits mean. It looks like each line/record starts with a type code, and ends with '~', with '*' as a separator.

I would start by looking for the spec for the file content - it may be public, but if not then you either need to work it out (yeuchh, prone to errors and missed bits) or talk to teh file format originator.

After that, it looks pretty simple, if somewhat repetitive.

Where are you having problems?
 
Share this answer
 
Comments
Sunil Wise 30-Jun-10 5:07am    
as you said it should be simple to parse the above raw data. if the data is 100% correct. but how to validate this raw data (like schema validation ie., xsd used for xml.) Thanks & Regards SunilWise

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900