About ASC X12 TR3 Schemas


Table of Contents List of Figures

Type 3 Technical Reports

Why Isomorphic?

Key Features

Transaction Sets

Group Member Sequence

X12 Namespace

Maximum Length

XSD Element Naming Conventions

 

1 - Transaction Sets

2 - x12:STD_Info

3 - x12:TR3_Info

4 - XSD appinfo Element

5 - X12 Namespace DTD

6 - Maximum Length Characteristics

7 - Data Element 782

Type 3 Technical Reports

Accredited Standards Committee X12 (ASC X12) publishes Type 3 Technical Reports (TR3) indicating how a generic ASC X12 Transaction Set is implemented for a specified business purpose. This document describes the key features of a collection of W3C-compliant XML Schema Definition (XSD) schemas mechanically generated from the same database as the TR3s providing an isomorphic approach to schema production. The output is known as an ASC X12 TR3 Schema.

Why Isomorphic?

Over the past several years, industry associations and individual organizations created proprietary XML schemas based on the generic X12 standard, X12N Implementation Guides, and TR3s. Some of those schemas are sold as part of larger applications, some are free, and many are internal to an organization. All of these separate, uncoordinated initiatives benefit from standardized XML schemas from a recognized authority.

The isomorphic approach ensures that every X12 structure and all simple data elements are represented in an XML document that can be validated with the schemas.

Key Features

Transaction Sets

Each transaction set detailed in a TR3s is constructed as an XML element as illustrated in Figure 1 - Transaction Sets, below

Transaction Sets

Figure 1 - Transaction Sets

Group Member Sequence

TR3s explicitly limit the repeat values of the X12 standard for segments and loops providing a concise description of the business process. These collections of repetitions are referred to as a Loop Group or a Segment Group. For example, loop 1000 in transaction set 835 can repeat 200 times, but the TR3 limits that to 2, one iteration for the payer and another for the payee. A similar technique is used for segment repeats.

Although the TR3s present the members of Groups in a specific order, those members do not have to appear in that order in the EDI. It is expected that an application performing the conversion from EDI to XML, conformant with the ASC X12 TR3 schemas, to sequence Groups in the order they are displayed in the TR3s.

X12 Namespace

Many of the properties specified in X12.6, Application Control Structure, map accurately, without change, to XML, but not all. For example, X12 data element types, such as date, do not correspond directly to the XSD date data type. Consequently all XML simple content is declared as a string and an X12 namespace, http://schemas.x12.org/isomorph is specified. The two elements that come from this namespace are prefixed with x12:

  • <x12:STD_Info ...
  • <x12:TR3_Info ...

The x12:STD_Info element can contain several attributes to convey X12 standard content as illustrated in Figure 2 - x12:STD_Info, below.

<x12:STD_Info Name="Date" Number="373" DataType="DT"/>

Figure 2 - x12:STD_Info

The x12:TR3_Info element, illustrated in Figure 3 - x12:TR3_Info below can contain two attributes, one to indicate whether an X12 simple data element or composite data structure is not used in a particular instance and another special case concerning maximum length, described in below under Maximum Length.

<x12:TR3_Info Used=?o?>

Figure 3 - x12:TR3_Info

The x12:STD_Info and x12:TR3_Info elements are contained in an XSD appinfo element and can be used by an application that requires the information within their attributes as illustrated in Figure 4 - XSD appinfo Element, below.

<xs:appinfo>
  <x12:STD_Info Name="Date" Number="373" DataType="DT"/>
</xs:appinfo>

Figure 4 - XSD appinfo Element

Although not needed to use the ASC X12 TR3 schemas, a Document Type Definition for the X12 namespace is illustrated in Figure 5 - X12 Namespace DTD, below.

<!ELEMENT STD_Info EMPTY>
<!ELEMENT TR3_Info EMPTY>
<!ATTLIST STD_Info Name CDATA #REQUIRED>
<!ATTLIST STD_Info Number CDATA #REQUIRED>
<!ATTLIST STD_Info DataType CDATA #REQUIRED>
<!ATTLIST STD_Info MaximumLength CDATA #IMPLIED>
<!ATTLIST TR3_Info Used CDATA "Yes">
<!ATTLIST TR3_Info MaximumLength CDATA #IMPLIED>

Figure 5 - X12 Namespace DTD

Maximum Length

The X12 data element dictionary specifies a maximum length for each simple data element. The X12 numeric and decimal number data types present an issue when used directly in an XSD schema. Both X12 data types can include an optional sign to indicate a negative value. The numeric data type never contains a decimal point, but can include an implied number of decimal positions. The decimal number data type always includes a decimal point, unless specifying an integer. For both numeric and decimal number data types, the optional sign is not included in the character count, and for decimal numbers, the decimal point is not included in the character count.

When EDI is converted to XML, the application performing the conversion may place a decimal point into a numeric type element and may place a decimal point at the end of a decimal number data type. Similarly, the application may convert an EDI date in the prescribed YYYYMMDD format to the XSD date data type formatted as YYYY-MM-DD.

In all of these cases the value attribute of the maxLength element needs to be larger than the X12 maximum length. The schema fragment in Figure 6 - Maximum Length Characteristics below illustrates how the x12:STD_Info element is used to specify the X12 maximum length while the XSD maxLength value attribute is larger to accommodate the optional sign and decimal point.

<xs:element name="QTY02__ClaimSupplementalInformationQuantity">
    <xs:annotation>
        <xs:documentation>Numeric value of the quantity of supplemental
          Information associated with the claim.
        </xs:documentation>
        <xs:appinfo>
            <x12:STD_Info Name="Quantity" Number="380" DataType="R"
              MaximumLength="15"/>
        </xs:appinfo>
    </xs:annotation>
    <xs:simpleType>
        <xs:restriction base="xs:string">
            <xs:minLength value="1"/>
            <xs:maxLength value="17"/>
        </xs:restriction>
    </xs:simpleType>
</xs:element>

Figure 6 - Maximum Length Characteristics

Several X12 TR3s are named under the Health Insurance Portability and Accountability Act of 1996 (HIPAA). Those TR3s contain this statement:

For implementation of this guide under the rules promulgated under the Health Insurance Portability and Accountability Act (HIPAA), decimal data elements in Data Element 782 (Monetary Amount) will be limited to a maximum length of 10 characters including reported or implied places for cents (implied value of 00 after the decimal point).

Consequently, the x12:STD_Info, the x12:TR3_Info, and the xs:maxLength elements are used to allow the content of data element 782 to be stored in an XML document, and for an application to validate the appropriate lengths as illustrated in Figure 7 - Data Element 782, below.

<xs:element name="SVC02__LineItemChargeAmount">
    <xs:annotation>
        <xs:documentation>Charges related to this service.</xs:documentation>
        <xs:appinfo>
            <x12:STD_Info Name="Monetary Amount" Number="782" 
              DataType="R" MaximumLength="18"/>
            <x12:TR3_Info MaximumLength="11"/>
        </xs:appinfo>
    </xs:annotation>
    <xs:simpleType>
        <xs:restriction base="xs:string">
            <xs:minLength value="1"/>
            <xs:maxLength value="20"/>
        </xs:restriction>
    </xs:simpleType>
</xs:element>

Figure 7 - Data Element 782

XSD Element Naming Conventions

ASC X12 TR3 schemas are constructed using the ASC X12 Type 2 Technical Report (TR2): Constructing XML Schema Definition Element Names from ASC X12 Metadata. The TR2 is included in the product's package.