This article is an overview of the aggregations our system currently offers.
💡 This is not a 'by default' feature - aggregations are added by Salv when needed.
Examples of aggregations we support
The following list is by no means exhaustive:
TRANSACTION_FROM_SENDER_ACCOUNT - Number of transactions and total amount
TRANSACTION_TO_RECEIVER_ACCOUNT - Number of transactions and total amount
TRANSACTIONS - Maximum amount transacted, number of transactions and total amount
In all these aggregations the transaction direction, sender and receiver account are also specified.
🧮 New aggregations are calculated with each transaction (and per day).
For example, if you want to take maximum amount over 30 days then you have to look all the rows within 30 days.
Below is a sample scenario that triggers an alert when money is sent to a recipient's account, which has received a total amount of 20000 in the last 30 days from at least 20 other senders.
select
count(distinct pa.person_id)>= 20
and sum(value) >= 20000 ,
sum(value),
count(distinct pa.person_id )
from
(
select
receiver_account,
timestamp
from
transaction
where
id = $transactionId
and direction = 'OUTGOING'
) sub
join person_aggregate pa on
pa.receiver = sub.receiver_account
and pa.organisation_id = $organisationId
where pa.aggregate_date between sub.timestamp-'30 days'::interval and sub.timestamp
and pa.aggregate_type = 'TRANSACTION_TO_RECEIVER_ACCOUNT'
and pa.aggregate_operation = 'SUM'