Patching and Updating Custom Fields

Custom Fields Overview

  • Field creation: Affinda staff must initially configure custom fields upon customer request. Once created, Affinda support provides a unique field identifier (e.g., pOyjXLCc) for patching
  • Patching: After setup, customers can update custom fields via API or their Affinda web-app account.

Note: Instructions below are only applicable to customers who have custom fields configured for their NextGen Parser.

What customers can see once a custom field has been created

Custom fields, once created, are visible to customers through both the Affinda Web-app's fields panel and the standard API response. In the example API response below, a custom field has been created for "drivers licence number":

Create initial annotation value for custom field(s)

To populate the custom fields, customers can add annotations using the Post Annotations API. Required details include:

  • Document: The unique identifier for the document to be updated.
  • Page Index: Zero-based page number (e.g., page 1 = 0, page 2 = 1).
  • Datapoint: Custom field's unique identifier
  • Raw Value: The exact text as it appears on the document (e.g., "Australia").
  • Parsed Value: The post-processed value (e.g., "AU" for Australia).

Example below:

After successful submission of the annotation request, the response includes an annotation ID (e.g., "id": 176932535). Store this ID for any future updates to the annotation value. The custom field's value is then updated in the document, which can be viewed in the Affinda web application.

Updating annotation value

To update annotation values after initial creation, use the Patch Annotations API. Required details include:

  • Annotation ID: Created after the first document patch. Find it in the Get Document API response under the custom field name, or in the JSON export from the Affinda web app.
  • Document: The unique identifier for the document to be updated.
  • Page Index: Zero-based page number (e.g., page 1 = 0, page 2 = 1).
  • Raw Value: The exact text as it appears on the document (e.g., "Australia").
  • Parsed Value: The post-processed value (e.g., "AU" for Australia).

Example below:

Upon receiving a successful API response, the custom field's value will update to reflect the specified raw and parsed values. This change can be verified in the Affinda web application.