← Projects
Type
Personal project
Status
Online
Season
2026-2027

Onde Caçar

Free calendar of hunting days in municipal hunting zones, built from hundreds of PDFs published by ICNF.

  • Python
  • Playwright
  • Vision AI

Before

  • Information scattered across hundreds of PDFs
  • Zone-by-zone lookups, slow and impractical
  • No view by municipality, district or species
  • Applications for each zone filled in by hand

After

  • A single calendar, free and easy to use
  • Search by municipality, district and species
  • Data validated before being published
  • Application generated directly on the site

How it works

  1. 1

    Collection

    Automated scraping of the ICNF website (Playwright), by district. Every new PDF is downloaded and its first page converted into an image — the PDF is then discarded, only the image is kept on disk.

  2. 2

    Processing

    The image is straightened based on the angle of the table grid itself. The grid's intersections are then detected and each cell is cropped and reassembled into a new image, with no overlaps.

  3. 3

    Extraction

    A vision-based AI agent reads the cropped grid directly and returns the structured data — no OCR, no per-image API cost.

  4. 4

    Validation and Calendar

    Automatic consistency checks, followed by human review in a dedicated webapp. Only then is each date range expanded into the allowed weekdays, holidays included.

Project obstacles

Cell-by-cell OCR (Tesseract) couldn't handle the real variety across ~300 documents.

The OCR pipeline was dropped entirely. A grid made of just the cropped cells is now assembled and read by a vision-based AI agent — one that understands the table as an image, not as loose text.

Extracting ~300 documents through the paid Claude API didn't scale.

The direct API call was removed. The system now only generates the prompts; extraction is done by manually-launched Claude Code agents, with no per-image API cost.

Scans were never perfectly straight, throwing off table detection.

The rotation angle is now calculated from the table grid itself, and the image is straightened before any cell detection happens.

Data scattered across parallel tables, linked by file path.

The schema was unified into a single table, linked by a numeric identifier instead of a path string — avoiding the backslash and escaping issues that came with it.

Hunting zones "disappearing", permanently skipped by the pipeline with no explanation.

An older version only saved the processed image under certain conditions, but the database always stored the path regardless. The pipeline now always confirms the file actually exists on disk.

Blindly trusting data extracted by an AI agent.

No row enters the calendar without automatic consistency checks and human review in a dedicated webapp, before being marked as ready.