From 7462e38f471db0ce98854c904116add6b7c5a3ca Mon Sep 17 00:00:00 2001 From: AWS <> Date: Mon, 26 Jul 2021 18:05:58 +0000 Subject: [PATCH] Amazon Textract Update: Adds support for AnalyzeExpense, a new API to extract relevant data such as contact information, items purchased, and vendor name, from almost any invoice or receipt without the need for any templates or configuration. --- .../feature-AmazonTextract-88c3a99.json | 6 + .../codegen-resources/service-2.json | 157 +++++++++++++++++- 2 files changed, 159 insertions(+), 4 deletions(-) create mode 100644 .changes/next-release/feature-AmazonTextract-88c3a99.json diff --git a/.changes/next-release/feature-AmazonTextract-88c3a99.json b/.changes/next-release/feature-AmazonTextract-88c3a99.json new file mode 100644 index 000000000000..a13b38366736 --- /dev/null +++ b/.changes/next-release/feature-AmazonTextract-88c3a99.json @@ -0,0 +1,6 @@ +{ + "type": "feature", + "category": "Amazon Textract", + "contributor": "", + "description": "Adds support for AnalyzeExpense, a new API to extract relevant data such as contact information, items purchased, and vendor name, from almost any invoice or receipt without the need for any templates or configuration." +} diff --git a/services/textract/src/main/resources/codegen-resources/service-2.json b/services/textract/src/main/resources/codegen-resources/service-2.json index 9b070d759948..2d52315cb159 100644 --- a/services/textract/src/main/resources/codegen-resources/service-2.json +++ b/services/textract/src/main/resources/codegen-resources/service-2.json @@ -34,6 +34,27 @@ ], "documentation":"

Analyzes an input document for relationships between detected items.

The types of information returned are as follows:

Selection elements such as check boxes and option buttons (radio buttons) can be detected in form data and in tables. A SELECTION_ELEMENT Block object contains information about a selection element, including the selection status.

You can choose which type of analysis to perform by specifying the FeatureTypes list.

The output is returned in a list of Block objects.

AnalyzeDocument is a synchronous operation. To analyze documents asynchronously, use StartDocumentAnalysis.

For more information, see Document Text Analysis.

" }, + "AnalyzeExpense":{ + "name":"AnalyzeExpense", + "http":{ + "method":"POST", + "requestUri":"/" + }, + "input":{"shape":"AnalyzeExpenseRequest"}, + "output":{"shape":"AnalyzeExpenseResponse"}, + "errors":[ + {"shape":"InvalidParameterException"}, + {"shape":"InvalidS3ObjectException"}, + {"shape":"UnsupportedDocumentException"}, + {"shape":"DocumentTooLargeException"}, + {"shape":"BadDocumentException"}, + {"shape":"AccessDeniedException"}, + {"shape":"ProvisionedThroughputExceededException"}, + {"shape":"InternalServerError"}, + {"shape":"ThrottlingException"} + ], + "documentation":"

Analyzes an input document for financially related relationships between text.

Information is returned as ExpenseDocuments and seperated as follows.

" + }, "DetectDocumentText":{ "name":"DetectDocumentText", "http":{ @@ -70,7 +91,8 @@ {"shape":"InvalidJobIdException"}, {"shape":"InternalServerError"}, {"shape":"ThrottlingException"}, - {"shape":"InvalidS3ObjectException"} + {"shape":"InvalidS3ObjectException"}, + {"shape":"InvalidKMSKeyException"} ], "documentation":"

Gets the results for an Amazon Textract asynchronous operation that analyzes text in a document.

You start asynchronous text analysis by calling StartDocumentAnalysis, which returns a job identifier (JobId). When the text analysis operation finishes, Amazon Textract publishes a completion status to the Amazon Simple Notification Service (Amazon SNS) topic that's registered in the initial call to StartDocumentAnalysis. To get the results of the text-detection operation, first check that the status value published to the Amazon SNS topic is SUCCEEDED. If so, call GetDocumentAnalysis, and pass the job identifier (JobId) from the initial call to StartDocumentAnalysis.

GetDocumentAnalysis returns an array of Block objects. The following types of information are returned:

Selection elements such as check boxes and option buttons (radio buttons) can be detected in form data and in tables. A SELECTION_ELEMENT Block object contains information about a selection element, including the selection status.

Use the MaxResults parameter to limit the number of blocks that are returned. If there are more results than specified in MaxResults, the value of NextToken in the operation response contains a pagination token for getting the next set of results. To get the next page of results, call GetDocumentAnalysis, and populate the NextToken request parameter with the token value that's returned from the previous call to GetDocumentAnalysis.

For more information, see Document Text Analysis.

" }, @@ -89,7 +111,8 @@ {"shape":"InvalidJobIdException"}, {"shape":"InternalServerError"}, {"shape":"ThrottlingException"}, - {"shape":"InvalidS3ObjectException"} + {"shape":"InvalidS3ObjectException"}, + {"shape":"InvalidKMSKeyException"} ], "documentation":"

Gets the results for an Amazon Textract asynchronous operation that detects text in a document. Amazon Textract can detect lines of text and the words that make up a line of text.

You start asynchronous text detection by calling StartDocumentTextDetection, which returns a job identifier (JobId). When the text detection operation finishes, Amazon Textract publishes a completion status to the Amazon Simple Notification Service (Amazon SNS) topic that's registered in the initial call to StartDocumentTextDetection. To get the results of the text-detection operation, first check that the status value published to the Amazon SNS topic is SUCCEEDED. If so, call GetDocumentTextDetection, and pass the job identifier (JobId) from the initial call to StartDocumentTextDetection.

GetDocumentTextDetection returns an array of Block objects.

Each document page has as an associated Block of type PAGE. Each PAGE Block object is the parent of LINE Block objects that represent the lines of detected text on a page. A LINE Block object is a parent for each word that makes up the line. Words are represented by Block objects of type WORD.

Use the MaxResults parameter to limit the number of blocks that are returned. If there are more results than specified in MaxResults, the value of NextToken in the operation response contains a pagination token for getting the next set of results. To get the next page of results, call GetDocumentTextDetection, and populate the NextToken request parameter with the token value that's returned from the previous call to GetDocumentTextDetection.

For more information, see Document Text Detection.

" }, @@ -192,6 +215,23 @@ } } }, + "AnalyzeExpenseRequest":{ + "type":"structure", + "required":["Document"], + "members":{ + "Document":{"shape":"Document"} + } + }, + "AnalyzeExpenseResponse":{ + "type":"structure", + "members":{ + "DocumentMetadata":{"shape":"DocumentMetadata"}, + "ExpenseDocuments":{ + "shape":"ExpenseDocumentList", + "documentation":"

The expenses detected by Amazon Textract.

" + } + } + }, "BadDocumentException":{ "type":"structure", "members":{ @@ -397,6 +437,83 @@ "member":{"shape":"EntityType"} }, "ErrorCode":{"type":"string"}, + "ExpenseDetection":{ + "type":"structure", + "members":{ + "Text":{ + "shape":"String", + "documentation":"

The word or line of text recognized by Amazon Textract

" + }, + "Geometry":{"shape":"Geometry"}, + "Confidence":{ + "shape":"Percent", + "documentation":"

The confidence in detection, as a percentage

" + } + }, + "documentation":"

An object used to store information about the Value or Label detected by Amazon Textract.

" + }, + "ExpenseDocument":{ + "type":"structure", + "members":{ + "ExpenseIndex":{ + "shape":"UInteger", + "documentation":"

Denotes which invoice or receipt in the document the information is coming from. First document will be 1, the second 2, and so on.

" + }, + "SummaryFields":{ + "shape":"ExpenseFieldList", + "documentation":"

Any information found outside of a table by Amazon Textract.

" + }, + "LineItemGroups":{ + "shape":"LineItemGroupList", + "documentation":"

Information detected on each table of a document, seperated into LineItems.

" + } + }, + "documentation":"

The structure holding all the information returned by AnalyzeExpense

" + }, + "ExpenseDocumentList":{ + "type":"list", + "member":{"shape":"ExpenseDocument"} + }, + "ExpenseField":{ + "type":"structure", + "members":{ + "Type":{ + "shape":"ExpenseType", + "documentation":"

The implied label of a detected element. Present alongside LabelDetection for explicit elements.

" + }, + "LabelDetection":{ + "shape":"ExpenseDetection", + "documentation":"

The explicitly stated label of a detected element.

" + }, + "ValueDetection":{ + "shape":"ExpenseDetection", + "documentation":"

The value of a detected element. Present in explicit and implicit elements.

" + }, + "PageNumber":{ + "shape":"UInteger", + "documentation":"

The page number the value was detected on.

" + } + }, + "documentation":"

Breakdown of detected information, seperated into the catagories Type, LableDetection, and ValueDetection

" + }, + "ExpenseFieldList":{ + "type":"list", + "member":{"shape":"ExpenseField"} + }, + "ExpenseType":{ + "type":"structure", + "members":{ + "Text":{ + "shape":"String", + "documentation":"

The word or line of text detected by Amazon Textract.

" + }, + "Confidence":{ + "shape":"Percent", + "documentation":"

The confidence of accuracy, as a percentage.

" + } + }, + "documentation":"

An object used to store information about the Type detected by Amazon Textract.

" + }, "FeatureType":{ "type":"string", "enum":[ @@ -705,6 +822,38 @@ "documentation":"

An Amazon Textract service limit was exceeded. For example, if you start too many asynchronous jobs concurrently, calls to start operations (StartDocumentTextDetection, for example) raise a LimitExceededException exception (HTTP status code: 400) until the number of concurrently running jobs is below the Amazon Textract service limit.

", "exception":true }, + "LineItemFields":{ + "type":"structure", + "members":{ + "LineItemExpenseFields":{ + "shape":"ExpenseFieldList", + "documentation":"

ExpenseFields used to show information from detected lines on a table.

" + } + }, + "documentation":"

A structure that holds information about the different lines found in a document's tables.

" + }, + "LineItemGroup":{ + "type":"structure", + "members":{ + "LineItemGroupIndex":{ + "shape":"UInteger", + "documentation":"

The number used to identify a specific table in a document. The first table encountered will have a LineItemGroupIndex of 1, the second 2, etc.

" + }, + "LineItems":{ + "shape":"LineItemList", + "documentation":"

The breakdown of information on a particular line of a table.

" + } + }, + "documentation":"

A grouping of tables which contain LineItems, with each table identified by the table's LineItemGroupIndex.

" + }, + "LineItemGroupList":{ + "type":"list", + "member":{"shape":"LineItemGroup"} + }, + "LineItemList":{ + "type":"list", + "member":{"shape":"LineItemFields"} + }, "MaxResults":{ "type":"integer", "min":1 @@ -744,7 +893,7 @@ "documentation":"

The prefix of the object key that the output will be saved to. When not enabled, the prefix will be “textract_output\".

" } }, - "documentation":"

Sets whether or not your output will go to a user created bucket. Used to set the name of the bucket, and the prefix on the output file.

" + "documentation":"

Sets whether or not your output will go to a user created bucket. Used to set the name of the bucket, and the prefix on the output file.

OutputConfig is an optional parameter which lets you adjust where your output will be placed. By default, Amazon Textract will store the results internally and can only be accessed by the Get API operations. With OutputConfig enabled, you can set the name of the bucket the output will be sent to and the file prefix of the results where you can download your results. Additionally, you can set the KMSKeyID parameter to a customer master key (CMK) to encrypt your output. Without this parameter set Amazon Textract will encrypt server-side using the AWS managed CMK for Amazon S3.

Decryption of Customer Content is necessary for processing of the documents by Amazon Textract. If your account is opted out under an AI services opt out policy then all unencrypted Customer Content is immediately and permanently deleted after the Customer Content has been processed by the service. No copy of of the output is retained by Amazon Textract. For information about how to opt out, see Managing AI services opt-out policy.

For more information on data privacy, see the Data Privacy FAQ.

" }, "Pages":{ "type":"list", @@ -829,7 +978,7 @@ "members":{ "Bucket":{ "shape":"S3Bucket", - "documentation":"

The name of the S3 bucket.

" + "documentation":"

The name of the S3 bucket. Note that the # character is not valid in the file name.

" }, "Name":{ "shape":"S3ObjectName",