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
installed on your system- Valid Taggun API key
- Files in supported formats (PDF, JPG, PNG, GIF, HEIC)
Project Structure
bulk-testing/
├── package.json
├── index.js
├── lib/
│ ├── api.js
│ └── csv.js
└── receipts/
└── [your receipt files]
Setup
- Download and unzip the project files from here: https://drive.google.com/drive/folders/125LLPZbChTgXRk15IffF3D9wRAx2PI5m
- Place your test files in the project directory
- Install dependencies:
npm install
- Open
index.js
and replace the API key (line 30):
const apiKey = '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
];
Refer to the page Data Fields That Taggun Extracts for available fields.
Usage
- Place your test files in the project directory
- Run the script:
npm run start
The script will:
- Process all receipt files in the directory
- Show progress as it processes each file
- Generate a
results.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 12 days ago