Bulk Testing
Use a bulk testing script to process multiple receipts with Taggun's Data Extraction APIs and export the results to a CSV file.
Overview
The bulk testing script allows you to:
- Process multiple receipt or invoice files in batch
- Extract data fields using Taggun APIs
- Export results to a CSV file
- Handle errors and provide progress feedback
Prerequisites
Node.js
orPython
installed on your system- Valid Taggun API key
- Files in supported formats (PDF, JPG, PNG, GIF, HEIC)
Project Structure
Javascript
bulk-testing-js/
├── package.json
├── index.js
└── receipts/
└── [your receipt files]
Python
bulk-testing-py/
├── index.py
└── receipts/
└── [your receipt files]
Setup
- Download and unzip the project files from here.
- Place your test files in the receipts directory
Javascript
- Install dependencies:
npm install
- Open
index.js
and replace the API key (line 30):
'apikey': '<----ENTER YOUR API KEY HERE---->',
- Also in
index.js
, customise the fields you want to extract by modifying thefields
array (line 46):
// CSV configuration
const fields = [
'filename',
'date.data',
'totalAmount.data',
'totalAmount.currencyCode',
'merchantTaxId.data',
'entities.chileReceiptDetails.documentType.data',
'entities.chileReceiptDetails.documentNumber.data',
'merchantName.data',
'merchantAddress.data',
'merchantState.data',
'merchantCountryCode.data',
'merchantPostalCode.data',
'confidenceLevel',
'entities.productLineItems.data.quantity.data',
'entities.productLineItems.data.name.data',
'entities.productLineItems.data.unitPrice.data',
'entities.productLineItems.data.totalPrice.data'
// Add or remove fields as needed
];
Python
- Install dependencies:
pip install requests requests-toolbelt pandas
- Open
index.py
and replace the API key (line 7):
API_KEY = '<----ENTER YOUR API KEY HERE---->'
- Also in
index.py
, customise the fields you want to extract by modifying thefields
array (line 13):
# CSV configuration
COLUMNS = [
'filename',
'date.data',
'totalAmount.data',
'totalAmount.currencyCode',
'merchantTaxId.data',
'entities.chileReceiptDetails.documentType.data',
'entities.chileReceiptDetails.documentNumber.data',
'merchantName.data',
'merchantAddress.data',
'merchantState.data',
'merchantCountryCode.data',
'merchantPostalCode.data',
'confidenceLevel',
'entities.productLineItems.data.quantity.data',
'entities.productLineItems.data.name.data',
'entities.productLineItems.data.unitPrice.data',
'entities.productLineItems.data.totalPrice.data'
]
Refer to the page Data Fields That Taggun Extracts for available fields.
Usage
- Place your test files in the project directory
- Run the script:
Javascript
node index.js
Python
python index.py
These scripts will:
- Process all receipt files in the directory
- Show progress as it processes each file
- Generate a
data.csv
file with the extracted data
Need Support?
For additional support or to report issues, please refer to our developer documentation or contact support at [email protected].
Updated 8 days ago