IBM / ibm-cloud-functions-serverless-ocr-openchecks

Serverless bank check deposit processing with object storage and optical character recognition using Apache OpenWhisk powered by IBM Cloud Functions. See the Tech Talk replay for a demo.
https://developer.ibm.com/code/patterns/automatically-scale-to-handle-peaks-in-banking-transaction-demand/
Apache License 2.0
45 stars 31 forks source link
bluemix docker ibm-cloud-functions ibm-developer-technology-cloud ibm-developer-technology-fintech ibmcode javascript object-storage ocr openwhisk openwhisk-getting-started openwhisk-hands-on-demo openwhisk-sample serverless

Build Status

Serverless check deposit processing with Apache OpenWhisk on IBM Cloud Functions

This project demonstrates serverless technology - powered by Apache OpenWhisk with IBM Cloud Functions - in the context of a retail banking scenario where deposited checks are processed digitally (such as through a mobile banking app) using optical character recognition (OCR).

This sort of use case is ideal for a serverless architecture because it addresses compute-intensive and highly elastic payday deposit processing where the workload spikes for one particular timeframe every two weeks.

You can learn more about this scenario in the IBM Code blog post and associated Code Pattern. You can also see a deeper dive and extended demo with the Tech Talk replay.

It also highlights a few OpenWhisk development concepts, which include rules, triggers, sequences, and invoking actions from other actions directly. Furthermore, it demonstrates a use case where polyglot development is applied in order to package an third-party C library for OCR as an action.

You should have a basic understanding of the OpenWhisk programming model. If not, try the action, trigger, and rule demo first. You'll also need a Bluemix account and the latest OpenWhisk command line tool (wsk) installed and on your PATH.

It is currently built on the public Cloud Functions service and relies on Cloudant and SoftLayer Object Storage. On-premises, it could use Apache CouchDB and OpenStack Swift. Other storage services could include FileNet or Cleversafe. Tesseract provides the OCR library.

Check 12

Components

Retail bank deposit processing with OpenWhisk

This project uses a set of actions and triggers linked by rules to process images that are added to an object storage service. When new checks are detected a workflow downloads, resizes, archives, and reads the checks then it invokes an external system to handle the transaction.

Most of the actions are written in JavaScript using the default Node.js version 6 environment on Cloud Functions. One of the actions is written as a shell script and packaged in a Docker container. This shows both the polyglot nature of OpenWhisk, as well as the ability to package any arbitrary program, as is needed in this case to leverage an OCR library.

Primary workflow

Sample check images

There are three checks in the images directory that the OCR action can read reliably and two that will fail in order to show the alternate workflows (and to provide an exercise for improving the image recognition capabilities).

Notice the MICR data at the bottom of the check representing the routing number and payer (deposit from) account number.

The amount data is not currently parsable, nor is the deposit to account information, as these are handwritten on most checks. This will need to be passed as metadata (and later the algorithm may be improved to handle this case with a more powerful service).

Check sample

Running the sample application

  1. Set up the Bluemix services (Cloudant, Object Storage, Docker Hub).
  2. Set up the OpenWhisk actions, triggers, and rules.

License

This code pattern is licensed under the Apache Software License, Version 2. Separate third party code objects invoked within this code pattern are licensed by their respective providers pursuant to their own separate licenses. Contributions are subject to the Developer Certificate of Origin, Version 1.1 (DCO) and the Apache Software License, Version 2.

Apache Software License (ASL) FAQ