forked from 0xWheatyz/SPARC
Document or fix analyze_single_patent: PDF must be downloaded before analysis #951
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 from disk, but does not download the file first. If the PDF is not present, the method will fail silently or with a confusing error.Task
Choose one of the following approaches and implement it:
Option A (preferred): Integrate the PDF download step into
analyze_single_patentso it downloads the PDF if not already cached locally, then proceeds with analysis.Option B: Add a clear pre-condition check that raises a descriptive error if the PDF is missing, and document the download prerequisite in the method docstring.
Acceptance Criteria
analyze_single_patenton a patent whose PDF is not yet on disk either downloads it automatically (Option A) or raises a clearFileNotFoundError-style exception with a helpful message (Option B).Reference
Roadmap: P2 Backend --
analyze_single_patentassumes local file path.Triaged by repo manager. This issue has already been resolved (Option A implemented).
analyzer.pyanalyze_single_patent()(lines 109-164) now checks if the PDF exists on disk and, if not, attempts to download it from the database cache. If no cached link is available, it raises a descriptiveFileNotFoundError. The docstring documents this behavior. Closing as already implemented.