Skip to content

feat(ocr): RCA expiry parsing from OCR text (MVP v0.3)#1

Draft
loquit-tud wants to merge 2 commits into
mainfrom
cursor/rca-ocr-expiry-parser-6527
Draft

feat(ocr): RCA expiry parsing from OCR text (MVP v0.3)#1
loquit-tud wants to merge 2 commits into
mainfrom
cursor/rca-ocr-expiry-parser-6527

Conversation

@loquit-tud

Copy link
Copy Markdown
Owner

Summary

Improves RCA / insurance expiry date extraction from OCR text via a pure-Dart RomanianDocumentParser. OCR remains a suggestion only — confirm screen requires user verification before save.

Root cause

  • Gallery import skipped OCR entirely (ImportFromGalleryUseCase had no extractor).
  • FakeDocumentFieldExtractor returned a hardcoded now + 90 days without parsing validity ranges.
  • No parser existed for Romanian RCA patterns (Valabilitate: start - end, de la … până la …, etc.).

Changes

  • RomanianDocumentParser: date formats dd.MM.yyyy, dd/MM/yyyy, dd-MM-yyyy, yyyy-MM-dd; RCA keyword proximity; end-of-range selection; debug logging [OCR] in debug builds only.
  • Pipeline: FakeOcrTextRecognitionServiceParsingDocumentFieldExtractor → confirm draft with OcrExpirySuggestion.
  • Confirm UI: RCA-specific banners (detected / not detected / low confidence).
  • Tests: parser unit tests + RCA OCR flow tests.
  • Docs: docs/QA_MVP_V0_3.md.

QA

See docs/QA_MVP_V0_3.md. Real gallery photos still need on-device ML Kit; empty OCR → manual expiry.

Verification

  • flutter analyze — no issues
  • flutter test — 38 passed
Open in Web Open in Cursor 

cursoragent and others added 2 commits May 29, 2026 16:31
- Add RomanianDocumentParser for RCA validity ranges and Romanian date formats
- Wire gallery import through ParsingDocumentFieldExtractor (suggestions only)
- Debug-only [OCR] logcat logging; RCA-specific confirm banner messages
- Unit tests for parser and RCA OCR flow; QA doc MVP v0.3

Co-authored-by: loquit-tud <loquit-tud@users.noreply.github.com>
Loading after gallery pick+OCR completed was misleading; overlay stays
only for fake scan flow.

Co-authored-by: loquit-tud <loquit-tud@users.noreply.github.com>
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