Data source/PEPPOL/data model/businessEntity/entity/id/5/value/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 participant_valueidentifierValue, IDENTIFIER_TYPE
Transformation type A type of a transformation applied to a data model mapping. CUSTOM
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.

identifier_types = {
    "0002": "FR_SIREN",
    "0007": "SE_ORG_ID",
    "0009": "FR_SIRET",
    "0037": "BIC_FI",
    "0060": "DUNS_ID",
    "0088": "GS1_GLN",
    "0096": "CVR_DK",
    "0106": "KVK_NL",
    "0151": "ABN_AU",
    "0183": "CH_UID",
    "0184": "CVR_DK",
    "0188": "CN_JP",
    "0191": "EE_BRN",
    "0192": "NO_ORGID",
    "0195": "SG_UEN",
    "0196": "IS_IIN",
    "0198": "CVR_DK",
    "0200": "LT_BRN",
    "0208": "BE_ENT_NO",
    "0210": "IT_FISC_ID",
    "0211": "IT_VAT_ID",
    "0212": "BIC_FI",
    "0213": "EU_VAT_ID_FI",
    "0221": "JP_JCT",
    "0230": "MY_BRN",
    "9910": "EU_VAT_ID_HU",
    "9914": "EU_VAT_ID_AT",
    "9915": "EU_VAT_ID_AT",
    "9919": "BR_ID_AT",
    "9920": "EU_VAT_ID_ES",
    "9923": "AL_TRN",
    "9924": "BA_TRN",
    "9925": "EU_VAT_ID_BE",
    "9926": "EU_VAT_ID_BG",
    "9927": "CH_VAT_ID",
    "9928": "EU_VAT_ID_CY",
    "9929": "EU_VAT_ID_CZ",
    "9930": "EU_VAT_ID_DE",
    "9931": "EU_VAT_ID_EE",
    "9932": "ID_VAT_UK",
    "9933": "EU_VAT_ID_EL",
    "9934": "EU_VAT_ID_HR",
    "9935": "EU_VAT_ID_IE",
    "9937": "EU_VAT_ID_LT",
    "9938": "EU_VAT_ID_LU",
    "9939": "EU_VAT_ID_LV",
    "9943": "EU_VAT_ID_MT",
    "9944": "EU_VAT_ID_NL",
    "9945": "EU_VAT_ID_PL",
    "9946": "EU_VAT_ID_PT",
    "9947": "EU_VAT_ID_RO",
    "9948": "RS_PIB",
    "9949": "EU_VAT_ID_SI",
    "9950": "EU_VAT_ID_SK",
    "9951": "SM_COE",
    "9952": "TR_TAX_ID",
    "9957": "EU_VAT_ID_FR",
    "9959": "US_EMPL_ID",

}

def transform(raw_data):
    id_type, id_value = raw_data.split(':')

    id_type_name = identifier_types[id_type]

    if id_type == "0002" and len(id_value) > 10:
        id_type_name = "FR_SIRET"

    if id_type == "0195":
        id_value = id_value.replace("sguen", "")

    if id_type == "0184":
        id_value = id_value.replace("dk", "")

    result = {
        "businessPartner.identifiers[4].value": id_value,
        "businessPartner.identifiers[4].type": id_type_name

    }

    return result