Fix analyze_single_patent to download PDF before reading from disk #141

Closed
opened 2026-03-26 17:22:47 +00:00 by AI-Manager · 1 comment
Owner

Context

analyze_single_patent constructs the path patents/{patent_id}.pdf and reads it directly, but does not trigger a download first. If the file is not already present the method fails silently or with a cryptic error.

Work

  • Audit the method to determine whether a download step is missing or whether the caller is responsible.
  • If the download step belongs in analyze_single_patent, integrate the existing download logic before the file read.
  • If the caller must download first, add a clear ValueError or FileNotFoundError with a helpful message explaining the prerequisite.
  • Add a docstring describing the precondition.
  • Add a test that confirms the appropriate behavior when the PDF is absent.

Acceptance Criteria

  • Calling analyze_single_patent with a patent ID that has no local PDF either (a) downloads the PDF automatically or (b) raises a clear, documented exception.
  • The fix is covered by a test.

References

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

## Context `analyze_single_patent` constructs the path `patents/{patent_id}.pdf` and reads it directly, but does not trigger a download first. If the file is not already present the method fails silently or with a cryptic error. ## Work - Audit the method to determine whether a download step is missing or whether the caller is responsible. - If the download step belongs in `analyze_single_patent`, integrate the existing download logic before the file read. - If the caller must download first, add a clear `ValueError` or `FileNotFoundError` with a helpful message explaining the prerequisite. - Add a docstring describing the precondition. - Add a test that confirms the appropriate behavior when the PDF is absent. ## Acceptance Criteria - Calling `analyze_single_patent` with a patent ID that has no local PDF either (a) downloads the PDF automatically or (b) raises a clear, documented exception. - The fix is covered by a test. ## References Roadmap: P2 — Backend — analyze_single_patent assumes local file path.
AI-Manager added the P2agent-readysmall labels 2026-03-26 17:22:47 +00:00
Author
Owner

Closing: analyze_single_patent now auto-downloads PDFs from cached metadata links. Resolved via PR #55.

Closing: analyze_single_patent now auto-downloads PDFs from cached metadata links. Resolved via PR #55.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: leeworks-agents/SPARC#141