Affinda · Arazzo Workflow

Affinda Parse and Reject a Document

Version 1.0.0

Upload a document, wait for parsing, inspect the result, then branch to reject or confirm it.

1 workflow 1 source API 1 provider
View Spec View on GitHub AIArtificial IntelligenceDocument ProcessingIntelligent Document ProcessingIDPOCRResume ParsingInvoice ParsingReceipt ParsingDocument ExtractionDocument ClassificationDocument SplittingRecruitmentBankingInsuranceLogisticsHealthcareGovernmentArazzoWorkflows

Provider

affinda

Workflows

parse-and-reject-document
Parse a document then reject it if it failed, otherwise confirm it.
Uploads a file, polls until ready, and branches: failed documents are rejected, successful documents are confirmed.
4 steps inputs: file, workspace outputs: documentIdentifier, isConfirmed, isRejected
1
uploadDocument
createDocument
Upload the file with wait=false so an identifier is returned for polling.
2
pollUntilReady
getDocument
Poll the document until meta.ready becomes true, then branch on whether processing failed.
3
rejectDocument
updateDocument
Reject the document because processing failed.
4
confirmDocument
updateDocument
Confirm the document because processing succeeded.

Source API Descriptions

Arazzo Workflow Specification

affinda-parse-and-reject-document-workflow.yml Raw ↑
arazzo: 1.0.1
info:
  title: Affinda Parse and Reject a Document
  summary: Upload a document, wait for parsing, inspect the result, then branch to reject or confirm it.
  description: >-
    A triage flow that branches on the parse outcome. A document is uploaded and
    polled until ready; if processing failed the document is rejected, otherwise it
    is confirmed. This shows how a pipeline can automatically quarantine documents
    that the AI could not process. Every step spells out its request inline so the
    flow can be read and executed without opening the underlying OpenAPI
    description.
  version: 1.0.0
sourceDescriptions:
- name: affindaV3Api
  url: ../openapi/affinda-v3-openapi.yml
  type: openapi
workflows:
- workflowId: parse-and-reject-document
  summary: Parse a document then reject it if it failed, otherwise confirm it.
  description: >-
    Uploads a file, polls until ready, and branches: failed documents are rejected,
    successful documents are confirmed.
  inputs:
    type: object
    required:
    - workspace
    - file
    properties:
      workspace:
        type: string
        description: The workspace identifier to upload the document into.
      file:
        type: string
        description: The document file contents (binary) to upload.
  steps:
  - stepId: uploadDocument
    description: Upload the file with wait=false so an identifier is returned for polling.
    operationId: createDocument
    requestBody:
      contentType: multipart/form-data
      payload:
        file: $inputs.file
        workspace: $inputs.workspace
        wait: false
    successCriteria:
    - condition: $statusCode == 201
    outputs:
      identifier: $response.body#/meta/identifier
  - stepId: pollUntilReady
    description: >-
      Poll the document until meta.ready becomes true, then branch on whether
      processing failed.
    operationId: getDocument
    parameters:
    - name: identifier
      in: path
      value: $steps.uploadDocument.outputs.identifier
    successCriteria:
    - condition: $statusCode == 200
    - context: $response.body
      condition: $.meta.ready == true
      type: jsonpath
    outputs:
      failed: $response.body#/meta/failed
    onSuccess:
    - name: parseFailed
      type: goto
      stepId: rejectDocument
      criteria:
      - context: $response.body
        condition: $.meta.failed == true
        type: jsonpath
    - name: parseSucceeded
      type: goto
      stepId: confirmDocument
      criteria:
      - context: $response.body
        condition: $.meta.failed == false
        type: jsonpath
  - stepId: rejectDocument
    description: Reject the document because processing failed.
    operationId: updateDocument
    parameters:
    - name: identifier
      in: path
      value: $steps.uploadDocument.outputs.identifier
    requestBody:
      contentType: application/json
      payload:
        isRejected: true
    successCriteria:
    - condition: $statusCode == 200
    outputs:
      isRejected: $response.body#/meta/isRejected
    onSuccess:
    - name: done
      type: end
  - stepId: confirmDocument
    description: Confirm the document because processing succeeded.
    operationId: updateDocument
    parameters:
    - name: identifier
      in: path
      value: $steps.uploadDocument.outputs.identifier
    requestBody:
      contentType: application/json
      payload:
        isConfirmed: true
    successCriteria:
    - condition: $statusCode == 200
    outputs:
      isConfirmed: $response.body#/meta/isConfirmed
  outputs:
    documentIdentifier: $steps.uploadDocument.outputs.identifier
    isRejected: $steps.rejectDocument.outputs.isRejected
    isConfirmed: $steps.confirmDocument.outputs.isConfirmed