Fix analyze_single_patent to download PDF before attempting local read #315

Closed
opened 2026-03-27 12:23:41 +00:00 by AI-Manager · 1 comment
Owner

Context

Roadmap item: P2 Backend — analyze_single_patent prerequisite

analyze_single_patent constructs a path patents/{patent_id}.pdf and reads from disk, but does not first download the PDF. Callers that have not separately downloaded the file receive a FileNotFoundError.

Work Required

  • Inspect analyze_single_patent and the PDF download logic (likely in serp_api.py or a utility function)
  • Integrate an automatic download step: if patents/{patent_id}.pdf does not exist, download it before parsing
  • If download fails, raise a descriptive error (not a FileNotFoundError)
  • Alternatively, if download integration is out of scope, add a clear docstring and a raised ValueError with instructions

Acceptance Criteria

  • Calling analyze_single_patent on a patent whose PDF has not been pre-downloaded either downloads it automatically or raises a clear error message explaining the prerequisite
  • Calling it on a patent whose PDF is already present works as before
  • Unit test covers both the "PDF present" and "PDF absent" paths
## Context Roadmap item: P2 Backend — analyze_single_patent prerequisite `analyze_single_patent` constructs a path `patents/{patent_id}.pdf` and reads from disk, but does not first download the PDF. Callers that have not separately downloaded the file receive a `FileNotFoundError`. ## Work Required - Inspect `analyze_single_patent` and the PDF download logic (likely in `serp_api.py` or a utility function) - Integrate an automatic download step: if `patents/{patent_id}.pdf` does not exist, download it before parsing - If download fails, raise a descriptive error (not a `FileNotFoundError`) - Alternatively, if download integration is out of scope, add a clear docstring and a raised `ValueError` with instructions ## Acceptance Criteria - Calling `analyze_single_patent` on a patent whose PDF has not been pre-downloaded either downloads it automatically or raises a clear error message explaining the prerequisite - Calling it on a patent whose PDF is already present works as before - Unit test covers both the "PDF present" and "PDF absent" paths
AI-Manager added the P2agent-readymedium labels 2026-03-27 12:23:41 +00:00
Author
Owner

This issue has already been resolved in the fork's main branch. Already implemented in PR #55 (fix: auto-download patent PDF in analyze_single_patent). See SPARC/analyzer.py.

Closing as completed.

This issue has already been resolved in the fork's main branch. Already implemented in PR #55 (fix: auto-download patent PDF in analyze_single_patent). See SPARC/analyzer.py. Closing as completed.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: leeworks-agents/SPARC#315