Skip to content

Fix get_cells_by_type returning only COLUMN_HEADER cells - #457

Merged
Belval merged 1 commit into
masterfrom
fix-206-get-cells-by-type
Aug 6, 2026
Merged

Belval merged 1 commit into
masterfrom
fix-206-get-cells-by-type

Conversation

@Belval

@Belval Belval commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

TableCell._update_response_metadata compared the Textract EntityTypes against incorrect string literals for every type except COLUMN_HEADER: 'SECTION_TITLE', 'SUMMARY_CELL', 'FLOATING_TITLE' and 'FLOATING_FOOTER'. Textract actually emits 'TABLE_SECTION_TITLE', 'TABLE_SUMMARY', 'TABLE_TITLE' and 'TABLE_FOOTER' (the same strings the response parser already uses to set is_section_title / is_summary / is_title / is_footer on the cell). As a result the isSectionTitleCell / isSummaryCell / isTitleCell / isFooterCell metadata flags were always False and Table.get_cells_by_type() returned an empty result for those four types.

Use the shared constants (TABLE_SECTION_TITLE, TABLE_SUMMARY, TABLE_TITLE, TABLE_FOOTER, TABLE_COLUMN_HEADER, MERGED_CELL) instead of raw literals so the comparison stays consistent with the parser and cannot drift again. Also update the now-inaccurate get_cells_by_type docstring which claimed only COLUMN_HEADER was supported.

NOTE: this changes observable output - get_cells_by_type() now returns cells for SECTION_TITLE / SUMMARY_CELL / FLOATING_TITLE / FLOATING_FOOTER where it previously returned nothing.

Closes #206

TableCell._update_response_metadata compared the Textract EntityTypes
against incorrect string literals for every type except COLUMN_HEADER:
'SECTION_TITLE', 'SUMMARY_CELL', 'FLOATING_TITLE' and 'FLOATING_FOOTER'.
Textract actually emits 'TABLE_SECTION_TITLE', 'TABLE_SUMMARY',
'TABLE_TITLE' and 'TABLE_FOOTER' (the same strings the response parser
already uses to set is_section_title / is_summary / is_title / is_footer
on the cell). As a result the isSectionTitleCell / isSummaryCell /
isTitleCell / isFooterCell metadata flags were always False and
Table.get_cells_by_type() returned an empty result for those four types.

Use the shared constants (TABLE_SECTION_TITLE, TABLE_SUMMARY, TABLE_TITLE,
TABLE_FOOTER, TABLE_COLUMN_HEADER, MERGED_CELL) instead of raw literals so
the comparison stays consistent with the parser and cannot drift again.
Also update the now-inaccurate get_cells_by_type docstring which claimed
only COLUMN_HEADER was supported.

NOTE: this changes observable output - get_cells_by_type() now returns
cells for SECTION_TITLE / SUMMARY_CELL / FLOATING_TITLE / FLOATING_FOOTER
where it previously returned nothing.

Closes #206
@Belval
Belval merged commit a6423c1 into master Aug 6, 2026
3 of 4 checks passed
@Belval
Belval deleted the fix-206-get-cells-by-type branch August 6, 2026 15:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Table.get_cells_by_type() only supports column header

1 participant