start_document_analysis
¶
start_document_analysis(
document_location: DocumentLocation,
feature_types: FeatureTypes,
*,
config_overrides: Optional[TextractClientConfig] = None,
client_request_token: Optional[ClientRequestToken] = None,
job_tag: Optional[JobTag] = None,
notification_channel: Optional[NotificationChannel] = None,
output_config: Optional[OutputConfig] = None,
kms_key_id: Optional[KMSKeyId] = None,
queries_config: Optional[QueriesConfig] = None,
adapters_config: Optional[AdaptersConfig] = None,
) -> StartDocumentAnalysisResponse
Starts the asynchronous analysis of an input document for relationships between detected items such as key-value pairs, tables, and selection elements.
StartDocumentAnalysis can analyze text in documents that are in JPEG, PNG, TIFF, and PDF format. The documents are stored in an Amazon S3 bucket. Use DocumentLocation to specify the bucket name and file name of the document.
StartDocumentAnalysis returns a job identifier (JobId) that you use to get the results of the operation. When text analysis is finished, Amazon Textract publishes a completion status to the Amazon Simple Notification Service (Amazon SNS) topic that you specify in NotificationChannel. To get the results of the text analysis 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.
For more information, see Document Text Analysis.
Parameters:
-
document_location(DocumentLocation) –The location of the document to be processed.
-
feature_types(FeatureTypes) –A list of the types of analysis to perform. Add TABLES to the list to return information about the tables that are detected in the input document. Add FORMS to return detected form data. To perform both types of analysis, add TABLES and FORMS to
FeatureTypes. All lines and words detected in the document are included in the response (including text that isn't related to the value ofFeatureTypes). -
client_request_token(Optional[ClientRequestToken], default:None) –The idempotent token that you use to identify the start request. If you use the same token with multiple
StartDocumentAnalysisrequests, the sameJobIdis returned. UseClientRequestTokento prevent the same job from being accidentally started more than once. For more information, see Calling Amazon Textract Asynchronous Operations. -
job_tag(Optional[JobTag], default:None) –An identifier that you specify that's included in the completion notification published to the Amazon SNS topic. For example, you can use
JobTagto identify the type of document that the completion notification corresponds to (such as a tax form or a receipt). -
notification_channel(Optional[NotificationChannel], default:None) –The Amazon SNS topic ARN that you want Amazon Textract to publish the completion status of the operation to.
-
output_config(Optional[OutputConfig], default:None) –Sets if the output will go to a customer defined bucket. By default, Amazon Textract will save the results internally to be accessed by the GetDocumentAnalysis operation.
-
kms_key_id(Optional[KMSKeyId], default:None) –The KMS key used to encrypt the inference results. This can be in either Key ID or Key Alias format. When a KMS key is provided, the KMS key will be used for server-side encryption of the objects in the customer bucket. When this parameter is not enabled, the result will be encrypted server side,using SSE-S3.
-
adapters_config(Optional[AdaptersConfig], default:None) –Specifies the adapter to be used when analyzing a document.
Raises:
-
AccessDeniedException–You aren't authorized to perform the action. Use the Amazon Resource Name (ARN) of an authorized user or IAM role to perform the operation.
-
BadDocumentException–Amazon Textract isn't able to read the document. For more information on the document limits in Amazon Textract, see Hard limits.
-
DocumentTooLargeException–The document can't be processed because it's too large. The maximum document size for synchronous operations 10 MB. The maximum document size for asynchronous operations is 500 MB for PDF files.
-
IdempotentParameterMismatchException–A
ClientRequestTokeninput parameter was reused with an operation, but at least one of the other input parameters is different from the previous call to the operation. -
InternalServerError–Amazon Textract experienced a service issue. Try your call again.
-
InvalidKMSKeyException–Indicates you do not have decrypt permissions with the KMS key entered, or the KMS key was entered incorrectly.
-
InvalidParameterException–An input parameter violated a constraint. For example, in synchronous operations, an
InvalidParameterExceptionexception occurs when neither of theS3ObjectorBytesvalues are supplied in theDocumentrequest parameter. Validate your parameter before calling the API operation again. -
InvalidS3ObjectException–Amazon Textract is unable to access the S3 object that's specified in the request. for more information, Configure Access to Amazon S3 For troubleshooting information, see Troubleshooting Amazon S3
-
LimitExceededException–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. -
ProvisionedThroughputExceededException–The number of requests exceeded your throughput limit. If you want to increase this limit, contact Amazon Textract.
-
ThrottlingException–Amazon Textract is temporarily unable to process the request. Try your call again.
-
UnsupportedDocumentException–The format of the input document isn't supported. Documents for operations can be in PNG, JPEG, PDF, or TIFF format.
-
UnknownServiceError–The service returned an error code this client does not model.
Source code in docs_src/capo_textract/_services/textract.py
1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 | |