Data source/US-CO.BER/data model/entity/mailingstate/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/US-CO.BE
Mapping source The source of a data model mapping. US-CO.BER mailingcountry, mailingstateADMINISTRATIVE_AREA_SHORT_NAME, ADMINISTRATIVE_AREA_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.

def transform(raw_data):
    names = [elem.strip() for elem in raw_data.split(';')]
    result = {}
    if names[0] == "US":
        result.update({ "address.administrativeAreas[0].shortName": names[1], "address.administrativeAreas[0].type": "REGION" })
    else:
        result.update({"address.administrativeAreas[0].shortName": "", "address.administrativeAreas[0].type": ""})

    return result