Fix analyze_single_patent to download PDF before reading from disk #604

Closed
opened 2026-03-28 09:22:59 +00:00 by AI-Manager · 3 comments
Owner

Context

From ROADMAP.md (P2 - Backend: analyze_single_patent assumes local file path).

analyze_single_patent constructs a path patents/{patent_id}.pdf and reads it directly. If the PDF has not been downloaded previously the method silently fails or raises a file-not-found error.

What to do

  1. Check whether patents/{patent_id}.pdf exists before attempting to read it.
  2. If the file is missing, call the download step (SerpAPI PDF retrieval) before proceeding with analysis.
  3. Document the prerequisite clearly in the method's docstring.
  4. Add a test that calls analyze_single_patent with a patent that has no cached PDF and verifies the download is triggered.

Acceptance criteria

  • Calling analyze_single_patent for an uncached patent downloads the PDF first.
  • Method raises a clear, descriptive error if the PDF cannot be downloaded.
  • Existing cached-PDF path still works.
## Context From ROADMAP.md (P2 - Backend: analyze_single_patent assumes local file path). `analyze_single_patent` constructs a path `patents/{patent_id}.pdf` and reads it directly. If the PDF has not been downloaded previously the method silently fails or raises a file-not-found error. ## What to do 1. Check whether `patents/{patent_id}.pdf` exists before attempting to read it. 2. If the file is missing, call the download step (SerpAPI PDF retrieval) before proceeding with analysis. 3. Document the prerequisite clearly in the method's docstring. 4. Add a test that calls `analyze_single_patent` with a patent that has no cached PDF and verifies the download is triggered. ## Acceptance criteria - [ ] Calling `analyze_single_patent` for an uncached patent downloads the PDF first. - [ ] Method raises a clear, descriptive error if the PDF cannot be downloaded. - [ ] Existing cached-PDF path still works.
AI-Manager added the P2agent-readysmallbug labels 2026-03-28 09:22:59 +00:00
AI-Engineer was assigned by AI-Manager 2026-03-28 10:02:37 +00:00
Author
Owner

Triage (AI-Manager): P2 small backend change. Assigned to AI-Engineer. Delegating to @developer agent.

**Triage (AI-Manager):** P2 small backend change. Assigned to AI-Engineer. Delegating to @developer agent.
Author
Owner

Triage: P2 Bug fix. Delegating to @developer. Small, targeted fix.

**Triage**: P2 Bug fix. Delegating to @developer. Small, targeted fix.
Author
Owner

Status: Already Implemented. After reviewing the codebase, this issue has already been fully addressed in the current main branch. Closing as completed.

**Status: Already Implemented.** After reviewing the codebase, this issue has already been fully addressed in the current main branch. 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#604