|
From: ddegroff <do-...@jb...> - 2006-06-24 16:32:46
|
OK, Tom. Here's the challenge: The data (the most simple example I could devise in the environment where I typically work) looks like this: ISA*00* *00* *ZZ*EXTERNAL_TP *ZZ*INTERNAL_TP *010806*1200*U*00401*000000003*0*T*: GS*HS*EXTERNAL_AP*INTERNAL_AP*20010101*120000*001*X*004010X092 ST*270*0001 BHT*0022*13*10001234*19990501*1319 HL*1**20*1 NM1*PR*2*ABC COMPANY*****PI*842610001 HL*2*1*21*1 NM1*1P*1*JONES*MARCUS****SV*0202034 HL*3*2*22*0 TRN*1*93175-012547*9877281234 NM1*IL*1*SMITH*ROBERT*B***MI*11122333301 REF*1L*599119 DMG*D8*19430519*M DTP*472*D8*19990501 EQ*98**FAM SE*14*0001 GE*1*001 IEA*1*000000003 Pretty, huh? This is ANSI X12N, the required format for US healthcare these days (stay tuned, HL7 is being knocked about as the "new" standard upcoming -- it, at least, is XML). X12N format is based on "segments" (each line starting with a two- to three-character code). Each "element" of data is, at least in this example, separated by asterisks. For readability, I've left the segment terminator as a line feed. This format is excruciatingly hierarchical. That is, a single transmission might contain multiple "interchanges" (that's the bit between the lines starting with "ISA" and ending with "IEA"). Each interchange may have one or more "groups" (bracketed by "GS" and "GE"). The target, if you will is the "transaction", located between "ST" and "SE". I'm going to take a crack at this myself, but my suggestion would be to tackle this in stages. First, check the transmission for interchanges, validating the ISA and IEA segments according to rules (to be posted subsequently). Then, invoke one secondary action for each interchange found, to check for groups. And so on. The output for the exercise is XML (the publisher who came up with the X12 has a version that I'm not too keen on) -- I'll be back shortly with my version, along with more descriptions for the input data elements. For now, I would recommend transforming this mess into an XML like <batch><ISA><ISA01>00</ISA01>... etc.</ISA></batch> where ISA01 is the first element found in the ISA segment, etc. Where an empty value is found (see the HL segment), the example would be <HL02></HL02>. I will be posting subsequent info via URLs so the forum can be spared the volume... :-) Please advise if this makes little sense. Dave De View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3953215#3953215 Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3953215 |