@wmfs/pg-address-matcher
v1.6.0
Published
A package to link two database tables by addresses
Downloads
4
Maintainers
Readme
pg-address-matcher
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";