@wmfs/pg-address-matcher

1.6.0 • Public • Published

pg-address-matcher

Tymly Package npm (scoped) CircleCI codecov CodeFactor Dependabot badge Commitizen friendly JavaScript Style Guide license

A package to link two database tables by addresses

Usage

const addressMatch = require('@wmfs/pg-address-matcher')

addressMatch(
    {
     source: {
       schema: 'link_test',
       table: 'food',
       id: 'food_id',
       type: 'bigint'
     },
     target: {
       schema: 'link_test',
       table: 'addressbase',
       id: 'address_id',
       type: 'bigint'
     },
     link: {
       schema: 'link_test_results',
       table: 'food_addressbase',
       map: {
         postcode: {
           source: 'postcode',
           target: 'postcode'
         },
         businessName: {
           source: ['business_name', 'address_line_1'],
           target: ['organisation_name', 'organisation', 'building_name']
         }
       }
     }
    }
)

The package will look at the options and try to match the records from the source table to the records from the target table and assign the id's given in the options to the link table.
The package currently matches on postcode and business name where the column names are indicated in the options provided.

Install

$ npm install pg-address-matcher --save

This package requires the database to have the "fuzzystrmatch" extension for Postgres which is achieved by:

CREATE EXTENSION "fuzzystrmatch";

License

MIT

Package Sidebar

Install

npm i @wmfs/pg-address-matcher

Weekly Downloads

1

Version

1.6.0

License

MIT

Unpacked Size

39.2 kB

Total Files

13

Last publish

Collaborators

  • wmfsbot