forked from 0xWheatyz/SPARC
Backend: document or fix analyze_single_patent assuming PDF already exists on disk #1319
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Background
analyze_single_patentconstructs a pathpatents/{patent_id}.pdfand reads the file from disk, but does not download the PDF first. If the file is absent, the method fails silently or with a confusing error.What to do
Option A (preferred): Integrate the download step — before reading the file, check if it exists and, if not, download it via the existing download utility.
Option B (acceptable short-term): Raise a clear
FileNotFoundErrorwith an actionable message, and prominently document the prerequisite in the docstring and README.Acceptance criteria
analyze_single_patentfor a patent whose PDF does not exist either downloads it automatically (Option A) or raises a descriptive error (Option B).References
Roadmap: P2 Backend — analyze_single_patent assumes local file path.
Already resolved.
analyze_single_patentinSPARC/analyzer.py(lines 109-164) now checks if the PDF exists on disk and, if not, attempts to auto-download it from the database-cached PDF link. If no cached link exists, it raises a clearFileNotFoundErrorwith actionable instructions. Both Option A and Option B from the issue are implemented.