Difference between revisions of "Data source/PEPPOL/data model/businessEntity/entity/id/3/scheme/mapping/CDQ/transformation"

From CDQ
Jump to navigation Jump to search
(Template parameters updated.)
 
(Template parameters updated.)
 
Line 1: Line 1:
 
{{Data model transformation
 
{{Data model transformation
 
  | data source = Data source/PEPPOL
 
  | data source = Data source/PEPPOL
  | transformation type = CUSTOM
+
  | transformation type = CUSTOM_TRANSFORMATION
 
  | transformation code = def transform(raw_data):
 
  | transformation code = def transform(raw_data):
     names = raw_data.split(";")
+
     names = [elem.upper().strip() for elem in raw_data.split(';')]
     if str.upper(names[0]) == 'VAT':
+
     if names[0] == 'CBE':
         return 'EU_VAT_ID_' + names[1].lstrip()
+
        result = names[1] + '_ENT_NO'
     elif str.upper(names[0]) == 'CBE':
+
    elif names[0] == 'KVK':
         return names[1].lstrip() + '_ENT_NO'
+
        result = 'KVK_NL'
     elif str.upper(names[0]) == 'KVK':
+
    elif names[0] == 'GLN':
         return 'KVK_NL'
+
        result = 'GS1_GLN'
     elif str.upper(names[0]) == 'ORGNR':
+
    elif names[0] == 'CVR':
         return 'CVR_DK'
+
         result = 'CVR_DK'
     elif str.upper(names[0]) == 'GLN':
+
    elif names[0] == 'EN':
         return 'GS1_GLN'
+
        result = names[1] + '_ENT_NO'
     elif str.upper(names[0]) == 'CVR':
+
     elif names[0] == 'ORG':
         return 'CVR_DK'
+
         result = names[1] + '_ORG_ID'
     elif str.upper(names[0]) == 'EN':
+
     elif names[0] == 'SIRENE':
         return names[1].lstrip() + '_ENT_NO'
+
         result = 'FR_SIREN'
     elif str.upper(names[0]) == 'ORG':
+
     elif names[0] == 'SIRET':
         return names[1].lstrip() + '_ORG_ID'
+
         result = 'FR_SIRET'
     elif str.upper(names[0]) == 'SIRENE':
+
     elif names[0] == '0007' and names[1]=='SE':
         return 'FR_SIREN'
+
         result = 'SE_ORG_ID'
     elif str.upper(names[0]) == 'SIRET':
+
     elif names[0] == 'ORGNR' and names[1]=='SE':
         return 'FR_SIRET'
+
         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:
 
     else:
         return names[0]
+
         result = names[0]
 +
    return result
 +
 
 
  | sources = Data source/PEPPOL/data model/businessEntity/entity/id/3/scheme/mapping/CDQ
 
  | sources = Data source/PEPPOL/data model/businessEntity/entity/id/3/scheme/mapping/CDQ
 
}}
 
}}

Latest revision as of 10:30, 16 May 2025


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_3_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