Javascript Library

Decide helps users make risk-free decisions based on an analysis of their banking transactions using extracted financial data. The Decide SDK helps developers plug into the functionalities of Decide from their projects.

Website: https://developers.indicina.co

Using the App

Authorizaton

Shell

export INDICINA_CLIENT_ID=my_id export INDICINA_CLIENT_SECRET=my_secret

JavaScript

const client_id = process.env.INDICINA_CLIENT_ID; const client_secret = process.env.INDICINA_CLIENT_SECRET;

You can get your INDICINA_CLIENT_ID and INDICINA_CLIENT_SECRET from here.

Sample Code

JSON

const customer = new Customer( 'ckq9ehqmv000001me62y85j1u', 'dee@dee.com', 'Dammy', 'Shabi', '081' ) json_statement = json.loads("""{ "paging": { "total": 190, "page": 2, "previous": "https://api.withmono.com/accounts/:id/transactions?page=2", "next": "https://api.withmono.com/accounts/:id/transactions?page=3" }, "data": [ { "_id": "12345", "amount": 10000, "date": "2020-07-21T00:00:00.000Z", "narration": "TRANSFER from *************", "type": "debit", "category": "E-CHANNELS" }, { "_id": "12345", "amount": 20000, "date": "2020-07-21T00:00:00.000Z", "narration": "TRANSFER from ***********", "type": "debit", "category": "E-CHANNELS" } ] }""") const statement = jsonString const statementObj = new DecideStatement("mono", statement, customer, true); const analysis = await statementObj.analyzeJSON({ format: "mono", statement, customer }); console.log(analysis.TransactionPatternAnalysis) console.log(analysis.SpendAnalysis) console.log(analysis.IncomeAnalysis) console.log(analysis.CashFlowAnalysis) console.log(analysis.BehaviouralAnalysis) // For Tags const tags = await analysis.getTransactionTags() console.log(tags.transactions[0].tags)

PDF Statement

JSON

CSV Statement

JSON

Sample Response

JSON

Supported Banks

In selecting a bank to use for analysis, we maintain an ENUM of supported banks. We have also provided a convenient method to fetch a current list of supported banks.

Shell

Shell

Analysis

When the Decide API sends a response, the response is represented in the Analysis class.

Anatomy of an Analysis

Shell

Analysis Status

Some bank statement analyses (e.g. PDF) are asynchronous. You may not get the results of the analysis immediately.

You may need to get the status of an analysis.

PDFStatus could take one of the following values.

Status

Value

Description

Status

Value

Description

DONE

DONE

The analysis is done

FAILED

FAILED

The analysis failed

IN_PROGRESS

IN_PROGRESS

The analysis is still in progress

Shell

 Rules Engine Documentation

The Rules Engine enables merchants to set up an automated decisioning process for lending, based on pre-determined conditions tailored to their unique use case. It allows users to:

  • Develop multiple rule-based conditions

  • Analyze statements with pre-determined conditions and rules that automate the decision-making process

  • Automatically filter qualifying applications based on the set rules

  • Set up an affordability logic to reveal what applicants can pay back

Import Required Libraries

Shell

Set Environment Variables

Shell

Initialize ScorecardAPI

Shell

Create Scorecard

Define Rules

A Rule is defined as a condition to be evaluated on a certain value. You can have as many rules as you need. A Rule consists of several properties, including:

  • order: an integer representing the order in which the rule is evaluated

  • rule_type: an Enum representing the type of rule (e.g., average balance, loan amount, etc.)

  • value: a string representing the value of the rule (e.g., "10000" for an average balance of 10,000)

  • condition: an ENUM representing the condition to be evaluated (e.g., "is equal to", "less than or equal to", etc.)

  • operator: an ENUM representing the logical operator to be used when evaluating the rule (e.g., "and", "or", etc.)
    For example, the first rule defined in the code states that the average balance of an account must be exactly 10,000.

Shell

Create a Block

A Block is a collection of Rule objects that are evaluated together using a logical operator (e.g., "and", "or", etc.). A Block consists of several properties, including:

rules: a list of Rule objects order: an integer representing the order in which the block is evaluated operator: an ENUM representing the logical operator to be used when evaluating the block (e.g., "and", "or", etc.) negative_outcome: an Enum representing the outcome of the block if the evaluation is false

Shell

Create a Boolean Rule Set

A BooleanRuleSet is a collection of Block objects that are evaluated together using a logical operator (e.g., "and", "or", etc.). A BooleanRuleSet consists of several properties, including:

  • name: a string representing the name of the rule set

  • positive_outcome: an ENUM representing the outcome of the rule set if the evaluation is true

  • negative_outcome: an ENUM representing the outcome of the rule set if the evaluation is false

  • owner: a string representing the owner of the rule set

  • blocks: a list of Block objects

Shell

Define Affordability Logic

Affordability logic defines the logic to determine what the applicant can pay back. It is made up of two properties:

  • monthly_interest_rate: interest rate per month

  • monthly_durations: a list of Duration objects representing the tenures they wish to provide their service for

Shell

 Create a Scorecard Request

The ScorecardRequest object is the final object that is created and is used to make requests to the ScorecardAPI. It contains the name of the scorecard, the boolean rule set, the affordability logic, and the status of the scorecard (whether it is enabled or disabled).

Shell

Read Scorecard

To retrieve an existing scorecard, we can use the get_scorecard method. The method takes the ID of the scorecard as input and returns a Scorecard object.

Shell

Update Scorecard

We can create a new ScorecardRequest object with the updated information and use the update_scorecard method. The method takes the ID of the scorecard and the new ScorecardRequest object as input and updates the scorecard with the new information.

Shell

Delete Scorecard

To delete an existing scorecard, we can use the delete_scorecard method. The method takes the ID of the scorecard as input and deletes the scorecard.

Shell

Analyse statement with Scorecard

To analyse a statement with some already created scorecards/rules, pass in the ids of the scorecards as below:

Shell

This concludes the documentation for using the Rules Engine, which covers creating, updating, deleting, and executing scorecards on existing analyses. Use this guide as a reference for implementing the automated decision-making process tailored to your specific lending use case.

 Contribution

Setup Project

The link for this projects's repository can be found here

Cloning the project

HTTP

Shell

  • Install the requirements.txt file npm i

  • Run files

Contribute to Project

Do you find the project interesting and you would like to contribute to our project?

  • Fork the repository to your github account

  • Clone the repository to your local machine

  • Create a new branch for your fix (preferably descriptive to your contribution)

  • Make appropriate changes and tests for the changes

  • Use git add insert-paths-of-changed-files-here to add the file contents of the changed files to the "snapshot" git uses for project management

  • Committing: As a means to create a seamless development and contribution flow, we require that commits be standardized, following the conventional commits guideline:

JSON

Examples of good commits:

  1. Adding a new feature: git commit -m "feat: allow provided config object to extend other configs"

  2. Adding a breaking change, take note of the ! : git commit -m "feat!: send an email to the customer when a product is shipped"

  • Push the changes to the remote repository using git push origin branch-name-here

  • Submit a pull request to the upstream repository

  • Title the pull request with a short description of the changes made and the issue or bug number associated with your change. For example, you can title an issue like so Added more log outputting to resolve #4352.

  • Wait for our in-house developers to approve the merge requests or update the merge requests if changes were requested,