Skip to content

Add canvas zoom and Test Regions admin button - #65

Open
JackW09 wants to merge 4 commits into
developfrom
feature/regions-improvement
Open

JackW09 wants to merge 4 commits into
developfrom
feature/regions-improvement

Conversation

@JackW09

@JackW09 JackW09 commented Oct 30, 2026

Copy link
Copy Markdown

Summary

  • Add zoom to the define_regions canvas via +/− buttons and Ctrl+scroll;
    coordinates stay in image space so saved regions are unaffected by zoom level
  • Add "Test Regions" button on the Document change form: upload an image,
    run OCR extraction synchronously, and see extracted values overlaid on
    the image with per-attribute pass/fail validation (regex shown on fail)
  • Route _generic_fallback in tasks.py through OCRAttributeExtractor
    to eliminate duplicate label→value parsing logic

Notes

  • Zoom is a display-only transform; all bounding box coordinates remain
    in original image pixel space regardless of zoom level
  • The _generic_fallback refactor means future improvements to
    OCRAttributeExtractor (LLM fallback, better parsing) automatically
    apply to both extraction paths

Legal Boilerplate

Look, I get it.
Contributing to HOPE Payment Gateway, I retain all rights, title and interest in and to my contributions, and by keeping
this boilerplate intact I confirm that HOPE Workspace can use, modify, copy, and redistribute my contributions,
under HOPE's choice of terms.

  Adds a "Test Regions" button to the Document change page that lets
  operators upload a real document image and immediately see extracted
  values per attribute without running a full analysis job
  _generic_fallback had its own inline copy of the label→value parsing
  logic from OCRAttributeExtractor.extract_attribute, calling find_single
  directly. Future improvements to the extractor (bilingual label handling,
  LLM fallback) would silently not apply to the generic path.

  Replace the duplicate block with a single extract_attribute(image, name, None)
  call, passing the already-constructed extractor instead of the processor.
@JackW09
JackW09 requested review from domdinicola and saxix October 30, 2026 14:56
@codecov-commenter

codecov-commenter commented Oct 30, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.18%. Comparing base (82fe37d) to head (373ce7b).

Additional details and impacted files
@@           Coverage Diff            @@
##           develop      #65   +/-   ##
========================================
  Coverage    99.18%   99.18%           
========================================
  Files           76       76           
  Lines         1832     1851   +19     
  Branches       146      147    +1     
========================================
+ Hits          1817     1836   +19     
  Misses           8        8           
  Partials         7        7           
Flag Coverage Δ
unittests 99.18% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

  Add two tests that mock OCRAttributeExtractor.extract_attribute to
  exercise the re.fullmatch path, which was unreachable when OCR returned
  an empty string. Brings admin.py patch coverage to 100%.

This branch has not been deployed

No deployments
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.

2 participants