Module: Stupidedi::TransactionSets::FiftyTen::Implementations::X212

Defined in:
lib/stupidedi/transaction_sets/005010/implementations.rb,
lib/stupidedi/transaction_sets/005010/implementations/X212-HN277.rb,
lib/stupidedi/transaction_sets/005010/implementations/X212-HR276.rb

Constant Summary collapse

HN277 =
Builder::Dsl.build("HN", "277", "Health Care Information Status Notification") do
  entity_values = %w[
    03 13 17 1e 1g 1h 1i 1o 1p 1q 1r 1s 1t 1u 1v 1w 1x 1y 1z 28 2a 2b
    2d 2e 2i 2k 2p 2q 2s 2z 30 36 3a 3c 3d 3e 3f 3g 3h 3i 3j 3k 3l 3m 3n 3o 3p 3q
    3r 3s 3t 3u 3v 3w 3x 3y 3z 40 43 44 4a 4b 4c 4d 4e 4f 4g 4h 4i 4j 4l 4m 4n 4o
    4p 4q 4r 4s 4u 4v 4w 4x 4y 4z 5a 5b 5c 5d 5e 5f 5g 5h 5i 5j 5k 5l
    5m 5n 5o 5p 5q 5r 5s 5t 5u 5v 5w 5x 5y 5z 61 6a 6b 6c 6d 6e 6f 6g 6h 6i 6j 6k
    6l 6n 6o 6p 6q 6r 6s 6u 6v 6w 6x 6y 71 72 73 74 77 7c 80 82 84 85 87 95 ck cz
    d2 dd dj dk dn do dq e1 e2 e7 e9 fa fd fe g0 g3 gb gb gi gj gk gm gy hf hh i3
    ij il in li lr mr msc ob od ox p0 p2 p3 p4 p5 p7 prp pt pv pw qa qb qc qd qe qh qk
    ql qn qo qs qv qy rc rw s4 sep sj su t4 tl tq tt ttp tu uh x3 x4 x5 zz
  ].map(&:upcase)
  table_header("1 - Header") do
    segment(100, s::ST, "Transaction Set Header", r::Required, d::RepeatCount.bounded(1)) do
      element(e::Required,    "Transaction Set Identifier Code", b::Values("277"))
      element(e::Required,    "Transaction Set Control Number")
      element(e::Required,    "Version, Release, or Industry Identifier", b::Values("005010X212"))
    end
    segment(200, s::BHT, "Beginning of Hierarchical Transaction", r::Required, d::RepeatCount.bounded(1)) do
      element(e::Required,    "Hierarchical Structure Code", b::Values("0010"))
      element(e::Required,    "Transaction Set Purpose Code", b::Values("08"))
      element(e::Required,    "Originator Application Transaction Identifier", b::MaxLength(30))
      element(e::Required,    "Transaction Set Creation Date")
      element(e::Required,    "Transaction Set Creation Time")
      element(e::Required,    "Transaction Type Code", b::Values("DG"))
    end
  end

  table_detail("2 - Information Source Detail") do
    loop_("2000A INFORMATION SOURCE LEVEL", d::RepeatCount.unbounded) do
      segment(100, s::HL, "Information Source Level", r::Required, d::RepeatCount.bounded(1)) do
        element(e::Required,    "Hierarchical ID Number")
        element(e::NotUsed,     "Hierarchical Parent ID Number")
        element(e::Required,    "Hierarchical Level Code", values("20"))
        element(e::Required,    "Hierachical Child Code", values("1"))
      end
      # positions on page 100
      loop_("2100A INFORMATION SOURCE NAME", d::RepeatCount.bounded(1)) do
        segment(500, s::NM1, "Information Source Name", r::Required, d::RepeatCount.bounded(1)) do
          element(e::Required,    "Entity Identifier Code", values("PR"))
          element(e::Required,    "Entity Type Qualifier", values("2"))
          element(e::Required,    "Payer Name")
          element(e::NotUsed,     "Name First")
          element(e::NotUsed,     "Name Middle")
          element(e::NotUsed,     "Name Prefix")
          element(e::NotUsed,     "Name Suffix")
          element(e::Required,    "Identification Code Qualifier", values("PI", "XV"))
          element(e::Required,    "Payer Identifier")
          element(e::NotUsed,     "Entity Relationship Code")
          element(e::NotUsed,     "Entity Identifier Code")
          element(e::NotUsed,     "Name Last or Organization Name")
        end
        segment(800, s::PER, "Administrative Communications Contact", r::Situational, d::RepeatCount.bounded(1)) do
          element(e::Required,    "Concat Function Code", values("IC"))
          element(e::Situational, "Payer Contact Name")
          element(e::Required,    "Communication Number Qualifier", values("ED", "EM", "FX", "TE"))
          element(e::Required,    "Payer Contact Communication Number")
          element(e::Required,    "Communication Number Qualifier", values("ED", "EM", "FX", "TE"))
          element(e::Required,    "Payer Contact Communication Number")
          element(e::Required,    "Communication Number Qualifier", values("ED", "EM", "FX", "TE"))
          element(e::Required,    "Payer Contact Communication Number")
          element(e::NotUsed,     "Contact Inquiry Reference")
        end
      end
    end
  end
  table_detail("2 - Information Receiver Detail") do
    loop_("2000B INFORMATION RECEIVER LEVEL", d::RepeatCount.unbounded) do
      segment(100, s::HL, "Information Receiver Level", r::Required, d::RepeatCount.bounded(1)) do
        element(e::Required,    "Hierarchical ID Number")
        element(e::Required,    "Hierarchical Parent ID Number")
        element(e::Required,    "Hierarchical Level Code", b::Values("21"))
        element(e::Required,    "Hierachical Child Code", b::Values("0", "1"))
      end # segment Information Receiver Level

      loop_("2100B INFORMATION RECEIVER NAME", d::RepeatCount.bounded(2)) do
        segment(500, s::NM1, "Information Receiver Name", r::Required, d::RepeatCount.bounded(1)) do
          element(e::Required,    "Entity Identifier Code", b::Values("41"))
          element(e::Required,    "Entity Type Qualifier", b::Values("1", "2"))
          element(e::Situational, "Information Receiver Last or Organizational Name")
          element(e::Situational, "Information Receiver First Name")
          element(e::Situational, "Information Receiver Middle Name")
          element(e::NotUsed,     "Name Prefix")
          element(e::NotUsed,     "Name Suffix")
          element(e::Required,    "Identification Code Qualifier", b::Values("46"))
          element(e::Required,    "Information Receiver Identification Number")
          element(e::NotUsed,     "Entity Relationship Code")
          element(e::NotUsed,     "Entity Identifier Code")
          element(e::NotUsed,     "Name Last or Organization Name")
        end # Segment Information Receiver Name
      end # Loop information Receiver Name
      loop_("2200B INFORMATION RECEIVER TRACE IDENTIFIER", d::RepeatCount.bounded(1)) do
        segment(900, s::TRN, "Information Receiver Trace Identifier", r::Situational, d::RepeatCount.bounded(1)) do
          element(e::Required,    "Trace Type Code", b::Values("2"))
          element(e::Required,    "Claim Transaction Batch Number")
          element(e::NotUsed,     "Originating Company Identifier")
          element(e::NotUsed,     "Reference Identification")
        end # Segment Information Receiever Application Trace Ident
        segment(1000, s::STC, "Information Receiver Status Information", r::Required, d::RepeatCount.unbounded) do
          composite(e::Required,    "HEALTH CARE CLAIM STATUS") do
            element(e::Required,    "Status Code")
            element(e::Required,    "Health Care Claim Status Code")
            element(e::Situational, "Entity Identifier Code", b::Values("41", "AY", "PR"))
            element(e::NotUsed,     "Code List Qualifier Code")
          end # composite value
          element(e::Required,    "Status Information Effective Date")
          element(e::NotUsed,     "Action Code")
          element(e::NotUsed,     "Monetary Amount")
          element(e::NotUsed,     "Monetary Amount")
          element(e::NotUsed,     "Date")
          element(e::NotUsed,     "Payment Method Code")
          element(e::NotUsed,     "Date")
          element(e::NotUsed,     "Check Number")
          composite(e::Situational, "HEALTH CARE CLAIM STATUS") do
            element(e::Required,    "Health Care Claim Status Category Code") # @todo: CodeSource.external("507")
            element(e::Required,    "Status Code")          # @todo: CodeSource.external("508")
            element(e::Situational, "Entity Identifier Qualifier", b::Values("41", "AY", "PR"))
            element(e::NotUsed,     "Code List Qualifier Code")
          end # composite value
          composite(e::Situational, "HEALTH CARE CLAIM STATUS") do
            element(e::Required,    "Health Care Claim Status Category Code") # @todo: CodeSource.external("507")
            element(e::Required,    "Status Code")          # @todo: CodeSource.external("508")
            element(e::Situational, "Entity Identifier Qualifier", b::Values("41", "AY", "PR"))
            element(e::NotUsed,     "Code List Qualifier Code")
          end # composite value
          element(e::NotUsed,     "Free-form Message Text")
        end # Segment  information receiver status information
      end # loop Information Receiver Trace Identifier
    end # loop Information Receiver Level
  end # Table 2 - Information Receiver Detail
  table_detail("2 - Service Provider Detail") do
    loop_("2000C Service Provider Level", d::RepeatCount.unbounded) do
      segment(100, s::HL, "Service Provider Level", r::Situational, d::RepeatCount.bounded(1)) do
        element(e::Required,    "Hierarchical ID Number")
        element(e::Required,    "Hierarchical Parent ID Number")
        element(e::Required,    "Hierarchical Level Code", b::Values("19"))
        element(e::Required,    "Hierachical Child Code", b::Values("0", "1"))
      end # Segment 100 Service Provider Level
      loop_("2100C PROVIDER NAME", d::RepeatCount.bounded(2)) do
        segment(500, s::NM1, "Provider Name", r::Required, d::RepeatCount.bounded(1)) do
          element(e::Required,    "Entity Identifier Code", b::Values("1P"))
          element(e::Required,    "Entity Type Qualifier", b::Values("1", "2"))
          element(e::Situational, "Provider Last or Organization Name")
          element(e::Situational, "Provider First Name")
          element(e::Situational, "Provider Middle Name")
          element(e::NotUsed,     "Name Prefix")
          element(e::Situational, "Provider Name Suffix")
          element(
            e::Required, "Identification Code Qualifier",
            b::Values("FI", "SV", "XX")
          )
          element(e::Required,    "Provider Identifier")
          element(e::NotUsed,     "Entity Relationship Code")
          element(e::NotUsed,     "Entity Identifier Code")
          element(e::NotUsed,     "Name Last or Organization Name")
        end # Segment/NM1 - Provider Name
      end # Loop/2100C - Provider Name
      loop_("2200C PROVIDER OF SERVICE TRACE IDENTIFIER", d::RepeatCount.bounded(1)) do
        segment(900, s::TRN, "Provider of Service Trace Identifier", r::Situational, d::RepeatCount.bounded(1)) do
          element(e::Required, "Trace Type Code", values("1"))
          element(e::Required, "Provider of Service INformation Trace Identifier")
          element(e::NotUsed, "Originating Company Identifier")
          element(e::NotUsed, "Reference Identification")
        end # Segment/TRN - Provider of Service Trance Information
        segment(1000, s::STC, "Provider Status Information", r::Required, d::RepeatCount.unbounded) do
          composite(e::Required,    "HEALTH CARE CLAIM STATUS") do
            element(e::Required,    "Health Care Claim Status Category Code")
            element(e::Required,    "Status Code")
            element(e::Situational, "Entity Identifier Code", b::Values("1P"))
            element(e::NotUsed,     "Code List Qualifier Code")
          end # composite value
          element(e::Required,    "Status Information Effective Date")
          element(e::NotUsed,     "Action Code")
          element(e::NotUsed,     "Monetary Amount")
          element(e::NotUsed,     "Monetary Amount")
          element(e::NotUsed,     "Date")
          element(e::NotUsed,     "Payment Method Code")
          element(e::NotUsed,     "Date")
          element(e::NotUsed,     "Check Number")
          composite(e::Situational, "HEALTH CARE CLAIM STATUS") do
            element(e::Required,    "Health Care Claim Status Category Code") # @todo: CodeSource.external("507")
            element(e::Required,    "Health Care Claim Status Code")          # @todo: CodeSource.external("508")
            element(e::Situational, "Entity Identifier Qualifier", b::Values("1P"))
            element(e::NotUsed,     "Code List Qualifier Code")
          end # composite value
          composite(e::Situational, "HEALTH CARE CLAIM STATUS") do
            element(e::Required,    "Health Care Claim Status Category Code") # @todo: CodeSource.external("507")
            element(e::Required,    "Health Care Claim Status Code")          # @todo: CodeSource.external("508")
            element(e::Situational, "Entity Identifier Qualifier", b::Values("1P"))
            element(e::NotUsed,     "Code List Qualifier Code")
          end # composite value
          element(e::NotUsed,     "Free-form Message Text")
        end # Segment/STC - Provider Status Information
      end # Loop/2200C - Provider of Service Trace Identifier
    end # Loop/2000C Service Provider Level
  end # Table/2 - Service Provider Detail
  table_detail("2 - Subscriber Detail") do
    loop_("2000D SUBSCRIBER LEVEL", d::RepeatCount.unbounded) do
      segment(100, s::HL, "Subscriber Level", r::Situational, d::RepeatCount.bounded(1)) do
        element(e::Required,    "Hierarchical ID Number")
        element(e::Required,    "Hierarchical Parent ID Number")
        element(e::Required,    "Hierarchical Level Code", values("22"))
        element(e::Required,    "Hierachical Child Code", values("0", "1"))
      end # Segment/HL - Subscriber Level

      loop_("2100D SUBSCRIBER NAME", d::RepeatCount.bounded(1)) do
        segment(500, s::NM1, "Subscriber Name", r::Required, d::RepeatCount.bounded(1)) do
          element(e::Required,    "Entity Identifier Code", values("IL"))
          element(e::Required,    "Entity Type Qualifier", values("1", "2"))
          element(e::Required,    "Subscriber Last Name")
          element(e::Situational, "Subscriber First Name")
          element(e::Situational, "Subscriber Middle Name or Initial")
          element(e::NotUsed,     "Name Prefix")
          element(e::Situational, "Subscriber Name Suffix")
          element(e::Required,    "Identification Code Qualifier", values("24", "II", "MI"))
          element(e::Required,    "Subscriber Identifier")
          element(e::NotUsed,     "Entity Relationship Code")
          element(e::NotUsed,     "Entity Identifier Code")
          element(e::NotUsed,     "Name Last or Organization Name")
        end # Segment/NM1 - Subscriber Name
      end # Loop/2100D - Subscriber name
      loop_("2200D CLAIM STATUS TRACKING NUMBER", d::RepeatCount.unbounded) do
        segment(900, s::TRN, "Claim Status Tracking Number", r::Situational, d::RepeatCount.bounded(1)) do
          element(e::Required,    "Trace Type Code", values("2"))
          element(e::Required,    "Referenced Transaction Trace Number")
          element(e::NotUsed,     "Originating Company Identifier")
          element(e::NotUsed,     "Reference Identification")
        end # Segment/TRN - Claim Status Tracking Number
        segment(1000, s::STC, "Claim Level Status Information", r::Required, d::RepeatCount.unbounded) do
          composite(e::Required,    "HEALTH CARE CLAIM STATUS") do
            element(e::Required,    "Health Care Claim Status Category Code")
            element(e::Required,    "Health Care Claim Status Code")
            element(e::Situational, "Entity Identifier Code", values(*entity_values))
            element(e::Situational, "Code List Qualifier Code", values("RX"))
          end # Composite/Health care claim status
          element(e::Required,    "Status Information Effective Date")
          element(e::NotUsed,     "Action Code")
          element(e::Situational, "Total Claim Charge Amount")
          element(e::Situational, "Claim Payment Amount")
          element(e::Situational, "Adjudication Finalized Date")
          element(e::NotUsed,     "Payment Method Code")
          element(e::Situational, "Remittance Date")
          element(e::Situational, "Remittance Trace Number")
          composite(e::Situational, "HEALTH CARE CLAIM STATUS") do
            element(e::Required,    "Health Care Claim Status Category Code")
            element(e::Required,    "Health Care Claim Status Code")
            element(e::Situational, "Entity Identifier Code", values(*entity_values))
            element(e::Situational, "Code List Qualifier Code", values("RX"))
          end # Composite/Health Care Claim Status
          composite(e::Situational, "HEALTH CARE CLAIM STATUS") do
            element(e::Required,    "Health Care Claim Status Category Code")
            element(e::Required,    "Health Care Claim Status Code")
            element(e::Situational, "Entity Identifier Code", values(*entity_values))
            element(e::Situational, "Code List Qualifier Code", values("RX"))
          end # Composite/Health Care Claim Status
          element(e::NotUsed, "Free Form Message Text")
        end # Segment/STC - Claim Level Status Information
        segment(1100, s::REF, "Payer Claim Control Number", r::Situational, d::RepeatCount.bounded(1)) do
          element(e::Required,    "Reference Identification Qualifier", values("1K"))
          element(e::Required,    "Payer Claim Control Number")
          element(e::NotUsed,     "Description")
          element(e::NotUsed,     "REFERENCE IDENTIFIER")
        end # Segment/REF - Payer Claim Control Number
        segment(1100, s::REF, "Institutional Bill Type Identification", r::Situational, d::RepeatCount.bounded(1)) do
          element(e::Required,    "Reference Identification Qualifier", values("BLT"))
          element(e::Required,    "Bill Type Identifier")
          element(e::NotUsed,     "Description")
          element(e::NotUsed,     "REFERENCE IDENTIFIER")
        end # Segment/REF - Institutional Bill Type Identification
        segment(1100, s::REF, "Patient Control Number", r::Situational, d::RepeatCount.bounded(1)) do
          element(e::Required,    "Reference Identification Qualifier", values("EJ"))
          element(e::Required,    "Patient Control Number")
          element(e::NotUsed,     "Description")
          element(e::NotUsed,     "REFERENCE IDENTIFIER")
        end # Segment/REF - Patient Control Number
        segment(1100, s::REF, "Pharmacy Prescription Number", r::Situational, d::RepeatCount.bounded(1)) do
          element(e::Required,    "Reference Identification Qualifier", values("XZ"))
          element(e::Required,    "Pharmacy Prescription Number")
          element(e::NotUsed,     "Description")
          element(e::NotUsed,     "REFERENCE IDENTIFIER")
        end # Segment/REF - Pharmacy Prescription Number
        segment(1100, s::REF, "Voucher Identifier", r::Situational, d::RepeatCount.bounded(1)) do
          element(e::Required,    "Reference Identification Qualifier", values("VV"))
          element(e::Required,    "Voucher Identifier")
          element(e::NotUsed,     "Description")
          element(e::NotUsed,     "REFERENCE IDENTIFIER")
        end # Segment/REF - Voucher Identifier
        segment(1100, s::REF, "Claim Identifier Number for Clearinghous and Other Transmission Intermediaries", r::Situational, d::RepeatCount.bounded(1)) do
          element(e::Required,    "Reference Identification Qualifier", values("D9"))
          element(e::Required,    "Clearinghouse Trace Number")
          element(e::NotUsed,     "Description")
          element(e::NotUsed,     "REFERENCE IDENTIFIER")
        end # Segment/REF - Claim Identifier Number for Clearinghouses and...
        segment(1200, s::DTP, "Claim Level Service Date", r::Situational, d::RepeatCount.bounded(1)) do
          element(e::Required,    "Date Time Qualifier", values("472"))
          element(e::Required,    "Date Time Period Format Qualifier", values("D8", "RD8"))
          element(e::Required,    "Claim Service Period")
        end # Segment/DTP - Claim Level Service Date

        loop_("2220D SERVICE LINE INFORMATION", d::RepeatCount.unbounded) do
          segment(1800, s::SVC, "Service Line Information", r::Situational, d::RepeatCount.bounded(1)) do
            composite(e::Required,    "COMPOSITE MEDICAL PROCEDURE IDENTIFIER") do
              element(e::Required,    "Product or Service ID Qualifier", values("AD", "ER", "HC", "HP", "IV", "NU", "WK"))
              element(e::Required,    "Procedure Code")
              element(e::Situational, "Procedure Modifier")
              element(e::Situational, "Procedure Modifier")
              element(e::Situational, "Procedure Modifier")
              element(e::Situational, "Procedure Modifier")
              element(e::NotUsed,     "Description")
              element(e::NotUsed,     "Product/Service ID")
            end # composite/medical procedure identifier
            element(e::Required,    "Line Item Charge Amount")
            element(e::Required,    "Line Item Payment Amount")
            element(e::Situational, "Revenue Code")
            element(e::NotUsed,     "Quantity")
            element(e::NotUsed,     "COMPOSITE MEDICAL PROCEDURE IDENTIFIER")
            element(e::Required, "Units of Service Count")
          end # Segment/SVC - Service Line Information

          segment(1900, s::STC, "Service Line Level Status Information", r::Required, d::RepeatCount.unbounded) do
            composite(e::Required, "HEALTH CARE CLAIM STATUS") do
              element(e::Required,    "Health Care Claim Status Category Code") # @todo: CodeSource.external("507")
              element(e::Required,    "Health Care Claim Status Code")          # @todo: CodeSource.external("508")
              element(e::Situational, "Entity Identifier Code", values(*entity_values))
              element(e::Situational, "Code List Qualifier Code", values("RX"))
            end # composite/ health care claim status
            element(e::Required,    "Statue Information Effective Date")
            element(e::NotUsed,     "Action Code")
            element(e::NotUsed,     "Monetary Amount")
            element(e::NotUsed,     "Monetary Amount")
            element(e::NotUsed,     "Date")
            element(e::NotUsed,     "Payment Method Code")
            element(e::NotUsed,     "Date")
            element(e::NotUsed,     "Check Number")
            composite(e::Situational, "HEALTH CARE CLAIM STATUS") do
              element(e::Required,    "Health Care Claim Status Category Code") # @todo: CodeSource.external("507")
              element(e::Required,    "Health Care Claim Status Code")          # @todo: CodeSource.external("508")
              element(e::Situational, "Entity Identifier Code", values(*entity_values))
              element(e::Situational, "Code List Qualifier Code", values("RX"))
            end # composite/Health care claims
            composite(e::Situational, "HEALTH CARE CLAIM STATUS") do
              element(e::Required,    "Health Care Claim Status Category Code")
              element(e::Required,    "Health Care Claim Status Code")
              element(e::Situational, "Entity Identifier Code", values(*entity_values))
              element(e::Situational, "Code List Qualifier Code", values("RX"))
            end # composite/Health care claim status
            element(e::NotUsed, "Free Form Message Text")
          end # Segment/STC - Service Line Level Information
          segment(2000, s::REF, "Service Line Item Identification", r::Situational, d::RepeatCount.bounded(1)) do
            element(e::Required,    "Reference Identification Qualifier", values("FJ"))
            element(e::Required,    "Line Item Control Number")
            element(e::NotUsed,     "Description")
            element(e::NotUsed,     "REFERENCE IDENTIFIER")
          end # Segment/REF - Service Line item Identification
          segment(2100, s::DTP, "Service Line Date", r::Required, d::RepeatCount.bounded(1)) do
            element(e::Required,    "Date Time Qualifier", values("472"))
            element(e::Required,    "Date Time Period Format Qualifier", values("D8", "RD8"))
            element(e::Required,    "Service Line Date")
          end # Segment/DTP - Service Line Date
        end # Loop/2220D - Service Line Information
      end # Loop/2200D - Claim Status Tracking Number
    end # Loop/2000D - Subscriber Level
  end # Table/2 - Subscriber Detail
  table_detail("2 - Dependent Detail") do
    loop_("2000E DEPENDENT LEVEL", d::RepeatCount.unbounded) do
      segment(100, s::HL, "Dependent Level", r::Situational, d::RepeatCount.bounded(1)) do
        element(e::Required,    "Hierarchical ID Number")
        element(e::Required,    "Hierarchical Parent ID Number")
        element(e::Required,    "Hierarchical Level Code", values("23"))
        element(e::NotUsed,     "Hierachical Child Code")
      end # Segment/HL - Dependent Level

      loop_("2100E DEPENDENT NAME", d::RepeatCount.bounded(1)) do
        segment(500, s::NM1, "Dependent Name", r::Required, d::RepeatCount.bounded(1)) do
          element(e::Required,    "Entity Identifier Code", values("QC"))
          element(e::Required,    "Entity Type Qualifier", values("1"))
          element(e::Required,    "Patient Last Name")
          element(e::Situational, "Patient First Name")
          element(e::Situational, "Patient Last Name")
          element(e::NotUsed,     "Name Prefix")
          element(e::Situational, "Patient Name Suffix")
          element(e::NotUsed,     "Identification Code Qualifier")
          element(e::NotUsed,     "Subscriber Identification Number")
          element(e::NotUsed,     "Entity Relationship Code")
          element(e::NotUsed,     "Entity Identifier Code")
          element(e::NotUsed,     "Name Last or Organization Name")
        end # Segment/NM1 - Dependent Name
      end # Loop/2100D - Subscriber name
      loop_("2200E CLAIM STATUS TRACKING NUMBER", d::RepeatCount.unbounded) do
        segment(900, s::TRN, "Claim Status Tracking Number", r::Required, d::RepeatCount.bounded(1)) do
          element(e::Required,    "Trace Type Code", values("2"))
          element(e::Required,    "Reference Transaction Trace Number")
          element(e::NotUsed,     "Originating Company Identifier")
          element(e::NotUsed,     "Reference Identification")
        end # Segment/TRN - Claim Status Tracking Number
        segment(1000, s::STC, "Claim Level Status Information", r::Required, d::RepeatCount.unbounded) do
          composite(e::Required,  "HEALTH CARE CLAIM STATUS") do
            element(e::Required,    "Health Care Claim Status Category Code")
            element(e::Required,    "Status Code")
            element(e::Situational, "Entity Identifier Code", values(*entity_values))
            element(e::Situational, "Code List Qualifier Code", values("RX"))
          end # Composite/Health care claim status
          element(e::Required,    "Status Information Effective Date")
          element(e::NotUsed,     "Action Code")
          element(e::Situational, "Total Claim Charge Amount")
          element(e::Situational, "Claim Payment Amount")
          element(e::Situational, "Adjudication Finalized Date")
          element(e::NotUsed,     "Payment Method Code")
          element(e::Situational, "Remittance Date")
          element(e::Situational, "Remittance Trace Number")
          composite(e::Situational, "HEALTH CARE CLAIM STATUS") do
            element(e::Required,    "Health Care Claim Status Category Code")
            element(e::Required,    "Health Care Claim Status Code")
            element(e::Situational, "Entity Identifier Code", values(*entity_values))
            element(e::Situational, "Code List Qualifier Code", values("RX"))
          end # Composite/Health Care Claim Status
          composite(e::Situational, "HEALTH CARE CLAIM STATUS") do
            element(e::Required,    "Health Care Claim Status Category Code")
            element(e::Required,    "Health Care Claim Status Code")
            element(e::Situational, "Entity Identifier Code", values(*entity_values))
            element(e::Situational, "Code List Qualifier Code", values("RX"))
          end # Composite/Health Care Claim Status
          element(e::NotUsed,     "Free Form Message Text")
        end # Segment/STC - Claim Level Status Information
        segment(1100, s::REF, "Payer Claim Control Number", r::Situational, d::RepeatCount.bounded(1)) do
          element(e::Required,    "Reference Identification Qualifier", values("1K"))
          element(e::Required,    "Payer Claim Control Number")
          element(e::NotUsed,     "Description")
          element(e::NotUsed,     "REFERENCE IDENTIFIER")
        end # Segment/REF - Payer Claim Control Number
        segment(1100, s::REF, "Institutional Bill Type Identification", r::Situational, d::RepeatCount.bounded(1)) do
          element(e::Required,    "Reference Identification Qualifier", values("BLT"))
          element(e::Required,    "Institutional Bill Type Identification")
          element(e::NotUsed,     "Description")
          element(e::NotUsed,     "REFERENCE IDENTIFIER")
        end # Segment/REF - Institutional Bill Type Identification
        segment(1100, s::REF, "Patient Control Number", r::Situational, d::RepeatCount.bounded(1)) do
          element(e::Required,    "Reference Identification Qualifier", values("EJ"))
          element(e::Required,    "Patient Control Number")
          element(e::NotUsed,     "Description")
          element(e::NotUsed,     "REFERENCE IDENTIFIER")
        end # Segment/REF - Patient Control Number
        segment(1100, s::REF, "Pharmacy Prescription Number", r::Situational, d::RepeatCount.bounded(1)) do
          element(e::Required,    "Reference Identification Qualifier", values("XZ"))
          element(e::Required,    "Pharmacy Prescription Number")
          element(e::NotUsed,     "Description")
          element(e::NotUsed,     "REFERENCE IDENTIFIER")
        end # Segment/REF - Pharmacy Prescription Number
        segment(1100, s::REF, "Voucher Identifier", r::Situational, d::RepeatCount.bounded(1)) do
          element(e::Required,    "Reference Identification Qualifier", values("VV"))
          element(e::Required,    "Pharmacy Prescription Number")
          element(e::NotUsed,     "Description")
          element(e::NotUsed,     "REFERENCE IDENTIFIER")
        end # Segment/REF - Voucher Identifier
        segment(1100, s::REF, "Claim Identifier Number for Clearinghous and Other Transmission Intermediaries", r::Situational, d::RepeatCount.bounded(3)) do
          element(e::Required,    "Reference Identification Qualifier", values("D9"))
          element(e::Required,    "Clearinghouse Trace Number")
          element(e::NotUsed,     "Description")
          element(e::NotUsed,     "REFERENCE IDENTIFIER")
        end # Segment/REF - Claim Identifier Number for Clearinghouses and...
        segment(1200, s::DTP, "Claim Level Service Date", r::Situational, d::RepeatCount.bounded(1)) do
          element(e::Required,    "Date Time Qualifier", values("472"))
          element(e::Required,    "Date Time Period Format Qualifier", values("D8", "RD8"))
          element(e::Required,    "Claim Service Period")
        end # Segment/DTP - Claim Level Service Date

        loop_("2220E SERVICE LINE INFORMATION", d::RepeatCount.unbounded) do
          segment(1800, s::SVC, "Service Line Information", r::Situational, d::RepeatCount.bounded(1)) do
            composite(e::Required,    "COMPOSITE MEDICAL PROCEDURE IDENTIFIER") do
              element(e::Required,    "Product or Service ID Qualifier", values("AD", "ER", "HC", "HP", "IV", "NU", "WK"))
              element(e::Required,    "Procedure Code")
              element(e::Situational, "Procedure Modifier")
              element(e::Situational, "Procedure Modifier")
              element(e::Situational, "Procedure Modifier")
              element(e::Situational, "Procedure Modifier")
              element(e::NotUsed,     "Description")
              element(e::NotUsed,     "Product/Service ID")
            end # composite/medical procedure identifier
            element(e::Required,    "Line Item Charge Amount")
            element(e::Required,    "Line Item Payment Amount")
            element(e::Situational, "Revenue Code")
            element(e::NotUsed,     "Quantity")
            element(e::NotUsed,     "COMPOSITE MEDICAL PROCEDURE IDENTIFIER")
            element(e::Required,    "Units of Service Count")
          end # Segment/SVC - Service Line Information
          segment(1900, s::STC, "Service Line Level Status Information", r::Required, d::RepeatCount.unbounded) do
            composite(e::Required,    "HEALTH CARE CLAIM STATUS") do
              element(e::Required,    "Health Care Claim Status Category Code") # @todo: CodeSource.external("507")
              element(e::Required,    "Status Code")          # @todo: CodeSource.external("508")
              element(e::Situational, "Entity Identifier Code", values(*entity_values))
              element(e::Situational, "Code List Qualifier Code", values("RX"))
            end # composite/ health care claim status
            element(e::Required,    "Status Information Effective Date")
            element(e::NotUsed,     "Action Code")
            element(e::NotUsed,     "Monetary Amount")
            element(e::NotUsed,     "Monetary Amount")
            element(e::NotUsed,     "Date")
            element(e::NotUsed,     "Payment Method Code")
            element(e::NotUsed,     "Date")
            element(e::NotUsed,     "Check Number")
            composite(e::Situational, "HEALTH CARE CLAIM STATUS") do
              element(e::Required,    "Health Care Claim Status Category Code") # @todo: CodeSource.external("507")
              element(e::Required,    "Status Code")          # @todo: CodeSource.external("508")

              element(e::Situational, "Entity Identifier Code", values(*entity_values))
              element(e::Situational, "Code List Qualifier Code", values("RX"))
            end # composite/Health care claims
            composite(e::Situational, "HEALTH CARE CLAIM STATUS") do
              element(e::Required,    "Health Care Claim Status Category Code")
              element(e::Required,    "Health Care Claim Status Code")
              element(e::Situational, "Entity Identifier Code", values(*entity_values))
              element(e::Situational, "Code List Qualifier Code", values("RX"))
            end # composite/Health care claim status
            element(e::NotUsed,     "Free Form Message Text")
          end # Segment/STC - Service Line Level Information
          segment(2000, s::REF, "Service Line Item Identification", r::Situational, d::RepeatCount.bounded(1)) do
            element(e::Required,    "Reference Identification Qualifier", values("FJ"))
            element(e::Required,    "Line Item Control Number")
            element(e::NotUsed,     "Description")
            element(e::NotUsed,     "REFERENCE IDENTIFIER")
          end # Segment/REF - Service Line item Identification
          segment(2100, s::DTP, "Service Line Date", r::Required, d::RepeatCount.bounded(1)) do
            element(e::Required,    "Date Time Qualifier", values("472"))
            element(e::Required,    "Date Time Period Format Qualifier", values("D8", "RD8"))
            element(e::Required,    "Service Line Date")
          end # Segment/DTP - Service Line Date
        end # Loop/2220D - Service Line Information
      end # Loop/2200D - Claim Status Tracking Number
    end # Loop/2000E - Subscriber Level
    segment(2700, s::SE, "Transaction Set Trailer", r::Required, d::RepeatCount.bounded(1)) do
      element(e::Required, "Transaction Segment Count")
      element(e::Required, "Transaction Set Control Number")
    end
  end # Table/2 - Dependent Detail
end
HR276 =
b.build("HR", "276", "Health Care Claim Request",
            d::TableDef.header("1 - Header",
              b::Segment(100, s::ST, "Transaction Set Header", r::Required, d::RepeatCount.bounded(1),
b::Element(e::Required,    "Transaction Set Identifier Code", b::Values("276")),
b::Element(e::Required,    "Transaction Set Control Number"),
b::Element(e::Required,    "Version, Release, or Industry Identifier", b::Values("005010X212"))),
              b::Segment(200, s::BHT, "Beginning of Hierarchical Transaction", r::Required, d::RepeatCount.bounded(1),
b::Element(e::Required,    "Hierarchical Structure Code", b::Values("0010")),
b::Element(e::Required,    "Transaction Set Purpose Code", b::Values("13")),
b::Element(e::Required,    "Reference Identification"),
b::Element(e::Required,    "Transaction Set Creation Date"),
b::Element(e::Required,    "Transaction Set Creation Time"),
b::Element(e::NotUsed,     "Transaction Type Code"))),

            d::TableDef.detail("2 - Information Source Detail",
              d::LoopDef.build("2000A INFORMATION SOURCE LEVEL", d::RepeatCount.unbounded,
b::Segment(100, s::HL, "Information Source 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::Values("1"))),

d::LoopDef.build("2100A PAYER NAME", d::RepeatCount.bounded(1),
  b::Segment(500, 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 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,    "Payer 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("2 - Information Receiver Detail",
              d::LoopDef.build("2000B INFORMATION RECEIVER LEVEL", d::RepeatCount.unbounded,
b::Segment(100, s::HL, "Information Receiver 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("21")),
  b::Element(e::Required,    "Hierachical Child Code", b::Values("1"))),

d::LoopDef.build("2100B INFORMATION RECEIVER NAME", d::RepeatCount.bounded(1),
  b::Segment(500, s::NM1, "Information Receiver 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::Situational, "Information Receiver Last or Organization Name"),
    b::Element(e::Situational, "Information Receiver First Name"),
    b::Element(e::Situational, "Information Receiver Middle Name"),
    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,    "Information Receiver Identification Number"),
    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("2 - Service Provider Detail",
              d::LoopDef.build("2000C SERVICE PROVIDER LEVEL", d::RepeatCount.unbounded,
b::Segment(100, s::HL, "Billing Provider of Service 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("19")),
  b::Element(e::Required,    "Hierachical Child Code", b::Values("1"))),

d::LoopDef.build("2100C PROVIDER NAME", d::RepeatCount.bounded(2),
  b::Segment(500, s::NM1, "Billing Provider Name", r::Required, d::RepeatCount.bounded(1),
    b::Element(e::Required,    "Entity Identifier Code", b::Values("1P")),
    b::Element(e::Required,    "Entity Type Qualifier", b::Values("1", "2")),
    b::Element(e::Situational, "Provider Last or Organization Name"),
    b::Element(e::Situational, "Provider First Name"),
    b::Element(e::Situational, "Provider Middle Name"),
    b::Element(e::NotUsed,     "Name Prefix"),
    b::Element(e::Situational, "Provider Name Suffix"),
    b::Element(e::Required,    "Identification Code Qualifier", b::Values("FI", "SV", "XX")),
    b::Element(e::Required,    "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"))))),

            d::TableDef.detail("2 - Subscriber Detail",
              d::LoopDef.build("2000D SUBSCRIBER LEVEL", d::RepeatCount.unbounded,
b::Segment(100, s::HL, "Subscriber 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 Code", b::Values("0", "1"))),
b::Segment(400, s::DMG, "Subscriber Demographic Information", r::Situational, d::RepeatCount.bounded(1),
  b::Element(e::Required,    "Date Time Period Format Qualifier", b::Values("D8")),
  b::Element(e::Required,    "Subscriber Birth Date"),
  b::Element(e::Situational, "Subscriber Gender Code", b::Values("F", "M")),
  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")),

d::LoopDef.build("2100D SUBSCRIBER NAME", d::RepeatCount.bounded(1),
  b::Segment(500, 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::Required,    "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::Required,    "Identification Code Qualifier", b::Values("24", "II", "MI")),
    b::Element(e::Required,    "Subscriber 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::LoopDef.build("2200D CLAIM STATUS TRACKING NUMBER", d::RepeatCount.unbounded,
  b::Segment( 900, s::TRN, "Claim Status Tracking Number", r::Situational, d::RepeatCount.bounded(1),
    b::Element(e::Required,    "Trace Type Code", b::Values("1")),
    b::Element(e::Required,    "Current Transaction Trace Number"),
    b::Element(e::NotUsed,     "Originating Company Identifier"),
    b::Element(e::NotUsed,     "Reference Identification")),
  b::Segment(1000, s::REF, "Payer Claim Control Number", r::Situational, d::RepeatCount.bounded(1),
    b::Element(e::Required,    "Reference Identification Qualifier", b::Values("1K")),
    b::Element(e::Required,    "Payer Claim Control Number"),
    b::Element(e::NotUsed,     "Description"),
    b::Element(e::NotUsed,     "REFERENCE IDENTIFIER")),
  b::Segment(1000, s::REF, "Institutional Bill Type Identification", r::Situational, d::RepeatCount.bounded(1),
    b::Element(e::Required,    "Reference Identification Qualifier", b::Values("BLT")),
    b::Element(e::Required,    "Bill Type Identifier"),
    b::Element(e::NotUsed,     "Description"),
    b::Element(e::NotUsed,     "REFERENCE IDENTIFIER")),
  b::Segment(1000, s::REF, "Application or Location System Identifier", r::Situational, d::RepeatCount.bounded(1),
    b::Element(e::Required,    "Reference Identification Qualifier", b::Values("LU")),
    b::Element(e::Required,    "Application or Location System Identifier"),
    b::Element(e::NotUsed,     "Description"),
    b::Element(e::NotUsed,     "REFERENCE IDENTIFIER")),
  b::Segment(1000, s::REF, "Group Number", r::Situational, d::RepeatCount.bounded(1),
    b::Element(e::Required,    "Reference Identification Qualifier", b::Values("6P")),
    b::Element(e::Required,    "Group Number"),
    b::Element(e::NotUsed,     "Description"),
    b::Element(e::NotUsed,     "REFERENCE IDENTIFIER")),
  b::Segment(1000, s::REF, "Patient Control Number", r::Situational, d::RepeatCount.bounded(1),
    b::Element(e::Required,    "Reference Identification Qualifier", b::Values("EJ")),
    b::Element(e::Required,    "Patient Control Number"),
    b::Element(e::NotUsed,     "Description"),
    b::Element(e::NotUsed,     "REFERENCE IDENTIFIER")),
  b::Segment(1000, s::REF, "Pharmacy Prescription Number", r::Situational, d::RepeatCount.bounded(1),
    b::Element(e::Required,    "Reference Identification Qualifier", b::Values("XZ")),
    b::Element(e::Required,    "Pharmacy Prescription Number"),
    b::Element(e::NotUsed,     "Description"),
    b::Element(e::NotUsed,     "REFERENCE IDENTIFIER")),
  b::Segment(1000, s::REF, "Claim Identification Number for Clearinghouses and Other Transmission Intermediaries", r::Situational, d::RepeatCount.bounded(1),
    b::Element(e::Required,    "Reference Identification Qualifier", b::Values("D9")),
    b::Element(e::Required,    "Clearinghouse Trace Number"),
    b::Element(e::NotUsed,     "Description"),
    b::Element(e::NotUsed,     "REFERENCE IDENTIFIER")),
  b::Segment(1100, s::AMT, "Institutional Bill Type Identification", r::Situational, d::RepeatCount.bounded(1),
    b::Element(e::Required,    "Amount Qualifier Code", b::Values("T3")),
    b::Element(e::Required,    "Total Claim Charge Amount"),
    b::Element(e::NotUsed,     "Credit/Debit Flag Code")),
  b::Segment(1200, s::DTP, "Claim Level Service Date", r::Situational, d::RepeatCount.bounded(1),
    b::Element(e::Required,    "Date Time Qualifier", b::Values("472")),
    b::Element(e::Required,    "Date Time Period Format Qualifier", b::Values("D8", "RD8")),
    b::Element(e::Required,    "Claim Service Period")),

  d::LoopDef.build("2210D SERVICE LINE INFORMATION", d::RepeatCount.unbounded,
    b::Segment(1300, s::SVC, "Service Line Information", r::Situational, d::RepeatCount.bounded(1),
      b::Element(e::Required,    "COMPOSITE MEDICAL PROCEDURE IDENTIFIER",
        b::Element(e::Required,    "Product or Service ID Qualifier", b::Values("AD", "ER", "HC", "HP", "IV", "N4", "NU", "WK")),
        b::Element(e::Required,    "Procedure Code"),
        b::Element(e::Situational, "Procedure Modifier"),
        b::Element(e::Situational, "Procedure Modifier"),
        b::Element(e::Situational, "Procedure Modifier"),
        b::Element(e::Situational, "Procedure Modifier"),
        b::Element(e::NotUsed,     "Description"),
        b::Element(e::NotUsed,     "Product/Service ID")),
      b::Element(e::Required,    "Line Item Charge Amount"),
      b::Element(e::NotUsed,     "Monetary Amount"),
      b::Element(e::Situational, "Revenue Code"),
      b::Element(e::NotUsed,     "Quantity"),
      b::Element(e::NotUsed,     "COMPOSITE MEDICAL PROCEDURE IDENTIFIER"),
      b::Element(e::Situational, "Units of Service Count")),
    b::Segment(1400, s::REF, "Service Line Item Identification", r::Situational, d::RepeatCount.bounded(1),
      b::Element(e::Required,    "Reference Identification Qualifier", b::Values("FJ")),
      b::Element(e::Required,    "Line Item Control Number"),
      b::Element(e::NotUsed,     "Description"),
      b::Element(e::NotUsed,     "REFERENCE IDENTIFIER")),
    b::Segment(1500, s::DTP, "Service Line Date", r::Required, d::RepeatCount.bounded(1),
      b::Element(e::Required,    "Date Time Qualifier", b::Values("472")),
      b::Element(e::Required,    "Date Time Period Format Qualifier", b::Values("D8", "RD8")),
      b::Element(e::Required,    "Service Line Date")))))),

            d::TableDef.detail("2 - Dependent Detail",
              d::LoopDef.build("2000E DEPENDENT LEVEL", d::RepeatCount.unbounded,
b::Segment(100, s::HL, "Dependent 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::NotUsed,     "Hierachical Child Code")),
b::Segment(400, s::DMG, "Dependent 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::Situational, "Patient Gender Code", b::Values("F", "M")),
  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")),

d::LoopDef.build("2100E DEPENDENT NAME", d::RepeatCount.bounded(1),
  b::Segment(500, s::NM1, "Dependent Name", r::Required, d::RepeatCount.bounded(1),
    b::Element(e::Required,    "Entity Identifier 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 Identifier Code"),
    b::Element(e::NotUsed,     "Name Last or Organization Name"))),

d::LoopDef.build("2200E CLAIM STATUS TRACKING NUMBER", d::RepeatCount.unbounded,
  b::Segment( 900, s::TRN, "Claim Status Tracking Number", r::Required, d::RepeatCount.bounded(1),
    b::Element(e::Required,    "Trace Type Code", b::Values("1")),
    b::Element(e::Required,    "Current Transaction Trace Number"),
    b::Element(e::NotUsed,     "Originating Company Identifier"),
    b::Element(e::NotUsed,     "Reference Identification")),
  b::Segment(1000, s::REF, "Payer Claim Control Number", r::Situational, d::RepeatCount.bounded(1),
    b::Element(e::Required,    "Reference Identification Qualifier", b::Values("1K")),
    b::Element(e::Required,    "Payer Claim Control Number"),
    b::Element(e::NotUsed,     "Description"),
    b::Element(e::NotUsed,     "REFERENCE IDENTIFIER")),
  b::Segment(1000, s::REF, "Institutional Bill Type Identification", r::Situational, d::RepeatCount.bounded(1),
    b::Element(e::Required,    "Reference Identification Qualifier", b::Values("BLT")),
    b::Element(e::Required,    "Bill Type Identifier"),
    b::Element(e::NotUsed,     "Description"),
    b::Element(e::NotUsed,     "REFERENCE IDENTIFIER")),
  b::Segment(1000, s::REF, "Application or Location System Identifier", r::Situational, d::RepeatCount.bounded(1),
    b::Element(e::Required,    "Reference Identification Qualifier", b::Values("LU")),
    b::Element(e::Required,    "Application or Location System Identifier"),
    b::Element(e::NotUsed,     "Description"),
    b::Element(e::NotUsed,     "REFERENCE IDENTIFIER")),
  b::Segment(1000, s::REF, "Group Number", r::Situational, d::RepeatCount.bounded(1),
    b::Element(e::Required,    "Reference Identification Qualifier", b::Values("6P")),
    b::Element(e::Required,    "Group Number"),
    b::Element(e::NotUsed,     "Description"),
    b::Element(e::NotUsed,     "REFERENCE IDENTIFIER")),
  b::Segment(1000, s::REF, "Patient Control Number", r::Situational, d::RepeatCount.bounded(1),
    b::Element(e::Required,    "Reference Identification Qualifier", b::Values("EJ")),
    b::Element(e::Required,    "Patient Control Number"),
    b::Element(e::NotUsed,     "Description"),
    b::Element(e::NotUsed,     "REFERENCE IDENTIFIER")),
  b::Segment(1000, s::REF, "Pharmacy Prescription Number", r::Situational, d::RepeatCount.bounded(1),
    b::Element(e::Required,    "Reference Identification Qualifier", b::Values("XZ")),
    b::Element(e::Required,    "Pharmacy Prescription Number"),
    b::Element(e::NotUsed,     "Description"),
    b::Element(e::NotUsed,     "REFERENCE IDENTIFIER")),
  b::Segment(1000, s::REF, "Claim Identification Number for Clearinghouses and Other Transmission Intermediaries", r::Situational, d::RepeatCount.bounded(1),
    b::Element(e::Required,    "Reference Identification Qualifier", b::Values("D9")),
    b::Element(e::Required,    "Clearinghouse Trace Number"),
    b::Element(e::NotUsed,     "Description"),
    b::Element(e::NotUsed,     "REFERENCE IDENTIFIER")),
  b::Segment(1100, s::AMT, "Claim Submitted Charges", r::Situational, d::RepeatCount.bounded(1),
    b::Element(e::Required,    "Amount Qualifier Code", b::Values("T3")),
    b::Element(e::Required,    "Total Claim Charge Amount"),
    b::Element(e::NotUsed,     "Credit/Debit Flag Code")),
  b::Segment(1200, s::DTP, "Claim Service Date", r::Situational, d::RepeatCount.bounded(1),
    b::Element(e::Required,    "Date Time Qualifier", b::Values("472")),
    b::Element(e::Required,    "Date Time Period Format Qualifier", b::Values("D8", "RD8")),
    b::Element(e::Required,    "Claim Service Period")),

  d::LoopDef.build("2210E SERVICE LINE INFORMATION", d::RepeatCount.unbounded,
    b::Segment(1300, s::SVC, "Service Line Information", r::Situational, d::RepeatCount.bounded(1),
      b::Element(e::Required,    "COMPOSITE MEDICAL PROCEDURE IDENTIFIER",
      b::Element(e::Required,    "Product or Service ID Qualifier", b::Values("AD", "ER", "HC", "HP", "IV", "N4", "NU", "WK")),
      b::Element(e::Required,    "Procedure Code"),
      b::Element(e::Situational, "Procedure Modifier"),
      b::Element(e::Situational, "Procedure Modifier"),
      b::Element(e::Situational, "Procedure Modifier"),
      b::Element(e::Situational, "Procedure Modifier"),
      b::Element(e::NotUsed,     "Description"),
      b::Element(e::NotUsed,     "Product/Service ID")),
      b::Element(e::Required,    "Line Item Charge Amount"),
      b::Element(e::NotUsed,     "Monetary Amount"),
      b::Element(e::Situational, "Revenue Code"),
      b::Element(e::NotUsed,     "Quantity"),
      b::Element(e::NotUsed,     "COMPOSITE MEDICAL PROCEDURE IDENTIFIER"),
      b::Element(e::Situational, "Units of Service Count")),
    b::Segment(1400, s::REF, "Service Line Item Identification", r::Situational, d::RepeatCount.bounded(1),
      b::Element(e::Required,    "Reference Identification Qualifier", b::Values("FJ")),
      b::Element(e::Required,    "Line Item Control Number"),
      b::Element(e::NotUsed,     "Description"),
      b::Element(e::NotUsed,     "REFERENCE IDENTIFIER")),
    b::Segment(1500, s::DTP, "Service Line Date", r::Required, d::RepeatCount.bounded(1),
      b::Element(e::Required,    "Date Time Qualifier", b::Values("472")),
      b::Element(e::Required,    "Date Time Period Format Qualifier", b::Values("D8", "RD8")),
      b::Element(e::Required,    "Service Line Date")))))),

            d::TableDef.summary("3 - Summary",
              b::Segment(1600, s::SE, "Transaction Set Trailer", r::Required, d::RepeatCount.bounded(1),
b::Element(e::Required,    "Transaction Segment Count"),
b::Element(e::Required,    "Transaction Set Control Number"))))