Commit Graph
7 Commits
Author SHA1 Message Date
Brenda Wallace f70b85e60d Add OCR functionality for seed packet photos
- Introduced ocr_text, ocr_engine, and ocr_at attributes to Photo model.
- Implemented awaiting_ocr scope to fetch photos needing OCR processing.
- Updated PhotoAssociation model to remove awaiting_text scope.
- Modified Seed model to include packet_texts method for retrieving OCR results.
- Enhanced PhotoResource and SeedResource to handle new OCR attributes.
- Created migration to add OCR fields to photos and remove packet_text from seeds.
- Updated read_packets.py script to save OCR results directly to photos.
- Added tests for new OCR functionality and removed outdated packet_text tests.
2026-10-31 23:21:01 +13:00
Brenda Wallace 86515141ee Add OCR functionality for seed packet photos and display packet text on seed page
- Implemented Dockerfile for OCR processing with necessary dependencies.
- Enhanced read_packets.py to read and save text from seed packet photos.
- Created requirements.txt for Python dependencies.
- Updated show.html.haml to display OCR results when available.
- Added tests for displaying packet text on seed pages, including handling of markup.
2026-10-29 12:12:54 +13:00
Brenda Wallace 4d53b24e9a Enhance photo and seed resources with new attributes and filters
- Added `label` computed attribute to `PhotoResource` to indicate the side of the seed packet.
- Introduced `needs_ocr` filter in `PhotoResource` to identify photos awaiting OCR processing.
- Updated `SeedResource` to associate photos with seeds.
- Modified `photos_request_spec` to include seed relationships and test for photo labels.
- Added filtering tests for photos needing OCR in `photos_request_spec`.
- Removed obsolete Rake task for listing photos needing OCR.
- Updated `read_packets.py` to fetch photos needing OCR from the API.
2026-10-28 23:20:42 +13:00
Brenda WallaceandClaude Sonnet 5.5 ab024ac51a Address review comments on packet photo labels
Keep every packet label when a side is photographed again, and use the newest
photo of a side. Before, giving a second photo the same label cleared the
older photo's, which let it back into the crop's photos and default picture.

Carry the label through the HTML photo picker (its search form and the links
that add a photo), so a packet photo added without JavaScript is labelled.

Have the OCR script treat any network failure on an image (DNS, timeout) as
that image failing, so the rest of the batch still runs.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-28 21:20:27 +13:00
Brenda Wallace cd6f8f1876 feat: add packet labeling functionality and awaiting text scope for seed photos 2026-10-28 20:44:37 +13:00
Brenda Wallace ac47a92aad feat: add image cleaning functionality before OCR processing 2026-10-28 20:29:19 +13:00
Brenda Wallace 1701f77723 Add OCR task for seed packet photos and related specs
- Introduced a Rake task `packets:needing_ocr` to list photos of seed packets that lack text, outputting results as JSON lines.
- Created a Python script `read_packets.py` to process the output of the Rake task, downloading images and performing OCR to extract text.
- Updated model specs for `Crop` to ensure proper handling of photos associated with different seeds.
- Refactored API request specs for `Photos` and `Seeds`, removing unnecessary attributes from the response.
- Added tests for the new Rake task to ensure correct functionality and output format.
2026-10-28 20:23:35 +13:00