Docparse Scraper Check Node
Allow node based scrapers to query the docparse database see if they should download a bill or not
Installation
npm install docparse-scraper-check-node
Usage
Call the module with your bill number, supplier code, and a cradle db connection to check if a bill should get downloaded or not
var check = ;// get an api object containing login credentials to the docparse servervar checkData = supplierCode: 'HES' billNumber: 'H1268729' db: db // a cradle db connection
The reply in the check callback will be the json data parsed from the docparse api server check request. It should look like as follows:
New Bills
var reply = {
download: true,
message: 'Bill not yet download. Perform download now.',
success: true
}
Existing Bills
var reply = {
download: false,
message: 'Bill already download. Do not download.',
success: true
}
Local Cache
You can also pass in an array with the key billNumbers. If your billNumber appears in this array, the system can avoid a remote api call and return results quicker
var billNumbers =var checkData = supplierCode: 'HES' billNumber: 'bar' billNumbers: 'foo' 'bar' db: db