address-matcher
v0.0.2
Published
A package to link two database tables by addresses
Downloads
7
Readme
address-matcher
A package to link two database tables by addresses
Usage
const addressMatch = require('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']
}
}
}
},
client,
(err) => {
// Callback
}
)
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 address-matcher --save
This package requires the database to have the "fuzzystrmatch" extension for Postgres which is achieved by:
CREATE EXTENSION "fuzzystrmatch";