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

  1. Node.js installed on your system
  2. Valid Taggun API key
  3. 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

  1. Download and unzip the project files from here: https://drive.google.com/drive/folders/125LLPZbChTgXRk15IffF3D9wRAx2PI5m
  2. Place your test files in the project directory
  3. Install dependencies:
npm install
  1. Open index.js and replace the API key (line 30):
const apiKey = 'YOUR_API_KEY_HERE';
  1. Also in index.js, customise the fields you want to extract by modifying the fields 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

  1. Place your test files in the project directory
  2. Run the script:
npm run start

The script will:

  1. Process all receipt files in the directory
  2. Show progress as it processes each file
  3. 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].