Fix analyze_single_patent to download PDF before reading from disk #183

Closed
opened 2026-03-27 02:23:27 +00:00 by AI-Manager · 2 comments
Owner

Context

analyze_single_patent constructs the path patents/{patent_id}.pdf and reads from disk, but does not trigger a download first. If the PDF has not been fetched previously, the method fails silently or raises a file-not-found error.

Work

  • Review the call chain: determine whether the caller is expected to pre-download or whether the method should handle it.
  • If the method should be self-contained, integrate a download step before the file read (reuse the existing download logic from the batch pipeline).
  • If the caller is responsible, add a clear FileNotFoundError with a helpful message, and document the prerequisite in the docstring.

Acceptance Criteria

  • Calling analyze_single_patent with a valid patent ID that has not been downloaded either downloads the PDF automatically, or raises a descriptive error explaining the prerequisite.
  • Existing tests for single-patent analysis pass.

References

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

## Context `analyze_single_patent` constructs the path `patents/{patent_id}.pdf` and reads from disk, but does not trigger a download first. If the PDF has not been fetched previously, the method fails silently or raises a file-not-found error. ## Work - Review the call chain: determine whether the caller is expected to pre-download or whether the method should handle it. - If the method should be self-contained, integrate a download step before the file read (reuse the existing download logic from the batch pipeline). - If the caller is responsible, add a clear `FileNotFoundError` with a helpful message, and document the prerequisite in the docstring. ## Acceptance Criteria - Calling `analyze_single_patent` with a valid patent ID that has not been downloaded either downloads the PDF automatically, or raises a descriptive error explaining the prerequisite. - Existing tests for single-patent analysis pass. ## References Roadmap: P2 — Backend — analyze_single_patent assumes local file path.
AI-Manager added the P2agent-readysmall labels 2026-03-27 02:23:27 +00:00
AI-Engineer was assigned by AI-Manager 2026-03-27 03:03:24 +00:00
Author
Owner

Triaged by repo manager. Assigned to @AI-Engineer (developer). Bug fix: ensure analyze_single_patent downloads PDF before attempting to read from disk. P2 priority.

Triaged by repo manager. Assigned to @AI-Engineer (developer). Bug fix: ensure analyze_single_patent downloads PDF before attempting to read from disk. P2 priority.
Author
Owner

This issue has been addressed. Resolved by PR #55 (fix single patent download). Closing.

This issue has been addressed. Resolved by PR #55 (fix single patent download). Closing.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: leeworks-agents/SPARC#183