4.2.1.3 Network Disposition Score and Breakdown

Disposition score should consider only Customers and Accounts and the Breakdown must show an additional column to show contribution.

This example shows how to change the score of disposition score to consider only Customers and Account and the breakdown must show an additional column to contribute toward the final risk score.

To update, follow these steps:
  1. Modify the GraphPgqlQueries#getDispositionScore() and GraphPgqlQueries#getDispositionScoreBreakdown() queries for disposition score and its breakdown, respectively, as shown below:
    • // Modified method
      public String getDispositionScore(boolean forVisibleGraph) {
      return "SELECT sum(n.Risk * 10)/count(n) as "
      + "network_disposition_score "
      + "FROM MATCH (n) "
      + "where n.Label in ('Customer', 'Account') and n.Risk is not
      null"
      + (forVisibleGraph ? " and id(n) in ?" : "");
      }
    • // A new method to get the node count of Customer and Account present in the graph/visible graph
      public String getNodeCount(boolean forVisibleGraph) {
      return "SELECT count(n) as "
      + " node_count "
      + " from match(n) "
      + " where n.Label in ('Customer', 'Account') and n.Risk is not
      null "
      + (forVisibleGraph ? " and id(n) in ?" : "");
      }
    • // Modified method
      public String getDispositionScoreBreakdown(long nodeCount, boolean
      forVisibleGraph) {
      return "SELECT "
      + "n.Name as Name, "
      + "n.Label as Type, "
      + "n.Risk as Score, "
      + "(n.Risk * 10)/" + nodeCount + " as Contribution, "
      + "n.Address as Address, "
      + "n.D_date as \"Opened Date\", "
      + "CASE WHEN n.Label = 'Account' THEN '2' ELSE '0' END as Acct, "
      + "CASE WHEN n.Label = 'Customer' THEN '1' ELSE '0' END as Cust "
      + "FROM MATCH (n) "
      + "where n.Label in ('Customer', 'Account') and n.Risk is not
      null"
      + (forVisibleGraph ? " and id(n) in ? " : "")
      + " order by Score desc";
      }
  2. Update the IHub#getNetworkDispositionScoreBreakdown() method to get the count and pass it to the updated GraphPgqlQueries#getDispositionScoreBreakdown() method as shown below.
    public void getNetworkDispositionScoreBreakdown() {
    if (validateIfGraphAnalysisIsEnabled() && resultGraph != null) {
    long nodeCount = getCountBasedOnQuery(true,
    graphPgqlQueries.getNodeCount(true), List.of(getVisibleGraphNode()));
    String query =
    graphPgqlQueries.getDispositionScoreBreakdown(nodeCount,true);
    queryVisibleGraphAndPrintTable(resultGraph, query,
    List.of(getVisibleGraphNode()));
    }
    }

After all the changes are done, the network disposition score and the breakdown are updated as shown in the following figure.
Description of network-disposition-score.png follows
Description of the illustration network-disposition-score.png