aws-samples / aws-samples/amazon-textract-response-parser

Error KeyError: 'TABLE_TITLE'

Open
#153 2 comments 0 reactions 1 assignee Claimed by @schadem View on GitHub
bug python
Dominant language
TypeScript
Stars
236
Forks
97
PR merge metrics
No merged PRs in 30d

Description

I run:

```python
j = call_textract(input_document=f"{awspath}/images/{newfile}_table.jpeg", features=[Textract_Features.TABLES])
# the t_doc will be not ordered
t_doc = TDocumentSchema().load(j)
# the ordered_doc has elements ordered by y-coordinate (top to bottom of page)
ordered_doc = order_blocks_by_geo(t_doc)
# send to trp for further processing logic
trp_doc = trp.Document(TDocumentSchema().dump(ordered_doc))
```

And get the following error:

```
File "/var/folders/6t/kcngxw3s50z4zg416dhcckjc0000gn/T/ipykernel_59247/1703830676.py", line 1, in
t_doc = TDocumentSchema().load(j)

File "/Users/olivergiesecke/opt/anaconda3/envs/labelstudioenv/lib/python3.9/site-packages/marshmallow/schema.py", line 719, in load
return self._do_load(

File "/Users/olivergiesecke/opt/anaconda3/envs/labelstudioenv/lib/python3.9/site-packages/marshmallow/schema.py", line 892, in _do_load
result = self._invoke_load_processors(

File "/Users/olivergiesecke/opt/anaconda3/envs/labelstudioenv/lib/python3.9/site-packages/marshmallow/schema.py", line 1090, in _invoke_load_processors
data = self._invoke_processors(

File "/Users/olivergiesecke/opt/anaconda3/envs/labelstudioenv/lib/python3.9/site-packages/marshmallow/schema.py", line 1220, in _invoke_processors
data = processor(data, many=many, **kwargs)

File "/Users/olivergiesecke/opt/anaconda3/envs/labelstudioenv/lib/python3.9/site-packages/trp/trp2.py", line 848, in make_tdocument
return TDocument(**data)

File "", line 14, in __init__

File "/Users/olivergiesecke/opt/anaconda3/envs/labelstudioenv/lib/python3.9/site-packages/trp/trp2.py", line 468, in __post_init__
self._block_id_maps[blk.block_type][blk.id] = blk_i

KeyError: 'TABLE_TITLE'
```

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.