Skip to content

Jaydip0724/fraud-detection-system

Repository files navigation

Fraud Detection Streaming Demo 🚀

Fraud Detection

Welcome to the Fraud Detection Streaming Demo! This repository provides a robust solution for detecting fraudulent activities in real-time using advanced technologies.

Table of Contents

Overview

Fraud detection is a critical aspect of many industries, especially in finance and e-commerce. This project demonstrates how to build a real-time fraud detection system using various technologies. The system analyzes streaming data to identify potential fraudulent transactions as they occur.

You can find the latest releases for this project here. Download the necessary files and execute them to get started!

Technologies Used

This project utilizes the following technologies:

  • Apache Spark: For big data processing and analytics.
  • Apache Superset: For data visualization.
  • Docker Compose: To manage multi-container Docker applications.
  • Flask: For building the REST API.
  • PostgreSQL: For the database.
  • RandomForestClassifier: For machine learning classification.
  • SQLAlchemy: For database interaction.
  • Superset Docker: For deploying Superset with Docker.

Getting Started

To set up the project locally, follow these steps:

  1. Clone the Repository:

    git clone https://github.com/Jaydip0724/fraud-detection-system.git
    cd fraud-detection-system
  2. Install Docker: Ensure you have Docker and Docker Compose installed on your machine. You can download them from the official Docker website.

  3. Build the Docker Containers: Use Docker Compose to build the containers.

    docker-compose up --build
  4. Access the Application: Open your browser and navigate to http://localhost:5000 to access the Flask application.

  5. Check PostgreSQL: Ensure that PostgreSQL is running and accessible. You can connect to it using any SQL client.

How It Works

The fraud detection system processes incoming transaction data in real-time. Here’s a brief overview of its workflow:

  1. Data Ingestion: The system ingests transaction data streams using Apache Spark.
  2. Data Processing: Spark processes the data and prepares it for analysis.
  3. Machine Learning: The RandomForestClassifier analyzes the data to identify fraudulent patterns.
  4. API Integration: The Flask application serves as a REST API, allowing users to interact with the system.
  5. Visualization: Apache Superset provides dashboards to visualize the data and insights.

Fraud Detection Workflow

API Documentation

The REST API provides several endpoints to interact with the fraud detection system:

Endpoints

  • POST /transactions: Submit a new transaction for analysis.
  • GET /transactions: Retrieve past transactions.
  • GET /status: Check the status of the fraud detection system.

Example Request

To submit a transaction, use the following curl command:

curl -X POST http://localhost:5000/transactions \
-H "Content-Type: application/json" \
-d '{"amount": 150.00, "currency": "USD", "user_id": "12345"}'

Example Response

The API will return a response indicating whether the transaction is fraudulent or not:

{
  "transaction_id": "abc123",
  "is_fraudulent": false
}

Usage

Once the application is running, you can start submitting transactions for analysis. Use the API endpoints to interact with the system. You can also visualize the data using Apache Superset.

Visualizing Data

  1. Open Superset at http://localhost:8088.
  2. Log in using the credentials provided in the Docker Compose file.
  3. Create dashboards to visualize transaction data and insights.

Contributing

We welcome contributions! If you want to contribute to this project, please follow these steps:

  1. Fork the repository.
  2. Create a new branch: git checkout -b feature/YourFeature.
  3. Make your changes and commit them: git commit -m 'Add your feature'.
  4. Push to the branch: git push origin feature/YourFeature.
  5. Open a pull request.

Please ensure your code adheres to the project's coding standards.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Contact

For questions or suggestions, feel free to reach out:

For more information, check the Releases section for updates and downloads.


Thank you for your interest in the Fraud Detection Streaming Demo! We hope you find it useful in your projects.