# -*- coding: utf-8 -*-
#
# Copyright (c) 2012-2018, CRS4
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in
# the Software without restriction, including without limitation the rights to
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
# the Software, and to permit persons to whom the Software is furnished to do so,
# subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


from hl7apy.utils import iteritems

DATATYPES = {
    'AD_1': ['leaf', None, 'ST', 'STREET_ADDRESS', None, -1],
    'AD_2': ['leaf', None, 'ST', 'OTHER_DESIGNATION', None, -1],
    'AD_3': ['leaf', None, 'ST', 'CITY', None, -1],
    'AD_4': ['leaf', None, 'ST', 'STATE_OR_PROVINCE', None, -1],
    'AD_5': ['leaf', None, 'ST', 'ZIP_OR_POSTAL_CODE', None, -1],
    'AD_6': ['leaf', None, 'ID', 'COUNTRY', None, -1],
    'AD_7': ['leaf', None, 'ID', 'ADDRESS_TYPE', None, -1],
    'AD_8': ['leaf', None, 'ST', 'OTHER_GEOGRAPHIC_DESIGNATION', None, -1],
    'AUI_1': ['leaf', None, 'ST', 'AUTHORIZATION_NUMBER', None, -1],
    'AUI_2': ['leaf', None, 'DT', 'DATE', None, -1],
    'AUI_3': ['leaf', None, 'ST', 'SOURCE', None, -1],
    'CCD_1': ['leaf', None, 'ID', 'INVOCATION_EVENT', None, -1],
    'CCD_2': ['leaf', None, 'DTM', 'DATE_TIME', None, -1],
    'CCP_1': ['leaf', None, 'NM', 'CHANNEL_CALIBRATION_SENSITIVITY_CORRECTION_FACTOR', None, -1],
    'CCP_2': ['leaf', None, 'NM', 'CHANNEL_CALIBRATION_BASELINE', None, -1],
    'CCP_3': ['leaf', None, 'NM', 'CHANNEL_CALIBRATION_TIME_SKEW', None, -1],
    'CD_1': ['sequence', None, 'WVI', 'CHANNEL_IDENTIFIER', None, -1],
    'CD_2': ['sequence', None, 'WVS', 'WAVEFORM_SOURCE', None, -1],
    'CD_3': ['sequence', None, 'CSU', 'CHANNEL_SENSITIVITY_AND_UNITS', None, -1],
    'CD_4': ['sequence', None, 'CCP', 'CHANNEL_CALIBRATION_PARAMETERS', None, -1],
    'CD_5': ['leaf', None, 'NM', 'CHANNEL_SAMPLING_FREQUENCY', None, -1],
    'CD_6': ['sequence', None, 'NR', 'MINIMUM_AND_MAXIMUM_DATA_VALUES', None, -1],
    'CF_1': ['leaf', None, 'ST', 'IDENTIFIER', None, -1],
    'CF_2': ['leaf', None, 'FT', 'FORMATTED_TEXT', None, -1],
    'CF_3': ['leaf', None, 'ID', 'NAME_OF_CODING_SYSTEM', None, -1],
    'CF_4': ['leaf', None, 'ST', 'ALTERNATE_IDENTIFIER', None, -1],
    'CF_5': ['leaf', None, 'FT', 'ALTERNATE_FORMATTED_TEXT', None, -1],
    'CF_6': ['leaf', None, 'ID', 'NAME_OF_ALTERNATE_CODING_SYSTEM', None, -1],
    'CF_7': ['leaf', None, 'ST', 'CODING_SYSTEM_VERSION_ID', None, -1],
    'CF_8': ['leaf', None, 'ST', 'ALTERNATE_CODING_SYSTEM_VERSION_ID', None, -1],
    'CF_9': ['leaf', None, 'ST', 'ORIGINAL_TEXT', None, -1],
    'CF_10': ['leaf', None, 'ST', 'SECOND_ALTERNATE_IDENTIFIER', None, -1],
    'CF_11': ['leaf', None, 'FT', 'SECOND_ALTERNATE_FORMATTED_TEXT', None, -1],
    'CF_12': ['leaf', None, 'ID', 'NAME_OF_SECOND_ALTERNATE_CODING_SYSTEM', None, -1],
    'CF_13': ['leaf', None, 'ST', 'SECOND_ALTERNATE_CODING_SYSTEM_VERSION_ID', None, -1],
    'CF_14': ['leaf', None, 'ST', 'CODING_SYSTEM_OID', None, -1],
    'CF_15': ['leaf', None, 'ST', 'VALUE_SET_OID', None, -1],
    'CF_16': ['leaf', None, 'DTM', 'VALUE_SET_VERSION_ID', None, -1],
    'CF_17': ['leaf', None, 'ST', 'ALTERNATE_CODING_SYSTEM_OID', None, -1],
    'CF_18': ['leaf', None, 'ST', 'ALTERNATE_VALUE_SET_OID', None, -1],
    'CF_19': ['leaf', None, 'DTM', 'ALTERNATE_VALUE_SET_VERSION_ID', None, -1],
    'CF_20': ['leaf', None, 'ST', 'SECOND_ALTERNATE_CODING_SYSTEM_OID', None, -1],
    'CF_21': ['leaf', None, 'ST', 'SECOND_ALTERNATE_VALUE_SET_OID', None, -1],
    'CF_22': ['leaf', None, 'DTM', 'SECOND_ALTERNATE_VALUE_SET_VERSION_ID', None, -1],
    'CNE_1': ['leaf', None, 'ST', 'IDENTIFIER', None, -1],
    'CNE_2': ['leaf', None, 'ST', 'TEXT', None, -1],
    'CNE_3': ['leaf', None, 'ID', 'NAME_OF_CODING_SYSTEM', None, -1],
    'CNE_4': ['leaf', None, 'ST', 'ALTERNATE_IDENTIFIER', None, -1],
    'CNE_5': ['leaf', None, 'ST', 'ALTERNATE_TEXT', None, -1],
    'CNE_6': ['leaf', None, 'ID', 'NAME_OF_ALTERNATE_CODING_SYSTEM', None, -1],
    'CNE_7': ['leaf', None, 'ST', 'CODING_SYSTEM_VERSION_ID', None, -1],
    'CNE_8': ['leaf', None, 'ST', 'ALTERNATE_CODING_SYSTEM_VERSION_ID', None, -1],
    'CNE_9': ['leaf', None, 'ST', 'ORIGINAL_TEXT', None, -1],
    'CNE_10': ['leaf', None, 'ST', 'SECOND_ALTERNATE_IDENTIFIER', None, -1],
    'CNE_11': ['leaf', None, 'ST', 'SECOND_ALTERNATE_TEXT', None, -1],
    'CNE_12': ['leaf', None, 'ID', 'NAME_OF_SECOND_ALTERNATE_CODING_SYSTEM', None, -1],
    'CNE_13': ['leaf', None, 'ST', 'SECOND_ALTERNATE_CODING_SYSTEM_VERSION_ID', None, -1],
    'CNE_14': ['leaf', None, 'ST', 'CODING_SYSTEM_OID', None, -1],
    'CNE_15': ['leaf', None, 'ST', 'VALUE_SET_OID', None, -1],
    'CNE_16': ['leaf', None, 'DTM', 'VALUE_SET_VERSION_ID', None, -1],
    'CNE_17': ['leaf', None, 'ST', 'ALTERNATE_CODING_SYSTEM_OID', None, -1],
    'CNE_18': ['leaf', None, 'ST', 'ALTERNATE_VALUE_SET_OID', None, -1],
    'CNE_19': ['leaf', None, 'DTM', 'ALTERNATE_VALUE_SET_VERSION_ID', None, -1],
    'CNE_20': ['leaf', None, 'ST', 'SECOND_ALTERNATE_CODING_SYSTEM_OID', None, -1],
    'CNE_21': ['leaf', None, 'ST', 'SECOND_ALTERNATE_VALUE_SET_OID', None, -1],
    'CNE_22': ['leaf', None, 'DTM', 'SECOND_ALTERNATE_VALUE_SET_VERSION_ID', None, -1],
    'CNN_1': ['leaf', None, 'ST', 'ID_NUMBER', None, -1],
    'CNN_2': ['leaf', None, 'ST', 'FAMILY_NAME', None, -1],
    'CNN_3': ['leaf', None, 'ST', 'GIVEN_NAME', None, -1],
    'CNN_4': ['leaf', None, 'ST', 'SECOND_AND_FURTHER_GIVEN_NAMES_OR_INITIALS_THEREOF', None, -1],
    'CNN_5': ['leaf', None, 'ST', 'SUFFIX_E_G_JR_OR_III', None, -1],
    'CNN_6': ['leaf', None, 'ST', 'PREFIX_E_G_DR', None, -1],
    'CNN_7': ['leaf', None, 'IS', 'DEGREE_E_G_MD', None, -1],
    'CNN_8': ['leaf', None, 'IS', 'SOURCE_TABLE', None, -1],
    'CNN_9': ['leaf', None, 'IS', 'ASSIGNING_AUTHORITY_NAMESPACE_ID', None, -1],
    'CNN_10': ['leaf', None, 'ST', 'ASSIGNING_AUTHORITY_UNIVERSAL_ID', None, -1],
    'CNN_11': ['leaf', None, 'ID', 'ASSIGNING_AUTHORITY_UNIVERSAL_ID_TYPE', None, -1],
    'CP_1': ['sequence', None, 'MO', 'PRICE', None, -1],
    'CP_2': ['leaf', None, 'ID', 'PRICE_TYPE', None, -1],
    'CP_3': ['leaf', None, 'NM', 'FROM_VALUE', None, -1],
    'CP_4': ['leaf', None, 'NM', 'TO_VALUE', None, -1],
    'CP_5': ['sequence', None, 'CWE', 'RANGE_UNITS', None, -1],
    'CP_6': ['leaf', None, 'ID', 'RANGE_TYPE', None, -1],
    'CQ_1': ['leaf', None, 'NM', 'QUANTITY', None, -1],
    'CQ_2': ['sequence', None, 'CWE', 'UNITS', None, -1],
    'CSU_1': ['leaf', None, 'NM', 'CHANNEL_SENSITIVITY', None, -1],
    'CSU_2': ['leaf', None, 'ST', 'UNIT_OF_MEASURE_IDENTIFIER', None, -1],
    'CSU_3': ['leaf', None, 'ST', 'UNIT_OF_MEASURE_DESCRIPTION', None, -1],
    'CSU_4': ['leaf', None, 'ID', 'UNIT_OF_MEASURE_CODING_SYSTEM', None, -1],
    'CSU_5': ['leaf', None, 'ST', 'ALTERNATE_UNIT_OF_MEASURE_IDENTIFIER', None, -1],
    'CSU_6': ['leaf', None, 'ST', 'ALTERNATE_UNIT_OF_MEASURE_DESCRIPTION', None, -1],
    'CSU_7': ['leaf', None, 'ID', 'ALTERNATE_UNIT_OF_MEASURE_CODING_SYSTEM', None, -1],
    'CSU_8': ['leaf', None, 'ST', 'UNIT_OF_MEASURE_CODING_SYSTEM_VERSION_ID', None, -1],
    'CSU_9': ['leaf', None, 'ST', 'ALTERNATE_UNIT_OF_MEASURE_CODING_SYSTEM_VERSION_ID', None, -1],
    'CSU_10': ['leaf', None, 'ST', 'ORIGINAL_TEXT', None, -1],
    'CSU_11': ['leaf', None, 'ST', 'SECOND_ALTERNATE_UNIT_OF_MEASURE_IDENTIFIER', None, -1],
    'CSU_12': ['leaf', None, 'ST', 'SECOND_ALTERNATE_UNIT_OF_MEASURE_TEXT', None, -1],
    'CSU_13': ['leaf', None, 'ID', 'NAME_OF_SECOND_ALTERNATE_UNIT_OF_MEASURE_CODING_SY', None, -1],
    'CSU_14': ['leaf', None, 'ST', 'SECOND_ALTERNATE_UNIT_OF_MEASURE_CODING_SYSTEM_VER', None, -1],
    'CSU_15': ['leaf', None, 'ST', 'UNIT_OF_MEASURE_CODING_SYSTEM_OID', None, -1],
    'CSU_16': ['leaf', None, 'ST', 'UNIT_OF_MEASURE_VALUE_SET_OID', None, -1],
    'CSU_17': ['leaf', None, 'DTM', 'UNIT_OF_MEASURE_VALUE_SET_VERSION_ID', None, -1],
    'CSU_18': ['leaf', None, 'ST', 'ALTERNATE_UNIT_OF_MEASURE_CODING_SYSTEM_OID', None, -1],
    'CSU_19': ['leaf', None, 'ST', 'ALTERNATE_UNIT_OF_MEASURE_VALUE_SET_OID', None, -1],
    'CSU_20': ['leaf', None, 'DTM', 'ALTERNATE_UNIT_OF_MEASURE_VALUE_SET_VERSION_ID', None, -1],
    'CSU_21': ['leaf', None, 'ST', 'ALTERNATE_UNIT_OF_MEASURE_CODING_SYSTEM_OID', None, -1],
    'CSU_22': ['leaf', None, 'ST', 'ALTERNATE_UNIT_OF_MEASURE_VALUE_SET_OID', None, -1],
    'CSU_23': ['leaf', None, 'ST', 'ALTERNATE_UNIT_OF_MEASURE_VALUE_SET_VERSION_ID', None, -1],
    'CWE_1': ['leaf', None, 'ST', 'IDENTIFIER', None, -1],
    'CWE_2': ['leaf', None, 'ST', 'TEXT', None, -1],
    'CWE_3': ['leaf', None, 'ID', 'NAME_OF_CODING_SYSTEM', None, -1],
    'CWE_4': ['leaf', None, 'ST', 'ALTERNATE_IDENTIFIER', None, -1],
    'CWE_5': ['leaf', None, 'ST', 'ALTERNATE_TEXT', None, -1],
    'CWE_6': ['leaf', None, 'ID', 'NAME_OF_ALTERNATE_CODING_SYSTEM', None, -1],
    'CWE_7': ['leaf', None, 'ST', 'CODING_SYSTEM_VERSION_ID', None, -1],
    'CWE_8': ['leaf', None, 'ST', 'ALTERNATE_CODING_SYSTEM_VERSION_ID', None, -1],
    'CWE_9': ['leaf', None, 'ST', 'ORIGINAL_TEXT', None, -1],
    'CWE_10': ['leaf', None, 'ST', 'SECOND_ALTERNATE_IDENTIFIER', None, -1],
    'CWE_11': ['leaf', None, 'ST', 'SECOND_ALTERNATE_TEXT', None, -1],
    'CWE_12': ['leaf', None, 'ID', 'NAME_OF_SECOND_ALTERNATE_CODING_SYSTEM', None, -1],
    'CWE_13': ['leaf', None, 'ST', 'SECOND_ALTERNATE_CODING_SYSTEM_VERSION_ID', None, -1],
    'CWE_14': ['leaf', None, 'ST', 'CODING_SYSTEM_OID', None, -1],
    'CWE_15': ['leaf', None, 'ST', 'VALUE_SET_OID', None, -1],
    'CWE_16': ['leaf', None, 'DTM', 'VALUE_SET_VERSION_ID', None, -1],
    'CWE_17': ['leaf', None, 'ST', 'ALTERNATE_CODING_SYSTEM_OID', None, -1],
    'CWE_18': ['leaf', None, 'ST', 'ALTERNATE_VALUE_SET_OID', None, -1],
    'CWE_19': ['leaf', None, 'DTM', 'ALTERNATE_VALUE_SET_VERSION_ID', None, -1],
    'CWE_20': ['leaf', None, 'ST', 'SECOND_ALTERNATE_CODING_SYSTEM_OID', None, -1],
    'CWE_21': ['leaf', None, 'ST', 'SECOND_ALTERNATE_VALUE_SET_OID', None, -1],
    'CWE_22': ['leaf', None, 'DTM', 'SECOND_ALTERNATE_VALUE_SET_VERSION_ID', None, -1],
    'CX_1': ['leaf', None, 'ST', 'ID_NUMBER', None, -1],
    'CX_2': ['leaf', None, 'ST', 'IDENTIFIER_CHECK_DIGIT', None, -1],
    'CX_3': ['leaf', None, 'ID', 'CHECK_DIGIT_SCHEME', None, -1],
    'CX_4': ['sequence', None, 'HD', 'ASSIGNING_AUTHORITY', None, -1],
    'CX_5': ['leaf', None, 'ID', 'IDENTIFIER_TYPE_CODE', None, -1],
    'CX_6': ['sequence', None, 'HD', 'ASSIGNING_FACILITY', None, -1],
    'CX_7': ['leaf', None, 'DT', 'EFFECTIVE_DATE', None, -1],
    'CX_8': ['leaf', None, 'DT', 'EXPIRATION_DATE', None, -1],
    'CX_9': ['sequence', None, 'CWE', 'ASSIGNING_JURISDICTION', None, -1],
    'CX_10': ['sequence', None, 'CWE', 'ASSIGNING_AGENCY_OR_DEPARTMENT', None, -1],
    'CX_11': ['leaf', None, 'ST', 'SECURITY_CHECK', None, -1],
    'CX_12': ['leaf', None, 'ID', 'SECURITY_CHECK_SCHEME', None, -1],
    'DDI_1': ['leaf', None, 'NM', 'DELAY_DAYS', None, -1],
    'DDI_2': ['sequence', None, 'MO', 'MONETARY_AMOUNT', None, -1],
    'DDI_3': ['leaf', None, 'NM', 'NUMBER_OF_DAYS', None, -1],
    'DIN_1': ['leaf', None, 'DTM', 'DATE', None, -1],
    'DIN_2': ['sequence', None, 'CWE', 'INSTITUTION_NAME', None, -1],
    'DLD_1': ['sequence', None, 'CWE', 'DISCHARGE_TO_LOCATION', None, -1],
    'DLD_2': ['leaf', None, 'DTM', 'EFFECTIVE_DATE', None, -1],
    'DLN_1': ['leaf', None, 'ST', 'LICENSE_NUMBER', None, -1],
    'DLN_2': ['sequence', None, 'CWE', 'ISSUING_STATE_PROVINCE_COUNTRY', None, -1],
    'DLN_3': ['leaf', None, 'DT', 'EXPIRATION_DATE', None, -1],
    'DLT_1': ['sequence', None, 'NR', 'NORMAL_RANGE', None, -1],
    'DLT_2': ['leaf', None, 'NM', 'NUMERIC_THRESHOLD', None, -1],
    'DLT_3': ['leaf', None, 'ID', 'CHANGE_COMPUTATION', None, -1],
    'DLT_4': ['leaf', None, 'NM', 'DAYS_RETAINED', None, -1],
    'DR_1': ['leaf', None, 'DTM', 'RANGE_START_DATE_TIME', None, -1],
    'DR_2': ['leaf', None, 'DTM', 'RANGE_END_DATE_TIME', None, -1],
    'DTN_1': ['sequence', None, 'CWE', 'DAY_TYPE', None, -1],
    'DTN_2': ['leaf', None, 'NM', 'NUMBER_OF_DAYS', None, -1],
    'ED_1': ['sequence', None, 'HD', 'SOURCE_APPLICATION', None, -1],
    'ED_2': ['leaf', None, 'ID', 'TYPE_OF_DATA', None, -1],
    'ED_3': ['leaf', None, 'ID', 'DATA_SUBTYPE', None, -1],
    'ED_4': ['leaf', None, 'ID', 'ENCODING', None, -1],
    'ED_5': ['leaf', None, 'TX', 'DATA', None, -1],
    'EI_1': ['leaf', None, 'ST', 'ENTITY_IDENTIFIER', None, -1],
    'EI_2': ['leaf', None, 'IS', 'NAMESPACE_ID', None, -1],
    'EI_3': ['leaf', None, 'ST', 'UNIVERSAL_ID', None, -1],
    'EI_4': ['leaf', None, 'ID', 'UNIVERSAL_ID_TYPE', None, -1],
    'EIP_1': ['sequence', None, 'EI', 'PLACER_ASSIGNED_IDENTIFIER', None, -1],
    'EIP_2': ['sequence', None, 'EI', 'FILLER_ASSIGNED_IDENTIFIER', None, -1],
    'ERL_1': ['leaf', None, 'ST', 'SEGMENT_ID', None, -1],
    'ERL_2': ['leaf', None, 'NM', 'SEGMENT_SEQUENCE', None, -1],
    'ERL_3': ['leaf', None, 'NM', 'FIELD_POSITION', None, -1],
    'ERL_4': ['leaf', None, 'NM', 'FIELD_REPETITION', None, -1],
    'ERL_5': ['leaf', None, 'NM', 'COMPONENT_NUMBER', None, -1],
    'ERL_6': ['leaf', None, 'NM', 'SUB_COMPONENT_NUMBER', None, -1],
    'FC_1': ['sequence', None, 'CWE', 'FINANCIAL_CLASS_CODE', None, -1],
    'FC_2': ['leaf', None, 'DTM', 'EFFECTIVE_DATE', None, -1],
    'FN_1': ['leaf', None, 'ST', 'SURNAME', None, -1],
    'FN_2': ['leaf', None, 'ST', 'OWN_SURNAME_PREFIX', None, -1],
    'FN_3': ['leaf', None, 'ST', 'OWN_SURNAME', None, -1],
    'FN_4': ['leaf', None, 'ST', 'SURNAME_PREFIX_FROM_PARTNER_SPOUSE', None, -1],
    'FN_5': ['leaf', None, 'ST', 'SURNAME_FROM_PARTNER_SPOUSE', None, -1],
    'HD_1': ['leaf', None, 'IS', 'NAMESPACE_ID', None, -1],
    'HD_2': ['leaf', None, 'ST', 'UNIVERSAL_ID', None, -1],
    'HD_3': ['leaf', None, 'ID', 'UNIVERSAL_ID_TYPE', None, -1],
    'ICD_1': ['sequence', None, 'CWE', 'CERTIFICATION_PATIENT_TYPE', None, -1],
    'ICD_2': ['leaf', None, 'ID', 'CERTIFICATION_REQUIRED', None, -1],
    'ICD_3': ['leaf', None, 'DTM', 'DATE_TIME_CERTIFICATION_REQUIRED', None, -1],
    'JCC_1': ['sequence', None, 'CWE', 'JOB_CODE', None, -1],
    'JCC_2': ['sequence', None, 'CWE', 'JOB_CLASS', None, -1],
    'JCC_3': ['leaf', None, 'TX', 'JOB_DESCRIPTION_TEXT', None, -1],
    'LA1_1': ['leaf', None, 'IS', 'POINT_OF_CARE', None, -1],
    'LA1_2': ['leaf', None, 'IS', 'ROOM', None, -1],
    'LA1_3': ['leaf', None, 'IS', 'BED', None, -1],
    'LA1_4': ['sequence', None, 'HD', 'FACILITY', None, -1],
    'LA1_5': ['leaf', None, 'IS', 'LOCATION_STATUS', None, -1],
    'LA1_6': ['leaf', None, 'IS', 'PATIENT_LOCATION_TYPE', None, -1],
    'LA1_7': ['leaf', None, 'IS', 'BUILDING', None, -1],
    'LA1_8': ['leaf', None, 'IS', 'FLOOR', None, -1],
    'LA1_9': ['sequence', None, 'AD', 'ADDRESS', None, -1],
    'LA2_1': ['leaf', None, 'IS', 'POINT_OF_CARE', None, -1],
    'LA2_2': ['leaf', None, 'IS', 'ROOM', None, -1],
    'LA2_3': ['leaf', None, 'IS', 'BED', None, -1],
    'LA2_4': ['sequence', None, 'HD', 'FACILITY', None, -1],
    'LA2_5': ['leaf', None, 'IS', 'LOCATION_STATUS', None, -1],
    'LA2_6': ['leaf', None, 'IS', 'PATIENT_LOCATION_TYPE', None, -1],
    'LA2_7': ['leaf', None, 'IS', 'BUILDING', None, -1],
    'LA2_8': ['leaf', None, 'IS', 'FLOOR', None, -1],
    'LA2_9': ['leaf', None, 'ST', 'STREET_ADDRESS', None, -1],
    'LA2_10': ['leaf', None, 'ST', 'OTHER_DESIGNATION', None, -1],
    'LA2_11': ['leaf', None, 'ST', 'CITY', None, -1],
    'LA2_12': ['leaf', None, 'ST', 'STATE_OR_PROVINCE', None, -1],
    'LA2_13': ['leaf', None, 'ST', 'ZIP_OR_POSTAL_CODE', None, -1],
    'LA2_14': ['leaf', None, 'ID', 'COUNTRY', None, -1],
    'LA2_15': ['leaf', None, 'ID', 'ADDRESS_TYPE', None, -1],
    'LA2_16': ['leaf', None, 'ST', 'OTHER_GEOGRAPHIC_DESIGNATION', None, -1],
    'MA_1': ['leaf', None, 'NM', 'SAMPLE_Y_FROM_CHANNEL_1', None, -1],
    'MA_2': ['leaf', None, 'NM', 'SAMPLE_Y_FROM_CHANNEL_2', None, -1],
    'MA_3': ['leaf', None, 'NM', 'SAMPLE_Y_FROM_CHANNEL_3', None, -1],
    'MA_4': ['leaf', None, 'NM', 'SAMPLE_Y_FROM_CHANNEL_4', None, -1],
    'MO_1': ['leaf', None, 'NM', 'QUANTITY', None, -1],
    'MO_2': ['leaf', None, 'ID', 'DENOMINATION', None, -1],
    'MOC_1': ['sequence', None, 'MO', 'MONETARY_AMOUNT', None, -1],
    'MOC_2': ['sequence', None, 'CWE', 'CHARGE_CODE', None, -1],
    'MOP_1': ['leaf', None, 'ID', 'MONEY_OR_PERCENTAGE_INDICATOR', None, -1],
    'MOP_2': ['leaf', None, 'NM', 'MONEY_OR_PERCENTAGE_QUANTITY', None, -1],
    'MOP_3': ['leaf', None, 'ID', 'MONETARY_DENOMINATION', None, -1],
    'MSG_1': ['leaf', None, 'ID', 'MESSAGE_CODE', None, -1],
    'MSG_2': ['leaf', None, 'ID', 'TRIGGER_EVENT', None, -1],
    'MSG_3': ['leaf', None, 'ID', 'MESSAGE_STRUCTURE', None, -1],
    'NA_1': ['leaf', None, 'NM', 'VALUE1', None, -1],
    'NA_2': ['leaf', None, 'NM', 'VALUE2', None, -1],
    'NA_3': ['leaf', None, 'NM', 'VALUE3', None, -1],
    'NA_4': ['leaf', None, 'NM', 'VALUE4', None, -1],
    'NDL_1': ['sequence', None, 'CNN', 'NAME', None, -1],
    'NDL_2': ['leaf', None, 'DTM', 'START_DATE_TIME', None, -1],
    'NDL_3': ['leaf', None, 'DTM', 'END_DATE_TIME', None, -1],
    'NDL_4': ['leaf', None, 'IS', 'POINT_OF_CARE', None, -1],
    'NDL_5': ['leaf', None, 'IS', 'ROOM', None, -1],
    'NDL_6': ['leaf', None, 'IS', 'BED', None, -1],
    'NDL_7': ['sequence', None, 'HD', 'FACILITY', None, -1],
    'NDL_8': ['leaf', None, 'IS', 'LOCATION_STATUS', None, -1],
    'NDL_9': ['leaf', None, 'IS', 'PATIENT_LOCATION_TYPE', None, -1],
    'NDL_10': ['leaf', None, 'IS', 'BUILDING', None, -1],
    'NDL_11': ['leaf', None, 'IS', 'FLOOR', None, -1],
    'NR_1': ['leaf', None, 'NM', 'LOW_VALUE', None, -1],
    'NR_2': ['leaf', None, 'NM', 'HIGH_VALUE', None, -1],
    'OCD_1': ['sequence', None, 'CNE', 'OCCURRENCE_CODE', None, -1],
    'OCD_2': ['leaf', None, 'DT', 'OCCURRENCE_DATE', None, -1],
    'OSP_1': ['sequence', None, 'CNE', 'OCCURRENCE_SPAN_CODE', None, -1],
    'OSP_2': ['leaf', None, 'DT', 'OCCURRENCE_SPAN_START_DATE', None, -1],
    'OSP_3': ['leaf', None, 'DT', 'OCCURRENCE_SPAN_STOP_DATE', None, -1],
    'PIP_1': ['sequence', None, 'CWE', 'PRIVILEGE', None, -1],
    'PIP_2': ['sequence', None, 'CWE', 'PRIVILEGE_CLASS', None, -1],
    'PIP_3': ['leaf', None, 'DT', 'EXPIRATION_DATE', None, -1],
    'PIP_4': ['leaf', None, 'DT', 'ACTIVATION_DATE', None, -1],
    'PIP_5': ['sequence', None, 'EI', 'FACILITY', None, -1],
    'PL_1': ['sequence', None, 'HD', 'POINT_OF_CARE', None, -1],
    'PL_2': ['sequence', None, 'HD', 'ROOM', None, -1],
    'PL_3': ['sequence', None, 'HD', 'BED', None, -1],
    'PL_4': ['sequence', None, 'HD', 'FACILITY', None, -1],
    'PL_5': ['leaf', None, 'IS', 'LOCATION_STATUS', None, -1],
    'PL_6': ['leaf', None, 'IS', 'PERSON_LOCATION_TYPE', None, -1],
    'PL_7': ['sequence', None, 'HD', 'BUILDING', None, -1],
    'PL_8': ['sequence', None, 'HD', 'FLOOR', None, -1],
    'PL_9': ['leaf', None, 'ST', 'LOCATION_DESCRIPTION', None, -1],
    'PL_10': ['sequence', None, 'EI', 'COMPREHENSIVE_LOCATION_IDENTIFIER', None, -1],
    'PL_11': ['sequence', None, 'HD', 'ASSIGNING_AUTHORITY_FOR_LOCATION', None, -1],
    'PLN_1': ['leaf', None, 'ST', 'ID_NUMBER', None, -1],
    'PLN_2': ['sequence', None, 'CWE', 'TYPE_OF_ID_NUMBER', None, -1],
    'PLN_3': ['leaf', None, 'ST', 'STATE_OTHER_QUALIFYING_INFORMATION', None, -1],
    'PLN_4': ['leaf', None, 'DT', 'EXPIRATION_DATE', None, -1],
    'PPN_1': ['leaf', None, 'ST', 'PERSON_IDENTIFIER', None, -1],
    'PPN_2': ['sequence', None, 'FN', 'FAMILY_NAME', None, -1],
    'PPN_3': ['leaf', None, 'ST', 'GIVEN_NAME', None, -1],
    'PPN_4': ['leaf', None, 'ST', 'SECOND_AND_FURTHER_GIVEN_NAMES_OR_INITIALS_THEREOF', None, -1],
    'PPN_5': ['leaf', None, 'ST', 'SUFFIX_E_G_JR_OR_III', None, -1],
    'PPN_6': ['leaf', None, 'ST', 'PREFIX_E_G_DR', None, -1],
    'PPN_7': ['leaf', None, 'WD', 'DEGREE_E_G_MD', None, -1],
    'PPN_8': ['sequence', None, 'CWE', 'SOURCE_TABLE', None, -1],
    'PPN_9': ['sequence', None, 'HD', 'ASSIGNING_AUTHORITY', None, -1],
    'PPN_10': ['leaf', None, 'ID', 'NAME_TYPE_CODE', None, -1],
    'PPN_11': ['leaf', None, 'ST', 'IDENTIFIER_CHECK_DIGIT', None, -1],
    'PPN_12': ['leaf', None, 'ID', 'CHECK_DIGIT_SCHEME', None, -1],
    'PPN_13': ['leaf', None, 'ID', 'IDENTIFIER_TYPE_CODE', None, -1],
    'PPN_14': ['sequence', None, 'HD', 'ASSIGNING_FACILITY', None, -1],
    'PPN_15': ['leaf', None, 'DTM', 'DATE_TIME_ACTION_PERFORMED', None, -1],
    'PPN_16': ['leaf', None, 'ID', 'NAME_REPRESENTATION_CODE', None, -1],
    'PPN_17': ['sequence', None, 'CWE', 'NAME_CONTEXT', None, -1],
    'PPN_18': ['leaf', None, 'WD', 'NAME_VALIDITY_RANGE', None, -1],
    'PPN_19': ['leaf', None, 'ID', 'NAME_ASSEMBLY_ORDER', None, -1],
    'PPN_20': ['leaf', None, 'DTM', 'EFFECTIVE_DATE', None, -1],
    'PPN_21': ['leaf', None, 'DTM', 'EXPIRATION_DATE', None, -1],
    'PPN_22': ['leaf', None, 'ST', 'PROFESSIONAL_SUFFIX', None, -1],
    'PPN_23': ['sequence', None, 'CWE', 'ASSIGNING_JURISDICTION', None, -1],
    'PPN_24': ['sequence', None, 'CWE', 'ASSIGNING_AGENCY_OR_DEPARTMENT', None, -1],
    'PPN_25': ['leaf', None, 'ST', 'SECURITY_CHECK', None, -1],
    'PPN_26': ['leaf', None, 'ID', 'SECURITY_CHECK_SCHEME', None, -1],
    'PRL_1': ['sequence', None, 'CWE', 'PARENT_OBSERVATION_IDENTIFIER', None, -1],
    'PRL_2': ['leaf', None, 'ST', 'PARENT_OBSERVATION_SUB_IDENTIFIER', None, -1],
    'PRL_3': ['leaf', None, 'TX', 'PARENT_OBSERVATION_VALUE_DESCRIPTOR', None, -1],
    'PT_1': ['leaf', None, 'ID', 'PROCESSING_ID', None, -1],
    'PT_2': ['leaf', None, 'ID', 'PROCESSING_MODE', None, -1],
    'PTA_1': ['sequence', None, 'CWE', 'POLICY_TYPE', None, -1],
    'PTA_2': ['sequence', None, 'CWE', 'AMOUNT_CLASS', None, -1],
    'PTA_3': ['leaf', None, 'WD', 'MONEY_OR_PERCENTAGE_QUANTITY', None, -1],
    'PTA_4': ['sequence', None, 'MOP', 'MONEY_OR_PERCENTAGE', None, -1],
    'QIP_1': ['leaf', None, 'ST', 'SEGMENT_FIELD_NAME', None, -1],
    'QIP_2': ['leaf', None, 'ST', 'VALUES', None, -1],
    'QSC_1': ['leaf', None, 'ST', 'SEGMENT_FIELD_NAME', None, -1],
    'QSC_2': ['leaf', None, 'ID', 'RELATIONAL_OPERATOR', None, -1],
    'QSC_3': ['leaf', None, 'ST', 'VALUE', None, -1],
    'QSC_4': ['leaf', None, 'ID', 'RELATIONAL_CONJUNCTION', None, -1],
    'RCD_1': ['leaf', None, 'ST', 'SEGMENT_FIELD_NAME', None, -1],
    'RCD_2': ['leaf', None, 'ID', 'HL7_DATA_TYPE', None, -1],
    'RCD_3': ['leaf', None, 'NM', 'MAXIMUM_COLUMN_WIDTH', None, -1],
    'RFR_1': ['sequence', None, 'NR', 'NUMERIC_RANGE', None, -1],
    'RFR_2': ['sequence', None, 'CWE', 'ADMINISTRATIVE_SEX', None, -1],
    'RFR_3': ['sequence', None, 'NR', 'AGE_RANGE', None, -1],
    'RFR_4': ['sequence', None, 'NR', 'GESTATIONAL_AGE_RANGE', None, -1],
    'RFR_5': ['leaf', None, 'ST', 'SPECIES', None, -1],
    'RFR_6': ['leaf', None, 'ST', 'RACE_SUBSPECIES', None, -1],
    'RFR_7': ['leaf', None, 'TX', 'CONDITIONS', None, -1],
    'RI_1': ['sequence', None, 'CWE', 'REPEAT_PATTERN', None, -1],
    'RI_2': ['leaf', None, 'ST', 'EXPLICIT_TIME_INTERVAL', None, -1],
    'RMC_1': ['sequence', None, 'CWE', 'ROOM_TYPE', None, -1],
    'RMC_2': ['sequence', None, 'CWE', 'AMOUNT_TYPE', None, -1],
    'RMC_3': ['leaf', None, 'WD', 'COVERAGE_AMOUNT', None, -1],
    'RMC_4': ['sequence', None, 'MOP', 'MONEY_OR_PERCENTAGE', None, -1],
    'RP_1': ['leaf', None, 'ST', 'POINTER', None, -1],
    'RP_2': ['sequence', None, 'HD', 'APPLICATION_ID', None, -1],
    'RP_3': ['leaf', None, 'ID', 'TYPE_OF_DATA', None, -1],
    'RP_4': ['leaf', None, 'ID', 'SUBTYPE', None, -1],
    'RPT_1': ['sequence', None, 'CWE', 'REPEAT_PATTERN_CODE', None, -1],
    'RPT_2': ['leaf', None, 'ID', 'CALENDAR_ALIGNMENT', None, -1],
    'RPT_3': ['leaf', None, 'NM', 'PHASE_RANGE_BEGIN_VALUE', None, -1],
    'RPT_4': ['leaf', None, 'NM', 'PHASE_RANGE_END_VALUE', None, -1],
    'RPT_5': ['leaf', None, 'NM', 'PERIOD_QUANTITY', None, -1],
    'RPT_6': ['sequence', None, 'CWE', 'PERIOD_UNITS', None, -1],
    'RPT_7': ['leaf', None, 'ID', 'INSTITUTION_SPECIFIED_TIME', None, -1],
    'RPT_8': ['leaf', None, 'ID', 'EVENT', None, -1],
    'RPT_9': ['leaf', None, 'NM', 'EVENT_OFFSET_QUANTITY', None, -1],
    'RPT_10': ['sequence', None, 'CWE', 'EVENT_OFFSET_UNITS', None, -1],
    'RPT_11': ['leaf', None, 'GTS', 'GENERAL_TIMING_SPECIFICATION', None, -1],
    'SAD_1': ['leaf', None, 'ST', 'STREET_OR_MAILING_ADDRESS', None, -1],
    'SAD_2': ['leaf', None, 'ST', 'STREET_NAME', None, -1],
    'SAD_3': ['leaf', None, 'ST', 'DWELLING_NUMBER', None, -1],
    'SCV_1': ['sequence', None, 'CWE', 'PARAMETER_CLASS', None, -1],
    'SCV_2': ['leaf', None, 'ST', 'PARAMETER_VALUE', None, -1],
    'SN_1': ['leaf', None, 'ST', 'COMPARATOR', None, -1],
    'SN_2': ['leaf', None, 'NM', 'NUM1', None, -1],
    'SN_3': ['leaf', None, 'ST', 'SEPARATOR_SUFFIX', None, -1],
    'SN_4': ['leaf', None, 'NM', 'NUM2', None, -1],
    'SPD_1': ['leaf', None, 'ST', 'SPECIALTY_NAME', None, -1],
    'SPD_2': ['leaf', None, 'ST', 'GOVERNING_BOARD', None, -1],
    'SPD_3': ['leaf', None, 'ID', 'ELIGIBLE_OR_CERTIFIED', None, -1],
    'SPD_4': ['leaf', None, 'DT', 'DATE_OF_CERTIFICATION', None, -1],
    'SRT_1': ['leaf', None, 'ST', 'SORT_BY_FIELD', None, -1],
    'SRT_2': ['leaf', None, 'ID', 'SEQUENCING', None, -1],
    'UVC_1': ['sequence', None, 'CWE', 'VALUE_CODE', None, -1],
    'UVC_2': ['sequence', None, 'MO', 'VALUE_AMOUNT', None, -1],
    'UVC_3': ['leaf', None, 'NM', 'NON_MONETARY_VALUE_AMOUNT_QUANTITY', None, -1],
    'UVC_4': ['sequence', None, 'CWE', 'NON_MONETARY_VALUE_AMOUNT_UNITS', None, -1],
    'VH_1': ['leaf', None, 'ID', 'START_DAY_RANGE', None, -1],
    'VH_2': ['leaf', None, 'ID', 'END_DAY_RANGE', None, -1],
    'VH_3': ['leaf', None, 'TM', 'START_HOUR_RANGE', None, -1],
    'VH_4': ['leaf', None, 'TM', 'END_HOUR_RANGE', None, -1],
    'VID_1': ['leaf', None, 'ID', 'VERSION_ID', None, -1],
    'VID_2': ['sequence', None, 'CWE', 'INTERNATIONALIZATION_CODE', None, -1],
    'VID_3': ['sequence', None, 'CWE', 'INTERNATIONAL_VERSION_ID', None, -1],
    'VR_1': ['leaf', None, 'ST', 'FIRST_DATA_CODE_VALUE', None, -1],
    'VR_2': ['leaf', None, 'ST', 'LAST_DATA_CODE_VALUE', None, -1],
    'WVI_1': ['leaf', None, 'NM', 'CHANNEL_NUMBER', None, -1],
    'WVI_2': ['leaf', None, 'ST', 'CHANNEL_NAME', None, -1],
    'WVS_1': ['leaf', None, 'ST', 'SOURCE_ONE_NAME', None, -1],
    'WVS_2': ['leaf', None, 'ST', 'SOURCE_TWO_NAME', None, -1],
    'XAD_1': ['sequence', None, 'SAD', 'STREET_ADDRESS', None, -1],
    'XAD_2': ['leaf', None, 'ST', 'OTHER_DESIGNATION', None, -1],
    'XAD_3': ['leaf', None, 'ST', 'CITY', None, -1],
    'XAD_4': ['leaf', None, 'ST', 'STATE_OR_PROVINCE', None, -1],
    'XAD_5': ['leaf', None, 'ST', 'ZIP_OR_POSTAL_CODE', None, -1],
    'XAD_6': ['leaf', None, 'ID', 'COUNTRY', None, -1],
    'XAD_7': ['leaf', None, 'ID', 'ADDRESS_TYPE', None, -1],
    'XAD_8': ['leaf', None, 'ST', 'OTHER_GEOGRAPHIC_DESIGNATION', None, -1],
    'XAD_9': ['sequence', None, 'CWE', 'COUNTY_PARISH_CODE', None, -1],
    'XAD_10': ['sequence', None, 'CWE', 'CENSUS_TRACT', None, -1],
    'XAD_11': ['leaf', None, 'ID', 'ADDRESS_REPRESENTATION_CODE', None, -1],
    'XAD_12': ['leaf', None, 'WD', 'ADDRESS_VALIDITY_RANGE', None, -1],
    'XAD_13': ['leaf', None, 'DTM', 'EFFECTIVE_DATE', None, -1],
    'XAD_14': ['leaf', None, 'DTM', 'EXPIRATION_DATE', None, -1],
    'XAD_15': ['sequence', None, 'CWE', 'EXPIRATION_REASON', None, -1],
    'XAD_16': ['leaf', None, 'ID', 'TEMPORARY_INDICATOR', None, -1],
    'XAD_17': ['leaf', None, 'ID', 'BAD_ADDRESS_INDICATOR', None, -1],
    'XAD_18': ['leaf', None, 'ID', 'ADDRESS_USAGE', None, -1],
    'XAD_19': ['leaf', None, 'ST', 'ADDRESSEE', None, -1],
    'XAD_20': ['leaf', None, 'ST', 'COMMENT', None, -1],
    'XAD_21': ['leaf', None, 'NM', 'PREFERENCE_ORDER', None, -1],
    'XAD_22': ['sequence', None, 'CWE', 'PROTECTION_CODE', None, -1],
    'XAD_23': ['sequence', None, 'EI', 'ADDRESS_IDENTIFIER', None, -1],
    'XCN_1': ['leaf', None, 'ST', 'PERSON_IDENTIFIER', None, -1],
    'XCN_2': ['sequence', None, 'FN', 'FAMILY_NAME', None, -1],
    'XCN_3': ['leaf', None, 'ST', 'GIVEN_NAME', None, -1],
    'XCN_4': ['leaf', None, 'ST', 'SECOND_AND_FURTHER_GIVEN_NAMES_OR_INITIALS_THEREOF', None, -1],
    'XCN_5': ['leaf', None, 'ST', 'SUFFIX_E_G_JR_OR_III', None, -1],
    'XCN_6': ['leaf', None, 'ST', 'PREFIX_E_G_DR', None, -1],
    'XCN_7': ['leaf', None, 'WD', 'DEGREE_E_G_MD', None, -1],
    'XCN_8': ['sequence', None, 'CWE', 'SOURCE_TABLE', None, -1],
    'XCN_9': ['sequence', None, 'HD', 'ASSIGNING_AUTHORITY', None, -1],
    'XCN_10': ['leaf', None, 'ID', 'NAME_TYPE_CODE', None, -1],
    'XCN_11': ['leaf', None, 'ST', 'IDENTIFIER_CHECK_DIGIT', None, -1],
    'XCN_12': ['leaf', None, 'ID', 'CHECK_DIGIT_SCHEME', None, -1],
    'XCN_13': ['leaf', None, 'ID', 'IDENTIFIER_TYPE_CODE', None, -1],
    'XCN_14': ['sequence', None, 'HD', 'ASSIGNING_FACILITY', None, -1],
    'XCN_15': ['leaf', None, 'ID', 'NAME_REPRESENTATION_CODE', None, -1],
    'XCN_16': ['sequence', None, 'CWE', 'NAME_CONTEXT', None, -1],
    'XCN_17': ['leaf', None, 'WD', 'NAME_VALIDITY_RANGE', None, -1],
    'XCN_18': ['leaf', None, 'ID', 'NAME_ASSEMBLY_ORDER', None, -1],
    'XCN_19': ['leaf', None, 'DTM', 'EFFECTIVE_DATE', None, -1],
    'XCN_20': ['leaf', None, 'DTM', 'EXPIRATION_DATE', None, -1],
    'XCN_21': ['leaf', None, 'ST', 'PROFESSIONAL_SUFFIX', None, -1],
    'XCN_22': ['sequence', None, 'CWE', 'ASSIGNING_JURISDICTION', None, -1],
    'XCN_23': ['sequence', None, 'CWE', 'ASSIGNING_AGENCY_OR_DEPARTMENT', None, -1],
    'XCN_24': ['leaf', None, 'ST', 'SECURITY_CHECK', None, -1],
    'XCN_25': ['leaf', None, 'ID', 'SECURITY_CHECK_SCHEME', None, -1],
    'XON_1': ['leaf', None, 'ST', 'ORGANIZATION_NAME', None, -1],
    'XON_2': ['sequence', None, 'CWE', 'ORGANIZATION_NAME_TYPE_CODE', None, -1],
    'XON_3': ['leaf', None, 'WD', 'ID_NUMBER', None, -1],
    'XON_4': ['leaf', None, 'NM', 'IDENTIFIER_CHECK_DIGIT', None, -1],
    'XON_5': ['leaf', None, 'ID', 'CHECK_DIGIT_SCHEME', None, -1],
    'XON_6': ['sequence', None, 'HD', 'ASSIGNING_AUTHORITY', None, -1],
    'XON_7': ['leaf', None, 'ID', 'IDENTIFIER_TYPE_CODE', None, -1],
    'XON_8': ['sequence', None, 'HD', 'ASSIGNING_FACILITY', None, -1],
    'XON_9': ['leaf', None, 'ID', 'NAME_REPRESENTATION_CODE', None, -1],
    'XON_10': ['leaf', None, 'ST', 'ORGANIZATION_IDENTIFIER', None, -1],
    'XPN_1': ['sequence', None, 'FN', 'FAMILY_NAME', None, -1],
    'XPN_2': ['leaf', None, 'ST', 'GIVEN_NAME', None, -1],
    'XPN_3': ['leaf', None, 'ST', 'SECOND_AND_FURTHER_GIVEN_NAMES_OR_INITIALS_THEREOF', None, -1],
    'XPN_4': ['leaf', None, 'ST', 'SUFFIX_E_G_JR_OR_III', None, -1],
    'XPN_5': ['leaf', None, 'ST', 'PREFIX_E_G_DR', None, -1],
    'XPN_6': ['leaf', None, 'ST', 'DEGREE', None, -1],
    'XPN_7': ['leaf', None, 'ID', 'NAME_TYPE_CODE', None, -1],
    'XPN_8': ['leaf', None, 'ID', 'NAME_REPRESENTATION_CODE', None, -1],
    'XPN_9': ['sequence', None, 'CWE', 'NAME_CONTEXT', None, -1],
    'XPN_10': ['leaf', None, 'ST', 'NAME_VALIDITY_RANGE', None, -1],
    'XPN_11': ['leaf', None, 'ID', 'NAME_ASSEMBLY_ORDER', None, -1],
    'XPN_12': ['leaf', None, 'DTM', 'EFFECTIVE_DATE', None, -1],
    'XPN_13': ['leaf', None, 'DTM', 'EXPIRATION_DATE', None, -1],
    'XPN_14': ['leaf', None, 'ST', 'PROFESSIONAL_SUFFIX', None, -1],
    'XPN_15': ['leaf', None, 'ST', 'CALLED_BY', None, -1],
    'XTN_1': ['leaf', None, 'WD', 'TELEPHONE_NUMBER', None, -1],
    'XTN_2': ['leaf', None, 'ID', 'TELECOMMUNICATION_USE_CODE', None, -1],
    'XTN_3': ['leaf', None, 'ID', 'TELECOMMUNICATION_EQUIPMENT_TYPE', None, -1],
    'XTN_4': ['leaf', None, 'ST', 'COMMUNICATION_ADDRESS', None, -1],
    'XTN_5': ['leaf', None, 'SNM', 'COUNTRY_CODE', None, -1],
    'XTN_6': ['leaf', None, 'SNM', 'AREA_CITY_CODE', None, -1],
    'XTN_7': ['leaf', None, 'SNM', 'LOCAL_NUMBER', None, -1],
    'XTN_8': ['leaf', None, 'SNM', 'EXTENSION', None, -1],
    'XTN_9': ['leaf', None, 'ST', 'ANY_TEXT', None, -1],
    'XTN_10': ['leaf', None, 'ST', 'EXTENSION_PREFIX', None, -1],
    'XTN_11': ['leaf', None, 'ST', 'SPEED_DIAL_CODE', None, -1],
    'XTN_12': ['leaf', None, 'ST', 'UNFORMATTED_TELEPHONE_NUMBER', None, -1],
    'XTN_13': ['leaf', None, 'DTM', 'EFFECTIVE_START_DATE', None, -1],
    'XTN_14': ['leaf', None, 'DTM', 'EXPIRATION_DATE', None, -1],
    'XTN_15': ['sequence', None, 'CWE', 'EXPIRATION_REASON', None, -1],
    'XTN_16': ['sequence', None, 'CWE', 'PROTECTION_CODE', None, -1],
    'XTN_17': ['sequence', None, 'EI', 'SHARED_TELECOMMUNICATION_IDENTIFIER', None, -1],
    'XTN_18': ['leaf', None, 'NM', 'PREFERENCE_ORDER', None, -1],
}


DATATYPES_STRUCTS = {
    'AD': (
           ('AD_1', DATATYPES['AD_1'], (0, 1), 'CMP'),
           ('AD_2', DATATYPES['AD_2'], (0, 1), 'CMP'),
           ('AD_3', DATATYPES['AD_3'], (0, 1), 'CMP'),
           ('AD_4', DATATYPES['AD_4'], (0, 1), 'CMP'),
           ('AD_5', DATATYPES['AD_5'], (0, 1), 'CMP'),
           ('AD_6', DATATYPES['AD_6'], (0, 1), 'CMP'),
           ('AD_7', DATATYPES['AD_7'], (0, 1), 'CMP'),
           ('AD_8', DATATYPES['AD_8'], (0, 1), 'CMP'),),
    'AUI': (
           ('AUI_1', DATATYPES['AUI_1'], (0, 1), 'CMP'),
           ('AUI_2', DATATYPES['AUI_2'], (0, 1), 'CMP'),
           ('AUI_3', DATATYPES['AUI_3'], (0, 1), 'CMP'),),
    'CCD': (
           ('CCD_1', DATATYPES['CCD_1'], (1, 1), 'CMP'),
           ('CCD_2', DATATYPES['CCD_2'], (0, 1), 'CMP'),),
    'CCP': (
           ('CCP_1', DATATYPES['CCP_1'], (0, 1), 'CMP'),
           ('CCP_2', DATATYPES['CCP_2'], (0, 1), 'CMP'),
           ('CCP_3', DATATYPES['CCP_3'], (0, 1), 'CMP'),),
    'CD': (
           ('CD_1', DATATYPES['CD_1'], (0, 1), 'CMP'),
           ('CD_2', DATATYPES['CD_2'], (0, 1), 'CMP'),
           ('CD_3', DATATYPES['CD_3'], (0, 1), 'CMP'),
           ('CD_4', DATATYPES['CD_4'], (0, 1), 'CMP'),
           ('CD_5', DATATYPES['CD_5'], (0, 1), 'CMP'),
           ('CD_6', DATATYPES['CD_6'], (0, 1), 'CMP'),),
    'CF': (
           ('CF_1', DATATYPES['CF_1'], (0, 1), 'CMP'),
           ('CF_2', DATATYPES['CF_2'], (0, 1), 'CMP'),
           ('CF_3', DATATYPES['CF_3'], (0, 1), 'CMP'),
           ('CF_4', DATATYPES['CF_4'], (0, 1), 'CMP'),
           ('CF_5', DATATYPES['CF_5'], (0, 1), 'CMP'),
           ('CF_6', DATATYPES['CF_6'], (0, 1), 'CMP'),
           ('CF_7', DATATYPES['CF_7'], (0, 1), 'CMP'),
           ('CF_8', DATATYPES['CF_8'], (0, 1), 'CMP'),
           ('CF_9', DATATYPES['CF_9'], (0, 1), 'CMP'),
           ('CF_10', DATATYPES['CF_10'], (0, 1), 'CMP'),
           ('CF_11', DATATYPES['CF_11'], (0, 1), 'CMP'),
           ('CF_12', DATATYPES['CF_12'], (0, 1), 'CMP'),
           ('CF_13', DATATYPES['CF_13'], (0, 1), 'CMP'),
           ('CF_14', DATATYPES['CF_14'], (0, 1), 'CMP'),
           ('CF_15', DATATYPES['CF_15'], (0, 1), 'CMP'),
           ('CF_16', DATATYPES['CF_16'], (0, 1), 'CMP'),
           ('CF_17', DATATYPES['CF_17'], (0, 1), 'CMP'),
           ('CF_18', DATATYPES['CF_18'], (0, 1), 'CMP'),
           ('CF_19', DATATYPES['CF_19'], (0, 1), 'CMP'),
           ('CF_20', DATATYPES['CF_20'], (0, 1), 'CMP'),
           ('CF_21', DATATYPES['CF_21'], (0, 1), 'CMP'),
           ('CF_22', DATATYPES['CF_22'], (0, 1), 'CMP'),),
    'CNE': (
           ('CNE_1', DATATYPES['CNE_1'], (1, 1), 'CMP'),
           ('CNE_2', DATATYPES['CNE_2'], (0, 1), 'CMP'),
           ('CNE_3', DATATYPES['CNE_3'], (0, 1), 'CMP'),
           ('CNE_4', DATATYPES['CNE_4'], (0, 1), 'CMP'),
           ('CNE_5', DATATYPES['CNE_5'], (0, 1), 'CMP'),
           ('CNE_6', DATATYPES['CNE_6'], (0, 1), 'CMP'),
           ('CNE_7', DATATYPES['CNE_7'], (0, 1), 'CMP'),
           ('CNE_8', DATATYPES['CNE_8'], (0, 1), 'CMP'),
           ('CNE_9', DATATYPES['CNE_9'], (0, 1), 'CMP'),
           ('CNE_10', DATATYPES['CNE_10'], (0, 1), 'CMP'),
           ('CNE_11', DATATYPES['CNE_11'], (0, 1), 'CMP'),
           ('CNE_12', DATATYPES['CNE_12'], (0, 1), 'CMP'),
           ('CNE_13', DATATYPES['CNE_13'], (0, 1), 'CMP'),
           ('CNE_14', DATATYPES['CNE_14'], (0, 1), 'CMP'),
           ('CNE_15', DATATYPES['CNE_15'], (0, 1), 'CMP'),
           ('CNE_16', DATATYPES['CNE_16'], (0, 1), 'CMP'),
           ('CNE_17', DATATYPES['CNE_17'], (0, 1), 'CMP'),
           ('CNE_18', DATATYPES['CNE_18'], (0, 1), 'CMP'),
           ('CNE_19', DATATYPES['CNE_19'], (0, 1), 'CMP'),
           ('CNE_20', DATATYPES['CNE_20'], (0, 1), 'CMP'),
           ('CNE_21', DATATYPES['CNE_21'], (0, 1), 'CMP'),
           ('CNE_22', DATATYPES['CNE_22'], (0, 1), 'CMP'),),
    'CNN': (
           ('CNN_1', DATATYPES['CNN_1'], (0, 1), 'CMP'),
           ('CNN_2', DATATYPES['CNN_2'], (0, 1), 'CMP'),
           ('CNN_3', DATATYPES['CNN_3'], (0, 1), 'CMP'),
           ('CNN_4', DATATYPES['CNN_4'], (0, 1), 'CMP'),
           ('CNN_5', DATATYPES['CNN_5'], (0, 1), 'CMP'),
           ('CNN_6', DATATYPES['CNN_6'], (0, 1), 'CMP'),
           ('CNN_7', DATATYPES['CNN_7'], (0, 1), 'CMP'),
           ('CNN_8', DATATYPES['CNN_8'], (0, 1), 'CMP'),
           ('CNN_9', DATATYPES['CNN_9'], (0, 1), 'CMP'),
           ('CNN_10', DATATYPES['CNN_10'], (0, 1), 'CMP'),
           ('CNN_11', DATATYPES['CNN_11'], (0, 1), 'CMP'),),
    'CP': (
           ('CP_1', DATATYPES['CP_1'], (1, 1), 'CMP'),
           ('CP_2', DATATYPES['CP_2'], (0, 1), 'CMP'),
           ('CP_3', DATATYPES['CP_3'], (0, 1), 'CMP'),
           ('CP_4', DATATYPES['CP_4'], (0, 1), 'CMP'),
           ('CP_5', DATATYPES['CP_5'], (0, 1), 'CMP'),
           ('CP_6', DATATYPES['CP_6'], (0, 1), 'CMP'),),
    'CQ': (
           ('CQ_1', DATATYPES['CQ_1'], (0, 1), 'CMP'),
           ('CQ_2', DATATYPES['CQ_2'], (0, 1), 'CMP'),),
    'CSU': (
           ('CSU_1', DATATYPES['CSU_1'], (1, 1), 'CMP'),
           ('CSU_2', DATATYPES['CSU_2'], (0, 1), 'CMP'),
           ('CSU_3', DATATYPES['CSU_3'], (0, 1), 'CMP'),
           ('CSU_4', DATATYPES['CSU_4'], (0, 1), 'CMP'),
           ('CSU_5', DATATYPES['CSU_5'], (0, 1), 'CMP'),
           ('CSU_6', DATATYPES['CSU_6'], (0, 1), 'CMP'),
           ('CSU_7', DATATYPES['CSU_7'], (0, 1), 'CMP'),
           ('CSU_8', DATATYPES['CSU_8'], (0, 1), 'CMP'),
           ('CSU_9', DATATYPES['CSU_9'], (0, 1), 'CMP'),
           ('CSU_10', DATATYPES['CSU_10'], (0, 1), 'CMP'),
           ('CSU_11', DATATYPES['CSU_11'], (0, 1), 'CMP'),
           ('CSU_12', DATATYPES['CSU_12'], (0, 1), 'CMP'),
           ('CSU_13', DATATYPES['CSU_13'], (0, 1), 'CMP'),
           ('CSU_14', DATATYPES['CSU_14'], (0, 1), 'CMP'),
           ('CSU_15', DATATYPES['CSU_15'], (0, 1), 'CMP'),
           ('CSU_16', DATATYPES['CSU_16'], (0, 1), 'CMP'),
           ('CSU_17', DATATYPES['CSU_17'], (0, 1), 'CMP'),
           ('CSU_18', DATATYPES['CSU_18'], (0, 1), 'CMP'),
           ('CSU_19', DATATYPES['CSU_19'], (0, 1), 'CMP'),
           ('CSU_20', DATATYPES['CSU_20'], (0, 1), 'CMP'),
           ('CSU_21', DATATYPES['CSU_21'], (0, 1), 'CMP'),
           ('CSU_22', DATATYPES['CSU_22'], (0, 1), 'CMP'),
           ('CSU_23', DATATYPES['CSU_23'], (0, 1), 'CMP'),),
    'CWE': (
           ('CWE_1', DATATYPES['CWE_1'], (0, 1), 'CMP'),
           ('CWE_2', DATATYPES['CWE_2'], (0, 1), 'CMP'),
           ('CWE_3', DATATYPES['CWE_3'], (0, 1), 'CMP'),
           ('CWE_4', DATATYPES['CWE_4'], (0, 1), 'CMP'),
           ('CWE_5', DATATYPES['CWE_5'], (0, 1), 'CMP'),
           ('CWE_6', DATATYPES['CWE_6'], (0, 1), 'CMP'),
           ('CWE_7', DATATYPES['CWE_7'], (0, 1), 'CMP'),
           ('CWE_8', DATATYPES['CWE_8'], (0, 1), 'CMP'),
           ('CWE_9', DATATYPES['CWE_9'], (0, 1), 'CMP'),
           ('CWE_10', DATATYPES['CWE_10'], (0, 1), 'CMP'),
           ('CWE_11', DATATYPES['CWE_11'], (0, 1), 'CMP'),
           ('CWE_12', DATATYPES['CWE_12'], (0, 1), 'CMP'),
           ('CWE_13', DATATYPES['CWE_13'], (0, 1), 'CMP'),
           ('CWE_14', DATATYPES['CWE_14'], (0, 1), 'CMP'),
           ('CWE_15', DATATYPES['CWE_15'], (0, 1), 'CMP'),
           ('CWE_16', DATATYPES['CWE_16'], (0, 1), 'CMP'),
           ('CWE_17', DATATYPES['CWE_17'], (0, 1), 'CMP'),
           ('CWE_18', DATATYPES['CWE_18'], (0, 1), 'CMP'),
           ('CWE_19', DATATYPES['CWE_19'], (0, 1), 'CMP'),
           ('CWE_20', DATATYPES['CWE_20'], (0, 1), 'CMP'),
           ('CWE_21', DATATYPES['CWE_21'], (0, 1), 'CMP'),
           ('CWE_22', DATATYPES['CWE_22'], (0, 1), 'CMP'),),
    'CX': (
           ('CX_1', DATATYPES['CX_1'], (1, 1), 'CMP'),
           ('CX_2', DATATYPES['CX_2'], (0, 1), 'CMP'),
           ('CX_3', DATATYPES['CX_3'], (0, 1), 'CMP'),
           ('CX_4', DATATYPES['CX_4'], (0, 1), 'CMP'),
           ('CX_5', DATATYPES['CX_5'], (1, 1), 'CMP'),
           ('CX_6', DATATYPES['CX_6'], (0, 1), 'CMP'),
           ('CX_7', DATATYPES['CX_7'], (0, 1), 'CMP'),
           ('CX_8', DATATYPES['CX_8'], (0, 1), 'CMP'),
           ('CX_9', DATATYPES['CX_9'], (0, 1), 'CMP'),
           ('CX_10', DATATYPES['CX_10'], (0, 1), 'CMP'),
           ('CX_11', DATATYPES['CX_11'], (0, 1), 'CMP'),
           ('CX_12', DATATYPES['CX_12'], (0, 1), 'CMP'),),
    'DDI': (
           ('DDI_1', DATATYPES['DDI_1'], (0, 1), 'CMP'),
           ('DDI_2', DATATYPES['DDI_2'], (1, 1), 'CMP'),
           ('DDI_3', DATATYPES['DDI_3'], (0, 1), 'CMP'),),
    'DIN': (
           ('DIN_1', DATATYPES['DIN_1'], (1, 1), 'CMP'),
           ('DIN_2', DATATYPES['DIN_2'], (1, 1), 'CMP'),),
    'DLD': (
           ('DLD_1', DATATYPES['DLD_1'], (1, 1), 'CMP'),
           ('DLD_2', DATATYPES['DLD_2'], (0, 1), 'CMP'),),
    'DLN': (
           ('DLN_1', DATATYPES['DLN_1'], (1, 1), 'CMP'),
           ('DLN_2', DATATYPES['DLN_2'], (0, 1), 'CMP'),
           ('DLN_3', DATATYPES['DLN_3'], (0, 1), 'CMP'),),
    'DLT': (
           ('DLT_1', DATATYPES['DLT_1'], (0, 1), 'CMP'),
           ('DLT_2', DATATYPES['DLT_2'], (0, 1), 'CMP'),
           ('DLT_3', DATATYPES['DLT_3'], (0, 1), 'CMP'),
           ('DLT_4', DATATYPES['DLT_4'], (0, 1), 'CMP'),),
    'DR': (
           ('DR_1', DATATYPES['DR_1'], (0, 1), 'CMP'),
           ('DR_2', DATATYPES['DR_2'], (0, 1), 'CMP'),),
    'DTN': (
           ('DTN_1', DATATYPES['DTN_1'], (1, 1), 'CMP'),
           ('DTN_2', DATATYPES['DTN_2'], (1, 1), 'CMP'),),
    'ED': (
           ('ED_1', DATATYPES['ED_1'], (0, 1), 'CMP'),
           ('ED_2', DATATYPES['ED_2'], (1, 1), 'CMP'),
           ('ED_3', DATATYPES['ED_3'], (0, 1), 'CMP'),
           ('ED_4', DATATYPES['ED_4'], (1, 1), 'CMP'),
           ('ED_5', DATATYPES['ED_5'], (1, 1), 'CMP'),),
    'EI': (
           ('EI_1', DATATYPES['EI_1'], (0, 1), 'CMP'),
           ('EI_2', DATATYPES['EI_2'], (0, 1), 'CMP'),
           ('EI_3', DATATYPES['EI_3'], (0, 1), 'CMP'),
           ('EI_4', DATATYPES['EI_4'], (0, 1), 'CMP'),),
    'EIP': (
           ('EIP_1', DATATYPES['EIP_1'], (0, 1), 'CMP'),
           ('EIP_2', DATATYPES['EIP_2'], (0, 1), 'CMP'),),
    'ERL': (
           ('ERL_1', DATATYPES['ERL_1'], (1, 1), 'CMP'),
           ('ERL_2', DATATYPES['ERL_2'], (1, 1), 'CMP'),
           ('ERL_3', DATATYPES['ERL_3'], (0, 1), 'CMP'),
           ('ERL_4', DATATYPES['ERL_4'], (0, 1), 'CMP'),
           ('ERL_5', DATATYPES['ERL_5'], (0, 1), 'CMP'),
           ('ERL_6', DATATYPES['ERL_6'], (0, 1), 'CMP'),),
    'FC': (
           ('FC_1', DATATYPES['FC_1'], (1, 1), 'CMP'),
           ('FC_2', DATATYPES['FC_2'], (0, 1), 'CMP'),),
    'FN': (
           ('FN_1', DATATYPES['FN_1'], (1, 1), 'CMP'),
           ('FN_2', DATATYPES['FN_2'], (0, 1), 'CMP'),
           ('FN_3', DATATYPES['FN_3'], (0, 1), 'CMP'),
           ('FN_4', DATATYPES['FN_4'], (0, 1), 'CMP'),
           ('FN_5', DATATYPES['FN_5'], (0, 1), 'CMP'),),
    'HD': (
           ('HD_1', DATATYPES['HD_1'], (0, 1), 'CMP'),
           ('HD_2', DATATYPES['HD_2'], (0, 1), 'CMP'),
           ('HD_3', DATATYPES['HD_3'], (0, 1), 'CMP'),),
    'ICD': (
           ('ICD_1', DATATYPES['ICD_1'], (0, 1), 'CMP'),
           ('ICD_2', DATATYPES['ICD_2'], (1, 1), 'CMP'),
           ('ICD_3', DATATYPES['ICD_3'], (0, 1), 'CMP'),),
    'JCC': (
           ('JCC_1', DATATYPES['JCC_1'], (0, 1), 'CMP'),
           ('JCC_2', DATATYPES['JCC_2'], (0, 1), 'CMP'),
           ('JCC_3', DATATYPES['JCC_3'], (0, 1), 'CMP'),),
    'LA1': (
           ('LA1_1', DATATYPES['LA1_1'], (0, 1), 'CMP'),
           ('LA1_2', DATATYPES['LA1_2'], (0, 1), 'CMP'),
           ('LA1_3', DATATYPES['LA1_3'], (0, 1), 'CMP'),
           ('LA1_4', DATATYPES['LA1_4'], (0, 1), 'CMP'),
           ('LA1_5', DATATYPES['LA1_5'], (0, 1), 'CMP'),
           ('LA1_6', DATATYPES['LA1_6'], (0, 1), 'CMP'),
           ('LA1_7', DATATYPES['LA1_7'], (0, 1), 'CMP'),
           ('LA1_8', DATATYPES['LA1_8'], (0, 1), 'CMP'),
           ('LA1_9', DATATYPES['LA1_9'], (0, 1), 'CMP'),),
    'LA2': (
           ('LA2_1', DATATYPES['LA2_1'], (0, 1), 'CMP'),
           ('LA2_2', DATATYPES['LA2_2'], (0, 1), 'CMP'),
           ('LA2_3', DATATYPES['LA2_3'], (0, 1), 'CMP'),
           ('LA2_4', DATATYPES['LA2_4'], (0, 1), 'CMP'),
           ('LA2_5', DATATYPES['LA2_5'], (0, 1), 'CMP'),
           ('LA2_6', DATATYPES['LA2_6'], (0, 1), 'CMP'),
           ('LA2_7', DATATYPES['LA2_7'], (0, 1), 'CMP'),
           ('LA2_8', DATATYPES['LA2_8'], (0, 1), 'CMP'),
           ('LA2_9', DATATYPES['LA2_9'], (0, 1), 'CMP'),
           ('LA2_10', DATATYPES['LA2_10'], (0, 1), 'CMP'),
           ('LA2_11', DATATYPES['LA2_11'], (0, 1), 'CMP'),
           ('LA2_12', DATATYPES['LA2_12'], (0, 1), 'CMP'),
           ('LA2_13', DATATYPES['LA2_13'], (0, 1), 'CMP'),
           ('LA2_14', DATATYPES['LA2_14'], (0, 1), 'CMP'),
           ('LA2_15', DATATYPES['LA2_15'], (0, 1), 'CMP'),
           ('LA2_16', DATATYPES['LA2_16'], (0, 1), 'CMP'),),
    'MA': (
           ('MA_1', DATATYPES['MA_1'], (0, 1), 'CMP'),
           ('MA_2', DATATYPES['MA_2'], (0, 1), 'CMP'),
           ('MA_3', DATATYPES['MA_3'], (0, 1), 'CMP'),
           ('MA_4', DATATYPES['MA_4'], (0, 1), 'CMP'),),
    'MO': (
           ('MO_1', DATATYPES['MO_1'], (0, 1), 'CMP'),
           ('MO_2', DATATYPES['MO_2'], (0, 1), 'CMP'),),
    'MOC': (
           ('MOC_1', DATATYPES['MOC_1'], (0, 1), 'CMP'),
           ('MOC_2', DATATYPES['MOC_2'], (0, 1), 'CMP'),),
    'MOP': (
           ('MOP_1', DATATYPES['MOP_1'], (1, 1), 'CMP'),
           ('MOP_2', DATATYPES['MOP_2'], (1, 1), 'CMP'),
           ('MOP_3', DATATYPES['MOP_3'], (0, 1), 'CMP'),),
    'MSG': (
           ('MSG_1', DATATYPES['MSG_1'], (1, 1), 'CMP'),
           ('MSG_2', DATATYPES['MSG_2'], (1, 1), 'CMP'),
           ('MSG_3', DATATYPES['MSG_3'], (1, 1), 'CMP'),),
    'NA': (
           ('NA_1', DATATYPES['NA_1'], (0, 1), 'CMP'),
           ('NA_2', DATATYPES['NA_2'], (0, 1), 'CMP'),
           ('NA_3', DATATYPES['NA_3'], (0, 1), 'CMP'),
           ('NA_4', DATATYPES['NA_4'], (0, 1), 'CMP'),),
    'NDL': (
           ('NDL_1', DATATYPES['NDL_1'], (0, 1), 'CMP'),
           ('NDL_2', DATATYPES['NDL_2'], (0, 1), 'CMP'),
           ('NDL_3', DATATYPES['NDL_3'], (0, 1), 'CMP'),
           ('NDL_4', DATATYPES['NDL_4'], (0, 1), 'CMP'),
           ('NDL_5', DATATYPES['NDL_5'], (0, 1), 'CMP'),
           ('NDL_6', DATATYPES['NDL_6'], (0, 1), 'CMP'),
           ('NDL_7', DATATYPES['NDL_7'], (0, 1), 'CMP'),
           ('NDL_8', DATATYPES['NDL_8'], (0, 1), 'CMP'),
           ('NDL_9', DATATYPES['NDL_9'], (0, 1), 'CMP'),
           ('NDL_10', DATATYPES['NDL_10'], (0, 1), 'CMP'),
           ('NDL_11', DATATYPES['NDL_11'], (0, 1), 'CMP'),),
    'NR': (
           ('NR_1', DATATYPES['NR_1'], (0, 1), 'CMP'),
           ('NR_2', DATATYPES['NR_2'], (0, 1), 'CMP'),),
    'OCD': (
           ('OCD_1', DATATYPES['OCD_1'], (1, 1), 'CMP'),
           ('OCD_2', DATATYPES['OCD_2'], (1, 1), 'CMP'),),
    'OSP': (
           ('OSP_1', DATATYPES['OSP_1'], (1, 1), 'CMP'),
           ('OSP_2', DATATYPES['OSP_2'], (0, 1), 'CMP'),
           ('OSP_3', DATATYPES['OSP_3'], (0, 1), 'CMP'),),
    'PIP': (
           ('PIP_1', DATATYPES['PIP_1'], (1, 1), 'CMP'),
           ('PIP_2', DATATYPES['PIP_2'], (0, 1), 'CMP'),
           ('PIP_3', DATATYPES['PIP_3'], (0, 1), 'CMP'),
           ('PIP_4', DATATYPES['PIP_4'], (0, 1), 'CMP'),
           ('PIP_5', DATATYPES['PIP_5'], (0, 1), 'CMP'),),
    'PL': (
           ('PL_1', DATATYPES['PL_1'], (0, 1), 'CMP'),
           ('PL_2', DATATYPES['PL_2'], (0, 1), 'CMP'),
           ('PL_3', DATATYPES['PL_3'], (0, 1), 'CMP'),
           ('PL_4', DATATYPES['PL_4'], (0, 1), 'CMP'),
           ('PL_5', DATATYPES['PL_5'], (0, 1), 'CMP'),
           ('PL_6', DATATYPES['PL_6'], (0, 1), 'CMP'),
           ('PL_7', DATATYPES['PL_7'], (0, 1), 'CMP'),
           ('PL_8', DATATYPES['PL_8'], (0, 1), 'CMP'),
           ('PL_9', DATATYPES['PL_9'], (0, 1), 'CMP'),
           ('PL_10', DATATYPES['PL_10'], (0, 1), 'CMP'),
           ('PL_11', DATATYPES['PL_11'], (0, 1), 'CMP'),),
    'PLN': (
           ('PLN_1', DATATYPES['PLN_1'], (1, 1), 'CMP'),
           ('PLN_2', DATATYPES['PLN_2'], (1, 1), 'CMP'),
           ('PLN_3', DATATYPES['PLN_3'], (0, 1), 'CMP'),
           ('PLN_4', DATATYPES['PLN_4'], (0, 1), 'CMP'),),
    'PPN': (
           ('PPN_1', DATATYPES['PPN_1'], (0, 1), 'CMP'),
           ('PPN_2', DATATYPES['PPN_2'], (0, 1), 'CMP'),
           ('PPN_3', DATATYPES['PPN_3'], (0, 1), 'CMP'),
           ('PPN_4', DATATYPES['PPN_4'], (0, 1), 'CMP'),
           ('PPN_5', DATATYPES['PPN_5'], (0, 1), 'CMP'),
           ('PPN_6', DATATYPES['PPN_6'], (0, 1), 'CMP'),
           ('PPN_7', DATATYPES['PPN_7'], (0, 0), 'CMP'),
           ('PPN_8', DATATYPES['PPN_8'], (0, 1), 'CMP'),
           ('PPN_9', DATATYPES['PPN_9'], (0, 1), 'CMP'),
           ('PPN_10', DATATYPES['PPN_10'], (0, 1), 'CMP'),
           ('PPN_11', DATATYPES['PPN_11'], (0, 1), 'CMP'),
           ('PPN_12', DATATYPES['PPN_12'], (0, 1), 'CMP'),
           ('PPN_13', DATATYPES['PPN_13'], (0, 1), 'CMP'),
           ('PPN_14', DATATYPES['PPN_14'], (0, 1), 'CMP'),
           ('PPN_15', DATATYPES['PPN_15'], (0, 1), 'CMP'),
           ('PPN_16', DATATYPES['PPN_16'], (0, 1), 'CMP'),
           ('PPN_17', DATATYPES['PPN_17'], (0, 1), 'CMP'),
           ('PPN_18', DATATYPES['PPN_18'], (0, 0), 'CMP'),
           ('PPN_19', DATATYPES['PPN_19'], (0, 1), 'CMP'),
           ('PPN_20', DATATYPES['PPN_20'], (0, 1), 'CMP'),
           ('PPN_21', DATATYPES['PPN_21'], (0, 1), 'CMP'),
           ('PPN_22', DATATYPES['PPN_22'], (0, 1), 'CMP'),
           ('PPN_23', DATATYPES['PPN_23'], (0, 1), 'CMP'),
           ('PPN_24', DATATYPES['PPN_24'], (0, 1), 'CMP'),
           ('PPN_25', DATATYPES['PPN_25'], (0, 1), 'CMP'),
           ('PPN_26', DATATYPES['PPN_26'], (0, 1), 'CMP'),),
    'PRL': (
           ('PRL_1', DATATYPES['PRL_1'], (1, 1), 'CMP'),
           ('PRL_2', DATATYPES['PRL_2'], (0, 1), 'CMP'),
           ('PRL_3', DATATYPES['PRL_3'], (0, 1), 'CMP'),),
    'PT': (
           ('PT_1', DATATYPES['PT_1'], (1, 1), 'CMP'),
           ('PT_2', DATATYPES['PT_2'], (0, 1), 'CMP'),),
    'PTA': (
           ('PTA_1', DATATYPES['PTA_1'], (1, 1), 'CMP'),
           ('PTA_2', DATATYPES['PTA_2'], (0, 1), 'CMP'),
           ('PTA_3', DATATYPES['PTA_3'], (0, 0), 'CMP'),
           ('PTA_4', DATATYPES['PTA_4'], (1, 1), 'CMP'),),
    'QIP': (
           ('QIP_1', DATATYPES['QIP_1'], (1, 1), 'CMP'),
           ('QIP_2', DATATYPES['QIP_2'], (1, 1), 'CMP'),),
    'QSC': (
           ('QSC_1', DATATYPES['QSC_1'], (1, 1), 'CMP'),
           ('QSC_2', DATATYPES['QSC_2'], (0, 1), 'CMP'),
           ('QSC_3', DATATYPES['QSC_3'], (0, 1), 'CMP'),
           ('QSC_4', DATATYPES['QSC_4'], (0, 1), 'CMP'),),
    'RCD': (
           ('RCD_1', DATATYPES['RCD_1'], (0, 1), 'CMP'),
           ('RCD_2', DATATYPES['RCD_2'], (0, 1), 'CMP'),
           ('RCD_3', DATATYPES['RCD_3'], (0, 1), 'CMP'),),
    'RFR': (
           ('RFR_1', DATATYPES['RFR_1'], (1, 1), 'CMP'),
           ('RFR_2', DATATYPES['RFR_2'], (0, 1), 'CMP'),
           ('RFR_3', DATATYPES['RFR_3'], (0, 1), 'CMP'),
           ('RFR_4', DATATYPES['RFR_4'], (0, 1), 'CMP'),
           ('RFR_5', DATATYPES['RFR_5'], (0, 1), 'CMP'),
           ('RFR_6', DATATYPES['RFR_6'], (0, 1), 'CMP'),
           ('RFR_7', DATATYPES['RFR_7'], (0, 1), 'CMP'),),
    'RI': (
           ('RI_1', DATATYPES['RI_1'], (0, 1), 'CMP'),
           ('RI_2', DATATYPES['RI_2'], (0, 1), 'CMP'),),
    'RMC': (
           ('RMC_1', DATATYPES['RMC_1'], (1, 1), 'CMP'),
           ('RMC_2', DATATYPES['RMC_2'], (0, 1), 'CMP'),
           ('RMC_3', DATATYPES['RMC_3'], (0, 0), 'CMP'),
           ('RMC_4', DATATYPES['RMC_4'], (1, 1), 'CMP'),),
    'RP': (
           ('RP_1', DATATYPES['RP_1'], (0, 1), 'CMP'),
           ('RP_2', DATATYPES['RP_2'], (0, 1), 'CMP'),
           ('RP_3', DATATYPES['RP_3'], (0, 1), 'CMP'),
           ('RP_4', DATATYPES['RP_4'], (0, 1), 'CMP'),),
    'RPT': (
           ('RPT_1', DATATYPES['RPT_1'], (1, 1), 'CMP'),
           ('RPT_2', DATATYPES['RPT_2'], (0, 1), 'CMP'),
           ('RPT_3', DATATYPES['RPT_3'], (0, 1), 'CMP'),
           ('RPT_4', DATATYPES['RPT_4'], (0, 1), 'CMP'),
           ('RPT_5', DATATYPES['RPT_5'], (0, 1), 'CMP'),
           ('RPT_6', DATATYPES['RPT_6'], (0, 1), 'CMP'),
           ('RPT_7', DATATYPES['RPT_7'], (0, 1), 'CMP'),
           ('RPT_8', DATATYPES['RPT_8'], (0, 1), 'CMP'),
           ('RPT_9', DATATYPES['RPT_9'], (0, 1), 'CMP'),
           ('RPT_10', DATATYPES['RPT_10'], (0, 1), 'CMP'),
           ('RPT_11', DATATYPES['RPT_11'], (0, 1), 'CMP'),),
    'SAD': (
           ('SAD_1', DATATYPES['SAD_1'], (0, 1), 'CMP'),
           ('SAD_2', DATATYPES['SAD_2'], (0, 1), 'CMP'),
           ('SAD_3', DATATYPES['SAD_3'], (0, 1), 'CMP'),),
    'SCV': (
           ('SCV_1', DATATYPES['SCV_1'], (0, 1), 'CMP'),
           ('SCV_2', DATATYPES['SCV_2'], (0, 1), 'CMP'),),
    'SN': (
           ('SN_1', DATATYPES['SN_1'], (0, 1), 'CMP'),
           ('SN_2', DATATYPES['SN_2'], (0, 1), 'CMP'),
           ('SN_3', DATATYPES['SN_3'], (0, 1), 'CMP'),
           ('SN_4', DATATYPES['SN_4'], (0, 1), 'CMP'),),
    'SPD': (
           ('SPD_1', DATATYPES['SPD_1'], (1, 1), 'CMP'),
           ('SPD_2', DATATYPES['SPD_2'], (0, 1), 'CMP'),
           ('SPD_3', DATATYPES['SPD_3'], (0, 1), 'CMP'),
           ('SPD_4', DATATYPES['SPD_4'], (0, 1), 'CMP'),),
    'SRT': (
           ('SRT_1', DATATYPES['SRT_1'], (1, 1), 'CMP'),
           ('SRT_2', DATATYPES['SRT_2'], (0, 1), 'CMP'),),
    'UVC': (
           ('UVC_1', DATATYPES['UVC_1'], (1, 1), 'CMP'),
           ('UVC_2', DATATYPES['UVC_2'], (0, 1), 'CMP'),
           ('UVC_3', DATATYPES['UVC_3'], (0, 1), 'CMP'),
           ('UVC_4', DATATYPES['UVC_4'], (0, 1), 'CMP'),),
    'VH': (
           ('VH_1', DATATYPES['VH_1'], (0, 1), 'CMP'),
           ('VH_2', DATATYPES['VH_2'], (0, 1), 'CMP'),
           ('VH_3', DATATYPES['VH_3'], (0, 1), 'CMP'),
           ('VH_4', DATATYPES['VH_4'], (0, 1), 'CMP'),),
    'VID': (
           ('VID_1', DATATYPES['VID_1'], (1, 1), 'CMP'),
           ('VID_2', DATATYPES['VID_2'], (0, 1), 'CMP'),
           ('VID_3', DATATYPES['VID_3'], (0, 1), 'CMP'),),
    'VR': (
           ('VR_1', DATATYPES['VR_1'], (0, 1), 'CMP'),
           ('VR_2', DATATYPES['VR_2'], (0, 1), 'CMP'),),
    'WVI': (
           ('WVI_1', DATATYPES['WVI_1'], (1, 1), 'CMP'),
           ('WVI_2', DATATYPES['WVI_2'], (0, 1), 'CMP'),),
    'WVS': (
           ('WVS_1', DATATYPES['WVS_1'], (1, 1), 'CMP'),
           ('WVS_2', DATATYPES['WVS_2'], (0, 1), 'CMP'),),
    'XAD': (
           ('XAD_1', DATATYPES['XAD_1'], (0, 1), 'CMP'),
           ('XAD_2', DATATYPES['XAD_2'], (0, 1), 'CMP'),
           ('XAD_3', DATATYPES['XAD_3'], (0, 1), 'CMP'),
           ('XAD_4', DATATYPES['XAD_4'], (0, 1), 'CMP'),
           ('XAD_5', DATATYPES['XAD_5'], (0, 1), 'CMP'),
           ('XAD_6', DATATYPES['XAD_6'], (0, 1), 'CMP'),
           ('XAD_7', DATATYPES['XAD_7'], (0, 1), 'CMP'),
           ('XAD_8', DATATYPES['XAD_8'], (0, 1), 'CMP'),
           ('XAD_9', DATATYPES['XAD_9'], (0, 1), 'CMP'),
           ('XAD_10', DATATYPES['XAD_10'], (0, 1), 'CMP'),
           ('XAD_11', DATATYPES['XAD_11'], (0, 1), 'CMP'),
           ('XAD_12', DATATYPES['XAD_12'], (0, 0), 'CMP'),
           ('XAD_13', DATATYPES['XAD_13'], (0, 1), 'CMP'),
           ('XAD_14', DATATYPES['XAD_14'], (0, 1), 'CMP'),
           ('XAD_15', DATATYPES['XAD_15'], (0, 1), 'CMP'),
           ('XAD_16', DATATYPES['XAD_16'], (0, 1), 'CMP'),
           ('XAD_17', DATATYPES['XAD_17'], (0, 1), 'CMP'),
           ('XAD_18', DATATYPES['XAD_18'], (0, 1), 'CMP'),
           ('XAD_19', DATATYPES['XAD_19'], (0, 1), 'CMP'),
           ('XAD_20', DATATYPES['XAD_20'], (0, 1), 'CMP'),
           ('XAD_21', DATATYPES['XAD_21'], (0, 1), 'CMP'),
           ('XAD_22', DATATYPES['XAD_22'], (0, 1), 'CMP'),
           ('XAD_23', DATATYPES['XAD_23'], (0, 1), 'CMP'),),
    'XCN': (
           ('XCN_1', DATATYPES['XCN_1'], (0, 1), 'CMP'),
           ('XCN_2', DATATYPES['XCN_2'], (0, 1), 'CMP'),
           ('XCN_3', DATATYPES['XCN_3'], (0, 1), 'CMP'),
           ('XCN_4', DATATYPES['XCN_4'], (0, 1), 'CMP'),
           ('XCN_5', DATATYPES['XCN_5'], (0, 1), 'CMP'),
           ('XCN_6', DATATYPES['XCN_6'], (0, 1), 'CMP'),
           ('XCN_7', DATATYPES['XCN_7'], (0, 0), 'CMP'),
           ('XCN_8', DATATYPES['XCN_8'], (0, 1), 'CMP'),
           ('XCN_9', DATATYPES['XCN_9'], (0, 1), 'CMP'),
           ('XCN_10', DATATYPES['XCN_10'], (0, 1), 'CMP'),
           ('XCN_11', DATATYPES['XCN_11'], (0, 1), 'CMP'),
           ('XCN_12', DATATYPES['XCN_12'], (0, 1), 'CMP'),
           ('XCN_13', DATATYPES['XCN_13'], (0, 1), 'CMP'),
           ('XCN_14', DATATYPES['XCN_14'], (0, 1), 'CMP'),
           ('XCN_15', DATATYPES['XCN_15'], (0, 1), 'CMP'),
           ('XCN_16', DATATYPES['XCN_16'], (0, 1), 'CMP'),
           ('XCN_17', DATATYPES['XCN_17'], (0, 0), 'CMP'),
           ('XCN_18', DATATYPES['XCN_18'], (0, 1), 'CMP'),
           ('XCN_19', DATATYPES['XCN_19'], (0, 1), 'CMP'),
           ('XCN_20', DATATYPES['XCN_20'], (0, 1), 'CMP'),
           ('XCN_21', DATATYPES['XCN_21'], (0, 1), 'CMP'),
           ('XCN_22', DATATYPES['XCN_22'], (0, 1), 'CMP'),
           ('XCN_23', DATATYPES['XCN_23'], (0, 1), 'CMP'),
           ('XCN_24', DATATYPES['XCN_24'], (0, 1), 'CMP'),
           ('XCN_25', DATATYPES['XCN_25'], (0, 1), 'CMP'),),
    'XON': (
           ('XON_1', DATATYPES['XON_1'], (0, 1), 'CMP'),
           ('XON_2', DATATYPES['XON_2'], (0, 1), 'CMP'),
           ('XON_3', DATATYPES['XON_3'], (0, 0), 'CMP'),
           ('XON_4', DATATYPES['XON_4'], (0, 1), 'CMP'),
           ('XON_5', DATATYPES['XON_5'], (0, 1), 'CMP'),
           ('XON_6', DATATYPES['XON_6'], (0, 1), 'CMP'),
           ('XON_7', DATATYPES['XON_7'], (0, 1), 'CMP'),
           ('XON_8', DATATYPES['XON_8'], (0, 1), 'CMP'),
           ('XON_9', DATATYPES['XON_9'], (0, 1), 'CMP'),
           ('XON_10', DATATYPES['XON_10'], (0, 1), 'CMP'),),
    'XPN': (
           ('XPN_1', DATATYPES['XPN_1'], (0, 1), 'CMP'),
           ('XPN_2', DATATYPES['XPN_2'], (0, 1), 'CMP'),
           ('XPN_3', DATATYPES['XPN_3'], (0, 1), 'CMP'),
           ('XPN_4', DATATYPES['XPN_4'], (0, 1), 'CMP'),
           ('XPN_5', DATATYPES['XPN_5'], (0, 1), 'CMP'),
           ('XPN_6', DATATYPES['XPN_6'], (0, 0), 'CMP'),
           ('XPN_7', DATATYPES['XPN_7'], (0, 1), 'CMP'),
           ('XPN_8', DATATYPES['XPN_8'], (0, 1), 'CMP'),
           ('XPN_9', DATATYPES['XPN_9'], (0, 1), 'CMP'),
           ('XPN_10', DATATYPES['XPN_10'], (0, 0), 'CMP'),
           ('XPN_11', DATATYPES['XPN_11'], (0, 1), 'CMP'),
           ('XPN_12', DATATYPES['XPN_12'], (0, 1), 'CMP'),
           ('XPN_13', DATATYPES['XPN_13'], (0, 1), 'CMP'),
           ('XPN_14', DATATYPES['XPN_14'], (0, 1), 'CMP'),
           ('XPN_15', DATATYPES['XPN_15'], (0, 1), 'CMP'),),
    'XTN': (
           ('XTN_1', DATATYPES['XTN_1'], (0, 0), 'CMP'),
           ('XTN_2', DATATYPES['XTN_2'], (0, 1), 'CMP'),
           ('XTN_3', DATATYPES['XTN_3'], (1, 1), 'CMP'),
           ('XTN_4', DATATYPES['XTN_4'], (0, 1), 'CMP'),
           ('XTN_5', DATATYPES['XTN_5'], (0, 1), 'CMP'),
           ('XTN_6', DATATYPES['XTN_6'], (0, 1), 'CMP'),
           ('XTN_7', DATATYPES['XTN_7'], (0, 1), 'CMP'),
           ('XTN_8', DATATYPES['XTN_8'], (0, 1), 'CMP'),
           ('XTN_9', DATATYPES['XTN_9'], (0, 1), 'CMP'),
           ('XTN_10', DATATYPES['XTN_10'], (0, 1), 'CMP'),
           ('XTN_11', DATATYPES['XTN_11'], (0, 1), 'CMP'),
           ('XTN_12', DATATYPES['XTN_12'], (0, 1), 'CMP'),
           ('XTN_13', DATATYPES['XTN_13'], (0, 1), 'CMP'),
           ('XTN_14', DATATYPES['XTN_14'], (0, 1), 'CMP'),
           ('XTN_15', DATATYPES['XTN_15'], (0, 1), 'CMP'),
           ('XTN_16', DATATYPES['XTN_16'], (0, 1), 'CMP'),
           ('XTN_17', DATATYPES['XTN_17'], (0, 1), 'CMP'),
           ('XTN_18', DATATYPES['XTN_18'], (0, 1), 'CMP'),),
}

for k, v in iteritems(DATATYPES):
    if v[0] == 'sequence':
        v[1] = DATATYPES_STRUCTS[v[2]]
