Skip to main content

PO PDF Extraction (Cost Price Report)

Automated extraction of parts pricing data from PartsCheck Cost Price Report PDFs using Claude AI.

System: Invoice Extraction Server (Node.js + Claude API) Integration: Zoho Creator → Extraction Server → Zoho Creator Processing time: ~30-60 seconds per PDF


Overview

PartsCheck is a parts ordering system used in the Australian automotive industry. The extraction workflow processes Cost Price Report PDFs generated by PartsCheck, extracting quote details, vehicle information, supplier pricing, and line-item parts data.

What It Extracts

Header Fields:

FieldDescriptionExample
quote_noQuote/order number"16568"
claim_noInsurance claim number"CLM-2024-001"
vehicleMake, Model, Year"Honda, HR-V, 2019"
estimatorName of estimator"Izac"
vinVehicle Identification Number (17 chars)"MRHRU5890LP060773"
dateReport date (dd/MM/yyyy)"03/07/2026"
registration_noVehicle registration/plate"EGC94K"
requested_timeTime requested"9:30am"

Summary/Totals:

FieldDescription
subtotalSubtotal ex GST & freight
freightFreight/shipping charge
gstGST amount
totalTotal including everything

Line Items (Parts Selected for Purchase):

FieldDescriptionExample
part_descriptionPart description (without part number)"HINGE ASY FRT DR RH BG A"
part_numberExtracted part number"F22800"
supplierSupplier name"Australian Automotive Group (City Ford)"
part_typeOEM, AFT, USED, etc."OEM"
expiryQuote expiry date (dd/MM/yyyy)"10/07/2026"
commentAdditional comments"EXTRA"
qtyQuantity ordered1
cost_priceCost price ex GST56.25
sell_priceSell price ex GST75.00

Process Flow

graph TD
A[User uploads PartsCheck PDF] --> B[Zoho Creator webhook triggers]
B --> C[Server: Download PDF]
C --> D[Extract data with Claude AI]
D --> E[Parse and validate JSON]
E --> F[Clean registration number]
F --> G[Send to Zoho API]
G --> H[Zoho creates/updates record]
H --> I[Complete]

Step-by-Step Process

1. File Upload & Trigger

Who: Parts team, Estimators Where: Zoho Creator → PartsCheck upload form What happens:

  • User uploads PartsCheck Cost Price Report PDF
  • Zoho Creator webhook fires with:
    • Record ID (upload_id)
    • File URL
    • Environment (dev/production)

2. PDF Download

System: Invoice Extraction Server What happens:

  • Downloads PDF from Zoho Creator using OAuth token
  • Saves to temporary directory: temp/partscheck-{timestamp}/
  • Retry mechanism: 3 attempts with 3-second intervals

:::info Download Retry File downloads retry automatically up to 3 times with 3-second delays. Claude API and Zoho API calls do NOT retry automatically. :::

3. PDF Direct Extraction (No Image Conversion)

Model: Claude Opus 4 (Anthropic) Input: PDF file sent directly as base64-encoded document What happens:

  • PDF encoded to base64
  • Sent to Claude API using document type (not images)
  • Claude processes entire PDF as a single document
  • Returns structured JSON with all extracted fields

Advantages of direct PDF processing:

  • Faster than image conversion
  • Better text recognition
  • Preserves document structure
  • Handles multi-page PDFs seamlessly

4. Registration Number Cleaning

Special handling for registration field:

PartsCheck PDFs often include the file/claim number appended to the registration:

Registration No: EGC94K - 220265
^^^^^^ ^^^^^^
Rego File#

Cleaning logic:

  • If registration contains a dash followed by numbers, extract ONLY the part before the dash
  • Remove all trailing spaces and special characters
  • Example: "EGC94K - 220265""EGC94K"

:::caution Registration Number Format The extraction prompt specifically instructs Claude to extract only the vehicle registration, excluding any file/claim numbers. This was added after discovering registration numbers were being extracted with file numbers appended. :::

5. Part Number Extraction

Challenge: Part numbers are embedded in descriptions

PartsCheck descriptions include part numbers inline:

"HINGE ASY FRT DR RH BG F22800 A"
└─ Description ──────┘ └─ Part# ─┘

Solution:

  • Claude extracts part number into separate part_number field
  • part_description contains ONLY the description text
  • Part numbers typically alphanumeric: F22800, BG72910-ABC

Examples:

Originalpart_descriptionpart_number
"HINGE ASY FRT DR RH BG F22800 A""HINGE ASY FRT DR RH BG A""F22800"
"BUMPER BAR REAR BG72910-ABC""BUMPER BAR REAR""BG72910-ABC"

6. Data Validation

Checks performed:

  • VIN exactly 17 characters
  • Date format: dd/MM/yyyy
  • Numeric values parsed correctly
  • Registration cleaned of file numbers
  • All line items extracted

7. Send to Zoho API

Endpoint: Custom Zoho Creator API Environment-aware:

  • Development: poc_extract_parts_details
  • Production: po_pdf_extract_details_prod

Payload:

{
"upload_id": "1234567890",
"status": "success",
"extracted_data": "{...JSON string of all extracted fields...}"
}

No retry mechanism - single attempt

8. Response & Cleanup

What happens:

  • Zoho processes extracted data
  • Updates PartsCheck upload record
  • Server cleans up temporary PDF file
  • Returns success/failure status

Prompt Engineering

The PartsCheck extraction uses a specialized prompt that includes:

Date Handling

  • Always convert to dd/MM/yyyy format
  • Handle various date formats from PDF

Numeric Values

  • Remove currency symbols ($, AUD)
  • Parse as decimal numbers
  • Use 0 for missing numeric values

Registration Cleaning Rules

If registration includes dash + numbers:
"EGC94K - 220265" → extract "EGC94K"

Remove trailing spaces and special characters

Part Number Extraction Rules

Part numbers are embedded in descriptions:
"HINGE ASY FRT DR RH BG F22800 A"

Extract part number separately:
part_description: "HINGE ASY FRT DR RH BG A"
part_number: "F22800"

VIN Validation

  • Must be exactly 17 alphanumeric characters
  • Flag if incorrect length

Error Handling

Error TypeHandling
File download failureRetry 3 times with 3s delay, then fail
Claude API errorFail immediately, log error, no retry
JSON parsing errorFail with parse error message
Zoho API errorLog error, no retry

Environment Configuration

EnvironmentZoho APIAPI Key
Developmentpoc_extract_parts_detailsDK6ThON2OyGvTxFkg24phyQ8a
Productionpo_pdf_extract_details_prod1FCKNxWAhzN7yPB7gUnYZTe9O

Common Data Issues

Issue: Registration with File Numbers

Problem:

Registration No: EGC94K - 220265

Solution: Prompt updated July 2026 to extract only EGC94K

Issue: Part Numbers in Description

Problem:

Description: "HINGE ASY FRT DR RH BG F22800 A"

Solution: Extraction splits into:

  • part_description: "HINGE ASY FRT DR RH BG A"
  • part_number: "F22800"

Issue: Missing Freight

Problem: Not all PartsCheck reports include freight charges

Solution: Use null for freight field if not present


Technical Details

Processing method: Direct PDF extraction (not image-based) Model: Claude Opus 4 (Anthropic) Max tokens: 16,000 Timeout: 30 seconds per PDF

Dependencies:

  • @anthropic-ai/sdk - Claude AI API
  • fs - File system operations
  • axios - HTTP client for Zoho API

Best Practices

For Parts Team

  1. Use latest PartsCheck format - Extraction optimized for current format
  2. Ensure registration visible - Check PDF preview before upload
  3. Multi-page OK - System handles multi-page reports
  4. Verify extractions - Review extracted data in Zoho

For IT/Developers

  1. Monitor Claude API usage - Track token consumption
  2. Check registration cleaning - Verify file numbers removed
  3. Validate part number extraction - Ensure descriptions split correctly
  4. Test both environments - Dev and production have different endpoints

Troubleshooting

IssueCauseSolution
Registration includes file numberPrompt not followedPrompt updated July 2026, should be fixed
Part numbers in descriptionNo splitting logicPart number extraction implemented
VIN wrong lengthOCR error, typo in PDFManual correction needed
Missing line itemsPoor PDF qualityRequest clearer export from PartsCheck
Freight always nullNot in PDFExpected if PartsCheck doesn't show freight


For technical support or issues, contact the development team.