Data source/PEPPOL/data model/businessEntity/entity/id/1/scheme/mapping/CDQ/transformation

From CDQ
Jump to navigation Jump to search


Part of Hierarchical relation between two concepts of the CDQ Data Model. Data source PEPPOL
Mapping source The source of a data model mapping. PEPPOL entity_id_1_scheme, entity_countrycodeIDENTIFIER_TYPE
Transformation type A type of a transformation applied to a data model mapping. CUSTOM_TRANSFORMATION"CUSTOM_TRANSFORMATION" is not in the list (UPPER_CASE, LOWER_CASE, CUSTOM) of allowed values for the "Has transformation type" property.
Transformation parameter A transformation parameter is an action proccessed by a data model transformation. n/a
Description Informal and comprehensive human-readable definition of a concept. n/a

Transformation code Any code (in Python, JAVA or other) that will transform values for a given data source attributes.

def transform(raw_data):
    names = [elem.upper().strip() for elem in raw_data.split(';')]
    if names[0] == 'CBE':
        result = names[1] + '_ENT_NO'
    elif names[0] == 'KVK':
        result = 'KVK_NL'
    elif names[0] == 'GLN':
        result = 'GS1_GLN'
    elif names[0] == 'CVR':
        result = 'CVR_DK'
    elif names[0] == 'EN':
        result = names[1] + '_ENT_NO'
    elif names[0] == 'ORG':
        result = names[1] + '_ORG_ID'
    elif names[0] == 'SIRENE':
        result = 'FR_SIREN'
    elif names[0] == 'SIRET':
        result = 'FR_SIRET'
    elif names[0] == '0007' and names[1]=='SE':
        result = 'SE_ORG_ID'
    elif names[0] == 'ORGNR' and names[1]=='SE':
        result = 'SE_ORG_ID'
    elif names[0] == 'ORGNR' and names[1]=='NO':
        result = 'NO_ORGID'
    elif names[0] == 'ORGNR' and names[1]=='FI':
        result = 'BIC_FI'
    elif names[0] == 'ORGNR' and names[1]=='UK':
        result = 'ID_CRN'
    elif names[0] == 'ORGNR' and names[1]=='DK':
        result = 'CVR_DK'
    elif names[0] == 'VAT' and names[1]=='NO':
        result = 'VAT_ID_NO'
    elif names[0] == 'VAT':
        result = 'EU_VAT_ID_' + names[1]
    else:
        result = names[0]
    return result