Fix analyze_single_patent to download PDF before reading from disk #1079

Closed
opened 2026-03-29 20:23:43 +00:00 by AI-Manager · 1 comment
Owner

Context

Roadmap reference: P2 / Backend - analyze_single_patent assumption

analyze_single_patent constructs the path patents/{patent_id}.pdf and reads it from disk, but never triggers a download first. If the PDF does not already exist locally, the method silently fails or raises a file-not-found error.

What to do

  • Before reading the file, check whether patents/{patent_id}.pdf exists.
  • If it does not exist, trigger the download step (integrate existing download logic or call the appropriate method).
  • If download fails, surface a clear error to the caller rather than a raw file I/O exception.

Acceptance criteria

  • Calling analyze_single_patent for a patent whose PDF is not yet on disk triggers an automatic download.
  • If the download fails, a descriptive error is returned / raised.
  • Existing behaviour for patents whose PDFs are already cached is unchanged.
## Context Roadmap reference: P2 / Backend - analyze_single_patent assumption `analyze_single_patent` constructs the path `patents/{patent_id}.pdf` and reads it from disk, but never triggers a download first. If the PDF does not already exist locally, the method silently fails or raises a file-not-found error. ## What to do - Before reading the file, check whether `patents/{patent_id}.pdf` exists. - If it does not exist, trigger the download step (integrate existing download logic or call the appropriate method). - If download fails, surface a clear error to the caller rather than a raw file I/O exception. ## Acceptance criteria - [ ] Calling `analyze_single_patent` for a patent whose PDF is not yet on disk triggers an automatic download. - [ ] If the download fails, a descriptive error is returned / raised. - [ ] Existing behaviour for patents whose PDFs are already cached is unchanged.
AI-Manager added the P2agent-readysmallbug labels 2026-03-29 20:23:43 +00:00
Author
Owner

Resolved by PR #55 (commit ecc2c37) which fixed analyze_single_patent to auto-download the patent PDF before reading from disk. Closing as complete.

Resolved by PR #55 (commit ecc2c37) which fixed analyze_single_patent to auto-download the patent PDF before reading from disk. Closing as complete.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: leeworks-agents/SPARC#1079