9. Transactional profile¶
To find out the transactional profiles of customers, the usual thing to do is segment them, for example, according to their profession, job seniority and income. Given the information consolidated in trak.e about the customer and his history of transactions it is possible to monitor that the behavior remains within normal parameters, that is, according to their economic capacity.
The expectation is that the transactional profiles of the clients are prepared prospectively, and can be adjusted later accordingly. According to the development and characteristics of the commercial relationship and with the periodicity required based on the risks assessed and the evolution of the transactional activity.
It is expected that the preparation of transactional profiles provide tools for entities for the timely and early detection of unusual and possibly, suspicious, operations carried out by the client.
Trak.e allows you to manage a configurable rule that assign to each digital profile the transactional profile within the application. It is allowed to add any number of transactional profile rules, but at most one can be active.
9.1 Implementation¶
The rule is implemented using the programming language Python. At a general level, the rule is evaluated based on the information consolidated in the digital profile and in the history of the transactionality of the client and decides its transactional profile, consolidated in a number that represents the prospective expectation of the transactionality of the client.
9.1.1 Parameters¶
-
profile
: When evaluating the rule, the variable is placed in the execution context.profile
contains the digital profile that is currently being processed. All the attributes detailed in the section Digital Profiles is available on this object. -
hist_trxs
: If the rule includes information about the transactionality of the digital profile, you can access the transaction history of the profile with this name. The variable is placed in the execution context in the format of pandas.DataFrame, where each row of the DataFrame represents a transaction and the columns of the DataFrame are the attributes of transactions (using underscore as separator in case of being nested attributes). It is possible that the history is empty (no rows or columns) if the customer does not record transactions.
9.1.2 Rule result¶
The rule must define a variable named TRANSACTIONAL_PROFILE
of type
float
, representing the numerical value of the transactional profile calculated by the rule
Note
Context: In addition to the numerical value that will be used as a transactional profile, the evaluation context is returned, particularly those public defined variables. This allows saving values calculated during the execution of the rule and that they are available when viewing the results.
9.2 Example 1¶
Next, the implementation of a trivial example rule for computation of the transactional profile of a profile is defined.
if profile.person_type == "natural_person":
TRANSACTIONAL_PROFILE = 24000
else:
TRANSACTIONAL_PROFILE = 48000
Given a digital profile, the previous rule simply assigns it a default value $24,000 as the transactional profile if they are a natural person; or $48,000 in the case they are legal entity.
9.3 Example 2¶
It is possible to make the rule as complex as one wants by using the constructs of the Python language.
For example, it is possible to define the transactional profile based on the total of deposits that the client took into account during the next past year. If the customer does not record transactions, its income statement is assigned. If the customer did not make a declaration of income, a default value is assigned.
if hist_trxs.empty:
# If we have no historical data, assign a default depending on person type
if profile.person_type == "natural_person":
if profile.declared_income:
TRANSACTIONAL_PROFILE = profile.natural_person.declared_income
else:
TRANSACTIONAL_PROFILE = 24000
else:
TRANSACTIONAL_PROFILE = 48000
else:
# If we have transaction history, use last year total deposits as profile amount
now = datetime.now()
from_ = int(datetime(year=now.year-1, month=1, day=1).timestamp() * 1000)
to_ = int(datetime(year=now.year, month=1, day=1).timestamp() * 1000)
last_year_deposits = hist_trxs[(from_ <= hist_trxs["timestamp"]) & (hist_trxs["timestamp"] < to_) & (
hist_trxs["side"] == "deposit")]
TRANSACTIONAL_PROFILE = sum(last_year_deposits["amount"])/3
reason = "trx_history"
9.4 Rule testing¶
Trak.e allows you to test the transactional profile rule before saving it with any digital profile from the database or with an custom-defined profile as necessary to test edge cases and make sure that the rule is correct both syntactically and semantically.
9.5 Name and description¶
The transactional profile rule is saved with a name, which must be unique within all the variants of the transactional profile that the entity.
You can also attach a description in rich text format, with which the documentation of the behavior of the transactional profile matrix can be kept along with the code that implements it.
9.6 API¶
For technical information on the API to set-up transactional profile assessment, the API documentation is available.