This project is a stream processing system for detecting anomalous behavior in card transactions using Apache Flink, Kafka, Redis, and Docker. It processes transactions in real time and raises alerts based on custom rule-based anomaly detectors.
🚀 Built entirely in Python, containerized using Docker Compose, and includes a fully interactive visualization module with real-time map rendering.
- Dawid Bartosiak
- Zuzanna Godek
The system detects the following 10 types of card transaction anomalies:
- TransactionTenTimesTheAverage – Transaction 10× higher than historical average
- NegativeTransaction – Transaction with a negative amount
- LimitExceeded – Exceeds available card limit
- VeryHighValue – Transaction exceeds 10,000 PLN
- ImpossibleTravel – Movement speed between transactions > 900 km/h
- RapidTransactions – Multiple transactions <10s apart
- PinAvoidance – Series of transactions just below 100 PLN
- ManyTransactionsNoPin – ≥5 transactions without PIN in a window
- DormantCardActivity – Sudden activity after long dormancy
- MultiCardDistance – Different cards of same user used far apart in short time
+-------------+ +-----------------+ +------------+ +----------------+
| Redis DB | <---> | Generator | ---> | Kafka | ---> | Apache Flink |
+-------------+ +-----------------+ +------------+ +----------------+
|
v
+---------------+
| Visualizer UI |
+---------------+
- Stores card data:
card_id,user_id, location, statistical parameters, limits.
- Produces synthetic transactions (normal + anomalies).
- Publishes to Kafka topic.
- Pulls baseline stats from Redis.
- Detects anomalies in streaming mode.
- Implements detectors as modular Python classes.
- Uses Sliding and Tumbling windows per card or per user.
- Outputs alerts to Kafka.
- 4 display modes: by user, by card, by type of anomaly.
- Real-time transaction map.
- Built with interactive stream merging and live updates.
Everything is containerized via docker-compose:
- Apache Kafka + Kafka UI
- Apache Flink (TaskManager + JobManager)
- Redis + Redis Commander
- Generator + Visualizer (Python)
- Custom Flink image with Python & Kafka connectors
./scripts/t_setup.sh./scripts/t_run.sh./scripts/debug.sh