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:
| Field | Description | Example |
|---|---|---|
assessor_name | Name of assessor/quoter | "John Smith" |
assessment_date | Date of assessment | "15/07/2026" |
claim_number | Insurance claim reference | "CLM-2024-001" |
vehicle_make | Vehicle manufacturer | "Toyota" |
vehicle_model | Vehicle model | "Camry" |
vehicle_year | Model year | "2020" |
vin | Vehicle Identification Number | "JTDKARFU5L3123456" |
registration | Vehicle registration | "ABC123" |
customer_name | Customer/claimant name | "Jane Doe" |
Breakdown Sections:
The document typically contains three main sections:
- Parts List - Repair parts needed
- Labour - Labor hours and rates
- Sublet Work - External services (painting, glass, etc.)
Line Item Structure:
| Field | Description | Example |
|---|---|---|
description | Item description | "Front Bumper Cover" |
part_number | Manufacturer part number | "52119-06F00" |
quantity | Quantity required | 1 |
unit_price | Unit price ex GST | 450.00 |
total | Line total ex GST | 450.00 |
category | Parts, Labour, or Sublet | "Parts" |
Summary Totals:
| Field | Description |
|---|---|
parts_total | Total parts cost ex GST |
labour_total | Total labour cost ex GST |
sublet_total | Total sublet cost ex GST |
subtotal | Combined subtotal ex GST |
gst | GST amount (10%) |
total | Grand 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/yyyyformat - 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 Type | Handling |
|---|---|
| File download failure | Retry 3 times with 3s delay, then fail |
| PDF conversion error | Fail immediately with error message |
| Claude API error | Fail immediately, log error, no retry |
| JSON parsing error | Fail with parse error details |
| Zoho API error | Log error, no retry |
| Nested structure | Auto-flatten, log normalization |
Environment Configuration
| Environment | Zoho API | API Key |
|---|---|---|
| Development | poc_extract_parts_details | DK6ThON2OyGvTxFkg24phyQ8a |
| Production | po_pdf_extract_details_prod | 1FCKNxWAhzN7yPB7gUnYZTe9O |
:::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:
| Description | Hours | Rate | Total |
|---|---|---|---|
| Remove & Refit Front Bumper | 1.5 | 85.00 | 127.50 |
| Paint Front Bumper | 2.0 | 85.00 | 170.00 |
Sublet Work
External services billed separately:
| Description | Quantity | Unit Price | Total |
|---|---|---|---|
| Windscreen Replacement | 1 | 450.00 | 450.00 |
| Headlight Restoration | 2 | 120.00 | 240.00 |
Parts List
Standard parts breakdown:
| Part | Part Number | Qty | Unit Price | Total |
|---|---|---|---|---|
| Front Bumper Cover | 52119-06F00 | 1 | 450.00 | 450.00 |
| Fog Light LH | 84501-06140 | 1 | 180.00 | 180.00 |
Data Quality Checks
Automatic Validations
-
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
-
Required fields
- Assessor name
- Vehicle details
- At least one line item
-
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 APIpdf2pic- PDF to image conversionsharp- Image processingfs- File system operationsaxios- HTTP client for Zoho API
Best Practices
For Assessment Team
- Export quality matters - Clear, high-resolution PDFs extract better
- Standard formats work best - Common assessment templates have higher accuracy
- Multi-page OK - System handles documents with many pages
- Review extractions - Verify key totals and part numbers in Zoho
For IT/Developers
- Monitor image conversion - Check GraphicsMagick logs for errors
- Watch for nested responses - Flattening logic catches these automatically
- Track API usage - Claude Vision tokens consumed per page
- Test both environments - Dev and prod use same endpoints but different keys
Troubleshooting
| Issue | Cause | Solution |
|---|---|---|
| PDF conversion fails | GraphicsMagick not installed | Verify Docker container has graphicsmagick package |
| Nested structure in response | Claude's interpretation | Auto-flattening handles this (already implemented) |
| Missing line items | Poor PDF quality, complex layout | Request clearer export, higher resolution |
| Incorrect totals | Calculation mismatch in source | Manual review and correction |
| Part numbers in description | No splitting in source | Prompt 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%+
Related Documentation
- Invoice Extraction - Bulk invoice processing
- PO PDF Extraction - Cost Price Report extraction
- Reference: Order Parts Form - Parts data structure
For technical support or issues, contact the development team.