X12 837P Health Care Claim: Professional Last updated: 2026-09-29
The 837P is the HIPAA-mandated EDI transaction a physician, clinic or billing service sends to a payer to bill for professional services - the electronic equivalent of the CMS-1500 paper form.
The payer answers with a 999 acknowledgment for syntax, a 277CA claim acknowledgment for acceptance, and later an 835 remittance advice with the payment. Claims are organized in HL loops: billing provider, subscriber, then patient when the patient is not the subscriber.
At a glance
- Standard
- X12 HIPAA
- Implementation guide
005010X222A1- Functional group
HC(GS01)- Sent by
- Provider or billing service to payer or clearinghouse
- Responses
- 999, 277CA, 835
- ediFabric .NET template
TS837PinEdiFabric.Templates.Hipaa- OpenEDI definition
- View 837P in the spec library
837P structure
The full X12 837P layout from its OpenEDI definition, the same model ediFabric uses to parse, validate and generate it: 65 loops and 381 segment positions, in file order. Loops are shaded and their segments indented; Max use is how many times a segment or loop may repeat.
| Segment / loop | Name | Usage | Max use |
|---|---|---|---|
ST | Transaction Set Header | Required | 1 |
BHT | Beginning of Hierarchical Transaction | Required | 1 |
| Any order | The loops below can appear in any order | Required | 1 |
| Loop 1000A | Submitter Name | Required | 1 |
NM1 | Submitter Name | Required | 1 |
PER | Submitter EDI Contact Information | Required | 2 |
| Loop 1000B | Receiver Name | Required | 1 |
NM1 | Receiver Name | Required | 1 |
| Loop 2000A | Billing Provider Hierarchical Level | Required | >1 |
HL | Billing Provider Hierarchical Level | Required | 1 |
PRV | Billing Provider Specialty Information | Situational | 1 |
CUR | Foreign Currency Information | Situational | 1 |
| Any order | The loops below can appear in any order | Required | 1 |
| Loop 2010AA | Billing Provider Name | Required | 1 |
NM1 | Billing Provider Name | Required | 1 |
N3 | Billing Provider Address | Required | 1 |
N4 | Billing Provider City State ZIP Code | Required | 1 |
| Any order | The loops below can appear in any order | Required | 1 |
REF | Billing Provider Tax Identification | Required | 1 |
REF | Billing Provider UPIN License Information | Situational | 2 |
PER | Billing Provider Contact Information | Situational | 2 |
| Loop 2010AB | Pay Address Name | Situational | 1 |
NM1 | Pay Address Name | Required | 1 |
N3 | Pay to Address ADDRESS | Required | 1 |
N4 | Pay Address City State ZIP Code | Required | 1 |
| Loop 2010AC | Pay to Plan Name | Situational | 1 |
NM1 | Pay to Plan Name | Required | 1 |
N3 | Pay to Plan Address | Required | 1 |
N4 | Pay to Plan City State ZIP Code | Required | 1 |
| Any order | The loops below can appear in any order | Required | 1 |
REF | Pay to Plan Secondary Identification | Situational | 1 |
REF | Pay to Plan Tax Identification Number | Required | 1 |
| Loop 2000B | Subscriber Hierarchical Level | Required | >1 |
HL | Subscriber Hierarchical Level | Required | 1 |
SBR | Subscriber Information | Required | 1 |
PAT | Patient Information | Situational | 1 |
| Any order | The loops below can appear in any order | Required | 1 |
| Loop 2010BA | Subscriber Name | Required | 1 |
NM1 | Subscriber Name | Required | 1 |
N3 | Subscriber Address | Situational | 1 |
N4 | Subscriber City State ZIP Code | Situational | 1 |
DMG | Subscriber Demographic Information | Situational | 1 |
| Any order | The loops below can appear in any order | Situational | 1 |
REF | Subscriber Secondary Identification | Situational | 1 |
REF | Propertyand Casualty Claim Number | Situational | 1 |
PER | Propertyand Casualty Subscriber Contact Information | Situational | 1 |
| Loop 2010BB | Payer Name | Required | 1 |
NM1 | Payer Name | Required | 1 |
N3 | Payer Address | Situational | 1 |
N4 | Payer City State ZIP Code | Situational | 1 |
| Any order | The loops below can appear in any order | Situational | 1 |
REF | Payer Secondary Identification | Situational | 3 |
REF | Billing Provider Secondary Identification | Situational | 2 |
| Loop 2300 | Claim Information | Situational | 100 |
CLM | Claim Information | Required | 1 |
| Any order | The loops below can appear in any order | Situational | 1 |
DTP | Date Onsetof Current Illnessor Symptom | Situational | 1 |
DTP | Date Initial Treatment Date | Situational | 1 |
DTP | Date Last Seen Date | Situational | 1 |
DTP | Date Acute Manifestation | Situational | 1 |
DTP | Date Accident | Situational | 1 |
DTP | Date Last Menstrual Period | Situational | 1 |
DTP | Date Last X Date | Situational | 1 |
DTP | Date Hearingand Vision Prescription Date | Situational | 1 |
DTP | Date Disability Dates | Situational | 1 |
DTP | Date Last Worked | Situational | 1 |
DTP | Date Authorized Returnto Work | Situational | 1 |
DTP | Date Admission | Situational | 1 |
DTP | Date Discharge | Situational | 1 |
DTP | Date Assumedand Relinquished Care Dates | Situational | 2 |
DTP | Propertyand Casualty Dateof First Contact | Situational | 1 |
DTP | Date Repricer Received Date | Situational | 1 |
PWK | Claim Supplemental Information | Situational | 10 |
CN1 | Contract Information | Situational | 1 |
AMT | Patient Amount Paid | Situational | 1 |
| Any order | The loops below can appear in any order | Situational | 1 |
REF | Service Authorization Exception Code | Situational | 1 |
REF | Mandatory Medicare Section4081 Crossover Indicator | Situational | 1 |
REF | Mammography Certification Number | Situational | 1 |
REF | Referral Number | Situational | 1 |
REF | Prior Authorization | Situational | 1 |
REF | Payer Claim Control Number | Situational | 1 |
REF | Clinical Laboratory Improvement Amendment CLIA Number | Situational | 1 |
REF | Repriced Claim Number | Situational | 1 |
REF | Adjusted Repriced Claim Number | Situational | 1 |
REF | Investigational Device Exemption Number | Situational | 1 |
REF | Claim Identifier for Transmission Intermediaries | Situational | 1 |
REF | Medical Record Number | Situational | 1 |
REF | Demonstration Project Identifier | Situational | 1 |
REF | Care Plan Oversight | Situational | 1 |
K3 | File Information | Situational | 10 |
NTE | Claim Note | Situational | 1 |
CR1 | Ambulance Transport Information | Situational | 1 |
CR2 | Spinal Manipulation Service Information | Situational | 1 |
| Any order | The loops below can appear in any order | Situational | 1 |
CRC | Ambulance Certification | Situational | 3 |
CRC | Patient Condition Information Vision | Situational | 3 |
CRC | Homebound Indicator | Situational | 1 |
CRC | EPSDT Referral | Situational | 1 |
| Any order | The loops below can appear in any order | Required | 1 |
HI | Health Care Diagnosis Code | Required | 1 |
HI | Anesthesia Related Procedure | Situational | 1 |
HI | Condition Information | Situational | 2 |
HCP | Claim Pricing Repricing Information | Situational | 1 |
| Any order | The loops below can appear in any order | Situational | 1 |
| Loop 2310A | Referring Provider Name | Situational | 2 |
NM1 | Referring Provider Name | Required | 1 |
REF | Referring Provider Secondary Identification | Situational | 3 |
| Loop 2310B | Rendering Provider Name | Situational | 1 |
NM1 | Rendering Provider Name | Required | 1 |
PRV | Rendering Provider Specialty Information | Situational | 1 |
REF | Rendering Provider Secondary Identification | Situational | 4 |
| Loop 2310C | Service Facility Location Name | Situational | 1 |
NM1 | Service Facility Location Name | Required | 1 |
N3 | Service Facility Location Address | Required | 1 |
N4 | Service Facility Location City State ZIP Code | Required | 1 |
REF | Service Facility Location Secondary Identification | Situational | 3 |
PER | Service Facility Contact Information | Situational | 1 |
| Loop 2310D | Supervising Provider Name | Situational | 1 |
NM1 | Supervising Provider Name | Required | 1 |
REF | Supervising Provider Secondary Identification | Situational | 4 |
| Loop 2310E | Ambulance Pick Location | Situational | 1 |
NM1 | Ambulance Pick Location | Required | 1 |
N3 | Ambulance Pick Location Address | Required | 1 |
N4 | Ambulance Pick Location City State Zip Code | Required | 1 |
| Loop 2310F | Ambulance Drop Location | Situational | 1 |
NM1 | Ambulance Drop Location | Required | 1 |
N3 | Ambulance Drop Location Address | Required | 1 |
N4 | Ambulance Drop Location City State Zip Code | Required | 1 |
| Loop 2320 | Other Subscriber Information | Situational | 10 |
SBR | Other Subscriber Information | Required | 1 |
CAS | Claim Level Adjustments | Situational | 5 |
| Any order | The loops below can appear in any order | Situational | 1 |
AMT | Coordinationof Benefits COB Payer Paid Amount | Situational | 1 |
AMT | Coordinationof Benefits COB Total Non Amount | Situational | 1 |
AMT | Remaining Patient Liability | Situational | 1 |
OI | Other Insurance Coverage Information | Required | 1 |
MOA | Outpatient Adjudication Information | Situational | 1 |
| Any order | The loops below can appear in any order | Required | 1 |
| Loop 2330A | Other Subscriber Name | Required | 1 |
NM1 | Other Subscriber Name | Required | 1 |
N3 | Other Subscriber Address | Situational | 1 |
N4 | Other Subscriber City State ZIP Code | Situational | 1 |
REF | Other Subscriber Secondary Identification | Situational | 1 |
| Loop 2330B | Other Payer Name | Required | 1 |
NM1 | Other Payer Name | Required | 1 |
N3 | Other Payer Address | Situational | 1 |
N4 | Other Payer City State ZIP Code | Situational | 1 |
DTP | Claim Checkor Remittance Date | Situational | 1 |
| Any order | The loops below can appear in any order | Situational | 1 |
REF | Other Payer Secondary Identifier | Situational | 2 |
REF | Other Payer Prior Authorization Number | Situational | 1 |
REF | Other Payer Referral Number | Situational | 1 |
REF | Other Payer Claim Adjustment Indicator | Situational | 1 |
REF | Other Payer Claim Control Number | Situational | 1 |
| Loop 2330C | Other Payer Referring Provider | Situational | 2 |
NM1 | Other Payer Referring Provider | Required | 1 |
REF | Other Payer Referring Provider Secondary Identification | Required | 3 |
| Loop 2330D | Other Payer Rendering Provider | Situational | 1 |
NM1 | Other Payer Rendering Provider | Required | 1 |
REF | Other Payer Rendering Provider Secondary Identification | Required | 3 |
| Loop 2330E | Other Payer Service Facility Location | Situational | 1 |
NM1 | Other Payer Service Facility Location | Required | 1 |
REF | Other Payer Service Facility Location Secondary Identification | Required | 3 |
| Loop 2330F | Other Payer Supervising Provider | Situational | 1 |
NM1 | Other Payer Supervising Provider | Required | 1 |
REF | Other Payer Supervising Provider Secondary Identification | Required | 3 |
| Loop 2330G | Other Payer Billing Provider | Situational | 1 |
NM1 | Other Payer Billing Provider | Required | 1 |
REF | Other Payer Billing Provider Secondary Identification | Required | 2 |
| Loop 2400 | Service Line Number | Required | 50 |
LX | Service Line Number | Required | 1 |
SV1 | Professional Service | Required | 1 |
SV5 | Durable Medical Equipment Service | Situational | 1 |
| Any order | The loops below can appear in any order | Situational | 1 |
PWK | Line Supplemental Information | Situational | 10 |
PWK | Durable Medical Equipment Certificateof Medical Necessity Indicator | Situational | 1 |
CR1 | Ambulance Transport Information | Situational | 1 |
CR3 | Durable Medical Equipment Certification | Situational | 1 |
| Any order | The loops below can appear in any order | Situational | 1 |
CRC | Ambulance Certification | Situational | 3 |
CRC | Hospice Employee Indicator | Situational | 1 |
CRC | Condition Indicator Durable Medical Equipment | Situational | 1 |
| Any order | The loops below can appear in any order | Required | 1 |
DTP | Date Service Date | Required | 1 |
DTP | Date Prescription Date | Situational | 1 |
DTP | DATE Certification Revision Recertification Date | Situational | 1 |
DTP | Date Begin Therapy Date | Situational | 1 |
DTP | Date Last Certification Date | Situational | 1 |
DTP | Date Last Seen Date | Situational | 1 |
DTP | Date Test Date | Situational | 2 |
DTP | Date Shipped Date | Situational | 1 |
DTP | Date Last X Date | Situational | 1 |
DTP | Date Initial Treatment Date | Situational | 1 |
| Any order | The loops below can appear in any order | Situational | 1 |
QTY | Ambulance Patient Count | Situational | 1 |
QTY | Obstetric Anesthesia Additional Units | Situational | 1 |
MEA | Test Result | Situational | 5 |
CN1 | Contract Information | Situational | 1 |
| Any order | The loops below can appear in any order | Situational | 1 |
REF | Repriced Line Item Reference Number | Situational | 1 |
REF | Adjusted Repriced Line Item Reference Number | Situational | 1 |
REF | Prior Authorization | Situational | 5 |
REF | Line Item Control Number | Situational | 1 |
REF | Mammography Certification Number | Situational | 1 |
REF | Clinical Laboratory Improvement Amendment CLIA Number | Situational | 1 |
REF | Referring Clinical Laboratory Improvement Amendment CLIA Facility Identification | Situational | 1 |
REF | Immunization Batch Number | Situational | 1 |
REF | Referral Number | Situational | 5 |
| Any order | The loops below can appear in any order | Situational | 1 |
AMT | Sales Tax Amount | Situational | 1 |
AMT | Postage Claimed Amount | Situational | 1 |
K3 | File Information | Situational | 10 |
| Any order | The loops below can appear in any order | Situational | 1 |
NTE | Line Note | Situational | 1 |
NTE | Third Party Organization Notes | Situational | 1 |
PS1 | Purchased Service Information | Situational | 1 |
HCP | Line Pricing Repricing Information | Situational | 1 |
| Loop 2410 | Drug Identification | Situational | 1 |
LIN | Drug Identification | Required | 1 |
CTP | Drug Quantity | Required | 1 |
REF | Prescriptionor Compound Drug Association Number | Situational | 1 |
| Any order | The loops below can appear in any order | Situational | 1 |
| Loop 2420A | Rendering Provider Name | Situational | 1 |
NM1 | Rendering Provider Name | Required | 1 |
PRV | Rendering Provider Specialty Information | Situational | 1 |
REF | Rendering Provider Secondary Identification | Situational | 20 |
| Loop 2420B | Purchased Service Provider Name | Situational | 1 |
NM1 | Purchased Service Provider Name | Required | 1 |
REF | Purchased Service Provider Secondary Identification | Situational | 20 |
| Loop 2420C | Service Facility Location | Situational | 1 |
NM1 | Service Facility Location | Required | 1 |
N3 | Service Facility Location Address | Required | 1 |
N4 | Service Facility Location City State ZIP Code | Required | 1 |
REF | Service Facility Location Secondary Identification | Situational | 3 |
| Loop 2420D | Supervising Provider Name | Situational | 1 |
NM1 | Supervising Provider Name | Required | 1 |
REF | Supervising Provider Secondary Identification | Situational | 20 |
| Loop 2420E | Ordering Provider Name | Situational | 1 |
NM1 | Ordering Provider Name | Required | 1 |
N3 | Ordering Provider Address | Situational | 1 |
N4 | Ordering Provider City State ZIP Code | Situational | 1 |
REF | Ordering Provider Secondary Identification | Situational | 20 |
PER | Ordering Provider Contact Information | Situational | 1 |
| Loop 2420F | Referring Provider Name | Situational | 2 |
NM1 | Referring Provider Name | Required | 1 |
REF | Referring Provider Secondary Identification | Situational | 20 |
| Loop 2420G | Ambulance Pick Location | Situational | 1 |
NM1 | Ambulance Pick Location | Required | 1 |
N3 | Ambulance Pick Location Address | Required | 1 |
N4 | Ambulance Pick Location City State Zip Code | Required | 1 |
| Loop 2420H | Ambulance Drop Location | Situational | 1 |
NM1 | Ambulance Drop Location | Required | 1 |
N3 | Ambulance Drop Location Address | Required | 1 |
N4 | Ambulance Drop Location City State Zip Code | Required | 1 |
| Loop 2430 | Line Adjudication Information | Situational | 15 |
SVD | Line Adjudication Information | Required | 1 |
CAS | Line Adjustment | Situational | 5 |
DTP | Line Checkor Remittance Date | Required | 1 |
AMT | Remaining Patient Liability | Situational | 1 |
| Loop 2440 | Form Identification Code | Situational | >1 |
LQ | Form Identification Code | Required | 1 |
FRM | Supporting Documentation | Required | 99 |
| Loop 2000C | Patient Hierarchical Level | Situational | >1 |
HL | Patient Hierarchical Level | Required | 1 |
PAT | Patient Information | Required | 1 |
| Loop 2010CA | Patient Name | Required | 1 |
NM1 | Patient Name | Required | 1 |
N3 | Patient Address | Required | 1 |
N4 | Patient City State ZIP Code | Required | 1 |
DMG | Patient Demographic Information | Required | 1 |
| Any order | The loops below can appear in any order | Situational | 1 |
REF | Propertyand Casualty Claim Number | Situational | 1 |
REF | Propertyand Casualty Patient Identifier | Situational | 1 |
PER | Propertyand Casualty Patient Contact Information | Situational | 1 |
| Loop 2300 | Claim Information | Required | 100 |
CLM | Claim Information | Required | 1 |
| Any order | The loops below can appear in any order | Situational | 1 |
DTP | Date Onsetof Current Illnessor Symptom | Situational | 1 |
DTP | Date Initial Treatment Date | Situational | 1 |
DTP | Date Last Seen Date | Situational | 1 |
DTP | Date Acute Manifestation | Situational | 1 |
DTP | Date Accident | Situational | 1 |
DTP | Date Last Menstrual Period | Situational | 1 |
DTP | Date Last X Date | Situational | 1 |
DTP | Date Hearingand Vision Prescription Date | Situational | 1 |
DTP | Date Disability Dates | Situational | 1 |
DTP | Date Last Worked | Situational | 1 |
DTP | Date Authorized Returnto Work | Situational | 1 |
DTP | Date Admission | Situational | 1 |
DTP | Date Discharge | Situational | 1 |
DTP | Date Assumedand Relinquished Care Dates | Situational | 2 |
DTP | Propertyand Casualty Dateof First Contact | Situational | 1 |
DTP | Date Repricer Received Date | Situational | 1 |
PWK | Claim Supplemental Information | Situational | 10 |
CN1 | Contract Information | Situational | 1 |
AMT | Patient Amount Paid | Situational | 1 |
| Any order | The loops below can appear in any order | Situational | 1 |
REF | Service Authorization Exception Code | Situational | 1 |
REF | Mandatory Medicare Section4081 Crossover Indicator | Situational | 1 |
REF | Mammography Certification Number | Situational | 1 |
REF | Referral Number | Situational | 1 |
REF | Prior Authorization | Situational | 1 |
REF | Payer Claim Control Number | Situational | 1 |
REF | Clinical Laboratory Improvement Amendment CLIA Number | Situational | 1 |
REF | Repriced Claim Number | Situational | 1 |
REF | Adjusted Repriced Claim Number | Situational | 1 |
REF | Investigational Device Exemption Number | Situational | 1 |
REF | Claim Identifier for Transmission Intermediaries | Situational | 1 |
REF | Medical Record Number | Situational | 1 |
REF | Demonstration Project Identifier | Situational | 1 |
REF | Care Plan Oversight | Situational | 1 |
K3 | File Information | Situational | 10 |
NTE | Claim Note | Situational | 1 |
CR1 | Ambulance Transport Information | Situational | 1 |
CR2 | Spinal Manipulation Service Information | Situational | 1 |
| Any order | The loops below can appear in any order | Situational | 1 |
CRC | Ambulance Certification | Situational | 3 |
CRC | Patient Condition Information Vision | Situational | 3 |
CRC | Homebound Indicator | Situational | 1 |
CRC | EPSDT Referral | Situational | 1 |
| Any order | The loops below can appear in any order | Required | 1 |
HI | Health Care Diagnosis Code | Required | 1 |
HI | Anesthesia Related Procedure | Situational | 1 |
HI | Condition Information | Situational | 2 |
HCP | Claim Pricing Repricing Information | Situational | 1 |
| Any order | The loops below can appear in any order | Situational | 1 |
| Loop 2310A | Referring Provider Name | Situational | 2 |
NM1 | Referring Provider Name | Required | 1 |
REF | Referring Provider Secondary Identification | Situational | 3 |
| Loop 2310B | Rendering Provider Name | Situational | 1 |
NM1 | Rendering Provider Name | Required | 1 |
PRV | Rendering Provider Specialty Information | Situational | 1 |
REF | Rendering Provider Secondary Identification | Situational | 4 |
| Loop 2310C | Service Facility Location Name | Situational | 1 |
NM1 | Service Facility Location Name | Required | 1 |
N3 | Service Facility Location Address | Required | 1 |
N4 | Service Facility Location City State ZIP Code | Required | 1 |
REF | Service Facility Location Secondary Identification | Situational | 3 |
PER | Service Facility Contact Information | Situational | 1 |
| Loop 2310D | Supervising Provider Name | Situational | 1 |
NM1 | Supervising Provider Name | Required | 1 |
REF | Supervising Provider Secondary Identification | Situational | 4 |
| Loop 2310E | Ambulance Pick Location | Situational | 1 |
NM1 | Ambulance Pick Location | Required | 1 |
N3 | Ambulance Pick Location Address | Required | 1 |
N4 | Ambulance Pick Location City State Zip Code | Required | 1 |
| Loop 2310F | Ambulance Drop Location | Situational | 1 |
NM1 | Ambulance Drop Location | Required | 1 |
N3 | Ambulance Drop Location Address | Required | 1 |
N4 | Ambulance Drop Location City State Zip Code | Required | 1 |
| Loop 2320 | Other Subscriber Information | Situational | 10 |
SBR | Other Subscriber Information | Required | 1 |
CAS | Claim Level Adjustments | Situational | 5 |
| Any order | The loops below can appear in any order | Situational | 1 |
AMT | Coordinationof Benefits COB Payer Paid Amount | Situational | 1 |
AMT | Coordinationof Benefits COB Total Non Amount | Situational | 1 |
AMT | Remaining Patient Liability | Situational | 1 |
OI | Other Insurance Coverage Information | Required | 1 |
MOA | Outpatient Adjudication Information | Situational | 1 |
| Any order | The loops below can appear in any order | Required | 1 |
| Loop 2330A | Other Subscriber Name | Required | 1 |
NM1 | Other Subscriber Name | Required | 1 |
N3 | Other Subscriber Address | Situational | 1 |
N4 | Other Subscriber City State ZIP Code | Situational | 1 |
REF | Other Subscriber Secondary Identification | Situational | 1 |
| Loop 2330B | Other Payer Name | Required | 1 |
NM1 | Other Payer Name | Required | 1 |
N3 | Other Payer Address | Situational | 1 |
N4 | Other Payer City State ZIP Code | Situational | 1 |
DTP | Claim Checkor Remittance Date | Situational | 1 |
| Any order | The loops below can appear in any order | Situational | 1 |
REF | Other Payer Secondary Identifier | Situational | 2 |
REF | Other Payer Prior Authorization Number | Situational | 1 |
REF | Other Payer Referral Number | Situational | 1 |
REF | Other Payer Claim Adjustment Indicator | Situational | 1 |
REF | Other Payer Claim Control Number | Situational | 1 |
| Loop 2330C | Other Payer Referring Provider | Situational | 2 |
NM1 | Other Payer Referring Provider | Required | 1 |
REF | Other Payer Referring Provider Secondary Identification | Required | 3 |
| Loop 2330D | Other Payer Rendering Provider | Situational | 1 |
NM1 | Other Payer Rendering Provider | Required | 1 |
REF | Other Payer Rendering Provider Secondary Identification | Required | 3 |
| Loop 2330E | Other Payer Service Facility Location | Situational | 1 |
NM1 | Other Payer Service Facility Location | Required | 1 |
REF | Other Payer Service Facility Location Secondary Identification | Required | 3 |
| Loop 2330F | Other Payer Supervising Provider | Situational | 1 |
NM1 | Other Payer Supervising Provider | Required | 1 |
REF | Other Payer Supervising Provider Secondary Identification | Required | 3 |
| Loop 2330G | Other Payer Billing Provider | Situational | 1 |
NM1 | Other Payer Billing Provider | Required | 1 |
REF | Other Payer Billing Provider Secondary Identification | Required | 2 |
| Loop 2400 | Service Line Number | Required | 50 |
LX | Service Line Number | Required | 1 |
SV1 | Professional Service | Required | 1 |
SV5 | Durable Medical Equipment Service | Situational | 1 |
| Any order | The loops below can appear in any order | Situational | 1 |
PWK | Line Supplemental Information | Situational | 10 |
PWK | Durable Medical Equipment Certificateof Medical Necessity Indicator | Situational | 1 |
CR1 | Ambulance Transport Information | Situational | 1 |
CR3 | Durable Medical Equipment Certification | Situational | 1 |
| Any order | The loops below can appear in any order | Situational | 1 |
CRC | Ambulance Certification | Situational | 3 |
CRC | Hospice Employee Indicator | Situational | 1 |
CRC | Condition Indicator Durable Medical Equipment | Situational | 1 |
| Any order | The loops below can appear in any order | Required | 1 |
DTP | Date Service Date | Required | 1 |
DTP | Date Prescription Date | Situational | 1 |
DTP | DATE Certification Revision Recertification Date | Situational | 1 |
DTP | Date Begin Therapy Date | Situational | 1 |
DTP | Date Last Certification Date | Situational | 1 |
DTP | Date Last Seen Date | Situational | 1 |
DTP | Date Test Date | Situational | 2 |
DTP | Date Shipped Date | Situational | 1 |
DTP | Date Last X Date | Situational | 1 |
DTP | Date Initial Treatment Date | Situational | 1 |
| Any order | The loops below can appear in any order | Situational | 1 |
QTY | Ambulance Patient Count | Situational | 1 |
QTY | Obstetric Anesthesia Additional Units | Situational | 1 |
MEA | Test Result | Situational | 5 |
CN1 | Contract Information | Situational | 1 |
| Any order | The loops below can appear in any order | Situational | 1 |
REF | Repriced Line Item Reference Number | Situational | 1 |
REF | Adjusted Repriced Line Item Reference Number | Situational | 1 |
REF | Prior Authorization | Situational | 5 |
REF | Line Item Control Number | Situational | 1 |
REF | Mammography Certification Number | Situational | 1 |
REF | Clinical Laboratory Improvement Amendment CLIA Number | Situational | 1 |
REF | Referring Clinical Laboratory Improvement Amendment CLIA Facility Identification | Situational | 1 |
REF | Immunization Batch Number | Situational | 1 |
REF | Referral Number | Situational | 5 |
| Any order | The loops below can appear in any order | Situational | 1 |
AMT | Sales Tax Amount | Situational | 1 |
AMT | Postage Claimed Amount | Situational | 1 |
K3 | File Information | Situational | 10 |
| Any order | The loops below can appear in any order | Situational | 1 |
NTE | Line Note | Situational | 1 |
NTE | Third Party Organization Notes | Situational | 1 |
PS1 | Purchased Service Information | Situational | 1 |
HCP | Line Pricing Repricing Information | Situational | 1 |
| Loop 2410 | Drug Identification | Situational | 1 |
LIN | Drug Identification | Required | 1 |
CTP | Drug Quantity | Required | 1 |
REF | Prescriptionor Compound Drug Association Number | Situational | 1 |
| Any order | The loops below can appear in any order | Situational | 1 |
| Loop 2420A | Rendering Provider Name | Situational | 1 |
NM1 | Rendering Provider Name | Required | 1 |
PRV | Rendering Provider Specialty Information | Situational | 1 |
REF | Rendering Provider Secondary Identification | Situational | 20 |
| Loop 2420B | Purchased Service Provider Name | Situational | 1 |
NM1 | Purchased Service Provider Name | Required | 1 |
REF | Purchased Service Provider Secondary Identification | Situational | 20 |
| Loop 2420C | Service Facility Location | Situational | 1 |
NM1 | Service Facility Location | Required | 1 |
N3 | Service Facility Location Address | Required | 1 |
N4 | Service Facility Location City State ZIP Code | Required | 1 |
REF | Service Facility Location Secondary Identification | Situational | 3 |
| Loop 2420D | Supervising Provider Name | Situational | 1 |
NM1 | Supervising Provider Name | Required | 1 |
REF | Supervising Provider Secondary Identification | Situational | 20 |
| Loop 2420E | Ordering Provider Name | Situational | 1 |
NM1 | Ordering Provider Name | Required | 1 |
N3 | Ordering Provider Address | Situational | 1 |
N4 | Ordering Provider City State ZIP Code | Situational | 1 |
REF | Ordering Provider Secondary Identification | Situational | 20 |
PER | Ordering Provider Contact Information | Situational | 1 |
| Loop 2420F | Referring Provider Name | Situational | 2 |
NM1 | Referring Provider Name | Required | 1 |
REF | Referring Provider Secondary Identification | Situational | 20 |
| Loop 2420G | Ambulance Pick Location | Situational | 1 |
NM1 | Ambulance Pick Location | Required | 1 |
N3 | Ambulance Pick Location Address | Required | 1 |
N4 | Ambulance Pick Location City State Zip Code | Required | 1 |
| Loop 2420H | Ambulance Drop Location | Situational | 1 |
NM1 | Ambulance Drop Location | Required | 1 |
N3 | Ambulance Drop Location Address | Required | 1 |
N4 | Ambulance Drop Location City State Zip Code | Required | 1 |
| Loop 2430 | Line Adjudication Information | Situational | 15 |
SVD | Line Adjudication Information | Required | 1 |
CAS | Line Adjustment | Situational | 5 |
DTP | Line Checkor Remittance Date | Required | 1 |
AMT | Remaining Patient Liability | Situational | 1 |
| Loop 2440 | Form Identification Code | Situational | >1 |
LQ | Form Identification Code | Required | 1 |
FRM | Supporting Documentation | Required | 99 |
SE | Transaction Set Trailer | Required | 1 |
Sample 837P file
One claim with four service lines for a patient who is a dependent of the subscriber. Paste it into EdiNation to see every element named and validated.
ISA*00* *00* *ZZ*1234567 *ZZ*11111 *170508*1141*^*00501*000000101*1*P*:~ GS*HC*XXXXXXX*XXXXX*20170617*1741*101*X*005010X222A1~ ST*837*0021*005010X222A1~ BHT*0019*00*244579*20061015*1023*CH~ NM1*41*2*PREMIER BILLING SERVICE*****46*TGJ23~ PER*IC*JERRY*TE*3055552222*EX*231~ NM1*40*2*KEY INSURANCE COMPANY*****46*66783JJT~ HL*1**20*1~ PRV*BI*PXC*203BF0100Y~ NM1*85*2*BEN KILDARE SERVICE*****XX*9876543210~ N3*234 SEAWAY ST~ N4*MIAMI*FL*33111~ REF*EI*587654321~ NM1*87*2*Kildare Associates~ N3*2345 OCEAN BLVD~ N4*MIAMI*FL*33111~ HL*2*1*22*1~ SBR*P**2222-SJ******CI~ NM1*IL*1*SMITH*JANE****MI*JS00111223333~ DMG*D8*19430501*F~ NM1*PR*2*KEY INSURANCE COMPANY*****PI*999996666~ REF*G2*KA6663~ HL*3*2*23*0~ PAT*19~ NM1*QC*1*SMITH*TED~ N3*236 N MAIN ST~ N4*MIAMI*FL*33413~ DMG*D8*19730501*M~ CLM*26463774*100***11:B:1*Y*A*Y*I~ REF*D9*17312345600006351~ HI*BK:0340*BF:V7389~ LX*1~ SV1*HC:99213*40*UN*1***1~ DTP*472*D8*20061003~ LX*2~ SV1*HC:87070*15*UN*1***1~ DTP*472*D8*20061003~ LX*3~ SV1*HC:99214*35*UN*1***2~ DTP*472*D8*20061010~ LX*4~ SV1*HC:86663*10*UN*1***2~ DTP*472*D8*20061010~ SE*42*0021~ GE*1*101~ IEA*1*000000101~
The same 837P as JSON
ediFabric turns every loop, segment and element into a named field. This is the transaction from the sample, in the JSON that ediFabric Native and Cloud return and accept.
{
"ST": {
"TransactionSetIdentifierCode_01": "837",
"TransactionSetControlNumber_02": "0021",
"ImplementationConventionPreference_03": "005010X222A1"
},
"BHT_BeginningOfHierarchicalTransaction": {
"HierarchicalStructureCode_01": "0019",
"TransactionSetPurposeCode_02": "00",
"SubmitterTransactionIdentifier_03": "244579",
"TransactionSetCreationDate_04": "20061015",
"TransactionSetCreationTime_05": "1023",
"TransactionTypeCode_06": "CH"
},
"AllNM1": {
"Loop1000A": {
"NM1_SubmitterName": {
"EntityIdentifierCode_01": "41",
"EntityTypeQualifier_02": "2",
"ResponseContactLastorOrganizationName_03": "PREMIER BILLING SERVICE",
"IdentificationCodeQualifier_08": "46",
"ResponseContactIdentifier_09": "TGJ23"
},
"PER_SubmitterEDIContactInformation": [
{
"ContactFunctionCode_01": "IC",
"ResponseContactName_02": "JERRY",
"CommunicationNumberQualifier_03": "TE",
"ResponseContactCommunicationNumber_04": "3055552222",
"CommunicationNumberQualifier_05": "EX",
"ResponseContactCommunicationNumber_06": "231"
}
]
},
"Loop1000B": {
"NM1_ReceiverName": {
"EntityIdentifierCode_01": "40",
"EntityTypeQualifier_02": "2",
"ResponseContactLastorOrganizationName_03": "KEY INSURANCE COMPANY",
"IdentificationCodeQualifier_08": "46",
"ResponseContactIdentifier_09": "66783JJT"
}
}
},
"Loop2000A": [
{
"HL_BillingProviderHierarchicalLevel": {
"HierarchicalIDNumber_01": "1",
"HierarchicalLevelCode_03": "20",
"HierarchicalChildCode_04": "1"
},
"PRV_BillingProviderSpecialtyInformation": {
"ProviderCode_01": "BI",
"ReferenceIdentificationQualifier_02": "PXC",
"ProviderTaxonomyCode_03": "203BF0100Y"
},
"AllNM1": {
"Loop2010AA": {
"NM1_BillingProviderName": {
"EntityIdentifierCode_01": "85",
"EntityTypeQualifier_02": "2",
"ResponseContactLastorOrganizationName_03": "BEN KILDARE SERVICE",
"IdentificationCodeQualifier_08": "XX",
"ResponseContactIdentifier_09": "9876543210"
},
"N3_BillingProviderAddress": {
"ResponseContactAddressLine_01": "234 SEAWAY ST"
},
"N4_BillingProviderCity_State_ZIPCode": {
"AdditionalPatientInformationContactCityName_01": "MIAMI",
"AdditionalPatientInformationContactStateCode_02": "FL",
"AdditionalPatientInformationContactPostalZoneorZIPCode_03": "33111"
},
"AllREF": {
"REF_BillingProviderTaxIdentification": {
"ReferenceIdentificationQualifier_01": "EI",
"MemberGrouporPolicyNumber_02": "587654321"
}
}
},
"Loop2010AB": {
"NM1_Pay_AddressName": {
"EntityIdentifierCode_01": "87",
"EntityTypeQualifier_02": "2",
"ResponseContactLastorOrganizationName_03": "Kildare Associates"
},
"N3_Pay_ToAddress_ADDRESS": {
"ResponseContactAddressLine_01": "2345 OCEAN BLVD"
},
"N4_Pay_AddressCity_State_ZIPCode": {
"AdditionalPatientInformationContactCityName_01": "MIAMI",
"AdditionalPatientInformationContactStateCode_02": "FL",
"AdditionalPatientInformationContactPostalZoneorZIPCode_03": "33111"
}
}
},
"Loop2000B": [
{
"HL_SubscriberHierarchicalLevel": {
"HierarchicalIDNumber_01": "2",
"HierarchicalParentIDNumber_02": "1",
"HierarchicalLevelCode_03": "22",
"HierarchicalChildCode_04": "1"
},
"SBR_SubscriberInformation": {
"PayerResponsibilitySequenceNumberCode_01": "P",
"InsuredGrouporPolicyNumber_03": "2222-SJ",
"ClaimFilingIndicatorCode_09": "CI"
},
"AllNM1": {
"Loop2010BA": {
"NM1_SubscriberName": {
"EntityIdentifierCode_01": "IL",
"EntityTypeQualifier_02": "1",
"ResponseContactLastorOrganizationName_03": "SMITH",
"ResponseContactFirstName_04": "JANE",
"IdentificationCodeQualifier_08": "MI",
"ResponseContactIdentifier_09": "JS00111223333"
},
"DMG_SubscriberDemographicInformation": {
"DateTimePeriodFormatQualifier_01": "D8",
"DependentBirthDate_02": "19430501",
"DependentGenderCode_03": "F"
}
},
"Loop2010BB": {
"NM1_PayerName": {
"EntityIdentifierCode_01": "PR",
"EntityTypeQualifier_02": "2",
"ResponseContactLastorOrganizationName_03": "KEY INSURANCE COMPANY",
"IdentificationCodeQualifier_08": "PI",
"ResponseContactIdentifier_09": "999996666"
},
"AllREF": {
"REF_BillingProviderSecondaryIdentification": [
{
"ReferenceIdentificationQualifier_01": "G2",
"MemberGrouporPolicyNumber_02": "KA6663"
}
]
}
}
},
"Loop2000C": [
{
"HL_PatientHierarchicalLevel": {
"HierarchicalIDNumber_01": "3",
"HierarchicalParentIDNumber_02": "2",
"HierarchicalLevelCode_03": "23",
"HierarchicalChildCode_04": "0"
},
"PAT_PatientInformation": {
"IndividualRelationshipCode_01": "19"
},
"Loop2010CA": {
"NM1_PatientName": {
"EntityIdentifierCode_01": "QC",
"EntityTypeQualifier_02": "1",
"ResponseContactLastorOrganizationName_03": "SMITH",
"ResponseContactFirstName_04": "TED"
},
"N3_PatientAddress": {
"ResponseContactAddressLine_01": "236 N MAIN ST"
},
"N4_PatientCity_State_ZIPCode": {
"AdditionalPatientInformationContactCityName_01": "MIAMI",
"AdditionalPatientInformationContactStateCode_02": "FL",
"AdditionalPatientInformationContactPostalZoneorZIPCode_03": "33413"
},
"DMG_PatientDemographicInformation": {
"DateTimePeriodFormatQualifier_01": "D8",
"DependentBirthDate_02": "19730501",
"DependentGenderCode_03": "M"
}
},
"Loop2300": [
{
"CLM_ClaimInformation": {
"PatientControlNumber_01": "26463774",
"TotalClaimChargeAmount_02": "100",
"HealthCareServiceLocationInformation_05": {
"FacilityTypeCode_01": "11",
"FacilityCodeQualifier_02": "B",
"ClaimFrequencyTypeCode_03": "1"
},
"ProviderorSupplierSignatureIndicator_06": "Y",
"AssignmentorPlanParticipationCode_07": "A",
"BenefitsAssignmentCertificationIndicator_08": "Y",
"ReleaseofInformationCode_09": "I"
},
"AllREF": {
"REF_ClaimIdentifierForTransmissionIntermediaries": {
"ReferenceIdentificationQualifier_01": "D9",
"MemberGrouporPolicyNumber_02": "17312345600006351"
}
},
"AllHI": {
"HI_HealthCareDiagnosisCode": {
"HealthCareCodeInformation_01": {
"CodeListQualifierCode_01": "BK",
"IndustryCode_02": "0340"
},
"HealthCareCodeInformation_02": {
"CodeListQualifierCode_01": "BF",
"IndustryCode_02": "V7389"
}
}
},
"Loop2400": [
{
"LX_ServiceLineNumber": {
"AssignedNumber_01": "1"
},
"SV1_ProfessionalService": {
"CompositeMedicalProcedureIdentifier_01": {
"ProductorServiceIDQualifier_01": "HC",
"ProcedureCode_02": "99213"
},
"LineItemChargeAmount_02": "40",
"UnitorBasisforMeasurementCode_03": "UN",
"ServiceUnitCount_04": "1",
"CompositeDiagnosisCodePointer_07": {
"DiagnosisCodePointer_01": "1"
}
},
"AllDTP": {
"DTP_Date_ServiceDate": {
"DateTimeQualifier_01": "472",
"DateTimePeriodFormatQualifier_02": "D8",
"DateTimePeriod_03": "20061003"
}
}
},
{
"LX_ServiceLineNumber": {
"AssignedNumber_01": "2"
},
"SV1_ProfessionalService": {
"CompositeMedicalProcedureIdentifier_01": {
"ProductorServiceIDQualifier_01": "HC",
"ProcedureCode_02": "87070"
},
"LineItemChargeAmount_02": "15",
"UnitorBasisforMeasurementCode_03": "UN",
"ServiceUnitCount_04": "1",
"CompositeDiagnosisCodePointer_07": {
"DiagnosisCodePointer_01": "1"
}
},
"AllDTP": {
"DTP_Date_ServiceDate": {
"DateTimeQualifier_01": "472",
"DateTimePeriodFormatQualifier_02": "D8",
"DateTimePeriod_03": "20061003"
}
}
},
{
"LX_ServiceLineNumber": {
"AssignedNumber_01": "3"
},
"SV1_ProfessionalService": {
"CompositeMedicalProcedureIdentifier_01": {
"ProductorServiceIDQualifier_01": "HC",
"ProcedureCode_02": "99214"
},
"LineItemChargeAmount_02": "35",
"UnitorBasisforMeasurementCode_03": "UN",
"ServiceUnitCount_04": "1",
"CompositeDiagnosisCodePointer_07": {
"DiagnosisCodePointer_01": "2"
}
},
"AllDTP": {
"DTP_Date_ServiceDate": {
"DateTimeQualifier_01": "472",
"DateTimePeriodFormatQualifier_02": "D8",
"DateTimePeriod_03": "20061010"
}
}
},
{
"LX_ServiceLineNumber": {
"AssignedNumber_01": "4"
},
"SV1_ProfessionalService": {
"CompositeMedicalProcedureIdentifier_01": {
"ProductorServiceIDQualifier_01": "HC",
"ProcedureCode_02": "86663"
},
"LineItemChargeAmount_02": "10",
"UnitorBasisforMeasurementCode_03": "UN",
"ServiceUnitCount_04": "1",
"CompositeDiagnosisCodePointer_07": {
"DiagnosisCodePointer_01": "2"
}
},
"AllDTP": {
"DTP_Date_ServiceDate": {
"DateTimeQualifier_01": "472",
"DateTimePeriodFormatQualifier_02": "D8",
"DateTimePeriod_03": "20061010"
}
}
}
]
}
]
}
]
}
]
}
],
"SE": {
"NumberofIncludedSegments_01": "42",
"TransactionSetControlNumber_02": "0021"
}
}Parse and validate an 837P file
Read the file into typed objects with ediFabric .NET, convert it to JSON in process with the ediFabric Native bindings for Python, Java and C, or post it to the ediFabric Cloud REST API from any language.
using EdiFabric.Templates.Hipaa5010; License.SetSerial("YOUR_SERIAL_KEY"); using (var stream = File.OpenRead(@"C:\edi\ClaimPayment.txt")) using (var reader = new X12Reader(stream, "EdiFabric.Templates.Hipaa")) { var items = await reader.ReadToEndAsync(); foreach (var transaction in items.OfType<TS837P>()) { if (transaction.IsValid(out MessageErrorContext errors)) Console.WriteLine($"{transaction.ST.TransactionSetControlNumber_02} is valid"); else Console.WriteLine(string.Join(Environment.NewLine, errors.Flatten())); } }
import json import edifabric_x12 as ef serial = "YOUR_SERIAL_KEY" ef.load_library() ef.set_serial(serial) ef.set_map(json.dumps({"default": serial, "maps": {}})) edi = open("ClaimPayment.txt", "rb").read() output, offset = ef.parse(edi, ef.ParseMode.JSON_VALIDATE) transactions = output[:offset] report = json.loads(output[offset:]) print(report["errors_count"])
import com.edifabric.nativex12.EdiFabricX12; import com.edifabric.nativex12.ParseMode; import com.edifabric.nativex12.ParseResult; String serial = "YOUR_SERIAL_KEY"; EdiFabricX12.loadLibrary(); EdiFabricX12.setSerial(serial); EdiFabricX12.setMap("{\"default\":\"" + serial + "\",\"maps\":{}}"); String edi = Files.readString(Path.of("ClaimPayment.txt")); ParseResult result = EdiFabricX12.parse(edi, ParseMode.JSON_VALIDATE); System.out.println(result.getTransactions()); System.out.println(result.getReport());
#include "edifabric_x12.h" const char *serial = "YOUR_SERIAL_KEY"; ef_parse_result result; if (ef_load_library(NULL) != 0) return 1; ef_set_serial(serial); ef_set_map("{\"default\":\"YOUR_SERIAL_KEY\",\"maps\":{}}"); char *edi = read_file("ClaimPayment.txt", NULL); /* helper in example_all_functions.c */ if (ef_parse(edi, EF_PARSE_JSON_VALIDATE, NULL, &result) == 0) { /* transactions = output[0 .. offset), report = output[offset .. length) */ fwrite(result.output.data, 1, (size_t)result.output.length, stdout); ef_free(result.output.data); }
curl -X POST 'https://api.edination.com/v2/x12/read' \ -H 'Ocp-Apim-Subscription-Key: YOUR_SERIAL_KEY' \ -H 'Content-Type: application/octet-stream' \ --data-binary '@ClaimPayment.txt'
Generate an 837P file
Populate a TS837P object in .NET, or pass JSON in the shape shown above to ediFabric Native or ediFabric Cloud, and get a valid 837P file back.
using EdiFabric.Templates.Hipaa5010; License.SetSerial("YOUR_SERIAL_KEY"); var transaction = new TS837P(); // Indicates the start of a claim transaction set and assigns a control number. transaction.ST = new ST(); transaction.ST.TransactionSetIdentifierCode_01 = "837"; transaction.ST.TransactionSetControlNumber_02 = "0001"; transaction.ST.ImplementationConventionPreference_03 = "005010X222A1"; // Indicates the claim was created on October 15, 2006 and submitter is identified with 244579. transaction.BHT_BeginningOfHierarchicalTransaction = new BHT_BeginningOfHierarchicalTransaction_8(); transaction.BHT_BeginningOfHierarchicalTransaction.HierarchicalStructureCode_01 = "0019"; transaction.BHT_BeginningOfHierarchicalTransaction.TransactionSetPurposeCode_02 = "00"; transaction.BHT_BeginningOfHierarchicalTransaction.SubmitterTransactionIdentifier_03 = "244579"; transaction.BHT_BeginningOfHierarchicalTransaction.TransactionSetCreationDate_04 = "20061015"; transaction.BHT_BeginningOfHierarchicalTransaction.TransactionSetCreationTime_05 = "1023"; transaction.BHT_BeginningOfHierarchicalTransaction.TransactionTypeCode_06 = "CH"; // Occurrence of NM1 Loops in any order transaction.AllNM1 = new All_NM1_837P_6(); // Begin 1000A Loop SUBMITTER transaction.AllNM1.Loop1000A = new Loop_1000A_837P(); // ... set the remaining loops and segments the same way // SegmentBuilders is in the Common project of the example repository using (var stream = new MemoryStream()) { using (var writer = new X12Writer(stream)) { writer.Write(SegmentBuilders.BuildIsa("1")); writer.Write(SegmentBuilders.BuildGs("1", "SENDER1", "RECEIVER1", "005010X222A1")); writer.Write(transaction); } Console.WriteLine(Encoding.UTF8.GetString(stream.ToArray())); }
import json import edifabric_x12 as ef serial = "YOUR_SERIAL_KEY" ef.load_library() ef.set_serial(serial) ef.set_map(json.dumps({"default": serial, "maps": {}})) # the transactions JSON returned by ef.parse, edited or produced by your application transactions = open("ClaimPayment.json", "rb").read() edi = ef.build(transactions, postfix="\r\n") print(edi)
import com.edifabric.nativex12.EdiFabricX12; String serial = "YOUR_SERIAL_KEY"; EdiFabricX12.loadLibrary(); EdiFabricX12.setSerial(serial); EdiFabricX12.setMap("{\"default\":\"" + serial + "\",\"maps\":{}}"); // the transactions JSON returned by parse, edited or produced by your application String transactions = Files.readString(Path.of("ClaimPayment.json")); String edi = EdiFabricX12.build(transactions, "\r\n"); System.out.println(edi);
#include "edifabric_x12.h" ef_buffer edi; if (ef_load_library(NULL) != 0) return 1; ef_set_serial("YOUR_SERIAL_KEY"); ef_set_map("{\"default\":\"YOUR_SERIAL_KEY\",\"maps\":{}}"); /* the transactions JSON returned by ef_parse, edited or produced by your application */ char *transactions = read_file("ClaimPayment.json", NULL); if (ef_build(transactions, "\r\n", &edi) == 0) { fwrite(edi.data, 1, (size_t)edi.length, stdout); ef_free(edi.data); }
# the JSON returned by /read, edited or produced by your application curl -X POST 'https://api.edination.com/v2/x12/write' \ -H 'Ocp-Apim-Subscription-Key: YOUR_SERIAL_KEY' \ -H 'Content-Type: application/json' \ --data-binary '@ClaimPayment.json' \ -o 'ClaimPayment.txt'
Complete ediFabric .NET example
A complete C# program for the X12 837P, built on TS837P in EdiFabric.Templates.Hipaa. The same code is in the ediFabric .NET examples on GitHub.
using EdiFabric.Framework.Readers;
using EdiFabric.Framework.Writers;
using EdiFabric.Templates.Hipaa5010;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using EdiFabric.Core.Model.Edi;
using EdiFabric.Core.Model.Edi.X12;
using EdiFabric.Examples.X12.Common;
namespace EdiFabric.Examples.X12.T837P
{
class Program
{
static void Main(string[] args)
{
SerialKey.Set(Common.SerialKey.Get());
Read();
Write();
}
///
/// Read Claim
///
static void Read()
{
var ediStream = File.OpenRead(Directory.GetCurrentDirectory() + @"\..\..\..\Files\Hipaa\ClaimPayment.txt");
List ediItems;
using (var ediReader = new X12Reader(ediStream, "EdiFabric.Templates.Hipaa"))
ediItems = ediReader.ReadToEnd().ToList();
var transactions = ediItems.OfType();
foreach (var transaction in transactions)
{
if (transaction.HasErrors)
{
// partially parsed
var errors = transaction.ErrorContext.Flatten();
}
}
}
///
/// Write Claim
///
static void Write()
{
var transaction = BuildClaim("1");
using (var stream = new MemoryStream())
{
using (var writer = new X12Writer(stream))
{
writer.Write(SegmentBuilders.BuildIsa("1"));
writer.Write(SegmentBuilders.BuildGs("1", "SENDER1", "RECEIVER1", "005010X222A1"));
writer.Write(transaction);
}
var ediString = stream.LoadToString();
}
}
///
/// Build claim.
/// Original from http://www.x12.org/examples/005010X222/commercial-health-insurance/
///
public static TS837P BuildClaim(string controlNumber)
{
var result = new TS837P();
// Indicates the start of a claim transaction set and assigns a control number.
result.ST = new ST();
result.ST.TransactionSetIdentifierCode_01 = "837";
result.ST.TransactionSetControlNumber_02 = controlNumber.PadLeft(9, '0');
result.ST.ImplementationConventionPreference_03 = "005010X222A1";
// Indicates the claim was created on October 15, 2006 and submitter is identified with 244579.
result.BHT_BeginningOfHierarchicalTransaction = new BHT_BeginningOfHierarchicalTransaction_8();
result.BHT_BeginningOfHierarchicalTransaction.HierarchicalStructureCode_01 = "0019";
result.BHT_BeginningOfHierarchicalTransaction.TransactionSetPurposeCode_02 = "00";
result.BHT_BeginningOfHierarchicalTransaction.SubmitterTransactionIdentifier_03 = "244579";
result.BHT_BeginningOfHierarchicalTransaction.TransactionSetCreationDate_04 = "20061015";
result.BHT_BeginningOfHierarchicalTransaction.TransactionSetCreationTime_05 = "1023";
result.BHT_BeginningOfHierarchicalTransaction.TransactionTypeCode_06 = "CH";
// Occurrence of NM1 Loops in any order
result.AllNM1 = new All_NM1_837P_6();
// Begin 1000A Loop SUBMITTER
result.AllNM1.Loop1000A = new Loop_1000A_837P();
// Premier Billing Service with EDI# TGJ23
result.AllNM1.Loop1000A.NM1_SubmitterName = new NM1_InformationReceiverName_4();
result.AllNM1.Loop1000A.NM1_SubmitterName.EntityIdentifierCode_01 = "41";
result.AllNM1.Loop1000A.NM1_SubmitterName.EntityTypeQualifier_02 = "2";
result.AllNM1.Loop1000A.NM1_SubmitterName.ResponseContactLastorOrganizationName_03 = "PREMIER BILLING SERVICE";
result.AllNM1.Loop1000A.NM1_SubmitterName.IdentificationCodeQualifier_08 = "46";
result.AllNM1.Loop1000A.NM1_SubmitterName.ResponseContactIdentifier_09 = "TGJ23";
// Repeating PER
result.AllNM1.Loop1000A.PER_SubmitterEDIContactInformation = new List();
// CONTACT PERSON AND PHONE NUMBER: JERRY, 305-555-2222 ext. 231
var perLoop1000A = new PER_BillingProviderContactInformation();
perLoop1000A.ContactFunctionCode_01 = "IC";
perLoop1000A.ResponseContactName_02 = "JERRY";
perLoop1000A.CommunicationNumberQualifier_03 = "TE";
perLoop1000A.ResponseContactCommunicationNumber_04 = "3055552222";
perLoop1000A.CommunicationNumberQualifier_05 = "EX";
perLoop1000A.ResponseContactCommunicationNumber_06 = "231";
result.AllNM1.Loop1000A.PER_SubmitterEDIContactInformation.Add(perLoop1000A);
// End 1000A Loop SUBMITTER
// Begin 1000B Loop RECEIVER
result.AllNM1.Loop1000B = new Loop_1000B_837P();
// Key Insurance Company with EDI #:66783JJT
result.AllNM1.Loop1000B.NM1_ReceiverName = new NM1_ReceiverName();
result.AllNM1.Loop1000B.NM1_ReceiverName.EntityIdentifierCode_01 = "40";
result.AllNM1.Loop1000B.NM1_ReceiverName.EntityTypeQualifier_02 = "2";
result.AllNM1.Loop1000B.NM1_ReceiverName.ResponseContactLastorOrganizationName_03 = "KEY INSURANCE COMPANY";
result.AllNM1.Loop1000B.NM1_ReceiverName.IdentificationCodeQualifier_08 = "46";
result.AllNM1.Loop1000B.NM1_ReceiverName.ResponseContactIdentifier_09 = "66783JJT";
// End 1000B Loop RECEIVER
// Repeating 2000A Loops
result.Loop2000A = new List();
// Begin 2000A Loop BILLING PROVIDER Hierarchy
var loop2000A = new Loop_2000A_837P();
// Hierarchical Number 1
loop2000A.HL_BillingProviderHierarchicalLevel = new HL_BillingProviderHierarchicalLevel();
loop2000A.HL_BillingProviderHierarchicalLevel.HierarchicalIDNumber_01 = "1";
loop2000A.HL_BillingProviderHierarchicalLevel.HierarchicalLevelCode_03 = "20";
loop2000A.HL_BillingProviderHierarchicalLevel.HierarchicalChildCode_04 = "1";
// Taxonomy Code: 203BF0100Y
loop2000A.PRV_BillingProviderSpecialtyInformation = new PRV_BillingProviderSpecialtyInformation();
loop2000A.PRV_BillingProviderSpecialtyInformation.ProviderCode_01 = "BI";
loop2000A.PRV_BillingProviderSpecialtyInformation.ReferenceIdentificationQualifier_02 = "PXC";
loop2000A.PRV_BillingProviderSpecialtyInformation.ProviderTaxonomyCode_03 = "203BF0100Y";
// Occurrence of NM1 Loops in any order
loop2000A.AllNM1 = new All_NM1_837P();
// Begin 2010AA Loop BILLING PROVIDER
loop2000A.AllNM1.Loop2010AA = new Loop_2010AA_837P();
// Name is BEN KILDARE SERVICE with NPI: 9876543210
loop2000A.AllNM1.Loop2010AA.NM1_BillingProviderName = new NM1_BillingProviderName_2();
loop2000A.AllNM1.Loop2010AA.NM1_BillingProviderName.EntityIdentifierCode_01 = "85";
loop2000A.AllNM1.Loop2010AA.NM1_BillingProviderName.EntityTypeQualifier_02 = "2";
loop2000A.AllNM1.Loop2010AA.NM1_BillingProviderName.ResponseContactLastorOrganizationName_03 = "BEN KILDARE SERVICE";
loop2000A.AllNM1.Loop2010AA.NM1_BillingProviderName.IdentificationCodeQualifier_08 = "XX";
loop2000A.AllNM1.Loop2010AA.NM1_BillingProviderName.ResponseContactIdentifier_09 = "9876543210";
// ADDRESS: 234 Seaway St
loop2000A.AllNM1.Loop2010AA.N3_BillingProviderAddress = new N3_AdditionalPatientInformationContactAddress();
loop2000A.AllNM1.Loop2010AA.N3_BillingProviderAddress.ResponseContactAddressLine_01 = "234 SEAWAY ST";
// LOCATION: Miami, FL, 33111
loop2000A.AllNM1.Loop2010AA.N4_BillingProviderCity_State_ZIPCode = new N4_AdditionalPatientInformationContactCity();
loop2000A.AllNM1.Loop2010AA.N4_BillingProviderCity_State_ZIPCode.AdditionalPatientInformationContactCityName_01 = "MIAMI";
loop2000A.AllNM1.Loop2010AA.N4_BillingProviderCity_State_ZIPCode.AdditionalPatientInformationContactStateCode_02 = "FL";
loop2000A.AllNM1.Loop2010AA.N4_BillingProviderCity_State_ZIPCode.AdditionalPatientInformationContactPostalZoneorZIPCode_03 = "33111";
// Occurrence of REF Loops in any order
loop2000A.AllNM1.Loop2010AA.AllREF = new All_REF_837P_8();
// TIN: 587654321
loop2000A.AllNM1.Loop2010AA.AllREF.REF_BillingProviderTaxIdentification = new REF_BillingProviderTaxIdentification();
loop2000A.AllNM1.Loop2010AA.AllREF.REF_BillingProviderTaxIdentification.ReferenceIdentificationQualifier_01 = "EI";
loop2000A.AllNM1.Loop2010AA.AllREF.REF_BillingProviderTaxIdentification.MemberGrouporPolicyNumber_02 = "587654321";
// End 2010AA Loop BILLING PROVIDER
// Begin 2010AB Loop PAY-TO PROVIDER
loop2000A.AllNM1.Loop2010AB = new Loop_2010AB_837P();
// PAY-TO PROVIDER Name is Kildare Associates
loop2000A.AllNM1.Loop2010AB.NM1_Pay_AddressName = new NM1_Pay();
loop2000A.AllNM1.Loop2010AB.NM1_Pay_AddressName.EntityIdentifierCode_01 = "87";
loop2000A.AllNM1.Loop2010AB.NM1_Pay_AddressName.EntityTypeQualifier_02 = "2";
loop2000A.AllNM1.Loop2010AB.NM1_Pay_AddressName.ResponseContactLastorOrganizationName_03 = "Kildare Associates";
// PROVIDER ADDRESS: 2345 Ocean Blvd
loop2000A.AllNM1.Loop2010AB.N3_Pay_ToAddress_ADDRESS = new N3_AdditionalPatientInformationContactAddress();
loop2000A.AllNM1.Loop2010AB.N3_Pay_ToAddress_ADDRESS.ResponseContactAddressLine_01 = "2345 OCEAN BLVD";
// PROVIDER LOCATION: Miami, Fl 33111
loop2000A.AllNM1.Loop2010AB.N4_Pay_AddressCity_State_ZIPCode = new N4_AdditionalPatientInformationContactCity();
loop2000A.AllNM1.Loop2010AB.N4_Pay_AddressCity_State_ZIPCode.AdditionalPatientInformationContactCityName_01 = "MIAMI";
loop2000A.AllNM1.Loop2010AB.N4_Pay_AddressCity_State_ZIPCode.AdditionalPatientInformationContactStateCode_02 = "FL";
loop2000A.AllNM1.Loop2010AB.N4_Pay_AddressCity_State_ZIPCode.AdditionalPatientInformationContactPostalZoneorZIPCode_03 = "33111";
// End 2010AB Loop PAY-TO PROVIDER
// Repeating 2000B Loops
loop2000A.Loop2000B = new List();
// Begin 2000B Loop SUBSCRIBER Hierarchy
var loop2000B = new Loop_2000B_837P();
// Hierarchical Number 2
loop2000B.HL_SubscriberHierarchicalLevel = new HL_SubscriberHierarchicalLevel();
loop2000B.HL_SubscriberHierarchicalLevel.HierarchicalIDNumber_01 = "2";
loop2000B.HL_SubscriberHierarchicalLevel.HierarchicalParentIDNumber_02 = "1";
loop2000B.HL_SubscriberHierarchicalLevel.HierarchicalLevelCode_03 = "22";
loop2000B.HL_SubscriberHierarchicalLevel.HierarchicalChildCode_04 = "1";
// SUBSCRIBER GROUP #: 2222-SJ
loop2000B.SBR_SubscriberInformation = new SBR_SubscriberInformation();
loop2000B.SBR_SubscriberInformation.PayerResponsibilitySequenceNumberCode_01 = "P";
loop2000B.SBR_SubscriberInformation.InsuredGrouporPolicyNumber_03 = "2222-SJ";
loop2000B.SBR_SubscriberInformation.ClaimFilingIndicatorCode_09 = "CI";
// Occurrence of NM1 Loops in any order
loop2000B.AllNM1 = new All_NM1_837P_2();
// Begin 2010BA Loop SUBSCRIBER
loop2000B.AllNM1.Loop2010BA = new Loop_2010BA_837P();
// SUBSCRIBER name is Jane Smith
loop2000B.AllNM1.Loop2010BA.NM1_SubscriberName = new NM1_SubscriberName_5();
loop2000B.AllNM1.Loop2010BA.NM1_SubscriberName.EntityIdentifierCode_01 = "IL";
loop2000B.AllNM1.Loop2010BA.NM1_SubscriberName.EntityTypeQualifier_02 = "1";
loop2000B.AllNM1.Loop2010BA.NM1_SubscriberName.ResponseContactLastorOrganizationName_03 = "SMITH";
loop2000B.AllNM1.Loop2010BA.NM1_SubscriberName.ResponseContactFirstName_04 = "JANE";
loop2000B.AllNM1.Loop2010BA.NM1_SubscriberName.IdentificationCodeQualifier_08 = "MI";
loop2000B.AllNM1.Loop2010BA.NM1_SubscriberName.ResponseContactIdentifier_09 = "JS00111223333";
// SUBSCRIBER SEX: F and DOB: 05 / 01 / 43
loop2000B.AllNM1.Loop2010BA.DMG_SubscriberDemographicInformation = new DMG_PatientDemographicInformation();
loop2000B.AllNM1.Loop2010BA.DMG_SubscriberDemographicInformation.DateTimePeriodFormatQualifier_01 = "D8";
loop2000B.AllNM1.Loop2010BA.DMG_SubscriberDemographicInformation.DependentBirthDate_02 = "19430501";
loop2000B.AllNM1.Loop2010BA.DMG_SubscriberDemographicInformation.DependentGenderCode_03 = "F";
// End 2010BA Loop SUBSCRIBER
// Begin 2010BB Loop PAYER
loop2000B.AllNM1.Loop2010BB = new Loop_2010BB_837P();
// Payer name is Key Insurance Company with PAYER ID: 999996666
loop2000B.AllNM1.Loop2010BB.NM1_PayerName = new NM1_OtherPayerName();
loop2000B.AllNM1.Loop2010BB.NM1_PayerName.EntityIdentifierCode_01 = "PR";
loop2000B.AllNM1.Loop2010BB.NM1_PayerName.EntityTypeQualifier_02 = "2";
loop2000B.AllNM1.Loop2010BB.NM1_PayerName.ResponseContactLastorOrganizationName_03 = "KEY INSURANCE COMPANY";
loop2000B.AllNM1.Loop2010BB.NM1_PayerName.IdentificationCodeQualifier_08 = "PI";
loop2000B.AllNM1.Loop2010BB.NM1_PayerName.ResponseContactIdentifier_09 = "999996666";
// Occurrence of REF in any order
loop2000B.AllNM1.Loop2010BB.AllREF = new All_REF_837P_5();
// Repeating REF
loop2000B.AllNM1.Loop2010BB.AllREF.REF_BillingProviderSecondaryIdentification = new List();
// KEY INSURANCE COMPANY PROVIDER ID #: KA6663
var refLoop2000B = new REF_BillingProviderSecondaryIdentification();
refLoop2000B.ReferenceIdentificationQualifier_01 = "G2";
refLoop2000B.MemberGrouporPolicyNumber_02 = "KA6663";
loop2000B.AllNM1.Loop2010BB.AllREF.REF_BillingProviderSecondaryIdentification.Add(refLoop2000B);
// End 2010BB Loop PAYER
// Repeating 2000C Loops
loop2000B.Loop2000C = new List();
// Begin 2000C Loop PATIENT Hierarchy
var loop2000C = new Loop_2000C_837P();
// Hierarchical Number 3
loop2000C.HL_PatientHierarchicalLevel = new HL_DependentLevel();
loop2000C.HL_PatientHierarchicalLevel.HierarchicalIDNumber_01 = "3";
loop2000C.HL_PatientHierarchicalLevel.HierarchicalParentIDNumber_02 = "2";
loop2000C.HL_PatientHierarchicalLevel.HierarchicalLevelCode_03 = "23";
loop2000C.HL_PatientHierarchicalLevel.HierarchicalChildCode_04 = "0";
loop2000C.PAT_PatientInformation = new PAT_PatientInformation();
loop2000C.PAT_PatientInformation.IndividualRelationshipCode_01 = "19";
// Begin 2010CA Loop PATIENT
loop2000C.Loop2010CA = new Loop_2010CA_837P();
// PATIENT name is Ted Smith
loop2000C.Loop2010CA.NM1_PatientName = new NM1_PatientName_3();
loop2000C.Loop2010CA.NM1_PatientName.EntityIdentifierCode_01 = "QC";
loop2000C.Loop2010CA.NM1_PatientName.EntityTypeQualifier_02 = "1";
loop2000C.Loop2010CA.NM1_PatientName.ResponseContactLastorOrganizationName_03 = "SMITH";
loop2000C.Loop2010CA.NM1_PatientName.ResponseContactFirstName_04 = "TED";
// PATIENT ADDRESS: 236 N. Main St.
loop2000C.Loop2010CA.N3_PatientAddress = new N3_AdditionalPatientInformationContactAddress();
loop2000C.Loop2010CA.N3_PatientAddress.ResponseContactAddressLine_01 = "236 N MAIN ST";
// PATIENT LOCATION: Miami, Fl, 33413
loop2000C.Loop2010CA.N4_PatientCity_State_ZIPCode = new N4_AdditionalPatientInformationContactCity();
loop2000C.Loop2010CA.N4_PatientCity_State_ZIPCode.AdditionalPatientInformationContactCityName_01 = "MIAMI";
loop2000C.Loop2010CA.N4_PatientCity_State_ZIPCode.AdditionalPatientInformationContactStateCode_02 = "FL";
loop2000C.Loop2010CA.N4_PatientCity_State_ZIPCode.AdditionalPatientInformationContactPostalZoneorZIPCode_03 = "33413";
// PATIENT SEX: M and DOB: 05 / 01 / 73
loop2000C.Loop2010CA.DMG_PatientDemographicInformation = new DMG_PatientDemographicInformation();
loop2000C.Loop2010CA.DMG_PatientDemographicInformation.DateTimePeriodFormatQualifier_01 = "D8";
loop2000C.Loop2010CA.DMG_PatientDemographicInformation.DependentBirthDate_02 = "19730501";
loop2000C.Loop2010CA.DMG_PatientDemographicInformation.DependentGenderCode_03 = "M";
// End 2010CA Loop PATIENT
// Repeating 2300 Loops
loop2000C.Loop2300 = new List();
// Begin 2300 Loop CLAIM
var loop2300 = new Loop_2300_837P();
// PATIENT ACCOUNT NUMBER: 2-646-3774
loop2300.CLM_ClaimInformation = new CLM_ClaimInformation_3();
loop2300.CLM_ClaimInformation.PatientControlNumber_01 = "26463774";
loop2300.CLM_ClaimInformation.TotalClaimChargeAmount_02 = "100";
loop2300.CLM_ClaimInformation.HealthCareServiceLocationInformation_05 = new C023_HealthCareServiceLocationInformation_2();
loop2300.CLM_ClaimInformation.HealthCareServiceLocationInformation_05.FacilityTypeCode_01 = "11";
loop2300.CLM_ClaimInformation.HealthCareServiceLocationInformation_05.FacilityCodeQualifier_02 = "B";
loop2300.CLM_ClaimInformation.HealthCareServiceLocationInformation_05.ClaimFrequencyTypeCode_03 = "1";
loop2300.CLM_ClaimInformation.ProviderorSupplierSignatureIndicator_06 = "Y";
loop2300.CLM_ClaimInformation.AssignmentorPlanParticipationCode_07 = "A";
loop2300.CLM_ClaimInformation.BenefitsAssignmentCertificationIndicator_08 = "Y";
loop2300.CLM_ClaimInformation.ReleaseofInformationCode_09 = "I";
// Occurrence of REF in any order
loop2300.AllREF = new All_REF_837P_6();
// ELECTRONIC ROUTE: Billing provider (sender), to VAN to Key Insurance Company (receiver). VAN claim identification number = 17312345600006351.
loop2300.AllREF.REF_ClaimIdentifierForTransmissionIntermediaries = new REF_ClaimIdentificationNumberForClearinghousesAndOtherTransmissionIntermediaries();
loop2300.AllREF.REF_ClaimIdentifierForTransmissionIntermediaries.ReferenceIdentificationQualifier_01 = "D9";
loop2300.AllREF.REF_ClaimIdentifierForTransmissionIntermediaries.MemberGrouporPolicyNumber_02 = "17312345600006351";
// Occurrence of HI in any order
loop2300.AllHI = new All_HI_837P();
// CASE: Patient has sore throat.
loop2300.AllHI.HI_HealthCareDiagnosisCode = new HI_DependentHealthCareDiagnosisCode_2();
loop2300.AllHI.HI_HealthCareDiagnosisCode.HealthCareCodeInformation_01 = new C022_HealthCareCodeInformation_8();
loop2300.AllHI.HI_HealthCareDiagnosisCode.HealthCareCodeInformation_01.CodeListQualifierCode_01 = "BK";
loop2300.AllHI.HI_HealthCareDiagnosisCode.HealthCareCodeInformation_01.IndustryCode_02 = "0340";
loop2300.AllHI.HI_HealthCareDiagnosisCode.HealthCareCodeInformation_02 = new C022_HealthCareCodeInformation_4();
loop2300.AllHI.HI_HealthCareDiagnosisCode.HealthCareCodeInformation_02.CodeListQualifierCode_01 = "BF";
loop2300.AllHI.HI_HealthCareDiagnosisCode.HealthCareCodeInformation_02.IndustryCode_02 = "V7389";
// Repeating 2400 Loops
loop2300.Loop2400 = new List();
// Begin 2400 Loop SERVICE LINE 1
var loop24001 = new Loop_2400_837P();
loop24001.LX_ServiceLineNumber = new LX_HeaderNumber();
loop24001.LX_ServiceLineNumber.AssignedNumber_01 = "1";
// SERVICES: Office visit, intermediate service, established patient, throat culture.
// CHARGES: Office first visit = $40.00
loop24001.SV1_ProfessionalService = new SV1_ProfessionalService();
loop24001.SV1_ProfessionalService.CompositeMedicalProcedureIdentifier_01 = new C003_CompositeMedicalProcedureIdentifier_12();
loop24001.SV1_ProfessionalService.CompositeMedicalProcedureIdentifier_01.ProductorServiceIDQualifier_01 = "HC";
loop24001.SV1_ProfessionalService.CompositeMedicalProcedureIdentifier_01.ProcedureCode_02 = "99213";
loop24001.SV1_ProfessionalService.LineItemChargeAmount_02 = "40";
loop24001.SV1_ProfessionalService.UnitorBasisforMeasurementCode_03 = "UN";
loop24001.SV1_ProfessionalService.ServiceUnitCount_04 = "1";
loop24001.SV1_ProfessionalService.CompositeDiagnosisCodePointer_07 = new C004_CompositeDiagnosisCodePointer();
loop24001.SV1_ProfessionalService.CompositeDiagnosisCodePointer_07.DiagnosisCodePointer_01 = "1";
// Occurrence of DTP in any order
loop24001.AllDTP = new All_DTP_837P();
// INITIAL VISIT: DOS=10/03/06. POS=Office
loop24001.AllDTP.DTP_Date_ServiceDate = new DTP_ClaimLevelServiceDate();
loop24001.AllDTP.DTP_Date_ServiceDate.DateTimeQualifier_01 = "472";
loop24001.AllDTP.DTP_Date_ServiceDate.DateTimePeriodFormatQualifier_02 = "D8";
loop24001.AllDTP.DTP_Date_ServiceDate.DateTimePeriod_03 = "20061003";
// End 2400 Loop SERVICE LINE 1
loop2300.Loop2400.Add(loop24001);
// Begin 2400 Loop SERVICE LINE 2
var loop24002 = new Loop_2400_837P();
loop24002.LX_ServiceLineNumber = new LX_HeaderNumber();
loop24002.LX_ServiceLineNumber.AssignedNumber_01 = "2";
// SERVICES: Office visit, intermediate service, established patient, throat culture.
// CHARGES: Lab test for strep = $15.00
loop24002.SV1_ProfessionalService = new SV1_ProfessionalService();
loop24002.SV1_ProfessionalService.CompositeMedicalProcedureIdentifier_01 = new C003_CompositeMedicalProcedureIdentifier_12();
loop24002.SV1_ProfessionalService.CompositeMedicalProcedureIdentifier_01.ProductorServiceIDQualifier_01 = "HC";
loop24002.SV1_ProfessionalService.CompositeMedicalProcedureIdentifier_01.ProcedureCode_02 = "87070";
loop24002.SV1_ProfessionalService.LineItemChargeAmount_02 = "15";
loop24002.SV1_ProfessionalService.UnitorBasisforMeasurementCode_03 = "UN";
loop24002.SV1_ProfessionalService.ServiceUnitCount_04 = "1";
loop24002.SV1_ProfessionalService.CompositeDiagnosisCodePointer_07 = new C004_CompositeDiagnosisCodePointer();
loop24002.SV1_ProfessionalService.CompositeDiagnosisCodePointer_07.DiagnosisCodePointer_01 = "1";
// Occurrence of DTP in any order
loop24002.AllDTP = new All_DTP_837P();
// INITIAL VISIT: DOS=10/03/06. POS=Office
loop24002.AllDTP.DTP_Date_ServiceDate = new DTP_ClaimLevelServiceDate();
loop24002.AllDTP.DTP_Date_ServiceDate.DateTimeQualifier_01 = "472";
loop24002.AllDTP.DTP_Date_ServiceDate.DateTimePeriodFormatQualifier_02 = "D8";
loop24002.AllDTP.DTP_Date_ServiceDate.DateTimePeriod_03 = "20061003";
// End 2400 Loop SERVICE LINE 2
loop2300.Loop2400.Add(loop24002);
// Begin 2400 Loop SERVICE LINE 3
var loop24003 = new Loop_2400_837P();
loop24003.LX_ServiceLineNumber = new LX_HeaderNumber();
loop24003.LX_ServiceLineNumber.AssignedNumber_01 = "3";
// SERVICES: Office visit, intermediate service, established patient, mono screening.
// CHARGES: Follow-up visit = $35.00
loop24003.SV1_ProfessionalService = new SV1_ProfessionalService();
loop24003.SV1_ProfessionalService.CompositeMedicalProcedureIdentifier_01 = new C003_CompositeMedicalProcedureIdentifier_12();
loop24003.SV1_ProfessionalService.CompositeMedicalProcedureIdentifier_01.ProductorServiceIDQualifier_01 = "HC";
loop24003.SV1_ProfessionalService.CompositeMedicalProcedureIdentifier_01.ProcedureCode_02 = "99214";
loop24003.SV1_ProfessionalService.LineItemChargeAmount_02 = "35";
loop24003.SV1_ProfessionalService.UnitorBasisforMeasurementCode_03 = "UN";
loop24003.SV1_ProfessionalService.ServiceUnitCount_04 = "1";
loop24003.SV1_ProfessionalService.CompositeDiagnosisCodePointer_07 = new C004_CompositeDiagnosisCodePointer();
loop24003.SV1_ProfessionalService.CompositeDiagnosisCodePointer_07.DiagnosisCodePointer_01 = "2";
// Occurrence of DTP in any order
loop24003.AllDTP = new All_DTP_837P();
// FOLLOW-UP VISIT: DOS=10/10/06 POS=Office
loop24003.AllDTP.DTP_Date_ServiceDate = new DTP_ClaimLevelServiceDate();
loop24003.AllDTP.DTP_Date_ServiceDate.DateTimeQualifier_01 = "472";
loop24003.AllDTP.DTP_Date_ServiceDate.DateTimePeriodFormatQualifier_02 = "D8";
loop24003.AllDTP.DTP_Date_ServiceDate.DateTimePeriod_03 = "20061010";
// End 2400 Loop SERVICE LINE 3
loop2300.Loop2400.Add(loop24003);
// Begin 2400 Loop SERVICE LINE 4
var loop24004 = new Loop_2400_837P();
loop24004.LX_ServiceLineNumber = new LX_HeaderNumber();
loop24004.LX_ServiceLineNumber.AssignedNumber_01 = "4";
// SERVICES: Office visit, intermediate service, established patient, mono screening.
// CHARGES: Lab test for mono = $10.00
loop24004.SV1_ProfessionalService = new SV1_ProfessionalService();
loop24004.SV1_ProfessionalService.CompositeMedicalProcedureIdentifier_01 = new C003_CompositeMedicalProcedureIdentifier_12();
loop24004.SV1_ProfessionalService.CompositeMedicalProcedureIdentifier_01.ProductorServiceIDQualifier_01 = "HC";
loop24004.SV1_ProfessionalService.CompositeMedicalProcedureIdentifier_01.ProcedureCode_02 = "86663";
loop24004.SV1_ProfessionalService.LineItemChargeAmount_02 = "10";
loop24004.SV1_ProfessionalService.UnitorBasisforMeasurementCode_03 = "UN";
loop24004.SV1_ProfessionalService.ServiceUnitCount_04 = "1";
loop24004.SV1_ProfessionalService.CompositeDiagnosisCodePointer_07 = new C004_CompositeDiagnosisCodePointer();
loop24004.SV1_ProfessionalService.CompositeDiagnosisCodePointer_07.DiagnosisCodePointer_01 = "2";
// Occurrence of DTP in any order
loop24004.AllDTP = new All_DTP_837P();
// FOLLOW-UP VISIT: DOS=10/10/06 POS=Office
loop24004.AllDTP.DTP_Date_ServiceDate = new DTP_ClaimLevelServiceDate();
loop24004.AllDTP.DTP_Date_ServiceDate.DateTimeQualifier_01 = "472";
loop24004.AllDTP.DTP_Date_ServiceDate.DateTimePeriodFormatQualifier_02 = "D8";
loop24004.AllDTP.DTP_Date_ServiceDate.DateTimePeriod_03 = "20061010";
// End 2400 Loop SERVICE LINE 4
loop2300.Loop2400.Add(loop24004);
// End 2300 Loop CLAIM
loop2000C.Loop2300.Add(loop2300);
// End 2000C Loop PATIENT Hierarchy
loop2000B.Loop2000C.Add(loop2000C);
// End 2000B Loop SUBSCRIBER Hierarchy
loop2000A.Loop2000B.Add(loop2000B);
// End 2000A Loop BILLING PROVIDER Hierarchy
result.Loop2000A.Add(loop2000A);
return result;
}
}
}More operations in ediFabric .NET
- Parse X12 files
- Generate X12 files
- Validate X12 messages
- Generate X12 acknowledgments
- Save X12 files to DB
- Convert between X12 and JSON
- Convert between X12 and XML
Template and sample downloads
ediFabric .NET parses, validates and generates the X12 837P with TS837P in EdiFabric.Templates.Hipaa. The template ships in the NuGet package; download the source to adapt it to a trading partner's implementation guide.
- EF_HIPAA_005010_837P.cs 67.5 KB
- EF_HIPAA_005010_Codes.cs 221.6 KB
- EF_HIPAA_005010_Segments.cs 253.8 KB
- EF_HIPAA_005010_SegmentInterfaces.cs 21.7 KB
- EF_HIPAA_005010_ComplexElementInterfaces.cs 5.4 KB
- EF_HIPAA_005010_ComplexElements.cs 38.6 KB
837P questions
What is the difference between the 837P, 837I and 837D?
All three are X12 837 health care claims. The 837P (005010X222A1) bills professional services and replaces the CMS-1500 form. The 837I (005010X223A2) bills institutional services such as hospital stays and replaces the UB-04. The 837D (005010X224A2) bills dental services.
What response does a payer send for an 837P?
A 999 implementation acknowledgment that reports whether the file is syntactically valid, then a 277CA claim acknowledgment that accepts or rejects each claim. Paid and denied claims are reported later in an 835 remittance advice.
How many service lines can one 837P claim have?
Up to 50 service lines (loop 2400) per claim, and up to 12 diagnosis codes in the HI segment. Larger encounters are split into multiple claims.
How do I parse and generate X12 837P files in .NET, Python, Java and C?
In .NET, install EdiFabric and EdiFabric.Templates.Hipaa, read the file with X12Reader into TS837P objects and write them back with X12Writer. From Python, Java or C, use ediFabric Native, which converts 837P files to JSON and JSON back to X12 inside your process. From any other language, post the file to the ediFabric Cloud REST API.
Resources
Parse your first X12 837P in five minutes
The Community plan is free forever and needs no credit card. It includes ediFabric .NET, Native and Cloud with one serial key.
Sign up free Validate EDI files free