Skip to content

phrsouza/transaction_fraud_detection

Repository files navigation

Transaction Fraud Detection ci workflow codecov

Overview

The transaction_fraud_detection project is aimed at developing a system for detecting fraudulent transactions in financial data. It utilizes a set of rules to identify potentially fraudulent activities.

Features

  • Customizable parameters for configuring rules.
  • Easy integration with new rules.
  • Helper to upload new transactions from CSV files in the database.

Local Setup

To set up the project locally, follow these steps:

  1. Clone the repository:
git clone https://github.com/phrsouza/transaction_fraud_detection.git
  1. Run setup script:
bin/setup

Usage

  1. Start api server:
docker-compose up api
  1. Request transactions endpoint:
curl -v -X POST localhost:3000/transactions \
   -H 'Content-Type: application/json' \
   -d '{"transaction_id":2342357, "merchant_id":29744, "user_id":97051, "card_number":"434505******9116", "transaction_date":"2019-11-31T23:16:32.812632", "transaction_amount":373, "device_id":285475}'

Rules

This project contain a set of rules to identify frauds that can be found on rules directory. The rules parameters can be adjusted in the rules file or through env vars.

  • AntiFraudRules::UserTransactionsExceeded: verify if the user requested a transaction right before requesting another.
  • AntiFraudRules::UserPreviousChargeback: verify if the trasaction user had a chargeback previouly.
  • AntiFraudRules::UserTransactionsExceeded: verify if the user requested a transaction right before requesting another

Data Analysis

Yu can fin the complete data analysis of the uploaded dataset at https://gist.github.com/phrsouza/99fbcff5ce9829a65843bc058fd791ec.

Deploy

This project is deployed to https://transaction-fraud-detection-ukv3.onrender.com whenever the default branch is updated. See the render.yaml file for more details.

You can test it running the following command:

curl -v -X POST https://transaction-fraud-detection-ukv3.onrender.com/transactions \
   -H 'Content-Type: application/json' \
   -d '{"transaction_id":2342357, "merchant_id":29744, "user_id":97051, "card_number":"434505******9116", "transaction_date":"2019-11-31T23:16:32.812632", "transaction_amount":373, "device_id":285475}'

Api Documentation

The api documentation can be found at: https://transaction-fraud-detection-ukv3.onrender.com/apipie.

License

This project is licensed under MIT License.

Contact

For inquiries or support, please contact:

Feel free to open an issue for bug reports or feature requests.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published