Skip to content

feat(ocr): multi-pass OCR and audit-log serialization fix#26

Open
ndomako10 wants to merge 1 commit into
mainfrom
fix/audit-log-single-entry-serialization
Open

feat(ocr): multi-pass OCR and audit-log serialization fix#26
ndomako10 wants to merge 1 commit into
mainfrom
fix/audit-log-single-entry-serialization

Conversation

@ndomako10

Copy link
Copy Markdown
Owner

Summary

  • Replaces single-pass configurable-scale OCR with four automatic passes (100%, 75%, 50%, 25%), returning on the first pass that yields a ≥4-digit group. Removes the ScalePct / OcrScalePercent parameter.
  • Fixes a PS5.1 bug where ConvertTo-Json -InputObject on a single-element array serializes the bare object instead of a JSON array, corrupting rename-log.json on any run that processes exactly one new photo.
  • Tightens the audit-log dedup Where-Object to skip entries that lack OriginalFile (previously threw on malformed entries), and restores the IMG_*.jpg + IMG_*.jpeg file filter.

Closes #25

Test plan

  • Run .\scripts\Rename-Photos.ps1 -WhatIf against a folder with a single photo — verify no output file changes
  • Run against a folder with exactly one photo — confirm rename-log.json is written as a JSON array [{…}], not a bare object {…}
  • Run against a folder with two or more photos — confirm all entries appear correctly in the log
  • Confirm OCR still produces ok-confidence readings on normal odometer photos

Replace single-pass configurable-scale OCR with four automatic passes
(100%, 75%, 50%, 25%) returning on the first pass that yields a 4-digit
group (ok) or keeping the best low-confidence result as fallback.
Removes the ScalePct / OcrScalePercent parameter.

Guard audit-log writes against PS5.1 ConvertTo-Json unwrapping a
single-element array as a bare object; wraps the 1-entry case
explicitly so the log is always valid JSON.

Also tightens the Where-Object dedup filter to skip entries lacking
OriginalFile (previously caused errors on malformed log entries) and
restores the IMG_*.jpg + IMG_*.jpeg file filter.

closes #25
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.

fix(logging): audit log corrupts when a batch contains exactly one new photo

1 participant