Skip to end of banner
Go to start of banner

Submit Transfer Summary on Extractions

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 22 Next »

Transfer Summary is approved or corrected extraction values that are submitted by your application to the extraction system.

You should always submit the summary to be able to measure the extraction quality and let Gini know whether the extracted information is correct. This way we can provide the best possible user experience since it also helps us continuously improve the extraction system and perform valuable data analytics for you.

The transfer summary should only be sent if real users see, approve, correct, and complement the extraction-based data.

Gini employs various machine learning techniques to learn from the transfer summary automatically. Therefore, it is equally important for Gini to receive the summary both on correct and incorrect extractions.


Ways of submitting the transfer summary

There are currently two ways to submit the summary.

The first and the most common one is to submit the complete summary in one request. This is the easiest way if your frontend (application) displays the extractions on a screen in an editable form. A user can modify the extractions before pressing the confirmation button.

The second (rarely used) way is where the final approval signal (button click) is not possible. In such case, send the summary on one label per request.

Types of transfer summaries

  • positive summary (preferred): the extraction was correct and confirmed by the user without modification.

  • complementary summary: the extraction system extracted nothing, for example, the response doesn't contain the requested label. The user manually entered the correct value.

  • negative summary: the extraction was incomplete or erroneous. The user manually corrected the extraction.

  • informative summary: the extraction was changed for another reason, for example, if a line item is returned, the quantity extraction gets summary "0" and a return reason.


The Gini Pay API lets you submit transfer summary on multiple extractions for a single document with a single request. It is strongly recommended that you submit the summary in this way for two reasons. On the one hand, the total number of round trips is reduced to one and the summary is handled internally as a batch. Therefore, the update is more efficient for multiple extractions compared to submitting the summary with each separate request. On the other hand, Gini's machine learning training techniques can benefit from the summary on multiple extractions, since Gini is aware of the fact that single parts of the submitted summary belong together.

Send transfer summary only on those labels that are physically seen by the user. Unseen labels except RA specific “amountsAreConsistent” should be filtered out.

//submitting transfer summary on extractions

    PUT /documents/{id}/extractions/feedback

IMPORTANT! In REST requests, the transfer summary is called feedback. Hence, in the examples below, “feedback” is transfer summary.

Request
Headers

Header

Value

Content-Type

application/vnd.gini.v1+json

Body

Key

Type

Description

extractions

object

transfer summary on atomic extractions.

compoundExtractions

object

transfer summary on compound extractions.

Response

Status Code

Description

204 (No Content)

The transfer summary was successfully processed.

404 (Not Found)

The document or the label could not be found.

406 (Not Acceptable)

The request headers were not set correctly.

422 (Unprocessable Entity)

At least one value was not valid regarding entity validation rules of the label.

Test example

In order to test the integration of the summary functionality, we offer a PDF test document with the expected outcome in a JSON format. This document can be used for an integration test of Gini’s Pay API in general. Furthermore, we provide a query for sending summary where all fields are correct except for the amountToPay. After sending this summary, we show you how to ensure that the summary with your confirmation and correction for the field values was successful.

  • Sending the test document to the Gini Pay API. See Submit Files.

  • Requesting the results. See Retrieve Extractions.

  • You should get a JSON like in the example.

  • Correcting the document with the following JSON. Here we change the amountToPay from "995.00:EUR" to "950.00:EUR" and confirm the other field values (iban, bic, paymentRecipient, paymentReference).

{
  "feedback": {
    "amountToPay": {
      "value": "950.00:EUR"
    },
    "iban": {
      "value": "DE68130300000017850360"
    },
    "bic": {
      "value": "BYLADEM1001"
    },
    "paymentPurpose": {
      "value": "RE-20170512-02"
    },
    "paymentRecipient": {
      "value": "Fahrrad Rückenwind"
    }
  }
}

Below we show a more elaborated example below including the Return Assistant compound extractions (if RA is enabled) in order to explain different types of the transfer summary. The example scenario is as follows: the user uploads a document where the labels amountToPay, paymentReference, iban, discount-addon are extracted. Unfortunately, the label paymentRecipient could not be extracted. Such response to the extractions request is as follows:

The boxes are optional. Boxes should only be sent if your use case visualizes the document with the locations of the extractions. Thus, the user can confirm the correct location of an extraction.

{
  "candidates": {},
  "extractions": {
    "amountToPay": {
      "box": {
        "height": 8.0,
        "left": 545.0,
        "page": 1,
        "top": 586.0,
        "width": 17.0
      },
      "candidates": "amounts",
      "entity": "amount",
      "value": "45.44:EUR"
    },
    "iban": {
      "box": {
        "height": 7.0,
        "left": 447.0,
        "page": 1,
        "top": 746.0,
        "width": 100.0
      },
      "candidates": "ibans",
      "entity": "iban",
      "value": "DE14200800000816170700"
    },
    "paymentReference": {
      "entity": "reference",
      "value": "ReNr 123, KdNr 32"
    },
    "discount-addon": {
      "entity": "amount",
      "value": "-2.51:EUR"
    },
    "amountsAreConsistent": {
      "entity": "text",
      "value": "true"
    }
  },
  "compoundExtractions": {
    "lineItems": [
      {
        "artNumber": {
          "value": "10101",
          "entity": "text"
        },
        "quantity": {
          "value": "2",
          "entity": "numeric"
        },
        "description": {
          "value": "Trocknerbälle, Wolle, 2er",
          "entity": "text"
        },
        "sumGross": {
          "value": "17.98:EUR",
          "entity": "amount"
        }
      },
      {
        "artNumber": {
          "value": "10103",
          "entity": "text"
        },
        "quantity": {
          "value": "3",
          "entity": "numeric"
        },
        "description": {
          "value": "Faltenstopp f. Wäscheständer",
          "entity": "text"
        },
        "sumGross": {
          "value": "29.97:EUR",
          "entity": "amount"
        }
      }
    ]
  }
}

The iban, amountToPay, discount-addon and the lineItems are correct (positive summary). amountsAreConsistent should be always delivered if it exists in the extractions response. The user adds the missing paymentRecipient value (complementary summary) and corrects the paymentReference to "ReNr 1735, KdNr 37" (negative summary). Sets the quantity of one line item to “0” and adds a reason for returning the articles.

Then the resulting transfer summary request to submit is as follows:

{
  "extractions": {
    "amountToPay": {
      "value": "45.44:EUR"
    },
    "iban": {
      "value": "DE14200800000816170700"
    },
    "bic": {
      "value": "BYLADEM1001"
    },
    "paymentPurpose": {
      "value": "RE-20170512-02"
    },
    "paymentRecipient": {
      "value": "Tchibo GmbH"
    },
    "amountsAreConsistent": {
      "entity": "text",
      "value": "true"
    },
    "discount-addon": {
      "entity": "amount",
      "value": "-2.51:EUR"
    }
  },
  "compoundExtractions": {
    "lineItems": [
      {
        "artNumber": {
          "value": "10101"
        },
        "quantity": {
          "value": "0"
        },
        "description": {
          "value": "Trocknerbälle, Wolle, 2er",
          "entity": "text"
        },
        "sumGross": {
          "value": "17.98:EUR",
          "entity": "amount"
        },
        "returnReason": {
          "value": "r3"
        }
      },
      {
        "artNumber": {
          "value": "10103"
        },
        "quantity": {
          "value": "3"
        },
        "description": {
          "value": "Faltenstopp f. Wäscheständer",
          "entity": "text"
        },
        "sumGross": {
          "value": "29.97:EUR",
          "entity": "amount"
        }
      }
    ]
  }
}

Submit transfer summary on invalid extractions

Request

In case an extraction was erroneously found (i.e. not present in the source document), you can delete it by issuing a DELETE request to the extraction URI:

//submitting summary on invalid extractions

    DELETE /documents/{id}/extractions/{label}
Response

Status Code

Description

204 (No Content)

Label removal was successful.

404 (Not Found)

The document or the label could not be found.

  • No labels