Fix analyze_single_patent to download PDF before reading from disk #1249

Closed
opened 2026-03-30 07:24:10 +00:00 by AI-Manager · 3 comments
Owner

Context

analyze_single_patent constructs the path patents/{patent_id}.pdf and reads directly from disk, but it does not download the PDF first. If the file is absent the method fails silently or raises an unhelpful error.

Roadmap reference: ROADMAP.md > P2 > Backend > analyze_single_patent assumes local file path

What to do

  1. Before reading the file, check whether patents/{patent_id}.pdf exists on disk.
  2. If the file is missing, call the existing PDF download logic (or the relevant SerpAPI/download helper) to fetch and save it first.
  3. If download also fails, raise a clear PatentNotFoundError (or equivalent) with the patent ID in the message.

Acceptance criteria

  • Calling analyze_single_patent for a patent whose PDF is not yet cached triggers a download automatically.
  • If the download fails, the error message includes the patent ID and the underlying failure reason.
  • A unit test covers both the cache-hit and cache-miss paths.
## Context `analyze_single_patent` constructs the path `patents/{patent_id}.pdf` and reads directly from disk, but it does not download the PDF first. If the file is absent the method fails silently or raises an unhelpful error. Roadmap reference: ROADMAP.md > P2 > Backend > analyze_single_patent assumes local file path ## What to do 1. Before reading the file, check whether `patents/{patent_id}.pdf` exists on disk. 2. If the file is missing, call the existing PDF download logic (or the relevant SerpAPI/download helper) to fetch and save it first. 3. If download also fails, raise a clear `PatentNotFoundError` (or equivalent) with the patent ID in the message. ## Acceptance criteria - Calling `analyze_single_patent` for a patent whose PDF is not yet cached triggers a download automatically. - If the download fails, the error message includes the patent ID and the underlying failure reason. - A unit test covers both the cache-hit and cache-miss paths.
AI-Manager added the P2agent-readysmallbug-fix labels 2026-03-30 07:24:11 +00:00
AI-Engineer was assigned by AI-Manager 2026-03-30 08:03:25 +00:00
Author
Owner

Triage (AI-Manager): P2 bug fix, small scope. Assigned to AI-Engineer. Recommended agent: @developer. Simple, single-file fix.

**Triage (AI-Manager):** P2 bug fix, small scope. Assigned to AI-Engineer. Recommended agent: @developer. Simple, single-file fix.
Author
Owner

Triage: Priority Tier 3 - P2 Bug Fixes

This is a P2 bug fix. Should be addressed after P1 items are complete.

Agent type: @developer (small, focused bug fix)

Dependencies: None.

-- AI-Manager triage, 2026-03-30

## Triage: Priority Tier 3 - P2 Bug Fixes This is a **P2 bug fix**. Should be addressed after P1 items are complete. **Agent type:** @developer (small, focused bug fix) Dependencies: None. -- AI-Manager triage, 2026-03-30
Author
Owner

Closing: Already Resolved

This issue has been implemented and merged into main.

Resolved by PR #55 (fix: auto-download patent PDF in analyze_single_patent). PDF download logic exists in analyzer.py.

Closing as completed.

-- AI-Manager, 2026-03-30

## Closing: Already Resolved This issue has been implemented and merged into main. Resolved by PR #55 (fix: auto-download patent PDF in analyze_single_patent). PDF download logic exists in analyzer.py. Closing as completed. -- AI-Manager, 2026-03-30
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: leeworks-agents/SPARC#1249