- A file upload UI that accepts multiple documents
- A document classification workflow that identifies each document type using AI
- A fan-out extraction pipeline that routes each type to a specialized extractor
- An AI reconciliation step that compares extracted data against application data
- Business rules that flag mismatches (name, address, income)
- A human review task for documents with discrepancies
- A summary generation step that produces a verification report
Architecture overview
The pipeline processes documents in four phases: upload, classify and extract, reconcile, and review. Workflow breakdown:Prerequisites
Before starting, make sure you have:- Access to a FlowX Designer workspace with AI Platform enabled
- Familiarity with creating processes, workflows, and UI flows in FlowX
- A project with the Documents Plugin configured (for file uploads)
Data model
Define the following data model keys in your process. These keys hold the application data submitted by the customer and the results produced by the AI pipeline.Step 1: Build the classification and extraction workflow
Create a workflow namedclassifyAndExtract. This workflow receives a single document file path, classifies the document type, and then routes to the appropriate extraction branch.
This implements the fan-out extraction pattern.
1.1 Add the classification node
Add a Document Understanding node as the first node after the Start node. This node accepts the document file directly and classifies it.classificationResult
1.2 Add the Condition node
Add a Condition node after the Document Understanding node. Configure branches based on thedocument_type value:
UNKNOWN documents. Use a Script node to return a structured error so the parent process can flag the document for manual classification.1.3 Configure type-specific extraction nodes
Each branch contains an Extract Data from File node with a prompt and schema tailored to that document type.- ID card
- Proof of address
- Salary slip
extractedData1.4 Add the End Flow node
Add an End Flow node where all branches converge. Set the body to pass results back to the parent process:Step 2: Build the reconciliation workflow
Create a workflow namedreconcileData. This workflow compares the extracted document data against the applicant’s declared data.
This implements the AI comparison and reconciliation pattern.
2.1 Add the comparison node
Add a Text Understanding node that receives both the extracted data and the application data.${...} references inside it. Pass dynamic values through the Context section instead; the node receives them alongside the instructions.${extraction.classifiedDocs}— the extracted document data${applicant}— the applicant’s declared data
reconciliationResult
2.2 Add the End Flow node
Step 3: Build the summary generation workflow
Create a workflow namedgenerateSummary with a single Text Generation node.
Instructions:
${applicant}— applicant data${extraction.classifiedDocs}— extraction results${reconciliation}— reconciliation results${review.reviewerNotes}— reviewer notes (if any)
summaryReport
End Flow body:
Step 4: Build the BPMN process
Create a process nameddocumentVerify that orchestrates the full pipeline using the workflows you built.
Add a User Task for file upload
- Task name:
Upload documents - Assignment: Assigned to the initiating user
Loop through uploaded documents
classifyAndExtract workflow. Add a Send Message Task node with a Start Integration Workflow action.Input mapping:extraction.classifiedDocs[index].Trigger the reconciliation workflow
reconcileData workflow.Input mapping:reconciliation.Add a business rule for validation
Add the routing gateway
Add the human review task
- Uploaded documents (viewable in a File Preview component)
- Extracted data side-by-side with declared data
- The exception report from reconciliation
- Validation flags from the business rule
- Approve — continue to summary
- Reject — end process with rejection status
- Request re-upload — loop back to the upload step
review.reviewerDecision and any notes in review.reviewerNotes.Trigger the summary generation workflow
generateSummary workflow.Input mapping:summary.Add the End Event
summary.report.Step 5: Build the upload UI
Create a UI Flow with a page for document upload.Create the UI Flow
documentUpload.Add an upload component
- Accept multiple files
- Restrict file types to PDF, JPG, PNG
- Map uploaded file paths to
documents.uploadedFiles
Add applicant data display
applicant. This gives context to the person uploading documents.Add a submit button
Step 6: Build the review UI
Create a second page in the UI Flow for the human review task. The review page should include:Testing
Test classification in isolation
classifyAndExtract workflow and use Run Workflow with a test file. Upload sample documents one at a time and verify the classification output.Test extraction accuracy
- Names are captured correctly (including accented characters)
- Dates are in the expected
YYYY-MM-DDformat - Numeric values (salary, postal code) are accurate
- Null is returned for missing fields (not hallucinated values)
Test reconciliation with known mismatches
- Name variation as
WARNING - Income discrepancy (16%) as
WARNING
Test the business rule
- Expired ID documents
- Missing required document types
- Income discrepancy above 10%
- CRITICAL exceptions from reconciliation
Test the full end-to-end flow
documentVerify process:- Upload three documents (ID, proof of address, salary slip)
- Verify classification and extraction complete
- Check the reconciliation report
- If routed to review, complete the reviewer task
- Verify the summary report is generated
What you learned
In this tutorial, you built a document processing pipeline that demonstrates several key patterns:- Fan-out extraction — classifying documents by type and routing each to a specialized extraction node with tailored prompts and schemas
- AI reconciliation — comparing AI-extracted data against application data with structured exception reports
- Hybrid AI + business rules — combining AI-driven comparison with deterministic validation (expired documents, missing types, income thresholds)
- Human-in-the-loop — routing edge cases to a reviewer while auto-approving clean results
- Workflow composition — building modular workflows for classification, reconciliation, and summary generation, then orchestrating them from a BPMN process

