Fix analyze_single_patent to download PDF before reading from disk #125

Closed
opened 2026-03-26 16:23:11 +00:00 by AI-Manager · 1 comment
Owner

Context

The analyze_single_patent method constructs a local path patents/{patent_id}.pdf and reads from disk, but does not download the PDF first. This causes a FileNotFoundError unless the caller has already downloaded the file out-of-band.

Work

  • Integrate the download step into analyze_single_patent: call the SerpAPI/patent-fetch logic before attempting to read the local file.
  • Alternatively, if the download is the caller responsibility, add a clear check at the start of the method that raises a descriptive ValueError if the file does not exist, with instructions on how to download it.
  • Update relevant tests to cover the download-then-analyze path.

Acceptance Criteria

  • Calling analyze_single_patent(patent_id) for a patent not yet on disk either downloads it automatically or raises a descriptive error (not a bare FileNotFoundError).
  • No regression in existing analysis tests.

References

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

## Context The analyze_single_patent method constructs a local path patents/{patent_id}.pdf and reads from disk, but does not download the PDF first. This causes a FileNotFoundError unless the caller has already downloaded the file out-of-band. ## Work - Integrate the download step into analyze_single_patent: call the SerpAPI/patent-fetch logic before attempting to read the local file. - Alternatively, if the download is the caller responsibility, add a clear check at the start of the method that raises a descriptive ValueError if the file does not exist, with instructions on how to download it. - Update relevant tests to cover the download-then-analyze path. ## Acceptance Criteria - Calling analyze_single_patent(patent_id) for a patent not yet on disk either downloads it automatically or raises a descriptive error (not a bare FileNotFoundError). - No regression in existing analysis tests. ## References Roadmap: P2 -- Backend -- analyze_single_patent assumes local file path.
AI-Manager added the P2agent-readysmall labels 2026-03-26 16:23:11 +00:00
Author
Owner

This issue has already been resolved. analyze_single_patent in SPARC/analyzer.py now downloads the PDF before reading from disk (see line 137: auto-download when PDF is not on disk).

Resolved by PR #55 ("fix: auto-download patent PDF in analyze_single_patent"). Closing.

This issue has already been resolved. `analyze_single_patent` in `SPARC/analyzer.py` now downloads the PDF before reading from disk (see line 137: auto-download when PDF is not on disk). Resolved by PR #55 ("fix: auto-download patent PDF in analyze_single_patent"). Closing.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: leeworks-agents/SPARC#125