The Conditional Extraction step allows you to dynamically route documents to different extractors based on variable values available within a workflow execution, including previous step outputs, external data fetches, and run metadata that you provided. This is particularly useful when you need to apply different extraction processors based on known or extracted document characteristics.

Use Cases

Common use cases for conditional extraction include:

  1. Document Content-Based Routing: Route documents to specialized extractors based on previous steps results
  2. Metadata-Driven Routing: Use metadata you send in your API request to determine which extractor to use

Configuration

To configure the Conditional Extraction step, add it to your workflow and click the “Configure” button.

The configuration has two main sections:

1. Variable Selection

First, select the variable that will determine which extractor to use. Hook up the step to previous steps to have these variables available. You can choose from:

  • Variables from previous steps in your workflow
    • Extraction outputs
    • External Data Validation step outputs
    • Classification outputs
  • Metadata fields from your API request

The selected variable’s value will be used to match against your defined routes.

The variable input autocompletes with the variables from previous steps. However, to add a metadata field or an external data validation field, just type the variable name in the input field and select the variable from the dropdown.

2. Extractor Routes

Next, configure the routing logic by defining conditions and their corresponding extractors:

  1. Add Routes: Click “Add Route” to create new conditional paths
  2. Define Values: Enter the variable values that should trigger each route
  3. Select Extractors: Choose which extractor and version should process documents for each condition
  4. Default Route: A default route is always required to handle cases where no conditions match

Example Extraction-Driven Routing Configuration

Here’s an example of how to configure conditional extraction based on a previously extracted field:

Let’s say you have a lot of insurance documents and you want to route them to different extractors based on the provider_name field.

  1. Set the variable to the provider_name field which will be available after you connect the extraction1 step:
extraction1.output.provider_name.value

You can select the extraction1 variable from the dropdown.

  1. Configure routes:
  • If value equals “cigna” → Use Cigna Extractor v1.0
  • If value equals “aetna” → Use Aetna Extractor v1.0
  • Default → Use Generic Insurance Extractor v1.0

  1. Click “Save”

Example Metadata-Driven Routing Configuration

Here’s an example of how to configure conditional extraction based on a metadata field:

  1. Set the variable to the metadata field provider_name which you would send in your API request:
metadata.provider_name
  1. Configure routes:
  • If value equals “cigna” → Use Cigna Extractor v1.0
  • If value equals “aetna” → Use Aetna Extractor v1.0
  • Default → Use Generic Insurance Extractor v1.0

  1. Click “Save”