aws-samples / aws-samples/amazon-textract-idp-cdk-constructs

Is there a way for TextractGenericAsyncSfnTask to use "features" (e.g. FORMS)?

Open
#119 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
33
Forks
14
PR merge metrics
No merged PRs in 30d

Description

Here's a construct:

```
const textractAsyncTask = new TextractGenericAsyncSfnTask(
this,
"TextractAsync",
{
s3OutputBucket: this._outputBucket.bucketName,
textractAPI: 'GENERIC',
s3TempOutputPrefix: s3TempOutputPrefix,
integrationPattern: IntegrationPattern.WAIT_FOR_TASK_TOKEN,
lambdaLogLevel: "DEBUG",
taskTimeout: Timeout.duration(Duration.minutes(2)),
input: TaskInput.fromObject({
Token: JsonPath.taskToken,
ExecutionId: JsonPath.stringAt("$$.Execution.Id"),
Payload: JsonPath.entirePayload,
FeatureTypes: ['TABLES', 'FORMS']
}),
resultPath: "$.textract_result",
}
);
```

Looking at the props:

/** Which Textract API to call
* ALL asynchronous Textract API calls are supported. Valid values are GENERIC | EXPENSE | LENDING.
*
* For GENERIC, when called without features (e. g. FORMS, TABLES, QUERIES, SIGNATURE), StartDetectText is called and only OCR is returned.
* For GENERIC, when called with a feature (e. g. FORMS, TABLES, QUERIES, SIGNATURE), StartAnalyzeDocument is called.
* @default - GENERIC */
readonly textractAPI?: 'GENERIC' | 'EXPENSE' | 'LENDING';

But what "when called with a feature" means? I couldn't find how to configure it via construct props.
Perhaps it should be something else, like "manifest", but that's not defined anywhere in the API. I've tried to look at the lambda functions, and gave up - the code there is not easy to understand

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.