forked from 0xWheatyz/SPARC
Fix analyze_single_patent to download PDF before reading from disk #295
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
analyze_single_patentconstructs the pathpatents/{patent_id}.pdfand reads from disk, but does not download the PDF first. If the file is not already present the method will fail silently or raise a confusing error.Task
analyze_single_patentshould handle the downloadFileNotFoundErrorwith a helpful message if the file is missingAcceptance Criteria
analyze_single_patentfor a patent not on disk either downloads it automatically or raises a clearFileNotFoundErrorwith instructionsReference
ROADMAP.md -- P2 Backend: analyze_single_patent assumes local file path
Triage: Assigned to @AI-Engineer. P2 backend improvement. Will be queued after P1 work completes.
Already implemented on main.
analyzer.pyanalyze_single_patent()(lines 108-162) checks if PDF exists on disk; if not, looks up the cached PDF link in the database and downloads it viaSERP.save_patents(). If no cached link exists, raisesFileNotFoundErrorwith a clear message explaining how to obtain the PDF. API endpoint catchesFileNotFoundErrorand returns 404. All acceptance criteria met. Closing.