A repository of network motifs indicating risk in financial and transaction networks of financial crime and corruption.
This project was created in the course of three blog posts:
- Financial Crime and Corruption Network Motifs
- Sigma Rules + FollowTheMoney → Crime and Corruption Risk Motifs
- Graphlet AI: Financial Crime and Corruption Network Motifs
The motifs in this project are based on the FollowTheMoney data model for financial networks. It represents a simple but comprehensive model for financial networks and transactions.
To run the code in this repository, you will need the following:
To develop locally, you will need the following:
Supported operating systems:
- Mac OS X
- Ubuntu Linux
- Windows support is in progress
You can use the docker-compose.yml file to test the code in this repository. To start the Docker container, run the following command:
docker-compose upWe use a Docker image to run this project. You can also setup the environment locally so the code will work in VSCode or another editor. We provide a development tools setup using black, flake8, isort, mypy and pre-commit for you to modify and use as you see fit.
We use Anaconda Python, Python version 3.12.6, for this course. You can download Anaconda Python from here. Once it is installed, you can create a new environment for this project by running the following command:
conda create -n motifs python=3.12 -yWhen you create a new environment or start a new shell, you will need to activate the motifs conda environment with the following command:
conda activate motifsNow you are running Python 3.12 in the motifs environment. To use this Python in VSCode, hit SHIFT-CMD-P (on Mac) and select Python: Select Interpreter. Then select the motifs environment's Python.
To deactivate this environment, run:
conda deactivateWe use Poetry for dependency management, as it makes things fairly painless.
To install using curl, just run:
curl -sSL https://install.python-poetry.org | python3 -To first install pipx, on Mac OS X run:
brew install pipx
pipx ensurepath
sudo pipx ensurepath --global # optional to allow pipx actions with --global argumentOn Ubuntu Linux, run:
sudo apt update
sudo apt install pipx
pipx ensurepath
sudo pipx ensurepath --global # optional to allow pipx actions with --global argumentThen install Poetry using pipx:
pipx install poetryIt will now be outside your virtual environment and available to all your Python projects.
poetry installThe code relies on a series of pytests in tests/test_motifs.py. To run the tests, use the following command:
pytest