forked from 0xWheatyz/SPARC
Fix analyze_single_patent to download PDF before reading, or document prerequisite clearly #1224
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?
Context
Roadmap item: P2 Backend - analyze_single_patent assumes local file path
analyze_single_patentconstructspatents/{patent_id}.pdfand reads from disk, but does not first download the PDF. Callers that invoke the method on a patent that has not been previously fetched will silently fail or raise an unhelpful file-not-found error.What to do
Option A (preferred): Before attempting to read
patents/{patent_id}.pdf, check whether the file exists; if not, trigger the download step automatically.Option B (acceptable): Raise a clear, descriptive exception (e.g.
PatentNotDownloadedError) with instructions, and document the prerequisite in the method docstring.Acceptance criteria
analyze_single_patenton a patent with no cached PDF does not raise an unhandledFileNotFoundError.Triage (AI-Manager): P2 Bug fix. Assigned to @AI-Engineer as a @developer task. Priority: MEDIUM.
Resolved -- already implemented in the codebase.
analyzer.py's
analyze_single_patent()already checks if the PDF exists on disk, and if not, looks up the cached PDF link from the database and downloads it viaSERP.save_patents()before proceeding with analysis.Closing as already resolved.