Module: Stupidedi::Guides::FiftyTen::X222A1

Defined in:
lib/stupidedi/guides/005010.rb,
lib/stupidedi/guides/005010/X222A1-HC837P.rb

Constant Summary collapse

HC837P =
b.build(t::HC837,
          d::TableDef.header("Table 1 - Header",
            b::Segment(50, s::ST, "Transaction Set Header",
r::Required, d::RepeatCount.bounded(1),
b::Element(e::Required,    "Transaction Set Identifier Code", b::Values("837")),
b::Element(e::Required,    "Transaction Set Control Number"),
b::Element(e::Required,    "Implementation Guide Version Name", b::Values("005010X222A1"))),
            b::Segment(100, s::BHT, "Beginning of Hierarchical Transaction",
r::Required, d::RepeatCount.bounded(1),
b::Element(e::Required,    "Hierarchical Structure Code", b::Values("0019")),
b::Element(e::Required,    "Transaction Set Purpose Code", b::Values("00", "18")),
b::Element(e::Required,    "Originator Application Transaction Identifier", b::MaxLength(30)),
b::Element(e::Required,    "Transaction Set Creation Date"),
b::Element(e::Required,    "Transaction Set Creation Time"),
b::Element(e::Required,    "Claim or Encounter Identifier", b::Values("31", "CH", "RP"))),

            d::LoopDef.build("1000A SUBMITTER NAME",
d::RepeatCount.bounded(1),
b::Segment(200, s::NM1, "Submitter Name",
  r::Required, d::RepeatCount.bounded(1),
  b::Element(e::Required,    "Entity Identifier Code", b::Values("41")),
  b::Element(e::Required,    "Entity Type Qualifier", b::Values("1", "2")),
  b::Element(e::Required,    "Submitter Last or Organization Name"),
  b::Element(e::Situational, "Submitter First Name"),
  b::Element(e::Situational, "Submitter Middle Name or Initial"),
  b::Element(e::NotUsed,     "Name Prefix"),
  b::Element(e::NotUsed,     "Name Suffix"),
  b::Element(e::Required,    "Identification Qualifier Code", b::Values("46")),
  b::Element(e::Required,    "Submitter Identifier"),
  b::Element(e::NotUsed,     "Entity Relationship Code"),
  b::Element(e::NotUsed,     "Entity Identifier Code"),
  b::Element(e::NotUsed,     "Name Last or Organization Name")),
b::Segment(450, s::PER, "Submitter EDI Contact Information",
  r::Required, d::RepeatCount.bounded(2),
  b::Element(e::Required,    "Contact Function Code", b::Values("IC")),
  b::Element(e::Situational, "Submitter Contact Name"),
  b::Element(e::Required,    "Communication Number Qualifier", b::Values("EM", "FX", "TE")),
  b::Element(e::Required,    "Communication Number"),
  b::Element(e::Situational, "Communication Number Qualifier", b::Values("EM", "EX", "FX", "TE")),
  b::Element(e::Situational, "Communication Number"),
  b::Element(e::Situational, "Communication Number Qualifier", b::Values("EM", "EX", "FX", "TE")),
  b::Element(e::Situational, "Communication Number"),
  b::Element(e::NotUsed,     "Contact Inquiry Reference"))),

            d::LoopDef.build("1000B RECEIVER NAME",
d::RepeatCount.bounded(1),
b::Segment(200, s::NM1, "Receiver Name",
  r::Required, d::RepeatCount.bounded(1),
  b::Element(e::Required,    "Entity Identifier Code", b::Values("40")),
  b::Element(e::Required,    "Entity Type Qualifier", b::Values("2")),
  b::Element(e::Required,    "Receiver Name"),
  b::Element(e::NotUsed,     "Name First"),
  b::Element(e::NotUsed,     "Name Last"),
  b::Element(e::NotUsed,     "Name Prefix"),
  b::Element(e::NotUsed,     "Name Suffix"),
  b::Element(e::Required,    "Identification Code Qualifier", b::Values("46")),
  b::Element(e::Required,    "Receiver Primary Identifier"),
  b::Element(e::NotUsed,     "Entity Relationship Code"),
  b::Element(e::NotUsed,     "Entity Identifier Code"),
  b::Element(e::NotUsed,     "Name Last or Organization Name")))),

          d::TableDef.detail("Table 2 - Billing Provider Detail",
            d::LoopDef.build("2000A BILLING PROVIDER HIERARCHICAL LEVEL",
d::RepeatCount.bounded(1),
b::Segment(10, s::HL, "Billing Provider Hierarchical Level",
  r::Required, d::RepeatCount.bounded(1),
  b::Element(e::Required,    "Hierarchical ID Number"),
  b::Element(e::NotUsed,     "Hierarchical Parent ID Number"),
  b::Element(e::Required,    "Hierarchical Level Code", b::Values("20")),
  b::Element(e::Required,    "Hierachical Child Code")),
b::Segment(30, s::PRV, "Billing Provider Specialty Information",
  r::Situational, d::RepeatCount.bounded(1),
  b::Element(e::Required,    "Provider Code", b::Values("BI")),
  b::Element(e::Required,    "Reference Identification Number", b::Values("PXC")),
  b::Element(e::Required,    "Provider Taxonomy Code"),
  b::Element(e::NotUsed,     "State or Province Code"),
  b::Element(e::NotUsed,     "PROVIDER SPECIALTY INFORMATION"),
  b::Element(e::NotUsed,     "Provider Organization Code")),
b::Segment(100, s::CUR, "Foreign Currency Information",
  r::Situational, d::RepeatCount.bounded(1),
  b::Element(e::Required,    "Entity Identifier Code", b::Values("85")),
  b::Element(e::Required,    "Currency Code"),
  b::Element(e::NotUsed,     "Exchange Rate"),
  b::Element(e::NotUsed,     "Entity Identifier Code"),
  b::Element(e::NotUsed,     "Currency Code"),
  b::Element(e::NotUsed,     "Currency Market/Exchange Code"),
  b::Element(e::NotUsed,     "Date/Time Qualifier"),
  b::Element(e::NotUsed,     "Date"),
  b::Element(e::NotUsed,     "Time"),
  b::Element(e::NotUsed,     "Date/Time Qualifier"),
  b::Element(e::NotUsed,     "Date"),
  b::Element(e::NotUsed,     "Time"),
  b::Element(e::NotUsed,     "Date/Time Qualifier"),
  b::Element(e::NotUsed,     "Date"),
  b::Element(e::NotUsed,     "Time"),
  b::Element(e::NotUsed,     "Date/Time Qualifier"),
  b::Element(e::NotUsed,     "Date"),
  b::Element(e::NotUsed,     "Time"),
  b::Element(e::NotUsed,     "Date/Time Qualifier"),
  b::Element(e::NotUsed,     "Date"),
  b::Element(e::NotUsed,     "Time")),

d::LoopDef.build("2010AA BILLING PROVIDER NAME",
  d::RepeatCount.bounded(1),
  b::Segment(150, s::NM1, "Billing Provider Name",
    r::Required, d::RepeatCount.bounded(1),
    b::Element(e::Required,    "Entity Identifier Code", b::Values("85")),
    b::Element(e::Required,    "Entity Type Qualifier", b::Values("1", "2")),
    b::Element(e::Required,    "Billing Provider Last or Organizational Name"),
    b::Element(e::Situational, "Billing Provider First Name"),
    b::Element(e::Situational, "Billing Provider Middle Name or Initial"),
    b::Element(e::NotUsed,     "Name Prefix"),
    b::Element(e::Situational, "Billing Provider Name Suffix"),
    b::Element(e::Situational, "Identification Code Qualifier", b::Values("XX")),
    b::Element(e::Situational, "Billing Provider Identifier"),
    b::Element(e::NotUsed,     "Entity Relationship Code"),
    b::Element(e::NotUsed,     "Entity Identifier Code"),
    b::Element(e::NotUsed,     "Name Last or Organization Name")),
  b::Segment(250, s::N3, "Billing Provider Address",
    r::Required, d::RepeatCount.bounded(1),
    b::Element(e::Required,    "Billing Provider Address Line"),
    b::Element(e::Situational, "Billing Provider Address Line")),
  b::Segment(300, s::N4, "Billing Provider City, State, ZIP Code",
    r::Required, d::RepeatCount.bounded(1),
    b::Element(e::Required,    "Billing Provider City Name"),
    b::Element(e::Situational, "Billing Provider State or Province Code"),
    b::Element(e::Situational, "Billing Provider Postal Zone or ZIP Code"),
    b::Element(e::Situational, "Country Code"),
    b::Element(e::NotUsed,     "Location Qualifier"),
    b::Element(e::NotUsed,     "Location Identifier"),
    b::Element(e::Situational, "Country Subdivision Code")),
  b::Segment(350, s::REF, "Billing Provider Tax Identification",
    r::Required, d::RepeatCount.bounded(1),
    b::Element(e::Required,    "Reference Identification Qualifier", b::Values("EI", "SY")),
    b::Element(e::Required,    "Billing Provider Tax Identification Number"),
    b::Element(e::NotUsed,     "Description"),
    b::Element(e::NotUsed,     "REFERENCE IDENTIFIER")),
  b::Segment(350, s::REF, "Billing Provider UPIN/License Information",
    r::Situational, d::RepeatCount.bounded(2),
    b::Element(e::Required,    "Reference Identification Qualifier", b::Values("0B", "1G")),
    b::Element(e::Required,    "Billing Provider License and/or UPIN Information"),
    b::Element(e::NotUsed,     "Description"),
    b::Element(e::NotUsed,     "REFERENCE IDENTIFIER")),
  b::Segment(400, s::PER, "Billing Provider Contact Information",
    r::Situational, d::RepeatCount.bounded(2),
    b::Element(e::Required,    "Contact Function Code", b::Values("IC")),
    b::Element(e::Situational, "Billing Provider Contact Name"),
    b::Element(e::Required,    "Communication Number Qualifier", b::Values("EM", "FX", "TE")),
    b::Element(e::Required,    "Communication Number"),
    b::Element(e::Situational, "Communication Number Qualifier", b::Values("EM", "EX", "FX", "TE")),
    b::Element(e::Situational, "Communication Number"),
    b::Element(e::Situational, "Communication Number Qualifier", b::Values("EM", "EX", "FX", "TE")),
    b::Element(e::Situational, "Communication Number"),
    b::Element(e::NotUsed,     "Contact Inquiry Reference"))),

d::LoopDef.build("2010AB PAY-TO ADDRESS NAME",
  d::RepeatCount.bounded(1),
  b::Segment(150, s::NM1, "Pay-to Address Name",
    r::Situational, d::RepeatCount.bounded(1),
    b::Element(e::Required,    "Entity Identifier Code", b::Values("87")),
    b::Element(e::Required,    "Entity Type Qualifier", b::Values("1", "2")),
    b::Element(e::NotUsed,     "Name Last or Organizational Name"),
    b::Element(e::NotUsed,     "Name First"),
    b::Element(e::NotUsed,     "Name Middle"),
    b::Element(e::NotUsed,     "Name Prefix"),
    b::Element(e::NotUsed,     "Name Suffix"),
    b::Element(e::NotUsed,     "Identification Code Qualifier"),
    b::Element(e::NotUsed,     "Identifier Code"),
    b::Element(e::NotUsed,     "Entity Relationship Code"),
    b::Element(e::NotUsed,     "Entity Identifier Code"),
    b::Element(e::NotUsed,     "Name Last or Organization Name")),
  b::Segment(250, s::N3, "Pay-to Address - ADDRESS",
    r::Required, d::RepeatCount.bounded(1),
    b::Element(e::Required,    "Pay-To Address Line"),
    b::Element(e::Situational, "Pay-To Address Line")),
  b::Segment(300, s::N4, "Pay-To Address City, State, ZIP Code",
    r::Required, d::RepeatCount.bounded(1),
    b::Element(e::Required,    "Pay-to City Name"),
    b::Element(e::Situational, "Pay-to State or Province Code"),
    b::Element(e::Situational, "Pay-to Postal Zone or ZIP Code"),
    b::Element(e::Situational, "Country Code"),
    b::Element(e::NotUsed,     "Location Qualifier"),
    b::Element(e::NotUsed,     "Location Identifier"),
    b::Element(e::Situational, "Country Subdivision Code"))),

d::LoopDef.build("2010AC PAY-TO PLAN NAME",
  d::RepeatCount.bounded(1),
  b::Segment(150, s::NM1, "Pay-To Plan Name",
    r::Situational, d::RepeatCount.bounded(1),
    b::Element(e::Required,    "Entity Identifier Code", b::Values("PE")),
    b::Element(e::Required,    "Entity Type Qualifier", b::Values("2")),
    b::Element(e::Required,    "Pay-To Plan Organizational Name"),
    b::Element(e::NotUsed,     "Name First"),
    b::Element(e::NotUsed,     "Name Middle"),
    b::Element(e::NotUsed,     "Name Prefix"),
    b::Element(e::NotUsed,     "Name Suffix"),
    b::Element(e::Required,    "Identification Code Qualifier", b::Values("PI", "XV")),
    b::Element(e::Required,    "Pay-To Plan Primary Identifier"),
    b::Element(e::NotUsed,     "Entity Relationship Code"),
    b::Element(e::NotUsed,     "Entity Identifier Code"),
    b::Element(e::NotUsed,     "Name Last or Organization Name")),
  b::Segment(250, s::N3, "Pay-to Plan Address",
    r::Required, d::RepeatCount.bounded(1),
    b::Element(e::Required,    "Pay-To Plan Address Line"),
    b::Element(e::Situational, "Pay-To Plan Address Line")),
  b::Segment(300, s::N4, "Pay-To Plan City, State, ZIP Code",
    r::Required, d::RepeatCount.bounded(1),
    b::Element(e::Required,    "Pay-to Plan City Name"),
    b::Element(e::Situational, "Pay-to Plan State or Province Code"),
    b::Element(e::Situational, "Pay-to Plan Postal Zone or ZIP Code"),
    b::Element(e::Situational, "Country Code"),
    b::Element(e::NotUsed,     "Location Qualifier"),
    b::Element(e::NotUsed,     "Location Identifier"),
    b::Element(e::Situational, "Country Subdivision Code")),
  b::Segment(350, s::REF, "Pay-to Plan Secondary Identification",
    r::Situational, d::RepeatCount.bounded(1),
    b::Element(e::Required,    "Reference Identification Qualifier", b::Values("2U", "FY", "NF")),
    b::Element(e::Required,    "Pay-to Plan Secondary Identifier"),
    b::Element(e::NotUsed,     "Description"),
    b::Element(e::NotUsed,     "REFERENCE IDENTIFIER")),
  b::Segment(350, s::REF, "Pay-to Plan Tax Identification Number",
    r::Required, d::RepeatCount.bounded(1),
    b::Element(e::Required,    "Reference Identification Qualifier", b::Values("EI")),
    b::Element(e::Required,    "Pay-to Plan Tax Identification Number"),
    b::Element(e::NotUsed,     "Description"),
    b::Element(e::NotUsed,     "REFERENCE IDENTIFIER"))))),

          d::TableDef.detail("Table 2 - Subscriber Detail",
            d::LoopDef.build("2000B SUBSCRIBER HIERARCHICAL LEVEL",
d::RepeatCount.bounded(1),
b::Segment(10, s::HL, "Subscriber Hierarchical Level",
  r::Required, d::RepeatCount.bounded(1),
  b::Element(e::Required,    "Hierarchical ID Number"),
  b::Element(e::Required,    "Hierarchical Parent ID Number"),
  b::Element(e::Required,    "Hierarchical Level Code", b::Values("22")),
  b::Element(e::Required,    "Hierachical Child values", b::Values("0", "1"))),
b::Segment(50, s::SBR, "Subscriber Information",
  r::Situational, d::RepeatCount.bounded(1),
  b::Element(e::Required,    "Payer Responsibility Sequence Number", b::Values("A", "B", "C", "D", "E", "F", "G", "H", "P", "S", "T", "U")),
  b::Element(e::Situational, "Individual Relationship Code", b::Values("18")),
  b::Element(e::Situational, "Subscriber Group or Policy Number"),
  b::Element(e::Situational, "Subscriber Group Name"),
  b::Element(e::Situational, "Insurance Type Code", b::Values("12", "13", "14", "15", "16", "41", "42", "43", "47")),
  b::Element(e::NotUsed,     "Coordination of Benefits Code"),
  b::Element(e::NotUsed,     "Yes/No Condition or Response Code"),
  b::Element(e::NotUsed,     "Employment Status Code"),
  b::Element(e::Situational, "Claim Filing Indicator Code", b::Values("11", "12", "13", "14", "15", "16", "17", "AM", "BL", "CH", "CI", "DS", "FI", "HM", "LM", "MA", "MB", "MC", "OF", "TV", "VA", "WC", "ZZ"))),
b::Segment(70, s::PAT, "Patient Information",
  r::Situational, d::RepeatCount.bounded(1),
  b::Element(e::NotUsed,     "Individual Relationship Code"),
  b::Element(e::NotUsed,     "Patient Location Code"),
  b::Element(e::NotUsed,     "Employment Status Code"),
  b::Element(e::NotUsed,     "Student Status Code"),
  b::Element(e::Situational, "Date Time Period Format Qualifier", b::Values("D8")),
  b::Element(e::Situational, "Patient Death Date"),
  b::Element(e::Situational, "Unit or Basis for Measurement Code", b::Values("01")),
  b::Element(e::Situational, "Patient Weight"),
  b::Element(e::Situational, "Pregnancy Indicator", b::Values("Y"))),

d::LoopDef.build("2010BA SUBSCRIBER NAME",
  d::RepeatCount.bounded(1),
  b::Segment(150, s::NM1, "Subscriber Name",
    r::Required, d::RepeatCount.bounded(1),
    b::Element(e::Required,    "Entity Identifier Code", b::Values("IL")),
    b::Element(e::Required,    "Entity Type Qualifier", b::Values("1", "2")),
    b::Element(e::Situational, "Subscriber Last Name"),
    b::Element(e::Situational, "Subscriber First Name"),
    b::Element(e::Situational, "Subscriber Middle Name or Initial"),
    b::Element(e::NotUsed,     "Name Prefix"),
    b::Element(e::Situational, "Subscriber Name Suffix"),
    b::Element(e::Situational, "Identification Code Qualifier", b::Values("II", "MI")),
    b::Element(e::Situational, "Subscriber Primary Identifier"),
    b::Element(e::NotUsed,     "Entity Relationship Code"),
    b::Element(e::NotUsed,     "Entity Identifier Code"),
    b::Element(e::NotUsed,     "Name Last or Organization Name")),
  b::Segment(250, s::N3, "Subscriber Address",
    r::Situational, d::RepeatCount.bounded(1),
    b::Element(e::Required,    "Subscriber Address Line"),
    b::Element(e::Situational, "Subscriber Address Line")),
  b::Segment(300, s::N4, "Subscriber City, State, ZIP Code",
    r::Situational, d::RepeatCount.bounded(1),
    b::Element(e::Required,    "Subscriber City Name"),
    b::Element(e::Situational, "Subscriber State Code"),
    b::Element(e::Situational, "Subscriber Postal Zone or ZIP Code"),
    b::Element(e::Situational, "Country Code"),
    b::Element(e::NotUsed,     "Location Qualifier"),
    b::Element(e::NotUsed,     "Location Identifier"),
    b::Element(e::Situational, "Country Subdivision Code")),
  b::Segment(320, s::DMG, "Subscriber Demographic Information",
    r::Situational, d::RepeatCount.bounded(1),
    b::Element(e::Required,    "Date Time Period Format Qualifier"),
    b::Element(e::Required,    "Subscriber Birth Date"),
    b::Element(e::Required,    "Subscriber Gender Code", b::Values("F", "M", "U")),
    b::Element(e::NotUsed,     "Marital Status Code"),
    b::Element(e::NotUsed,     "COMPOSITE RACE OR ETHNICITY INFORMATION"),
    b::Element(e::NotUsed,     "Citizenship Status Code"),
    b::Element(e::NotUsed,     "Country Code"),
    b::Element(e::NotUsed,     "Basis of Verification Code"),
    b::Element(e::NotUsed,     "Quantity"),
    b::Element(e::NotUsed,     "Code List Qualifier Code"),
    b::Element(e::NotUsed,     "Industry Code")),
  b::Segment(350, s::REF, "Subscriber Secondary Identification",
    r::Situational, d::RepeatCount.bounded(1),
    b::Element(e::Required,    "Reference Identification Qualifier", b::Values("SY")),
    b::Element(e::Required,    "Subscriber Supplemental Identifier"),
    b::Element(e::NotUsed,     "Description"),
    b::Element(e::NotUsed,     "REFERENCE IDENTIFIER")),
  b::Segment(350, s::REF, "Property and Casualty Claim Number",
    r::Situational, d::RepeatCount.bounded(1),
    b::Element(e::Required,    "Reference Identification Qualifier", b::Values("Y4")),
    b::Element(e::Required,    "Property Casualty Claim Number"),
    b::Element(e::NotUsed,     "Description"),
    b::Element(e::NotUsed,     "REFERENCE IDENTIFIER")),
  b::Segment(400, s::PER, "Property and Casualty Subscriber Contact Information",
    r::Situational, d::RepeatCount.bounded(1),
    b::Element(e::Required,    "Contact Fuction Code", b::Values("IC")),
    b::Element(e::Situational, "Name"),
    b::Element(e::Required,    "Communication Qualifier Number", b::Values("TE")),
    b::Element(e::Required,    "Communication Number"),
    b::Element(e::Situational, "Communication Qualifier Number", b::Values("TE", "EX")),
    b::Element(e::Situational, "Communication Number"),
    b::Element(e::NotUsed,     "Communication Qualifier Number"),
    b::Element(e::NotUsed,     "Communication Number"),
    b::Element(e::NotUsed,     "Contact Inquiry Reference"))),

d::LoopDef.build("2010BB PAYER NAME",
  d::RepeatCount.bounded(10),
  b::Segment(150, s::NM1, "Payer Name",
    r::Required, d::RepeatCount.bounded(1),
    b::Element(e::Required,    "Entity Identifier Code", b::Values("PR")),
    b::Element(e::Required,    "Entity Type Qualifier", b::Values("2")),
    b::Element(e::Required,    "Payer Name"),
    b::Element(e::NotUsed,     "Name Last"),
    b::Element(e::NotUsed,     "Name Middle"),
    b::Element(e::NotUsed,     "Name Prefix"),
    b::Element(e::NotUsed,     "Name Suffix"),
    b::Element(e::Required,    "Identification Code Qualifier", b::Values("PI", "XV")),
    b::Element(e::Required,    "Payer Identification"),
    b::Element(e::NotUsed,     "Entity Relationship Code"),
    b::Element(e::NotUsed,     "Entity Identifier Code"),
    b::Element(e::NotUsed,     "Name Last or Organization Name")),
  b::Segment(250, s::N3, "Payer Address",
    r::Situational, d::RepeatCount.bounded(2),
    b::Element(e::Required,    "Payer Address Line"),
    b::Element(e::Situational, "Payer Address Line")),
  b::Segment(300, s::N4, "Payer City, State, ZIP Code",
    r::Situational, d::RepeatCount.bounded(1),
    b::Element(e::Required,    "Payer City Name"),
    b::Element(e::Situational, "Payer State or Province Code"),
    b::Element(e::Situational, "Payer Postal Zone or ZIP Code"),
    b::Element(e::Situational, "Country Code"),
    b::Element(e::NotUsed,     "Location Qualifier"),
    b::Element(e::NotUsed,     "Location Identifier"),
    b::Element(e::Situational, "Country Subdivision Code")),
  b::Segment(350, s::REF, "Payer Secondary Identification",
    r::Situational, d::RepeatCount.bounded(3),
    b::Element(e::Required,    "Reference Identification Qualifier", b::Values("2U", "EI", "FY", "NF")),
    b::Element(e::Required,    "Payer Secondary Identifier"),
    b::Element(e::NotUsed,     "Description"),
    b::Element(e::NotUsed,     "REFERENCE IDENTIFIER")),
  b::Segment(350, s::REF, "Billing Provider Secondary Identification",
    r::Situational, d::RepeatCount.bounded(2),
    b::Element(e::Required,    "Reference Identification Qualifier", b::Values("G2", "LU")),
    b::Element(e::Required,    "Billing Provider Secondary Identifier"),
    b::Element(e::NotUsed,     "Description"),
    b::Element(e::NotUsed,     "REFERENCE IDENTIFIER"))),

loop2300)),

          d::TableDef.detail("Table 2 - Patient Detail",
            d::LoopDef.build("2000C PATIENT HIERARCHICAL LEVEL",
d::RepeatCount.bounded(1),
b::Segment(10, s::HL, "Patient Hierachical Level",
  r::Situational, d::RepeatCount.bounded(1),
  b::Element(e::Required,    "Hierarchical ID Number"),
  b::Element(e::Required,    "Hierarchical Parent ID Number"),
  b::Element(e::Required,    "Hierarchical Level Code", b::Values("23")),
  b::Element(e::Required,    "Hierarchical Child Code", b::Values("0"))),
b::Segment(70, s::PAT, "Patient Information",
  r::Required, d::RepeatCount.bounded(1),
  b::Element(e::Required,    "Individual Relationship Code", b::Values("01", "19", "20", "21", "39", "40", "53", "G8")),
  b::Element(e::NotUsed,     "Patient Location Code"),
  b::Element(e::NotUsed,     "Employment Status Code"),
  b::Element(e::NotUsed,     "Student Status Code"),
  b::Element(e::Situational, "Date Time Period Format Qualifier"),
  b::Element(e::Situational, "Patient Death Date"),
  b::Element(e::Situational, "Unit Basis for Measurement Code", b::Values("01")),
  b::Element(e::Situational, "Patient Weight"),
  b::Element(e::Situational, "Pregnancy Indicator", b::Values("Y"))),

d::LoopDef.build("2010CA PATIENT NAME",
  d::RepeatCount.bounded(1),
  b::Segment(150, s::NM1, "Patient Name",
    r::Required, d::RepeatCount.bounded(1),
    b::Element(e::Required,    "Entity Qualifier Code", b::Values("QC")),
    b::Element(e::Required,    "Entity Type Qualifier", b::Values("1")),
    b::Element(e::Required,    "Patient Last Name"),
    b::Element(e::Situational, "Patient First Name"),
    b::Element(e::Situational, "Patient Middle Name or Initial"),
    b::Element(e::NotUsed,     "Name Prefix"),
    b::Element(e::Situational, "Patient Name Suffix"),
    b::Element(e::NotUsed,     "Identification Code Qualifier"),
    b::Element(e::NotUsed,     "Identification Code"),
    b::Element(e::NotUsed,     "Entity Relationship Code"),
    b::Element(e::NotUsed,     "Entity Identification Code"),
    b::Element(e::NotUsed,     "Name Last or Organization Name")),
  b::Segment(250, s::N3, "Patient Address",
    r::Required, d::RepeatCount.bounded(1),
    b::Element(e::Required,    "Patient Address Line"),
    b::Element(e::Situational, "Patient Address Line")),
  b::Segment(300, s::N4, "Patient City, State, ZIP Code",
    r::Required, d::RepeatCount.bounded(1),
    b::Element(e::Required,    "Patient City Name"),
    b::Element(e::Situational, "Patient State Code"),
    b::Element(e::Situational, "Patient Postal Zone or ZIP Code"),
    b::Element(e::Situational, "Country Code"),
    b::Element(e::NotUsed,     "Location Qualifier"),
    b::Element(e::NotUsed,     "Location Identifier"),
    b::Element(e::Situational, "Country Subdivision Code")),
  b::Segment(320, s::DMG, "Patient Demographic Information",
    r::Required, d::RepeatCount.bounded(1),
    b::Element(e::Required,    "Date Time Period Format Qualifier", b::Values("D8")),
    b::Element(e::Required,    "Patient Birth Date"),
    b::Element(e::Required,    "Patient Gender Code", b::Values("F", "M", "U")),
    b::Element(e::NotUsed,     "Marital Status Code"),
    b::Element(e::NotUsed,     "COMPOSITE RACE OR ETHNICITY INFORMATION"),
    b::Element(e::NotUsed,     "Citizenship Status Code"),
    b::Element(e::NotUsed,     "Country Code"),
    b::Element(e::NotUsed,     "Basis of Verification Code"),
    b::Element(e::NotUsed,     "Quantity"),
    b::Element(e::NotUsed,     "Code List Qualifier Code"),
    b::Element(e::NotUsed,     "Industry Code")),
  b::Segment(350, s::REF, "Property and Casualty Claim Number",
    r::Situational, d::RepeatCount.bounded(1),
    b::Element(e::Required,    "Reference Identifier Qualifier", b::Values("Y4")),
    b::Element(e::Required,    "Property Casualty Claim Number"),
    b::Element(e::NotUsed,     "Description"),
    b::Element(e::NotUsed,     "REFERENCE IDENTIFIER")),
  b::Segment(350, s::REF, "Property and Casualty Patient Identifier",
    r::Situational, d::RepeatCount.bounded(1),
    b::Element(e::Required,    "Reference Identifier Qualifier", b::Values("1W", "SY")),
    b::Element(e::Required,    "Property Casualty Patient Identifier"),
    b::Element(e::NotUsed,     "Description"),
    b::Element(e::NotUsed,     "REFERENCE IDENTIFIER")),
  b::Segment(400, s::PER, "Property and Casualty Patient Contact Information",
    r::Situational, d::RepeatCount.bounded(1),
    b::Element(e::Required,    "Contact Function Code", b::Values("IC")),
    b::Element(e::Situational, "Name"),
    b::Element(e::Required,    "Communication Number Qualifier", b::Values("TE")),
    b::Element(e::Required,    "Communication Number"),
    b::Element(e::Situational, "Communication Number Qualifier", b::Values("EX")),
    b::Element(e::Situational, "Communication Number"),
    b::Element(e::NotUsed,     "Communication Number Qualifier"),
    b::Element(e::NotUsed,     "Communication Number"),
    b::Element(e::NotUsed,     "Contact Inquiry Reference"))),

loop2300)),

          # The X12 standard and X222 specification place the SE segment at what
          # appears to be the end of Table 2 - Patient Detail. This doesn't make
          # sense because Table 2 - Patient Detail doesn't occur if the patient
          # is the subscriber.
          #
          # If we placed it in both Table 2 - Subscriber Detail and Table 2 -
          # Patient Detail, it would incorrectly allow the segment to occur in
          # each table.
          #
          # This structure doesn't match the specification, but it does ensure
          # that the first occurrence of SE terminates the transaction set.
          d::TableDef.summary("Table 3 - Summary",
            b::Segment(5550, s::SE, "Transaction Set Trailer",
r::Required, d::RepeatCount.bounded(1),
b::Element(e::Required,    "Number of Included Segments"),
b::Element(e::Required,    "Transaction Set Control Number"))))