Difference between revisions of "Data source/PEPPOL/data model/businessEntity/entity/id/5/value/mapping/CDQ/transformation"
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 = | + | | transformation type = CUSTOM_TRANSFORMATION |
− | | transformation code = identifier_types = { | + | | transformation code = import re |
+ | |||
+ | identifier_types = { | ||
"0002": "FR_SIREN", | "0002": "FR_SIREN", | ||
"0007": "SE_ORG_ID", | "0007": "SE_ORG_ID", | ||
Line 59: | Line 61: | ||
"9951": "SM_COE", | "9951": "SM_COE", | ||
"9952": "TR_TAX_ID", | "9952": "TR_TAX_ID", | ||
+ | "9956": "BE_ENT_NO", | ||
"9957": "EU_VAT_ID_FR", | "9957": "EU_VAT_ID_FR", | ||
− | "9959": "US_EMPL_ID", | + | "9959": "US_EMPL_ID" |
+ | } | ||
+ | |||
+ | def transform(input_data): | ||
+ | result = {} | ||
+ | |||
+ | id_type, id_value = input_data.split(":", 1) | ||
+ | |||
+ | if id_type == "0195": | ||
+ | if id_value.startswith("usuid"): | ||
+ | id_type_name = "US_EMPL_ID" | ||
+ | elif id_value.startswith("sguen"): | ||
+ | id_type_name = "SG_UEN" | ||
+ | else: | ||
+ | id_type_name = "SG_UEN" | ||
+ | |||
+ | id_value = re.sub(r"^(sguen|usuid)", "", id_value) | ||
+ | |||
+ | elif id_type == "0002" and len(id_value) > 10: | ||
+ | id_type_name = "FR_SIRET" | ||
+ | elif id_type == "0184": | ||
+ | id_value = id_value.replace("dk", "") | ||
+ | id_type_name = "CVK_DK" | ||
+ | else: | ||
+ | id_type_name = identifier_types.get(id_type) | ||
+ | |||
+ | if id_type_name: | ||
+ | result["identifiers[4].value"] = id_value | ||
+ | result["identifiers[4].type.technicalKey"] = id_type_name | ||
− | + | return result | |
− | + | | id_value = raw_data.split(':') | |
− | |||
id_type_name = identifier_types[id_type] | id_type_name = identifier_types[id_type] | ||
Line 81: | Line 111: | ||
"businessPartner.identifiers[4].value": id_value, | "businessPartner.identifiers[4].value": id_value, | ||
"businessPartner.identifiers[4].type": id_type_name | "businessPartner.identifiers[4].type": id_type_name | ||
− | |||
− | |||
− | |||
− | |||
| sources = Data source/PEPPOL/data model/businessEntity/entity/id/5/value/mapping/CDQ | | sources = Data source/PEPPOL/data model/businessEntity/entity/id/5/value/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 participant_value ↣ IDENTIFIER_VALUE , IDENTIFIER_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.
import re
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",
"9956": "BE_ENT_NO",
"9957": "EU_VAT_ID_FR",
"9959": "US_EMPL_ID"
}
def transform(input_data):
result = {}
id_type, id_value = input_data.split(":", 1)
if id_type == "0195":
if id_value.startswith("usuid"):
id_type_name = "US_EMPL_ID"
elif id_value.startswith("sguen"):
id_type_name = "SG_UEN"
else:
id_type_name = "SG_UEN"
id_value = re.sub(r"^(sguen
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",
"9956": "BE_ENT_NO",
"9957": "EU_VAT_ID_FR",
"9959": "US_EMPL_ID"
}
def transform(input_data):
result = {}
id_type, id_value = input_data.split(":", 1)
if id_type == "0195":
if id_value.startswith("usuid"):
id_type_name = "US_EMPL_ID"
elif id_value.startswith("sguen"):
id_type_name = "SG_UEN"
else:
id_type_name = "SG_UEN"
id_value = re.sub(r"^(sguen