GithubHelp home page GithubHelp logo

isabella232 / documentai-fraud-detection-demo Goto Github PK

View Code? Open in Web Editor NEW

This project forked from googlecloudplatform/documentai-fraud-detection-demo

0.0 0.0 0.0 2.06 MB

Shell 13.82% Python 86.18%

documentai-fraud-detection-demo's Introduction

Document AI Fraud Detection Demo with Enterprise Knowledge Graph

Objective

Learn how to use Google Cloud Platform to process and enrich invoices so that we can enable fraud detection.

Visualizing the flow of data

diagram

Cloud Services used in the Demo

Steps to re-create this demo in your own GCP environment

  1. Create a Google Cloud Platform Project

  2. Enable the APIs in the project you created in step #1 above

    • Cloud Document AI API
    • Cloud Functions API
    • Geocoding API
    • Cloud Build API
# Replace with Your Project ID
gcloud config set project YOUR_PROJECT_ID

gcloud services enable documentai.googleapis.com

gcloud services enable cloudfunctions.googleapis.com

gcloud services enable geocoding-backend.googleapis.com

gcloud services enable kgsearch.googleapis.com

gcloud services enable cloudbuild.googleapis.com
  1. Initialize Repository

    • Activate your Command Shell and clone this GitHub Repo in your Command shell using the command:

      git clone https://github.com/GoogleCloudPlatform/documentai-fraud-detection-demo.git
    • Change Directory to the Repo Folder

      cd documentai-fraud-detection-demo
  2. Manage API Key

    • Create an API Key - Note the api key value, you will need to plug this values in your cloud function's environment variables

    • Paste the API Key in the geocode-addresses/.env.yaml file.

    • Add API restrictions - To set API restrictions:

      1. Select Restrict key in the API restrictions section.
      2. Select Geocoding API from the dropdown.
      3. Select the Save button.
  3. Create your Doc AI processor

    • Go to Console > Doc AI > Create Processor > Invoice Parser (Under Specilaized)
      • Name the processor fraud-detection-invoice-parser
      • Note the Region and ID of the processor, you will need to plug these values in your cloud function's environment variables
    • Paste the processor location and ID in the process-invoices/.env.yaml file
  4. Execute Bash shell scripts in your Cloud Shell terminal to create cloud resources (i.e Google Cloud Storage Buckets, Pub/Sub topics, Cloud Functions, BigQuery tables)

    1. Update the value of PROJECT_ID in .env.local to match your current projectID

      vim .env.local
    2. Execute your .sh files to create cloud resources

      bash create-archive-bucket.sh
      bash create-input-bucket.sh
      bash create-output-bucket.sh
      bash create-pub-sub-topic.sh
      bash create-bq-tables.sh
      bash deploy-cloud-function-process-invoices.sh
      bash deploy-cloud-function-geocode-addresses.sh
  5. Testing/Validating the demo

    • Upload a sample invoice in the input bucket
    • At the end of the processing, you should expect your BigQuery tables to be populated with extracted entities as well as enriched data (i.e placesID, lat, long, formatted address, name, url, description, kgscore)
    • Reading the results, we can now build custom business intelligence rules using these enriched fields to enable fraud detection. For example, if the address is not something the Geocoding API can find, then it is an indicator of either incorrect value or fraudulent invoice

documentai-fraud-detection-demo's People

Contributors

sugandhachoudhary avatar holtskinner avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.