简体   繁体   中英

How to parse HIPAA 834 EDI File and generate 997 using python?

I have to parse and validate HIPAA 834 EDI file and generate 997 response with the success or error message

Sample 834 EDI File:

ISA 00 00 30 261401960 30 261105741 210525 0609*^ 00501 189171275 0 T*:~

GS BE 161401960 Facets 20210525 0609 171275 X 005010X220A1~

ST 834 0001*005010X220A1~

REF 38 00417558~

QTY DT 958~

QTY**1381~

QTY**1381~

N1 IN HealthPLAN FI 161105741~

INS Y 18 030 XN A **AC N N~

F 0F 951747732~

REF 1L 00417558~

REF 17 0001~

REF DX 0001~

DTP 336 D8*20040202~

PER IP**EM mvastola@wscschools.org HP 7169543565~

N3*130 Rosewood Dr.~

N4 West Seneca NY*14224~

DMG D8 19810817 M M~

HD 024**HLT CPO1Y000*FAM~

INS Y 18 030 XN A **AC N N~

DTP 303 D8*20200701~

INS N 01 030 XN A ** N N~

REF 0F 951747732~

REF 1L 00417558~

REF 17 0001~

REF DX 0001~

NM1 IL 1 Testmember Jessica*** 34 962703984~

N3*130 Rosewood Dr.~

N4 West Seneca NY*14224~

DMG D8 19820720*F~

HD 024**HLT CPO1Y000*FAM~

DTP 303 D8*20200701~

DTP 348 D8*20200701~

INS N 19 030 XN A ** F N~

REF 0F 951747732~

REF 1L 00417558~

REF 17 0001~ REF DX 0001~

NM1 IL 1 testy Sofia*** 34 992599285~

N3*130 Rosewood Dr.~

N4 West Seneca NY*14224~

DMG D8 20120524*F~

HD 030**HLT CPO1Y000*FAM~

DTP 303 D8*20200701~

DTP 348 D8*20200701~

SE 47 0001~

GE 1 171275~

IEA 1 189171275~

please help me out to resolve the issue, I'm not understanding how to use pyx12 parser library which is available in python or implement the code using pyx12

It looks like you've lost a bit of your formatting.

The ~ is the segment terminator. The * character is the element separator. So you should first split by the segment end, read each segment in, and then parse each element.

There is the concept of qualifiers, backed by a dictionary. The N1 segment typically holds names, with N3 and N4 being address segments. The first element in the N1 segment (N101) is a qualifier. It describes the data in the N102 using a code value. The 834 has many of these.

REF 17 0001~ REF DX 0001~

In this case 17 and DX describe what value is in the REF02.

You should download a tool like EDI Notepad so that you can understand what each element is, what it means and how to parse it into something your application can understand.

Once you follow Andrew's advice above and get the EDI file properly formatted, if you want to parse this document and understand the semantics without downloading any software, you can use Stedi's EDI Inspector tool: https://edi.stedi.com/inspector .

Just copy paste the EDI file on the left, and select "JSON" view on the right hand side. If you file is invalid, it will provide you with validation errors and recommendations.

Not sure how to parse the file in Python, but if you want to quickly view and validate it, then generate a 997/999, all for free, head on to https://www.edination.com/ . BTW, 834 is a HIPAA transaction, and you shouldn't be posting these online at all as it violates the HIPAA rules.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM