Reltio Connect

 View Only
  • 1.  Building Custom Cleanser

    Posted 05-10-2021 14:12
    Hi Fellow Developers,

    We have a requirement for building a Custom Cleanse Function which Reltio Documentation gives directions to but do not provide lot of details to start with.
    Could any one please help if they have such requirement earlier and build the one for their project?

    ------------------------------
    Nipun Fnu
    BCBSNC
    ------------------------------


  • 2.  RE: Building Custom Cleanser

    Reltio Employee
    Posted 05-12-2021 08:17
    @Nipun Fnu, I haven't forgotten about this. I am looking for a reply now.

    Chris ​

    ------------------------------
    Chris Detzel
    Community Program Manager
    Reltio
    ------------------------------



  • 3.  RE: Building Custom Cleanser
    Best Answer

    Reltio Employee
    Posted 05-12-2021 13:54
    Hi Nipun,

    You should start with the sample cleanser.  That will be a simple example of what a java project will look like.  From there you can update it to do what you'd like.

    There are a couple of things you need to do:

    1.) Download Sample code:  Bitbucket
    Bitbucket remove preview
    Bitbucket
    View this on Bitbucket >
     
    2.) Get your code certified.  It will need to be reviewed by engineering to ensure you're following best practices.  Open a support ticket once you are ready and finished with coding.

    3.) Once certified the JAR will be placed in S3.  Register the JAR file to the tenant using this API:
    PUT {{applicationURL}}/reltio/tenants/{{tenantID}}/cleanse
    Body:
    [
    {
    "cleanseFunction": "CustomTestNameCleanser",
    "type": "com.customername.cleanse.example.CleanseFunctionExample",
    "module": "reltio.modules/cleanse/test/custom-name-cleanser-1.0.1.jar"
    }
    ]

    4.) Implement cleanser in L3 config, just like you would with any of the OOTB cleansers.  Be sure to reference in your input mapping the cleanse function that you defined in step 3.  This refers to the "cleanseFunction" object within the infos section.  You'll need to map your L3 data model to the cleanser.  Your firstname attribute must be mapped to the cleanser via 'fn', and lastname via 'ln'.  The output will go to the 'result' cleanser output, so this must be mapped to something in your data model.
    {
    "cleanseConfig": {
    "mappings": [
    {
    "uri": "configuration/entityTypes/person/cleanse/mappings/name",
    "outputMapping": [
    {
    "attribute": "configuration/entityTypes/person/attributes/result",
    "mandatory": false,
    "allValues": false,
    "cleanseAttribute": "result"
    }
    ]
    }
    ],
    "infos": [
    {
    "uri": "configuration/entityTypes/person/cleanse/infos/NameCleanserFn",
    "useInCleansing": true,
    "sequence": [
    {
    "chain": [
    {
    "cleanseFunction": "CustomTestNameCleanser",
    "resultingValuesSourceTypeUri": "configuration/sources/ReltioCleanser",
    "proceedOnSuccess": true,
    "proceedOnFailure": false,
    "mapping": {
    "inputMapping": [
    {
    "attribute": "configuration/entityTypes/person/attributes/givenName/attributes/givenName1",
    "mandatory": false,
    "allValues": false,
    "cleanseAttribute": "fn"
    },
    {
    "attribute": "configuration/entityTypes/person/attributes/givenName/attributes/surName1",
    "mandatory": false,
    "allValues": false,
    "cleanseAttribute": "ln"
    }
    ],
    "outputMappingRef": "configuration/entityTypes/person/cleanse/mappings/name/outputMapping"
    }
    }
    ]
    }
    ],
    "nestedAttributeToCleanse": "configuration/entityTypes/person/attributes/givenName"
    }
    ]
    }
    }


    Keep me posted on your progress.

    Thanks,
    Chris

    ------------------------------
    Christopher Jezorek
    ------------------------------



  • 4.  RE: Building Custom Cleanser

    Posted 06-04-2021 02:58
    Thanks for the sharing the details but when I am trying to register the jar to my Dev tenant using the endpoint provide I am getting the error. Details are as below:

    API Used:
    PUT {{serviceURL}}/reltio/tenants/{{tenant}}/cleanse

    where
    {{serviceURL}} =https://dev-h360.reltio.com/reltio
    {{tenant}}= jAGVdhr5d7UQEDR

    Body:
    [
    {
    "cleanseFunction": "CustomNameCleanser",
    "type": "com.customername.cleanse.example.CleanseFunctionExample",
    "module": "reltio.modules/cleanse/BlueCrossBlueShield/sample-cleans-function-1.0.jar"
    }
    ]

    Response:
    <!doctype html><html lang="en"><head><title>HTTP Status 405 – Method Not Allowed</title><style type="text/css">body {font-family:Tahoma,Arial,sans-serif;} h1, h2, h3, b {color:white;background-color:#525D76;} h1 {font-size:22px;} h2 {font-size:16px;} h3 {font-size:14px;} p {font-size:12px;} a {color:black;} .line {height:1px;background-color:#525D76;border:none;}</style></head><body><h1>HTTP Status 405 – Method Not Allowed</h1></body></html>


    I am not sure if this is right platform to discuss the errors but any direction will be really appreciated.




    ------------------------------
    Nipun Fnu
    BCBSNC
    ------------------------------



  • 5.  RE: Building Custom Cleanser

    Reltio Employee
    Posted 06-04-2021 10:39
    @Christopher Jezorek any additional thoughts on this? ​

    ------------------------------
    Chris Detzel
    Community Program Manager
    Reltio
    ------------------------------



  • 6.  RE: Building Custom Cleanser

    Reltio Employee
    Posted 06-04-2021 11:02
    Url is formed incorrectly here 

     {{serviceURL}}/reltio/tenants/{{tenant}}/cleanse

    where
    {{serviceURL}} =https://dev-h360.reltio.com/reltio
    https://dev-h360.reltio.com/reltio/reltio/tenants/{{tenant}}/cleanse


    Customer needs to remove extra "reltio" in the path like above
    also, the Cleanser jar needs to be reviewed with the Internal team so that the Internal team will revert to the uploaded jar file path

    ------------------------------
    Shivaputrappa Patil
    ------------------------------



  • 7.  RE: Building Custom Cleanser

    Founding Member
    Posted 06-27-2023 13:30

    Is there a way to test the cleanser before deploying into Reltio ? 

    Should we provide the source code or the compiled jar for Reltio to get certification ?



    ------------------------------
    Gowthamprabhu Sivaraj
    AstraZeneca
    ------------------------------



  • 8.  RE: Building Custom Cleanser

    Posted 12-27-2023 15:44

    was there any reply on this?

    Is there a way to test the custom cleanser before deploying into Reltio ? 



    ------------------------------
    Abhimanyu Kumar
    GSK
    Cary NC
    ------------------------------



  • 9.  RE: Building Custom Cleanser

    Reltio Employee
    Posted 01-02-2024 12:38

    You can test the cleanser by writing JUnit test cases.  The sample cleanser project on bitbucket that is referenced in this post has a JUnit test pre-written, so you can understand what it all looks like. You'd be altering this code for your own test cases. Running this will execute your cleanser code, so you'll know if it works or not before deploying.

    See the below code for a sample example:

    @Test
    public void test1() throws CleanseException {
    CleanseInputs input = new CleanseInputs("entities/hjh6ut1");
    input.addCleanseAttribute("fn", "John");
    input.addCleanseAttribute("ln", "Taylor");

    List<CleanseOutputs> outputList =
    function.cleanseValues(Arrays.asList(input), Collections.emptyMap(), Collections.emptyMap());

    String fullName = (String) outputList.get(0).getCleansedAttributes().get("result").get(0);
    Assert.assertEquals("John Taylor", fullName);
    }

    ------------------------------
    Christopher Jezorek
    ------------------------------