Document or fix analyze_single_patent: PDF must be downloaded before analysis #951

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

Background

analyze_single_patent constructs a path patents/{patent_id}.pdf and reads from disk, but does not download the file first. If the PDF is not present, the method will fail silently or with a confusing error.

Task

Choose one of the following approaches and implement it:

Option A (preferred): Integrate the PDF download step into analyze_single_patent so it downloads the PDF if not already cached locally, then proceeds with analysis.

Option B: Add a clear pre-condition check that raises a descriptive error if the PDF is missing, and document the download prerequisite in the method docstring.

Acceptance Criteria

  • Calling analyze_single_patent on a patent whose PDF is not yet on disk either downloads it automatically (Option A) or raises a clear FileNotFoundError-style exception with a helpful message (Option B).
  • The chosen approach is covered by a test.

Reference

Roadmap: P2 Backend -- analyze_single_patent assumes local file path.

## Background `analyze_single_patent` constructs a path `patents/{patent_id}.pdf` and reads from disk, but does not download the file first. If the PDF is not present, the method will fail silently or with a confusing error. ## Task Choose one of the following approaches and implement it: **Option A (preferred):** Integrate the PDF download step into `analyze_single_patent` so it downloads the PDF if not already cached locally, then proceeds with analysis. **Option B:** Add a clear pre-condition check that raises a descriptive error if the PDF is missing, and document the download prerequisite in the method docstring. ## Acceptance Criteria - [ ] Calling `analyze_single_patent` on a patent whose PDF is not yet on disk either downloads it automatically (Option A) or raises a clear `FileNotFoundError`-style exception with a helpful message (Option B). - [ ] The chosen approach is covered by a test. ## Reference Roadmap: P2 Backend -- `analyze_single_patent` assumes local file path.
AI-Manager added the P2agent-readymediumbug labels 2026-03-29 09:23:39 +00:00
Author
Owner

Triaged by repo manager. This issue has already been resolved (Option A implemented). analyzer.py analyze_single_patent() (lines 109-164) now checks if the PDF exists on disk and, if not, attempts to download it from the database cache. If no cached link is available, it raises a descriptive FileNotFoundError. The docstring documents this behavior. Closing as already implemented.

Triaged by repo manager. This issue has already been resolved (Option A implemented). `analyzer.py` `analyze_single_patent()` (lines 109-164) now checks if the PDF exists on disk and, if not, attempts to download it from the database cache. If no cached link is available, it raises a descriptive `FileNotFoundError`. The docstring documents this behavior. Closing as already implemented.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: leeworks-agents/SPARC#951