X12Reader Class

Properties   Methods   Events   Config Settings   Errors  

The X12Reader class efficiently parses complete X12 transmissions, providing a convenient way to extract and explore data from all included transaction sets.

Syntax

class edisdk.X12Reader

Remarks

The class allows you to parse an incoming EDI document. To parse a document, first, use load_schema to load a schema file into the class. Next, select the document you want to process by setting input_file or input_data and calling parse.

As the class processes the document, its events will fire and the contents of the document will be available in the interchange, functional_group, message, segment, element, and component properties. The corresponding *Index properties can be thought of as a path within the document. For example, setting the MessageIndex property will cause the SegmentCount property to be updated with the number of segments within the selected message, and then the SegmentIndex property can be used to select one of the segments within that message.

To manage the amount of memory used during processing, the build_dom property can be used to select how much of the message will be available in the properties at once:

  • bdEntireDocument - The entire document will be available at once.
  • bdInterchange - Only the current interchange and its contents will be available.
  • bdMessage - Only the current message will be available.
  • bdNone - Only the current segment and its elements will be available.

During parsing, the class performs basic validation of the incoming document. If an error is encountered, the on_validate_warning event will fire.

Property List


The following is the full list of the properties of the class with short descriptions. Click on the links for further details.

ack_typeSpecifies the type of ACK that will be generated by GenerateAck .
build_domSpecifies how much of the current document should be held in memory.
component_data_typeThe type of data contained in the element.
component_is_compositeSpecifies whether the element is a simple or composite element.
component_max_lenFor a simple element, this specifies the maximum length of the element according to the schema.
component_min_lenFor a simple element, this specifies the minimum length of the element according to the schema.
component_schema_descThe description of the element as specified in the schema.
component_schema_nameThe name of the element as specified in the schema.
component_valueIf the element is a simple element, this property contains its value.
component_countThe number of classes in the current Element.
component_indexThe index of the current Class.
delimiter_componentThe delimiter separating classes.
delimiter_elementThe delimiter separating elements.
delimiter_repetitionThe delimiter separating classes.
delimiter_segmentThe delimiter separating segments.
element_data_typeThe type of data contained in the element.
element_is_compositeSpecifies whether the element is a simple or composite element.
element_max_lenFor a simple element, this specifies the maximum length of the element according to the schema.
element_min_lenFor a simple element, this specifies the minimum length of the element according to the schema.
element_schema_descThe description of the element as specified in the schema.
element_schema_nameThe name of the element as specified in the schema.
element_valueIf the element is a simple element, this property contains its value.
element_countThe number of elements in the current Segment.
element_indexThe index of the current Element.
f_group_app_receiver_codeThe name or code of the intended receiver of the transaction set group.
f_group_app_sender_codeCode identifying the sender of FunctionalGroup This is an alphanumeric property with a value between 2 and 15 characters long.
f_group_dateThe date that the group of transaction sets was prepared.
f_group_functional_identifier_codeA code identifying the type of transaction sets included in the functional group.
f_group_group_control_numAn identification number assigned by the sender to uniquely identify the group of transaction sets.
f_group_responsible_agency_codeA code identifying the issuer of the standard that the transaction set conforms to.
f_group_timeThe time that the group of transaction sets was prepared.
f_group_versionCode indicating the version of the X12 standard used to construct the transaction set.
functional_group_countThe number of FunctionalGroups in the current Interchange.
functional_group_indexThe index of the current FunctionalGroup.
input_dataThe EDI message, specified as a string.
input_fileThe file containing the EDI message.
interchange_ack_requestCode indicating whether an interchange acknowledgment is requested.
interchange_authorization_infoInformation used for additional identification or authorization of the interchange sender or the data in the interchange.
interchange_authorization_info_qualifierA code indicating the type of data supplied in Authorization Information property.
interchange_dateThe date that the Interchange was prepared.
interchange_interchange_control_numA control number assigned by the sender to uniquely identify the interchange.
interchange_interchange_control_version_numA code specifying the version of the X12 standard used to construct the Interchange.
interchange_receiver_idThe identification code of the receiver of the transaction set.
interchange_receiver_id_qualifierA code that identifies the format of the receiver ID.
interchange_security_infoCoded security information associated with the Interchange.
interchange_security_info_qualifierA code indicating the type of data in the Security Information property.
interchange_sender_idThe identification code of the sender of the transaction set.
interchange_sender_id_qualifierA code that identifies the format of the sender ID.
interchange_timeThe time that the Interchange sets was prepared.
interchange_usage_indicatorCode to indicate whether the interchange is a test or production.
interchange_countThe number of Interchanges in the document.
interchange_indexThe index of the current Interchange.
loopSpecifies the loop to load segments from.
segment_optionalSpecifies whether the segment is required or optional.
segment_pathContains the path to the segment, including the groups that the segment is contained in.
segment_schema_pathContains a numeric representation of the path to the segment, using the indexes within the schema, such as \\4[3]\\5[6]\\7[8] .
segment_tagThe tag of the segment, such as BGM , DTM , FTX , etc.
segment_countThe number of segments in the current TransactionSet.
segment_indexThis property is used to specify a Segment within the current TransactionSet .
trans_set_imp_convention_referenceReference used to identify the implementation convention.
trans_set_transaction_set_control_numThe unique transaction set control number assigned for a transaction set.
trans_set_transaction_set_id_codeThe identifier code for the transaction set.
transaction_set_countThe number of TransactionSets in the current FunctionalGroup.
transaction_set_indexThe current TransactionSet index.
validate_on_parseWhen true, the class will validate any documents it parses.
validation_error_countThe number of records in the ValidationError arrays.
validation_error_columnThe column number where the error occurred.
validation_error_component_indexThis property holds the position of the class element where the error occurred.
validation_error_element_indexThis property holds the position of the element where the error occurred.
validation_error_error_codeThe ErrorCode property contains the type of error encountered.
validation_error_error_messageErrorMessage is a textual description of the error.
validation_error_error_typeIndicates the level of the document where the error was encountered.
validation_error_f_group_indexThis property holds the position of the functional group where the error occurred.
validation_error_interchange_indexThis property holds the position of the interchange where the error occurred.
validation_error_lineThe line number where the error occurred.
validation_error_positionThis property holds the byte position in the EDI stream where the error occurred.
validation_error_segment_indexThis property is the index of the segment where the error occurred.
validation_error_segment_tagThis property specifies the tag name of the segment where the error occurred.
validation_error_transaction_set_indexThis property holds the position of the message where the error occurred.

Method List


The following is the full list of the methods of the class with short descriptions. Click on the links for further details.

configSets or retrieves a configuration setting.
generate_ackGenerates an ACK in response to the most recently parsed TransactionSet.
get_element_valueReturns the value of the element or class at the specified path.
load_schemaLoads schema information from a file or string data.
parseParse the EDI document and fire parsing events.
resetSets the class to its initial state.
schema_codeDefines a code value within a list of codes.
schema_code_listDefines a list of codes.
schema_compositeDefines a composite element.
schema_elementDefines a simple element.
schema_element_refAdds a reference to an element in a segment or composite element.
schema_endEnds a schema definition.
schema_groupDefines a group of segments.
schema_messageDefines a message.
schema_segmentDefines a segment.
schema_segment_refAdds a reference to a segment in a message or group.
schema_startStarts a schema definition.
validateValidate the EDI document and warn about any errors encountered.

Event List


The following is the full list of the events fired by the class with short descriptions. Click on the links for further details.

on_end_functional_groupFires at the end of a functional group while parsing.
on_end_interchangeFires at the end of a interchange while parsing.
on_end_loopFires at the end of a loop while parsing.
on_end_transaction_setFires at the end of a transaction set while parsing.
on_errorFires when a parsing error occurs.
on_resolve_schemaFires to request schema information for a specific transaction set.
on_segmentFires at the end of a Segment while parsing.
on_start_functional_groupFires at the beginning of a functional group while parsing.
on_start_interchangeFires at the beginning of an interchange while parsing.
on_start_loopFires at the beginning of a loop while parsing a transaction set.
on_start_transaction_setFires at the beginning of a transaction set while parsing.
on_validate_warningFires to warn about validation errors.

Config Settings


The following is a list of config settings for the class with short descriptions. Click on the links for further details.

InputFormatThe format of the input document.
MaxValidationErrorsThe maximum number of validation errors to return.

ack_type property

Specifies the type of ACK that will be generated by GenerateAck .

Syntax

def get_ack_type() -> int: ...
def set_ack_type(value: int) -> None: ...

ack_type = property(get_ack_type, set_ack_type)

Possible Values

0   # 997
1 # 999
2 # TA1

Default Value

0

Remarks

This setting specifies the type of ACK that will be generated when generate_ack is called. Options include:

997 Functional Acknowledgement (at997 - 0)A 997 functional acknowledgement. If any syntax errors are encountered when parsing the data, the response will indicate the details of the issue.
999 Implementation Acknowledgement (at999 - 0)A 999 implementation acknowledgement. This ACK replaces a 997 ACK when in a healthcare setting, and can also report issues with standards such as HIPAA compliance.
TA1 Interchange Acknowledgement (atTA1 - 0)A TA1 technical acknowledgement, which confirms the ISA header and IEA footer are valid but does not report on the processing of the contents.

build_dom property

Specifies how much of the current document should be held in memory.

Syntax

def get_build_dom() -> int: ...
def set_build_dom(value: int) -> None: ...

build_dom = property(get_build_dom, set_build_dom)

Possible Values

0   # EntireDocument
1 # Interchange
2 # TranSet
3 # None

Default Value

0

Remarks

Set BuildDOM to bdEntireDocument (0) when you need to browse the current document.

Use bdInterchange (1) when parsing large documents to tell the component to only hold an internal object model of the current Interchange being parsed. When this value is used, and a new Interchange is encountered during parsing, the old interchange is cleared from memory. If the input contains a single Interchange, this is equivalent to using bdEntireDocument.

Use bdTranSet (2) when parsing large documents to tell the component to only hold an internal object model of the current transaction being parsed. When this value is used, and a new transaction is encountered during parsing, the old transaction is cleared from memory.

A value of bdNone (3) will tell the component to not save any internal state of the document being parsed, and thus browsing will be unavailable.

component_data_type property

The type of data contained in the element.

Syntax

def get_component_data_type() -> str: ...

component_data_type = property(get_component_data_type, None)

Default Value

""

Remarks

The type of data contained in the element.

Possible values for EDIFACT include:

A The element can only contain alphabetic characters.
AN The element can contain any alphanumeric characters.
N The element can only contain numeric characters.
composite The element is a composite element containing multiple components.

Possible values for X12 include:

AN The element can contain any alphanumeric characters.
ID The element contains an identifier for a code value.
Nn The element contains a numeric integer value.
R The element contains a number with an optional decimal value.
DT The element contains a string representing a date.
TM The element contains a string representing a time.
B The element contains binary data.
composite The element is a composite element containing multiple components.

This property is read-only.

component_is_composite property

Specifies whether the element is a simple or composite element.

Syntax

def get_component_is_composite() -> bool: ...

component_is_composite = property(get_component_is_composite, None)

Default Value

FALSE

Remarks

Specifies whether the element is a simple or composite element. If True, the element is a composite element that contains other components.

This property is read-only.

component_max_len property

For a simple element, this specifies the maximum length of the element according to the schema.

Syntax

def get_component_max_len() -> int: ...

component_max_len = property(get_component_max_len, None)

Default Value

0

Remarks

For a simple element, this specifies the maximum length of the element according to the schema.

This property is read-only.

component_min_len property

For a simple element, this specifies the minimum length of the element according to the schema.

Syntax

def get_component_min_len() -> int: ...

component_min_len = property(get_component_min_len, None)

Default Value

0

Remarks

For a simple element, this specifies the minimum length of the element according to the schema.

This property is read-only.

component_schema_desc property

The description of the element as specified in the schema.

Syntax

def get_component_schema_desc() -> str: ...

component_schema_desc = property(get_component_schema_desc, None)

Default Value

""

Remarks

The description of the element as specified in the schema.

This property is read-only.

component_schema_name property

The name of the element as specified in the schema.

Syntax

def get_component_schema_name() -> str: ...

component_schema_name = property(get_component_schema_name, None)

Default Value

""

Remarks

The name of the element as specified in the schema.

This property is read-only.

component_value property

If the element is a simple element, this property contains its value.

Syntax

def get_component_value() -> str: ...

component_value = property(get_component_value, None)

Default Value

""

Remarks

If the element is a simple element, this field contains its value.

This property is read-only.

component_count property

The number of classes in the current Element.

Syntax

def get_component_count() -> int: ...

component_count = property(get_component_count, None)

Default Value

0

Remarks

If the current element is composite, this property contains the number of components within the element.

This property is read-only.

component_index property

The index of the current Class.

Syntax

def get_component_index() -> int: ...
def set_component_index(value: int) -> None: ...

component_index = property(get_component_index, set_component_index)

Default Value

1

Remarks

If the current element is composite, this property is used to specify a component within the element.

Note: When build_dom is set to bdentiredoc, after parse is called the entire EDI document is parsed and stored in memory. You can then use interchange_index, functional_group_index, message_index, segment_index, element_index and ComponentIndex to navigate to a specific component within the parsed document.

delimiter_component property

The delimiter separating classes.

Syntax

def get_delimiter_component() -> str: ...
def set_delimiter_component(value: str) -> None: ...

delimiter_component = property(get_delimiter_component, set_delimiter_component)

Default Value

":"

Remarks

The delimiter separating components.

In X12Reader, this type is used to hold the delimiters found when parsing the component, while in X12Writer the fields can be set to choose the delimiters that will be used when writing

delimiter_element property

The delimiter separating elements.

Syntax

def get_delimiter_element() -> str: ...
def set_delimiter_element(value: str) -> None: ...

delimiter_element = property(get_delimiter_element, set_delimiter_element)

Default Value

"*"

Remarks

The delimiter separating elements.

In X12Reader, this type is used to hold the delimiters found when parsing the element, while in X12Writer the fields can be set to choose the delimiters that will be used when writing

delimiter_repetition property

The delimiter separating classes.

Syntax

def get_delimiter_repetition() -> str: ...
def set_delimiter_repetition(value: str) -> None: ...

delimiter_repetition = property(get_delimiter_repetition, set_delimiter_repetition)

Default Value

"^"

Remarks

The delimiter separating components.

In X12Reader, this type is used to hold the delimiters found when parsing the component, while in X12Writer the fields can be set to choose the delimiters that will be used when writing

delimiter_segment property

The delimiter separating segments.

Syntax

def get_delimiter_segment() -> str: ...
def set_delimiter_segment(value: str) -> None: ...

delimiter_segment = property(get_delimiter_segment, set_delimiter_segment)

Default Value

"~"

Remarks

The delimiter separating segments.

In X12Reader, this type is used to hold the delimiters found when parsing the segment, while in X12Writer the fields can be set to choose the delimiters that will be used when writing

element_data_type property

The type of data contained in the element.

Syntax

def get_element_data_type() -> str: ...

element_data_type = property(get_element_data_type, None)

Default Value

""

Remarks

The type of data contained in the element.

Possible values for EDIFACT include:

A The element can only contain alphabetic characters.
AN The element can contain any alphanumeric characters.
N The element can only contain numeric characters.
composite The element is a composite element containing multiple components.

Possible values for X12 include:

AN The element can contain any alphanumeric characters.
ID The element contains an identifier for a code value.
Nn The element contains a numeric integer value.
R The element contains a number with an optional decimal value.
DT The element contains a string representing a date.
TM The element contains a string representing a time.
B The element contains binary data.
composite The element is a composite element containing multiple components.

This property is read-only.

element_is_composite property

Specifies whether the element is a simple or composite element.

Syntax

def get_element_is_composite() -> bool: ...

element_is_composite = property(get_element_is_composite, None)

Default Value

FALSE

Remarks

Specifies whether the element is a simple or composite element. If True, the element is a composite element that contains other components.

This property is read-only.

element_max_len property

For a simple element, this specifies the maximum length of the element according to the schema.

Syntax

def get_element_max_len() -> int: ...

element_max_len = property(get_element_max_len, None)

Default Value

0

Remarks

For a simple element, this specifies the maximum length of the element according to the schema.

This property is read-only.

element_min_len property

For a simple element, this specifies the minimum length of the element according to the schema.

Syntax

def get_element_min_len() -> int: ...

element_min_len = property(get_element_min_len, None)

Default Value

0

Remarks

For a simple element, this specifies the minimum length of the element according to the schema.

This property is read-only.

element_schema_desc property

The description of the element as specified in the schema.

Syntax

def get_element_schema_desc() -> str: ...

element_schema_desc = property(get_element_schema_desc, None)

Default Value

""

Remarks

The description of the element as specified in the schema.

This property is read-only.

element_schema_name property

The name of the element as specified in the schema.

Syntax

def get_element_schema_name() -> str: ...

element_schema_name = property(get_element_schema_name, None)

Default Value

""

Remarks

The name of the element as specified in the schema.

This property is read-only.

element_value property

If the element is a simple element, this property contains its value.

Syntax

def get_element_value() -> str: ...

element_value = property(get_element_value, None)

Default Value

""

Remarks

If the element is a simple element, this field contains its value.

This property is read-only.

element_count property

The number of elements in the current Segment.

Syntax

def get_element_count() -> int: ...

element_count = property(get_element_count, None)

Default Value

0

Remarks

This property contains the total number of elements in the current segment.

This property is read-only.

element_index property

The index of the current Element.

Syntax

def get_element_index() -> int: ...
def set_element_index(value: int) -> None: ...

element_index = property(get_element_index, set_element_index)

Default Value

1

Remarks

This property is used to specify an element within the current segment.

Note: When build_dom is set to bdentiredoc, after parse is called the entire EDI document is parsed and stored in memory. You can then use interchange_index, functional_group_index, message_index, segment_index and ElementIndex to navigate to specific element within the parsed document.

f_group_app_receiver_code property

The name or code of the intended receiver of the transaction set group.

Syntax

def get_f_group_app_receiver_code() -> str: ...
def set_f_group_app_receiver_code(value: str) -> None: ...

f_group_app_receiver_code = property(get_f_group_app_receiver_code, set_f_group_app_receiver_code)

Default Value

""

Remarks

The name or code of the intended receiver of the transaction set group.

This is an alphanumeric field with a value between 2 and 15 characters.

f_group_app_sender_code property

Code identifying the sender of FunctionalGroup This is an alphanumeric property with a value between 2 and 15 characters long.

Syntax

def get_f_group_app_sender_code() -> str: ...
def set_f_group_app_sender_code(value: str) -> None: ...

f_group_app_sender_code = property(get_f_group_app_sender_code, set_f_group_app_sender_code)

Default Value

""

Remarks

Code identifying the sender of functional_group

This is an alphanumeric field with a value between 2 and 15 characters long.

f_group_date property

The date that the group of transaction sets was prepared.

Syntax

def get_f_group_date() -> str: ...
def set_f_group_date(value: str) -> None: ...

f_group_date = property(get_f_group_date, set_f_group_date)

Default Value

""

Remarks

The date that the group of transaction sets was prepared.

This is a numeric field with a value in the format YYMMDD.

f_group_functional_identifier_code property

A code identifying the type of transaction sets included in the functional group.

Syntax

def get_f_group_functional_identifier_code() -> str: ...
def set_f_group_functional_identifier_code(value: str) -> None: ...

f_group_functional_identifier_code = property(get_f_group_functional_identifier_code, set_f_group_functional_identifier_code)

Default Value

""

Remarks

A code identifying the type of transaction sets included in the functional group.

This is an alphanumeric field with a code value between of 2 characters.

f_group_group_control_num property

An identification number assigned by the sender to uniquely identify the group of transaction sets.

Syntax

def get_f_group_group_control_num() -> str: ...
def set_f_group_group_control_num(value: str) -> None: ...

f_group_group_control_num = property(get_f_group_group_control_num, set_f_group_group_control_num)

Default Value

""

Remarks

An identification number assigned by the sender to uniquely identify the group of transaction sets.

This is a numeric field with a value between 1 and 9 digits.

f_group_responsible_agency_code property

A code identifying the issuer of the standard that the transaction set conforms to.

Syntax

def get_f_group_responsible_agency_code() -> str: ...
def set_f_group_responsible_agency_code(value: str) -> None: ...

f_group_responsible_agency_code = property(get_f_group_responsible_agency_code, set_f_group_responsible_agency_code)

Default Value

""

Remarks

A code identifying the issuer of the standard that the transaction set conforms to.

This is an alphanumeric field with a code value of 1 to 2 characters.

f_group_time property

The time that the group of transaction sets was prepared.

Syntax

def get_f_group_time() -> str: ...
def set_f_group_time(value: str) -> None: ...

f_group_time = property(get_f_group_time, set_f_group_time)

Default Value

""

Remarks

The time that the group of transaction sets was prepared.

This is a numeric field with a value between 4 and 8 digits in the format HHMM, HHMMSS, or HHMMSSDD. Time should be in the 24-hour format.

f_group_version property

Code indicating the version of the X12 standard used to construct the transaction set.

Syntax

def get_f_group_version() -> str: ...
def set_f_group_version(value: str) -> None: ...

f_group_version = property(get_f_group_version, set_f_group_version)

Default Value

""

Remarks

Code indicating the version of the X12 standard used to construct the transaction set.

This is an alphanumeric field with a code value between 1 and 12 characters.

functional_group_count property

The number of FunctionalGroups in the current Interchange.

Syntax

def get_functional_group_count() -> int: ...

functional_group_count = property(get_functional_group_count, None)

Default Value

0

Remarks

This property contains the number of FunctionalGroups in the current interchange.

This property is read-only.

functional_group_index property

The index of the current FunctionalGroup.

Syntax

def get_functional_group_index() -> int: ...
def set_functional_group_index(value: int) -> None: ...

functional_group_index = property(get_functional_group_index, set_functional_group_index)

Default Value

1

Remarks

This property is used to specify a functional_group within the current interchange.

Note: When build_dom is set to bdentiredoc, after parse is called the entire EDI document is parsed and stored in memory, including all interchanges, and functional groups. You can then use interchange_index and FunctionalGroupIndex to navigate to a specific functional_group within the parsed document.

input_data property

The EDI message, specified as a string.

Syntax

def get_input_data() -> str: ...
def set_input_data(value: str) -> None: ...

input_data = property(get_input_data, set_input_data)

Default Value

""

Remarks

Set this property to specify the input EDI message as a string. The message can then be parsed with parse.

input_file property

The file containing the EDI message.

Syntax

def get_input_file() -> str: ...
def set_input_file(value: str) -> None: ...

input_file = property(get_input_file, set_input_file)

Default Value

""

Remarks

Set this property to specify the input EDI message as a file. The message can then be parsed with parse.

If the file is not found or cannot be opened, an error will be returned.

Note: If both input_file and input_data are set, input_data takes precedence.

interchange_ack_request property

Code indicating whether an interchange acknowledgment is requested.

Syntax

def get_interchange_ack_request() -> str: ...
def set_interchange_ack_request(value: str) -> None: ...

interchange_ack_request = property(get_interchange_ack_request, set_interchange_ack_request)

Default Value

""

Remarks

Code indicating whether an interchange acknowledgment is requested.

This is an alphanumeric field with a code value of 1 character, either "0" (no acknowledgment requested) or "1" (acknowledgment requested).

interchange_authorization_info property

Information used for additional identification or authorization of the interchange sender or the data in the interchange.

Syntax

def get_interchange_authorization_info() -> str: ...
def set_interchange_authorization_info(value: str) -> None: ...

interchange_authorization_info = property(get_interchange_authorization_info, set_interchange_authorization_info)

Default Value

""

Remarks

Information used for additional identification or authorization of the interchange sender or the data in the interchange.

The type of information is set by the AuthorizationInfoQual field.

interchange_authorization_info_qualifier property

A code indicating the type of data supplied in Authorization Information property.

Syntax

def get_interchange_authorization_info_qualifier() -> str: ...
def set_interchange_authorization_info_qualifier(value: str) -> None: ...

interchange_authorization_info_qualifier = property(get_interchange_authorization_info_qualifier, set_interchange_authorization_info_qualifier)

Default Value

""

Remarks

A code indicating the type of data supplied in Authorization Information field.

This is an alphanumeric field with a code value of 2 characters.

interchange_date property

The date that the Interchange was prepared.

Syntax

def get_interchange_date() -> str: ...
def set_interchange_date(value: str) -> None: ...

interchange_date = property(get_interchange_date, set_interchange_date)

Default Value

""

Remarks

The date that the Interchange was prepared.

This is a numeric field with a value of 6 digits in the format YYMMDD.

interchange_interchange_control_num property

A control number assigned by the sender to uniquely identify the interchange.

Syntax

def get_interchange_interchange_control_num() -> str: ...
def set_interchange_interchange_control_num(value: str) -> None: ...

interchange_interchange_control_num = property(get_interchange_interchange_control_num, set_interchange_interchange_control_num)

Default Value

""

Remarks

A control number assigned by the sender to uniquely identify the interchange.

This is a numeric field with a value of 9 digits.

interchange_interchange_control_version_num property

A code specifying the version of the X12 standard used to construct the Interchange.

Syntax

def get_interchange_interchange_control_version_num() -> str: ...
def set_interchange_interchange_control_version_num(value: str) -> None: ...

interchange_interchange_control_version_num = property(get_interchange_interchange_control_version_num, set_interchange_interchange_control_version_num)

Default Value

""

Remarks

A code specifying the version of the X12 standard used to construct the Interchange.

This is an alphanumeric field with a code value 5 characters.

interchange_receiver_id property

The identification code of the receiver of the transaction set.

Syntax

def get_interchange_receiver_id() -> str: ...
def set_interchange_receiver_id(value: str) -> None: ...

interchange_receiver_id = property(get_interchange_receiver_id, set_interchange_receiver_id)

Default Value

""

Remarks

The identification code of the receiver of the transaction set.

This is an alphanumeric field with a value of 15 characters.

interchange_receiver_id_qualifier property

A code that identifies the format of the receiver ID.

Syntax

def get_interchange_receiver_id_qualifier() -> str: ...
def set_interchange_receiver_id_qualifier(value: str) -> None: ...

interchange_receiver_id_qualifier = property(get_interchange_receiver_id_qualifier, set_interchange_receiver_id_qualifier)

Default Value

""

Remarks

A code that identifies the format of the receiver ID.

This is an alphanumeric field with a code value of 2 characters.

interchange_security_info property

Coded security information associated with the Interchange.

Syntax

def get_interchange_security_info() -> str: ...
def set_interchange_security_info(value: str) -> None: ...

interchange_security_info = property(get_interchange_security_info, set_interchange_security_info)

Default Value

""

Remarks

Coded security information associated with the Interchange.

The type of information is set by the SecurityInfoQualifier.

This is an alphanumeric field with a value between of 10 characters.

interchange_security_info_qualifier property

A code indicating the type of data in the Security Information property.

Syntax

def get_interchange_security_info_qualifier() -> str: ...
def set_interchange_security_info_qualifier(value: str) -> None: ...

interchange_security_info_qualifier = property(get_interchange_security_info_qualifier, set_interchange_security_info_qualifier)

Default Value

""

Remarks

A code indicating the type of data in the Security Information field.

This is an alphanumeric field with a code value of 2 characters.

interchange_sender_id property

The identification code of the sender of the transaction set.

Syntax

def get_interchange_sender_id() -> str: ...
def set_interchange_sender_id(value: str) -> None: ...

interchange_sender_id = property(get_interchange_sender_id, set_interchange_sender_id)

Default Value

""

Remarks

The identification code of the sender of the transaction set.

This is an alphanumeric field with a value of 15 characters.

interchange_sender_id_qualifier property

A code that identifies the format of the sender ID.

Syntax

def get_interchange_sender_id_qualifier() -> str: ...
def set_interchange_sender_id_qualifier(value: str) -> None: ...

interchange_sender_id_qualifier = property(get_interchange_sender_id_qualifier, set_interchange_sender_id_qualifier)

Default Value

""

Remarks

A code that identifies the format of the sender ID.

This is an alphanumeric field with a code value of 2 characters.

interchange_time property

The time that the Interchange sets was prepared.

Syntax

def get_interchange_time() -> str: ...
def set_interchange_time(value: str) -> None: ...

interchange_time = property(get_interchange_time, set_interchange_time)

Default Value

""

Remarks

The time that the Interchange sets was prepared.

This is a numeric field with a value in the format HHMM.

interchange_usage_indicator property

Code to indicate whether the interchange is a test or production.

Syntax

def get_interchange_usage_indicator() -> str: ...
def set_interchange_usage_indicator(value: str) -> None: ...

interchange_usage_indicator = property(get_interchange_usage_indicator, set_interchange_usage_indicator)

Default Value

""

Remarks

Code to indicate whether the interchange is a test or production.

This is an alphanumeric field with a code value of 1 character.

interchange_count property

The number of Interchanges in the document.

Syntax

def get_interchange_count() -> int: ...

interchange_count = property(get_interchange_count, None)

Default Value

0

Remarks

This property contains the number of Interchanges in the current document.

This property is read-only.

interchange_index property

The index of the current Interchange.

Syntax

def get_interchange_index() -> int: ...
def set_interchange_index(value: int) -> None: ...

interchange_index = property(get_interchange_index, set_interchange_index)

Default Value

1

Remarks

This property is used to specify an interchange within the document.

Note: When build_dom is set to bdentiredoc, after parse is called the entire EDI document is parsed and stored in memory, including all interchanges. You can then use InterchangeIndex to navigate to specific interchange within the parsed document.

loop property

Specifies the loop to load segments from.

Syntax

def get_loop() -> str: ...
def set_loop(value: str) -> None: ...

loop = property(get_loop, set_loop)

Default Value

""

Remarks

When this property is set, only segments from the specified loop and iteration will be available through the Segment properties.

A path for a loop consists of the name of the loop followed by an index indicating the iteration, like this:

reader.Loop = "N1Loop[2]";

If the loop is nested inside of another loop, the parent and child are connected by a ".":

reader.Loop = ""AK2Loop[2].AK3Loop[1]"; That can be repeated if a loop is nested more than one level deep.

segment_optional property

Specifies whether the segment is required or optional.

Syntax

def get_segment_optional() -> bool: ...

segment_optional = property(get_segment_optional, None)

Default Value

FALSE

Remarks

Specifies whether the segment is required or optional. If True, the element is optional.

This property is read-only.

segment_path property

Contains the path to the segment, including the groups that the segment is contained in.

Syntax

def get_segment_path() -> str: ...

segment_path = property(get_segment_path, None)

Default Value

""

Remarks

Contains the path to the segment, including the groups that the segment is contained in.

This property is read-only.

segment_schema_path property

Contains a numeric representation of the path to the segment, using the indexes within the schema, such as \\4[3]\\5[6]\\7[8] .

Syntax

def get_segment_schema_path() -> str: ...

segment_schema_path = property(get_segment_schema_path, None)

Default Value

""

Remarks

Contains a numeric representation of the path to the segment, using the indexes within the schema, such as \4[3]\5[6]\7[8].

This property is read-only.

segment_tag property

The tag of the segment, such as BGM , DTM , FTX , etc.

Syntax

def get_segment_tag() -> str: ...

segment_tag = property(get_segment_tag, None)

Default Value

""

Remarks

The tag of the segment, such as BGM, DTM, FTX, etc.

This property is read-only.

segment_count property

The number of segments in the current TransactionSet.

Syntax

def get_segment_count() -> int: ...

segment_count = property(get_segment_count, None)

Default Value

0

Remarks

This property contains the number of elements in the current transaction_set.

This property is read-only.

segment_index property

This property is used to specify a Segment within the current TransactionSet .

Syntax

def get_segment_index() -> int: ...
def set_segment_index(value: int) -> None: ...

segment_index = property(get_segment_index, set_segment_index)

Default Value

1

Remarks

Note: When build_dom is set to bdentiredoc, after parse is called the entire EDI document is parsed and stored in memory. You can then use interchange_index, functional_group_index, transaction_set_index and SegmentIndex to navigate to specific segment within the parsed document.

trans_set_imp_convention_reference property

Reference used to identify the implementation convention.

Syntax

def get_trans_set_imp_convention_reference() -> str: ...
def set_trans_set_imp_convention_reference(value: str) -> None: ...

trans_set_imp_convention_reference = property(get_trans_set_imp_convention_reference, set_trans_set_imp_convention_reference)

Default Value

""

Remarks

Reference used to identify the implementation convention.

This is an alphanumeric field with a value up to 35 characters long.

trans_set_transaction_set_control_num property

The unique transaction set control number assigned for a transaction set.

Syntax

def get_trans_set_transaction_set_control_num() -> str: ...
def set_trans_set_transaction_set_control_num(value: str) -> None: ...

trans_set_transaction_set_control_num = property(get_trans_set_transaction_set_control_num, set_trans_set_transaction_set_control_num)

Default Value

""

Remarks

The unique transaction set control number assigned for a transaction set.

This is an alphanumeric field with a value between 4 and 9 characters long.

trans_set_transaction_set_id_code property

The identifier code for the transaction set.

Syntax

def get_trans_set_transaction_set_id_code() -> str: ...
def set_trans_set_transaction_set_id_code(value: str) -> None: ...

trans_set_transaction_set_id_code = property(get_trans_set_transaction_set_id_code, set_trans_set_transaction_set_id_code)

Default Value

""

Remarks

The identifier code for the transaction set.

This is an alphanumeric field with a code value of 3 characters long.

transaction_set_count property

The number of TransactionSets in the current FunctionalGroup.

Syntax

def get_transaction_set_count() -> int: ...

transaction_set_count = property(get_transaction_set_count, None)

Default Value

0

Remarks

This property contains the count of TransactionSets in the current FunctionalGroup.

This property is read-only.

transaction_set_index property

The current TransactionSet index.

Syntax

def get_transaction_set_index() -> int: ...
def set_transaction_set_index(value: int) -> None: ...

transaction_set_index = property(get_transaction_set_index, set_transaction_set_index)

Default Value

1

Remarks

This property contains the index of the current TransactionSet within the current FunctionalGroup.

validate_on_parse property

When true, the class will validate any documents it parses.

Syntax

def get_validate_on_parse() -> bool: ...
def set_validate_on_parse(value: bool) -> None: ...

validate_on_parse = property(get_validate_on_parse, set_validate_on_parse)

Default Value

FALSE

Remarks

When this property is set to True, the class will perform validation on the document when parse is called. The on_validate_warning event will fire for each error it encounters.

validation_error_count property

The number of records in the ValidationError arrays.

Syntax

def get_validation_error_count() -> int: ...

validation_error_count = property(get_validation_error_count, None)

Default Value

0

Remarks

This property controls the size of the following arrays:

The array indices start at 0 and end at validation_error_count - 1.

This property is read-only.

validation_error_column property

The column number where the error occurred.

Syntax

def get_validation_error_column(validation_error_index: int) -> int: ...

Default Value

0

Remarks

The column number where the error occurred.

The validation_error_index parameter specifies the index of the item in the array. The size of the array is controlled by the validation_error_count property.

This property is read-only.

validation_error_component_index property

This property holds the position of the class element where the error occurred.

Syntax

def get_validation_error_component_index(validation_error_index: int) -> int: ...

Default Value

1

Remarks

This property holds the position of the component element where the error occurred.

The validation_error_index parameter specifies the index of the item in the array. The size of the array is controlled by the validation_error_count property.

This property is read-only.

validation_error_element_index property

This property holds the position of the element where the error occurred.

Syntax

def get_validation_error_element_index(validation_error_index: int) -> int: ...

Default Value

1

Remarks

This property holds the position of the element where the error occurred.

The validation_error_index parameter specifies the index of the item in the array. The size of the array is controlled by the validation_error_count property.

This property is read-only.

validation_error_error_code property

The ErrorCode property contains the type of error encountered.

Syntax

def get_validation_error_error_code(validation_error_index: int) -> str: ...

Default Value

"0"

Remarks

The validation_error_error_code property contains the type of error encountered.

The validation_error_index parameter specifies the index of the item in the array. The size of the array is controlled by the validation_error_count property.

This property is read-only.

validation_error_error_message property

ErrorMessage is a textual description of the error.

Syntax

def get_validation_error_error_message(validation_error_index: int) -> str: ...

Default Value

""

Remarks

validation_error_error_message is a textual description of the error.

The validation_error_index parameter specifies the index of the item in the array. The size of the array is controlled by the validation_error_count property.

This property is read-only.

validation_error_error_type property

Indicates the level of the document where the error was encountered.

Syntax

def get_validation_error_error_type(validation_error_index: int) -> int: ...

Default Value

0

Remarks

Indicates the level of the document where the error was encountered. Possible values include:

1Interchange
2Functional group
3Transaction set
4Segment
5Element

The validation_error_index parameter specifies the index of the item in the array. The size of the array is controlled by the validation_error_count property.

This property is read-only.

validation_error_f_group_index property

This property holds the position of the functional group where the error occurred.

Syntax

def get_validation_error_f_group_index(validation_error_index: int) -> int: ...

Default Value

1

Remarks

This property holds the position of the functional group where the error occurred.

The validation_error_index parameter specifies the index of the item in the array. The size of the array is controlled by the validation_error_count property.

This property is read-only.

validation_error_interchange_index property

This property holds the position of the interchange where the error occurred.

Syntax

def get_validation_error_interchange_index(validation_error_index: int) -> int: ...

Default Value

1

Remarks

This property holds the position of the interchange where the error occurred.

The validation_error_index parameter specifies the index of the item in the array. The size of the array is controlled by the validation_error_count property.

This property is read-only.

validation_error_line property

The line number where the error occurred.

Syntax

def get_validation_error_line(validation_error_index: int) -> int: ...

Default Value

0

Remarks

The line number where the error occurred.

The validation_error_index parameter specifies the index of the item in the array. The size of the array is controlled by the validation_error_count property.

This property is read-only.

validation_error_position property

This property holds the byte position in the EDI stream where the error occurred.

Syntax

def get_validation_error_position(validation_error_index: int) -> int: ...

Default Value

0

Remarks

This property holds the byte position in the EDI stream where the error occurred.

The validation_error_index parameter specifies the index of the item in the array. The size of the array is controlled by the validation_error_count property.

This property is read-only.

validation_error_segment_index property

This property is the index of the segment where the error occurred.

Syntax

def get_validation_error_segment_index(validation_error_index: int) -> int: ...

Default Value

1

Remarks

This property is the index of the segment where the error occurred.

The validation_error_index parameter specifies the index of the item in the array. The size of the array is controlled by the validation_error_count property.

This property is read-only.

validation_error_segment_tag property

This property specifies the tag name of the segment where the error occurred.

Syntax

def get_validation_error_segment_tag(validation_error_index: int) -> str: ...

Default Value

""

Remarks

This property specifies the tag name of the segment where the error occurred.

The validation_error_index parameter specifies the index of the item in the array. The size of the array is controlled by the validation_error_count property.

This property is read-only.

validation_error_transaction_set_index property

This property holds the position of the message where the error occurred.

Syntax

def get_validation_error_transaction_set_index(validation_error_index: int) -> int: ...

Default Value

1

Remarks

This property holds the position of the message where the error occurred.

The validation_error_index parameter specifies the index of the item in the array. The size of the array is controlled by the validation_error_count property.

This property is read-only.

config method

Sets or retrieves a configuration setting.

Syntax

def config(configuration_string: str) -> str: ...

Remarks

config is a generic method available in every class. It is used to set and retrieve configuration settings for the class.

These settings are similar in functionality to properties, but they are rarely used. In order to avoid "polluting" the property namespace of the class, access to these internal properties is provided through the config method.

To set a configuration setting named PROPERTY, you must call Config("PROPERTY=VALUE"), where VALUE is the value of the setting expressed as a string. For boolean values, use the strings "True", "False", "0", "1", "Yes", or "No" (case does not matter).

To read (query) the value of a configuration setting, you must call Config("PROPERTY"). The value will be returned as a string.

generate_ack method

Generates an ACK in response to the most recently parsed TransactionSet.

Syntax

def generate_ack() -> str: ...

Remarks

After parsing a TransactionSet, call this method to generate an ACK that you can send back in response. The type of ACK generated can be controlled by setting the ack_type property.

get_element_value method

Returns the value of the element or class at the specified path.

Syntax

def get_element_value(path: str) -> str: ...

Remarks

This method returns the value of the element at the specified path. The path starts at the current message and consists of loops (with indexes to indicate the iteration), a segment tag, and 1-2 indexes to indicate the element or component.

For a simple element the path should include the path to a specific iteration of a loop (as in the loop property), followed by a segment tag and an index for the element position within the segment, each separated by a ".":

reader.GetElementValue("N1Loop[2].N4.4");

When selecting a component of a composite element, the component index should be added after the element index:

reader.GetElementValue("AK2Loop[2].AK3Loop[1].AK4.1.1");

load_schema method

Loads schema information from a file or string data.

Syntax

def load_schema(file_or_data: str, messagename: str) -> None: ...

Remarks

This method loads schema information for use when parsing, validating, and translating messages.

The FileOrData parameter can be set to the path of a file containing schema data, or can be set to the contents of a schema file directly.

MessageName can be set to the name of a specific message to load only the specified message's schema information. If left empty or set to "*", the entire schema will be loaded.

parse method

Parse the EDI document and fire parsing events.

Syntax

def parse() -> None: ...

Remarks

This method parses the input EDI document, firing the following events as it parses:

When multiple input sources are specified, only the highest-priority input will be used, in the following order:

  1. set_input_stream
  2. input_file
  3. input_data

reset method

Sets the class to its initial state.

Syntax

def reset() -> None: ...

Remarks

When called the class clears all inputs and outputs, and resets all properties to their default values.

schema_code method

Defines a code value within a list of codes.

Syntax

def schema_code(schema_id: str, code_list_id: str, value: str, description: str) -> None: ...

Remarks

Creates a schema definition for a code value within a particular list of codes.

This method can be used when defining a schema instead of loading one from a file.

schema_code_list method

Defines a list of codes.

Syntax

def schema_code_list(schema_id: str, code_list_id: str, description: str) -> None: ...

Remarks

Creates a schema definition for an empty list of codes. schema_code can be used to add code values to the list.

This method can be used when defining a schema instead of loading one from a file.

schema_composite method

Defines a composite element.

Syntax

def schema_composite(schema_id: str, composite_id: str, description: str) -> None: ...

Remarks

Creates a schema definition for a composite element. schema_element_ref can be used to add components to the element.

This method can be used when defining a schema instead of loading one from a file.

schema_element method

Defines a simple element.

Syntax

def schema_element(schema_id: str, element_id: str, data_type: str, min_length: int, max_length: int, code_id: str, description: str) -> None: ...

Remarks

Creates a schema definition for a simple element.

This method can be used when defining a schema instead of loading one from a file.

schema_element_ref method

Adds a reference to an element in a segment or composite element.

Syntax

def schema_element_ref(schema_id: str, parent_id: str, element_id: str, ref_id: str, required: bool, max_count: int) -> None: ...

Remarks

Adds a reference to an element to the specified parent, which can be the most recently defined segment or composite element.

This method can be used when defining a schema instead of loading one from a file.

schema_end method

Ends a schema definition.

Syntax

def schema_end() -> None: ...

Remarks

Ends a schema definition when a schema is being defined manually instead of loaded from a file.

schema_group method

Defines a group of segments.

Syntax

def schema_group(schema_id: str, group_path: str, group_id: str, required: bool, max_count: int) -> None: ...

Remarks

Creates a schema definition for a group of segments. schema_segment_ref can be used to add references to defined segments.

This method can be used when defining a schema instead of loading one from a file.

schema_message method

Defines a message.

Syntax

def schema_message(schema_id: str, message_id: str, description: str) -> None: ...

Remarks

Creates a schema definition for a message. schema_segment_ref and schema_group can be used to add segment references and groups to the message.

This method can be used when defining a schema instead of loading one from a file.

schema_segment method

Defines a segment.

Syntax

def schema_segment(schema_id: str, segment_id: str, description: str) -> None: ...

Remarks

Creates a schema definition for a segment. schema_element_ref can be used to add component references to the segment.

This method can be used when defining a schema instead of loading one from a file.

schema_segment_ref method

Adds a reference to a segment in a message or group.

Syntax

def schema_segment_ref(schema_id: str, segment_path: str, segment_id: str, required: bool, max_count: int) -> None: ...

Remarks

Adds a reference to a segment to the specified path.

This method can be used when defining a schema instead of loading one from a file.

schema_start method

Starts a schema definition.

Syntax

def schema_start(schema_id: str) -> None: ...

Remarks

Starts manually defining a schema, as an alternative to loading one from a file.

validate method

Validate the EDI document and warn about any errors encountered.

Syntax

def validate() -> None: ...

Remarks

This method parses the input EDI document, firing the on_validate_warning event for any non-blocking errors it encounters.

on_end_functional_group event

Fires at the end of a functional group while parsing.

Syntax

class X12ReaderEndFunctionalGroupEventParams(object):
  @property
  def tag() -> str: ...

  @property
  def transaction_count() -> int: ...

  @property
  def control_number() -> str: ...

# In class X12Reader:
@property
def on_end_functional_group() -> Callable[[X12ReaderEndFunctionalGroupEventParams], None]: ...
@on_end_functional_group.setter
def on_end_functional_group(event_hook: Callable[[X12ReaderEndFunctionalGroupEventParams], None]) -> None: ...

Remarks

This event fires when the class encounters the end of a functional group while parsing a document.

on_end_interchange event

Fires at the end of a interchange while parsing.

Syntax

class X12ReaderEndInterchangeEventParams(object):
  @property
  def tag() -> str: ...

  @property
  def group_count() -> int: ...

  @property
  def control_number() -> str: ...

# In class X12Reader:
@property
def on_end_interchange() -> Callable[[X12ReaderEndInterchangeEventParams], None]: ...
@on_end_interchange.setter
def on_end_interchange(event_hook: Callable[[X12ReaderEndInterchangeEventParams], None]) -> None: ...

Remarks

This event fires when the class encounters the end of a interchange while parsing a document.

on_end_loop event

Fires at the end of a loop while parsing.

Syntax

class X12ReaderEndLoopEventParams(object):
  @property
  def name() -> str: ...

  @property
  def index() -> int: ...

# In class X12Reader:
@property
def on_end_loop() -> Callable[[X12ReaderEndLoopEventParams], None]: ...
@on_end_loop.setter
def on_end_loop(event_hook: Callable[[X12ReaderEndLoopEventParams], None]) -> None: ...

Remarks

This event fires when the class encounters the end of a loop while parsing a document.

on_end_transaction_set event

Fires at the end of a transaction set while parsing.

Syntax

class X12ReaderEndTransactionSetEventParams(object):
  @property
  def tag() -> str: ...

  @property
  def segment_count() -> int: ...

  @property
  def control_number() -> str: ...

# In class X12Reader:
@property
def on_end_transaction_set() -> Callable[[X12ReaderEndTransactionSetEventParams], None]: ...
@on_end_transaction_set.setter
def on_end_transaction_set(event_hook: Callable[[X12ReaderEndTransactionSetEventParams], None]) -> None: ...

Remarks

This event fires when the class encounters the end of a transaction set while parsing a document.

on_error event

Fires when a parsing error occurs.

Syntax

class X12ReaderErrorEventParams(object):
  @property
  def error_code() -> int: ...

  @property
  def description() -> str: ...

# In class X12Reader:
@property
def on_error() -> Callable[[X12ReaderErrorEventParams], None]: ...
@on_error.setter
def on_error(event_hook: Callable[[X12ReaderErrorEventParams], None]) -> None: ...

Remarks

This event fires when the class encounters a parsing error while processing a document.

on_resolve_schema event

Fires to request schema information for a specific transaction set.

Syntax

class X12ReaderResolveSchemaEventParams(object):
  @property
  def version_number() -> str: ...

  @property
  def transaction_set_id_code() -> str: ...

# In class X12Reader:
@property
def on_resolve_schema() -> Callable[[X12ReaderResolveSchemaEventParams], None]: ...
@on_resolve_schema.setter
def on_resolve_schema(event_hook: Callable[[X12ReaderResolveSchemaEventParams], None]) -> None: ...

Remarks

load_schema can be called from within this event to load the schema information for the specified transaction set.

on_segment event

Fires at the end of a Segment while parsing.

Syntax

class X12ReaderSegmentEventParams(object):
  @property
  def tag() -> str: ...

  @property
  def schema_path() -> str: ...

  @property
  def optional() -> bool: ...

  @property
  def element_count() -> int: ...

  @property
  def schema_index() -> int: ...

  @property
  def segment_index() -> int: ...

  @property
  def max_count() -> int: ...

  @property
  def path() -> str: ...

# In class X12Reader:
@property
def on_segment() -> Callable[[X12ReaderSegmentEventParams], None]: ...
@on_segment.setter
def on_segment(event_hook: Callable[[X12ReaderSegmentEventParams], None]) -> None: ...

Remarks

Fires at the end of a segment while parsing a document with the parse method. The parameters provide information about the segment that was just parsed: Tag: The segment tag (e.g., "ISA", "GS", "ST", etc.).

SchemaPath: The schema path for the segment, if schema information is available.

Optional: A boolean indicating whether the segment is optional (true) or required (false) according to the schema.

ElementCount: The number of elements in the segment.

SchemaIndex: The index of the segment in the schema, if schema information is available.

SegmentIndex: The index of the segment within the current transaction set.

MaxCount: The maximum number of times this segment can occur in the current context, according to the schema.

Path: The full path to the segment within the message structure.

on_start_functional_group event

Fires at the beginning of a functional group while parsing.

Syntax

class X12ReaderStartFunctionalGroupEventParams(object):
  @property
  def tag() -> str: ...

  @property
  def app_sender_code() -> str: ...

  @property
  def app_receiver_code() -> str: ...

  @property
  def date_time() -> str: ...

  @property
  def control_number() -> str: ...

# In class X12Reader:
@property
def on_start_functional_group() -> Callable[[X12ReaderStartFunctionalGroupEventParams], None]: ...
@on_start_functional_group.setter
def on_start_functional_group(event_hook: Callable[[X12ReaderStartFunctionalGroupEventParams], None]) -> None: ...

Remarks

This event fires when the class encounters the start of a functional group while parsing a document.

on_start_interchange event

Fires at the beginning of an interchange while parsing.

Syntax

class X12ReaderStartInterchangeEventParams(object):
  @property
  def tag() -> str: ...

  @property
  def sender_id() -> str: ...

  @property
  def receiver_id() -> str: ...

  @property
  def date_time() -> str: ...

  @property
  def control_number() -> str: ...

# In class X12Reader:
@property
def on_start_interchange() -> Callable[[X12ReaderStartInterchangeEventParams], None]: ...
@on_start_interchange.setter
def on_start_interchange(event_hook: Callable[[X12ReaderStartInterchangeEventParams], None]) -> None: ...

Remarks

This event fires at the beginning of an interchange while parsing a document.

on_start_loop event

Fires at the beginning of a loop while parsing a transaction set.

Syntax

class X12ReaderStartLoopEventParams(object):
  @property
  def name() -> str: ...

  @property
  def index() -> int: ...

  @property
  def max_count() -> int: ...

  @property
  def path() -> str: ...

# In class X12Reader:
@property
def on_start_loop() -> Callable[[X12ReaderStartLoopEventParams], None]: ...
@on_start_loop.setter
def on_start_loop(event_hook: Callable[[X12ReaderStartLoopEventParams], None]) -> None: ...

Remarks

This event fires when the class encounters the start of a loop while parsing a transaction set.

on_start_transaction_set event

Fires at the beginning of a transaction set while parsing.

Syntax

class X12ReaderStartTransactionSetEventParams(object):
  @property
  def tag() -> str: ...

  @property
  def version_number() -> str: ...

  @property
  def transaction_set_id_code() -> str: ...

  @property
  def control_number() -> str: ...

  @property
  def schema_loaded() -> bool: ...

# In class X12Reader:
@property
def on_start_transaction_set() -> Callable[[X12ReaderStartTransactionSetEventParams], None]: ...
@on_start_transaction_set.setter
def on_start_transaction_set(event_hook: Callable[[X12ReaderStartTransactionSetEventParams], None]) -> None: ...

Remarks

This event fires when the class encounters the start of a transaction set while parsing a document.

on_validate_warning event

Fires to warn about validation errors.

Syntax

class X12ReaderValidateWarningEventParams(object):
  @property
  def position() -> int: ...

  @property
  def line() -> int: ...

  @property
  def column() -> int: ...

  @property
  def error_code() -> str: ...

  @property
  def error_message() -> str: ...

  @property
  def error_type() -> int: ...

# In class X12Reader:
@property
def on_validate_warning() -> Callable[[X12ReaderValidateWarningEventParams], None]: ...
@on_validate_warning.setter
def on_validate_warning(event_hook: Callable[[X12ReaderValidateWarningEventParams], None]) -> None: ...

Remarks

When the class encounters a non-blocking error while validating a document, this event fires with information about the error.

X12Reader Config Settings

The class accepts one or more of the following configuration settings. Configuration settings are similar in functionality to properties, but they are rarely used. In order to avoid "polluting" the property namespace of the class, access to these internal properties is provided through the config method.

X12Reader Config Settings

InputFormat:   The format of the input document.

This setting controls the type of input document for parsing. Possible values are:

0 (default)X12
1XML
MaxValidationErrors:   The maximum number of validation errors to return.

This setting controls the maximum number of validation errors that will be returned during the validation process. The default value is 200.

X12Reader Errors

X12Reader Errors

202   Invalid argument.
304   Cannot write to file.
1003   Could not find the selected schema in the chosen file.
1099   Encountered an unexpected segment tag.
1100   Attempted to perform an action while the component was busy, or close an incomplete interchange.
1044   Tried to load an invalid schema file.
1201   The index is out of range.
1202   The selected ACK type is invalid.
1204   Encountered an error while validating the ISA segment.