Configuring Chain Cleansing

The purpose of defining a chain section is to gain the best cleansed result. The chain section of cleanseConfig specifies a list of cleanse functions that are applied one by one in a chain.

When we need to validate addresses from more than one country. Of which, one country is the USA and its address is verified by CASS, the entity type used is Location.

In such cases, our configuration includes the following details:

  • Tenant configuration ("process": "c+g")
  • Meta-configuration (chain with a few links)
  • Meta-configuration ("params" for a link)
  • Meta-configuration ("mandatory": true at outputMapping)

The following steps explain chain cleansing:

  1. In this configuration, "process": "c+g" defines CASS cleansing. All addresses are cleansed by CASS (USA or non-USA).
  2. Rewrite the "options" parameters of the tenant configuration by setting them at the meta-configuration level as shown below.
    {
                    "uri": "configuration/entityTypes/Location/cleanse/infos/other",
                    "useInCleansing": true,
                    "sequence": [
                    {
                    "chain": [
                    {
                    "cleanseFunction": "Loqate",
                    "resultingValuesSourceTypeUri": "configuration/sources/ReltioCleanser",
                    "proceedOnSuccess": false,
                    "proceedOnFailure": true,
                    "params": {
                    "process": "v+g"
                    },
                    "mapping": {
                    "inputMapping": [
                    ...
  3. Then, specify a few links in the chain.
    "infos": [
                            {
                            "uri": "configuration/entityTypes/Location/cleanse/infos/other",
                            "useInCleansing": true,
                            "sequence": [
                            {
                            "chain": [
                            {
                            "cleanseFunction": "Loqate",
                            "resultingValuesSourceTypeUri": "configuration/sources/ReltioCleanser",
                            "proceedOnSuccess": false,
                            "proceedOnFailure": true,
                            "mapping": {
                            ...
                            }
                            },
                            {
                            "cleanseFunction": "Loqate",
                            "resultingValuesSourceTypeUri": "configuration/sources/ReltioCleanser",
                            "proceedOnSuccess": false,
                            "proceedOnFailure": true,
                            "mapping": {
                            ...
                            }
                            }
                            ]
                            }
                            ]
                            }
                            ]
  4. Now, set a chain with rewriting options for the address cleansing function (called loqate in the configuration).
    "infos": [
                                    {
                                    "uri": "configuration/entityTypes/Location/cleanse/infos/other",
                                    "useInCleansing": true,
                                    "sequence": [
                                    {
                                    "chain": [
                                    {
                                    "cleanseFunction": "Loqate",
                                    "resultingValuesSourceTypeUri": "configuration/sources/ReltioCleanser",
                                    "proceedOnSuccess": false,
                                    "proceedOnFailure": true,
                                    "params": {
                                    "process": "c+g"
                                    },
                                    "mapping": {
                                    ...
                                    }
                                    },
                                    {
                                    "cleanseFunction": "Loqate",
                                    "resultingValuesSourceTypeUri": "configuration/sources/ReltioCleanser",
                                    "proceedOnSuccess": false,
                                    "proceedOnFailure": true,
                                    "params": {
                                    "process": "v+g"
                                    },
                                    "mapping": {
                                    ...
                                    }
                                    }
                                    ]
                                    }
                                    ]
                                    }
                                    ]
  5. Next, configure "proceedOnSuccess" and "proceedOnFailure" for the first link.
    1. Set "process": "c+g" for the first link to cleanse the address by CASS (it can be a USA address).
    2. If CASS cleansing fails, then cleanse this address in a standard way using "process": "v+g" (second link in the chain). According to this logic, we must set the following values for the first chain:
      • "proceedOnSuccess": false
      • "proceedOnFailure": true
  6. This is not enough when cleansing a non-US address by CASS. The body and sample are as given below:

    Request:

    POST {{cleanse_uri}}/?p=c+g&lqtkey={{lqtkey}}&opts=DefaultCountry%3DUS&ctry=US

    Body:

    [
                                            {
                                            "pcde": "K2M 2T5",
                                            "ctry": "Canada",
                                            "admn": "ON",
                                            "add1": "48 Glenrill Pl",
                                            "lcty": "Kanata"
                                            }
                                            ]

    Response:

    [
                                                {
                                                "results": [
                                                {
                                                "AdministrativeArea": "ON",
                                                "GeoAccuracy": "A2",
                                                "Locality": "Kanata",
                                                "GeoDistance": "19267.2",
                                                "PostalCode": "K2M 2T5",
                                                "Latitude": "45.294972",
                                                "Address1": "48 Glenrill Pl",
                                                "Longitude": "-75.900250"
                                                }
                                                ],
                                                "status": "OK"
                                                }
                                                ]
Note: Without Address Verification Code (AVC), the response is not appropriate. To avoid getting failed cleansed results, set a few mandatory fields in the output mapping.
"cleanseConfig": {
            "mappings": [
            {
            "uri": "configuration/entityTypes/Location/cleanse/mappings/address",
            "outputMapping": [
            {
            "attribute": "configuration/entityTypes/Location/attributes/AVC",
            "mandatory": true,
            "allValues": false,
            "cleanseAttribute": "AVC"
            },

After performing the above sequence of steps, we have the following details:

  • Default tenant configuration with "process": "c+g".
  • Meta-configuration where Location has cleanseConfig: outputMapping with a few mandatory attributes. This includes chain of two Loqate links, where the first link has options "c+g" and the second link has "v+g".

For the AddressInput attribute we have the section, "configuration/entityTypes/Location/cleanse/infos/default" that must be configured. However, as per the requirements of input fields for CASS, the configuration must have one link:

"infos": [
            {
            "uri": "configuration/entityTypes/Location/cleanse/infos/default",
            "useInCleansing": true,
            "sequence": [
            {
            "chain": [
            {
            "cleanseFunction": "Loqate",
            "resultingValuesSourceTypeUri": "configuration/sources/ReltioCleanser",
            "proceedOnSuccess": true,
            "proceedOnFailure": false,
            "params": {
            "process": "v+g"
            },
            "mapping": {
Note: If you have used CASS cleansing and are trying to cleanse a non-USA address, then with the above configuration, two requests are sent to the system instead of one request. However, this behavior is expected in case of standard cleanse only.