4.2.1 Customize Notebook Template

An admin user can refer to the Investigation Toolkit notebook template with source code to understand and customize the output of each paragraph.

The Investigation Toolkit notebook template (with source code) has complete java code in the "Entity Summary Risk Report" paragraph of the ECM Case Narrative notebook template or "Click to Start Investigation" paragraph in the ECM Integration L1 or Special Investigation notebook template. The code has multiple java classes for different entities. An admin user can go through the code to understand the implementation of each paragraph. The changes may be simple or complex based on the nature of customization. In this section, we will discuss a few common customizations.

An admin user who wants to customize the notebook template should have experience with the following:
  • Java
  • SQL
  • PGQL (required for graph-based analysis)
If customizations are complex, we recommend to setup IDE and then do the customization. For more information, see the Setup an Integrated Development Environment section.

Customize Entity Summary Risk Report (Narrative)

Entity Summary Risk Report is also referred to as Narrative and is generated in two step process. We collect all the information first and then generate the narrative. This section discusses the following scenarios:

Customer Transaction Summary should show transaction type wise distribution

In this example, in the pre-configured narrative, you want to see the transaction type wise count for each account-wise Customer's transaction summary.

To update the pre-configured Investigation Toolkit notebook template, enable the flag to show transaction breakup in the SummaryGenerator#getAcctWiseDetail() method as given below.
// Replace below line
getTransactionDetails(detail.transactionDetail, reportStringBuilder,
false);
// with below lines
getTransactionDetails(detail.transactionDetail, reportStringBuilder,
true);


Additional Attributes in Account Summary

This example shows the account opening method in the account summary. To update the pre-configured Investigation Toolkit notebook template, follow these steps:
  1. Check if the attribute is defined in the graph definition. Since the attribute account opening method is not defined in the Account node provider, update the graph pipeline to add the property. For more information, see the Graphs section in the OFS Compliance Studio User Guide.

    Let's say it was added as an attribute, Opening Method.

  2. Query Update: Update the query for information collection.
    • PGQL Query: Modify the query in the GraphPgqlQueries#getAccountDetails()method to add the attribute Opening Method as shown below.
      public String getAccountDetails(
      Set<String> nodeIds, PgxGraph resultGraph, GetInfoFromGraph
      getInfo) {
      if (getInfo.verifyIfNodeProviderExist(List.of("Account"),
      resultGraph, false, false)) {
      return "SELECT "
      + "n.Name,"
      + "n.Status,"
      + "n.\"Tax Id\","
      + "n.Address,"
      + "n.\"Entity Type\","
      + "n.City,"
      + "n.Country,"
      + "n.State,"
      + "n.Jurisdiction,"
      + "n.\"Business Domain\","
      + "n.Risk,"
      + "n.D_date,"
      + "n.\"Original Id\","
      + "n.\"Opening Method\""
      + "id(n) "
      + "MATCH (n:Account) where id(n) in ('"
      + String.join("','", nodeIds)
      + "')";
      } else {
      return null;
      }
      }
    • SQL query: Modify the query in the SqlQueries#getAccountDetails()method to add the attribute Opening Method as shown below.
      public String getAccountDetails(Set<String> nodeIds, HashSet<String>
      tableHashSet) {
      StringBuilder queryString = new StringBuilder();
      if
      (tableHashSet.contains("VW_FCC_ACCOUNT853E4164_0968_4CB6_A6F3_2B49306
      14A8B")) {
      queryString
      .append("SELECT /*+ parallel(")
      .append(config.PARALLEL_HINT)
      .append(
      ") */ n.\"Name\", n.\"Status\", n.\"Tax Id\",
      n.\"Address\", n.\"Entity Type\", n.\"City\", n")
      .append(
      ".\"Country\", n.\"State\", n.\"Jurisdiction\",
      n.\"Business Domain\", n.\"Risk\", n.\"D_date\", n")
      .append(
      ".\"Original Id\", n.\"Id\" , n.\"Label\", n.\"Opening
      Method\" FROM vw_fcc_account853e4164_0968_4cb6_a6f3_2b4930614a8b n ")
      .append("WHERE n.\"Id\" IN ( '")
      .append(String.join("','", nodeIds))
      .append("')");
      }
      return queryString.toString();
      }
    • Update the entity, Account, to store the value: Add a variable for openingMethod and respective getter and setter in class AccountDetail as shown below.
      String openingMethod;
      public String getOpeningMethod() {
      return openingMethod ;
      }
      public void setOpeningMethod(String openingMethod ) {
      this.openingMethod = openingMethod ;
      }
    • Setting the value: Modify these methods, GetInfoFromDb#gatherAccountDetails() and GetInfoFromGraph#gatherAccountDetails() to set the value as shown below respectively:
      • Set the value in
        GetInfoFromDb#gatherAccountDetails() 
        accountDetail.setOriginalId(result.getString(13)); 
        accountDetail.setOpeningMethod(result.getString(16));
      • Set the value in
        GetInfoFromGraph#gatherAccountDetails() 
        accountDetail.setOriginalId(result.getString(13)); 
        accountDetail.setOpeningMethod(result.getString(14));
    • Risk Report update: Modify the risk report in the SummaryGenerator#getAccountReport() method by appending the message and the value as shown below.
      public void getAccountReport(AccountDetail accountDetail, StringBuilder
      reportStringBuilder) {
      if (accountDetail != null) {
      reportStringBuilder
      .append("<details>")
      .append("<summary>Account Summary of <b>")
      .append(accountDetail.getName())
      .append("</b></summary>")
      .append("<p>")
      .append("The account, <b>")
      .append(accountDetail.getName())
      .append("</b>, is in our internal records with ID, <b>")
      .append(accountDetail.getOriginalId())
      .append("</b>, and the status of account ");
      String acctStatus = accountDetail.getStatus();
      reportStringBuilder
      .append(acctStatus.startsWith("code") ? "has <b>" : "is <b>")
      .append(accountDetail.getStatus())
      .append("</b>")
      .append("</br>")
      .append("Entity Type: <b>")
      .append(accountDetail.getEntityType())
      .append("</b>")
      .append("</br>")
      .append("Tax ID: <b>")
      .append(accountDetail.getTaxId())
      .append("</b>")
      .append("</br>")
      .append("Account opening method: <b>")
      .append(accountDetail.getOpeningMethod())
      .append("</br>")
      .append("Address: ")
      .append(getList(accountDetail.getAddresses()))
      .append("</br>")
      .append("City: <b>")
      .append(getList(accountDetail.getCities()).append("</b>"))
      .append("</br>")
      .append("State: <b>")
      .append(getList(accountDetail.getStates()).append("</b>"))
      .append("</br>")
      .append("Country: <b>")
      .append(getList(accountDetail.getCountries()).append("</b>"))
      .append("</br>")
      .append("Risk Score: <b>")
      .append(accountDetail.getRiskScore())
      .append("</b>")
      .append("</br>")
      .append("Jurisdiction: <b>")
      .append(accountDetail.getJurisdiction())
      .append("</b>")
      .append("</br>")
      .append("Business Domain: <b>")
      .append(accountDetail.getBusinessDomain())
      .append("</b>")
      .append("</br>")
      .append("Added to the bank on: <b>")
      .append(accountDetail.getAddedDate())
      .append("</b>");
      getTransactionDetails(accountDetail.transactionDetail,
      reportStringBuilder, true);
      getRelatedCustSummary(accountDetail, reportStringBuilder);
      getComplianceSummary(accountDetail.getEventDetails(),
      reportStringBuilder, false);
      getRiskFactorsAndRedFlags(accountDetail.getCustomerDetails(),
      reportStringBuilder, true);
      reportStringBuilder.append("</p>").append("<hr>").append("</
      details>");
      } else {
      ihubUtil.log("Skipping Account report as passed account detail is
      null.");
      }
      }

After all the changes are done, value of the account opening method will be shown in the account summary.
Description of account-opening-method.png follows
Description of the illustration account-opening-method.png