Skip to main content

Parts and Sublet List Extraction

Automated extraction of repair assessment data from Parts and Sublet List PDFs using Claude AI Vision.

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


Overview

The Parts Assessment extraction workflow processes Parts and Sublet List documents generated by assessment/quoting systems. These documents detail parts needed for vehicle repairs, including labor, sublet work, and parts breakdowns.

What It Extracts

Header Fields:

FieldDescriptionExample
assessor_nameName of assessor/quoter"John Smith"
assessment_dateDate of assessment"15/07/2026"
claim_numberInsurance claim reference"CLM-2024-001"
vehicle_makeVehicle manufacturer"Toyota"
vehicle_modelVehicle model"Camry"
vehicle_yearModel year"2020"
vinVehicle Identification Number"JTDKARFU5L3123456"
registrationVehicle registration"ABC123"
customer_nameCustomer/claimant name"Jane Doe"

Breakdown Sections:

The document typically contains three main sections:

  1. Parts List - Repair parts needed
  2. Labour - Labor hours and rates
  3. Sublet Work - External services (painting, glass, etc.)

Line Item Structure:

FieldDescriptionExample
descriptionItem description"Front Bumper Cover"
part_numberManufacturer part number"52119-06F00"
quantityQuantity required1
unit_priceUnit price ex GST450.00
totalLine total ex GST450.00
categoryParts, Labour, or Sublet"Parts"

Summary Totals:

FieldDescription
parts_totalTotal parts cost ex GST
labour_totalTotal labour cost ex GST
sublet_totalTotal sublet cost ex GST
subtotalCombined subtotal ex GST
gstGST amount (10%)
totalGrand total inc GST

Process Flow

graph TD
A[User uploads Assessment PDF] --> B[Zoho Creator webhook triggers]
B --> C[Server: Download PDF]
C --> D[Convert PDF to images]
D --> E[Extract with Claude Vision]
E --> F[Parse and validate JSON]
F --> G[Normalize nested structures]
G --> H[Send to Zoho API]
H --> I[Zoho creates/updates record]
I --> J[Complete]

Step-by-Step Process

1. File Upload & Trigger

Who: Assessors, Quoters, Parts team Where: Zoho Creator → Parts Assessment upload form What happens:

  • User uploads Parts and Sublet List 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/partsassessment-{timestamp}/
  • Retry mechanism: 3 attempts with 3-second intervals

:::info Download Retry Only File downloads retry automatically (3 attempts, 3s delay). Claude AI and Zoho API calls do NOT retry - if they fail, manual intervention is required. :::

3. PDF to Image Conversion

Technology: pdf2pic + GraphicsMagick What happens:

  • PDF split into individual page images (PNG format)
  • High-resolution conversion for optimal Vision AI accuracy
  • All pages converted (multi-page documents supported)
  • Output: Array of page images in temp/{job_id}/pages/

Why images instead of direct PDF? Parts and Sublet Lists often have complex formatting, tables, and visual layouts. Image-based extraction provides better accuracy for these structured documents.

4. Data Extraction (Claude Vision)

Model: Claude Opus 4 (Anthropic) Input: Array of page images (base64-encoded) What happens:

  • All page images sent in single API call
  • Claude Vision analyzes entire document layout
  • Extracts header, parts list, labour, sublet sections
  • Returns structured JSON

Prompt engineering:

  • Australian assessment format handling
  • Part number extraction from descriptions
  • Labour rate and hours parsing
  • Sublet work identification
  • Multi-page document handling

5. Response Normalization

Challenge: Claude may return nested structures

Sometimes Claude returns nested objects like:

{
"header": {
"assessor_name": "John Smith",
"claim_number": "CLM-001"
},
"vehicle": {
"make": "Toyota",
"model": "Camry"
},
"parts": [...]
}

Solution: Automatic flattening

// Flatten nested header
if (extractedData.header && typeof extractedData.header === 'object') {
const { header, ...rest } = extractedData;
extractedData = { ...header, ...rest };
}

// Flatten nested vehicle
if (extractedData.vehicle && typeof extractedData.vehicle === 'object') {
const { vehicle, ...rest } = extractedData;
extractedData = { ...vehicle, ...rest };
}

Result: Flat structure expected by Zoho API

6. JSON Parsing & Validation

What happens:

  • Claude response may be wrapped in markdown code blocks:
    ```json
    { ... }
    ```
  • Server strips markdown wrappers
  • Parses JSON
  • Validates required fields
  • Checks data types

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 fields...}"
}

No retry mechanism - single attempt

8. Response & Cleanup

What happens:

  • Zoho processes extracted data
  • Updates assessment upload record
  • Server cleans up temporary files and images
  • Returns success/failure status

Extraction Prompt Details

The Parts Assessment prompt instructs Claude to:

Document Structure Recognition

  • Identify header section (top of first page)
  • Locate Parts list table
  • Find Labour section
  • Identify Sublet work section
  • Extract summary totals (bottom of document)

Part Number Handling

Similar to PO PDF extraction, part numbers may be embedded in descriptions:

"Front Bumper Cover 52119-06F00"
└─ Description ─┘ └─ Part Number ─┘

Extraction should split into:

  • description: "Front Bumper Cover"
  • part_number: "52119-06F00"

Date Formatting

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

Numeric Values

  • Remove currency symbols ($, AUD)
  • Parse as decimal numbers
  • GST = 10% of subtotal
  • Validate totals match sum of line items

Multi-Page Handling

  • Extract all pages
  • Continuation tables across pages
  • Maintain correct item sequence

Error Handling

Error TypeHandling
File download failureRetry 3 times with 3s delay, then fail
PDF conversion errorFail immediately with error message
Claude API errorFail immediately, log error, no retry
JSON parsing errorFail with parse error details
Zoho API errorLog error, no retry
Nested structureAuto-flatten, log normalization

Environment Configuration

EnvironmentZoho APIAPI Key
Developmentpoc_extract_parts_detailsDK6ThON2OyGvTxFkg24phyQ8a
Productionpo_pdf_extract_details_prod1FCKNxWAhzN7yPB7gUnYZTe9O

:::info Shared API Endpoints Parts Assessment and PO PDF extraction use the same Zoho API endpoints. The system differentiates between them based on the upload form used. :::


Common Data Patterns

Labour Line Items

Labour is typically broken down by operation:

DescriptionHoursRateTotal
Remove & Refit Front Bumper1.585.00127.50
Paint Front Bumper2.085.00170.00

Sublet Work

External services billed separately:

DescriptionQuantityUnit PriceTotal
Windscreen Replacement1450.00450.00
Headlight Restoration2120.00240.00

Parts List

Standard parts breakdown:

PartPart NumberQtyUnit PriceTotal
Front Bumper Cover52119-06F001450.00450.00
Fog Light LH84501-061401180.00180.00

Data Quality Checks

Automatic Validations

  1. Total reconciliation

    • Parts total = sum of parts lines
    • Labour total = sum of labour lines
    • Sublet total = sum of sublet lines
    • Subtotal = parts + labour + sublet
    • GST = subtotal × 0.10
    • Total = subtotal + GST
  2. Required fields

    • Assessor name
    • Vehicle details
    • At least one line item
  3. Field formats

    • Dates: dd/MM/yyyy
    • VIN: 17 characters (if present)
    • Numbers: valid decimals

Technical Details

Processing method: Image-based Vision AI extraction Model: Claude Opus 4 (Anthropic) Max tokens: 16,000 Image format: PNG (high resolution) Timeout: 30 seconds per document

Dependencies:

  • @anthropic-ai/sdk - Claude AI Vision API
  • pdf2pic - PDF to image conversion
  • sharp - Image processing
  • fs - File system operations
  • axios - HTTP client for Zoho API

Best Practices

For Assessment Team

  1. Export quality matters - Clear, high-resolution PDFs extract better
  2. Standard formats work best - Common assessment templates have higher accuracy
  3. Multi-page OK - System handles documents with many pages
  4. Review extractions - Verify key totals and part numbers in Zoho

For IT/Developers

  1. Monitor image conversion - Check GraphicsMagick logs for errors
  2. Watch for nested responses - Flattening logic catches these automatically
  3. Track API usage - Claude Vision tokens consumed per page
  4. Test both environments - Dev and prod use same endpoints but different keys

Troubleshooting

IssueCauseSolution
PDF conversion failsGraphicsMagick not installedVerify Docker container has graphicsmagick package
Nested structure in responseClaude's interpretationAuto-flattening handles this (already implemented)
Missing line itemsPoor PDF quality, complex layoutRequest clearer export, higher resolution
Incorrect totalsCalculation mismatch in sourceManual review and correction
Part numbers in descriptionNo splitting in sourcePrompt instructs separation, may need manual cleanup

Performance Metrics

Average processing times:

  • 1-page document: ~30 seconds
  • 3-page document: ~60 seconds
  • 5+ page document: ~90 seconds

Accuracy expectations:

  • Header extraction: 95%+
  • Line item extraction: 90%+
  • Total calculation: 98%+


For technical support or issues, contact the development team.