Skip to content

fix: tesseract centauro#14

Merged
br-monteiro merged 3 commits into
mainfrom
fix/tesseract-centauro
Mar 24, 2026
Merged

fix: tesseract centauro#14
br-monteiro merged 3 commits into
mainfrom
fix/tesseract-centauro

Conversation

@br-monteiro

Copy link
Copy Markdown
Member

This pull request enhances the tesseract_command.py command to support multiple business units (BUs) with different data formats, specifically adding support for the "centauro" BU alongside "fisia". The code now dynamically adapts column headers and data extraction logic based on the BU, and introduces robust mapping functions for each BU's data structure. Comprehensive tests have been added to cover these new behaviors and ensure correctness.

Business unit-specific data handling:

  • Added a data_mapping_by_bu dispatcher in tesseract_command.py to select the appropriate data mapping function (_map_data_for_fisia or _map_data_for_centauro) based on the BU argument. This allows the command to handle different data formats for "fisia" and "centauro".
  • Implemented _map_data_for_fisia and _map_data_for_centauro to extract and normalize product data from their respective input structures, ensuring consistent output regardless of BU.

Dynamic column headers and output:

  • The column header for the second column is now set dynamically: "EXTERNAL_ID" for "fisia" and "EAN" for "centauro", improving clarity for users of different BUs.

Testing enhancements:

  • Added extensive tests in test_tesseract_command.py to verify dynamic column headers, correct data extraction for both BUs, filtering by blocked/unblocked status, totals calculation, and graceful handling of empty or missing data fields.
  • Tests also cover the dispatcher logic and error handling for unsupported BUs.

Documentation updates:

  • Updated test documentation to reflect the new BU-specific logic and data mapping functions.

@br-monteiro br-monteiro self-assigned this Mar 24, 2026
@br-monteiro br-monteiro merged commit 96d54f5 into main Mar 24, 2026
1 check passed
@br-monteiro br-monteiro deleted the fix/tesseract-centauro branch March 24, 2026 14:12
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.

1 participant