Skip to content

Transaction Model: Create a New Model (Tutorial)

hkanezashi edited this page Nov 7, 2019 · 4 revisions

How to create a new AML typology (alert transaction model)

1. Edit a Python script

First, you need to add a function to transaction_graph_generator.py to register a new AML typology.

1.1. Add process codes to generate alert transactions

Add process codes to add_alert_pattern function. For example, the fan_in pattern is defined as follows:

if pattern_type == "fan_in":  # fan_in pattern (multiple accounts --> single (subject) account)
      src_list = [n for n in members if n != subject]
      dst = subject

      if transaction_freq is None:
        transaction_freq = num_members - 1

      for src in itertools.cycle(src_list):  # Generate transactions for the specified number
        amount = random.uniform(min_amount, max_amount)
        date = random.randrange(start_day, end_day)
        sub_g.add_edge(src, dst, amount=amount, date=date)
        self.g.add_edge(src, dst, amount=amount, date=date)

        transaction_count += 1
        total_amount += amount
        if transaction_count >= transaction_freq and total_amount >= aggregated_amount:
          break

2. Create a new Java class

Next, create a Java class extends amlsim.model.aml.AMLTypology.