Smart document split (sypht.split)

Add automatic document splitting to workflows.

Split workflows are a BETA feature and subject to change. This guide is under-construction.

How it works

In cases where a single PDF file contains multiple underlying documents, smart-split allows for the automatic detection and segmentation of sub-documents. Even in cases where sub-documents have variable lengths and format.

When a source file is uploaded, it is processed and a corresponding fileId is assigned. The /results/ for the original file will then contain one or more child document fileIds which can be processed futher with the sypht.validate or sypht.extractworkflows.

Getting started

After uploading, invoke the sypht.split workflow

1. Invoke split workflow

POST /workflows/sypht.split/jobs

Request body:

Sample
{
    "inputs":{
        "file_id":":00000000-0000-0000-0000-000000000000"
    }
}

Response:

{
    "job": {
        "id": "", //uuid
        "company_id": "", //uuid
        "created": "2023-03-28T22:36:03.911887",
        "workflow_id": "", //worflowId 
        "inputs": {
            ...
            //key-value pairs of workflow inputs
        },
        "settings": {
            // key-value pair of your sypht settings
            ...
        },
        "usage": null,
        "file_id": "",
        "status": "new",
        "version": 3
    },
    "message_id": "" //uuid
}

2. Collect the split results

GET https://api.sypht.com/result/final/00000000-0000-0000-0000-000000000000

{
    "fileId": "815c63f6-...-f07223d057cb",
    "status": "FINALISED",
    "results": {
        "fields": [
            {
                "name": "components.children",
                "value": [
                    {"file_id": "aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa"},
                    {"file_id": "bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb"}
                ]
            }
        ]
    }
}

3. Invoke workflows on each child document

POST /workflows/sypht.extract/jobs

Request body
{
    "inputs":{
        "file_id":"aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa",
        "product_ids":["ndis-claims:2"]
    }
}

4. Fetch results for child documents

GET /result/final/aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa

Response
{
    "fileId": "aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa",
    "status": "FINALISED",
    "results": {
        "timestamp": "2020-08-20T03:30:09.703Z",
        "fields": [
            {
                "name": "invoice.total",
                "value": "1485.00",
                "confidence": 0.9958282699555642,
                ...
            },
            ...
        ]
    }
}

GET /result/final/bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb

Response
{
    "fileId": "bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb",
    "status": "FINALISED",
    "results": {
        "timestamp": "2020-08-20T03:30:09.703Z",
        "fields": [
            {
                "name": "invoice.total",
                "value": "2485.00",
                "confidence": 0.99582,
                ...
            },
            ...
        ]
    }
}

Limitations, Errors and Recommendations

  • Uploading a document via the v2 upload endpoint avoids any of the downstream errors encountered with the v1 endpoint approach by enfocing page limits on all documents. The default limit is 16 pages but this can be increased by request.

Last updated