Vendor Matching In Master Database Using API

Using a webhook extension, you can do many extra activities that Rossum application does not do by default, for example validating the extracted vendor data against your database to match the correct vendor. We have published a sample vendor matching webhook that you can use on your Rossum account, set up and deploy all by yourself. Let's have a look at how to do it.

382

However we would first encourage you to check out our own data matching extension.

1. Set up a PostgreSQL database

To set up a PostgreSQL database, you may need to first download and install a management tool such as pgAdmin. Using this tool, create a database that your webhook will use to match the vendor data.

As the sample vendor matching webhook code uses a fuzzy matching trigram extension, you must call the extension before running the code. After you have created the database, run the following query once:

CREATE EXTENSION IF NOT EXISTS pg_trgm;

This will initialize the trigram functionality that is used in the webhook code.

2. Set up the microservice

Set up the microservice, install the required dependencies using command line:

$ sudo apt install python3-pip
$ pip3 install -r requirements.txt

To allow the webhook to communicate with your PostgreSQL database, edit the access credentials stored in config.py and ~/.pgpass file.

📘

Using .pgpass file

.pgpass file shall be added manually to the same level where webhook.py is located. The file should contain credentials to your database in the following format:
your_host:your_port:db_name:username:password

There is no need to add the password to the database to config.py script. psygopg2 will automatically look for the password in this file.

3. Fill the database with the vendor data

You can use the data stored in supportive_data folder to fill your database for testing purposes. To import the testing vendor data to database, run:

$ python3 import_vendor_data.py supportive_data/vendor_data_de.csv

4. Add datapoints for matching to your schema

To see the matching happening, you must configure the schema appropriately. Update the schema for the webhook to work, using the example schema file example_schema.json in the GitHub repository. You can change the schema using the Schema Editor in the Rossum UI.

5. Run the microservice

To run the webhook, proceed with steps 1-4 as described in this article.