Skip to content

Service Fields Object

The service_fields object is a key component in defining the structure and behavior of various data elements within the system. It represents a collection of fields that may be used across different service requests, each with specific configurations for handling tags, values, and aggregation rules.

Service Fields Object
{
    "service_fields": {
        "field_obj_1": {
            "tag_alias": "IdNumber",
            "tag_multiple_values": true,
            "tag_aggregation": null
        },
        "field_obj_2": {
            "tag_alias": "IssueDate",
            "tag_multiple_values": false,
            "tag_aggregation": null
        },
        "field_obj_3": {
            "tag_alias": "PurchaseLine",
            "tag_multiple_values": true,
            "tag_aggregation": {
                "aggregation_fields": [
                    "id_number_3",
                    "id_number_4",
                    "id_number_5"
                ]
            }
        }
    }
}

Each property within the service_fields object correspond to a Field Object:

Field Object

The Field object has three key properties and this structure allows for flexible handling of fields, supporting single or multiple values and providing aggregation options when needed. Below, we break down each property and its use cases.

Schema

Schema: Field Object
Key Type Description
tag_alias string the name of field
tag_multiple_values boolean specify is fields contains multiple occurrences
tag_aggregation object | null an object containing additional data about which field aggregate
Schema: Field Object > tag_aggregation
Key Type Description
aggregation_fields list[string] a list of fields name

Additional Information

About tag_multiple_values

There is a strict connection between tag_multiple_values and how result.entities and result.aggregated_entities are displayed.

In case tag_multiple_values is true, entities predicted with that field will be all added in a list.

{
    ...
    "document_pages": {
        ...
        "entities": {
            ...
            "field_obj_1": []
            ...
        }
        ...
    },
    ...
}

In case tag_multiple_values is false, entities predicted with that field will be collapsed in a object.

{
    ...
    "document_pages": {
        ...
        "entities": {
            ...
            "field_obj_1": {}
            ...
        }
        ...
    },
    ...
}