Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Update README.md #72

Merged
merged 1 commit into from
May 18, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ For samples on usage, look at [Amazon Textact IDP CDK Stack Samples](https://git

## Input


Expects a Manifest JSON at 'Payload'.
Manifest description: https://pypi.org/project/schadem-tidp-manifest/

Expand All @@ -46,6 +47,48 @@ Example call in Python
result_path="$.textract_result")
```

#### Query Parameter

Example:
```python

input=sfn.TaskInput.from_object({
"Token":
sfn.JsonPath.task_token,
"ExecutionId":
sfn.JsonPath.string_at('$$.Execution.Id'),
"Payload":
sfn.JsonPath.entire_payload,
"Query": [
{
'Text': 'string',
'Alias': 'string',
'Pages': [
'string',
]
},
{
"Text": "What is the name of the realestate company",
"Alias": "APP_COMPANY_NAME"
},
{
"Text": "What is the name of the applicant or the prospective tenant",
"Alias": "APP_APPLICANT_NAME"
},
]
}),

```
Documentation: https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/textract/client/start_document_analysis.html

To add a query parameter to the Manifest JSON, we are going to leverage the 'convert_manifest_queries_config_to_caller'. It transforms a list of Query objects (as indicated by the type hint List[tm.Query]) into a QueriesConfig object (as indicated by the return type tc.QueriesConfig).

The function expects a list of Query objects as input. Each Query object should have the following attributes:
- text (required)
- alias (opt)
- pages (opt)

The function creates a new QueriesConfig object. If the input list is not empty, it creates a list comprehension that generates a new Query object for each Query object in the input list, maintaining the same text, alias, and pages values. If the input list is empty, it simply creates a QueriesConfig object with an empty queries list.


## Output
Expand Down
Loading