forked from 0xWheatyz/SPARC
Fix analyze_single_patent to download PDF before attempting to read it from disk #212
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 it does not download the PDF first. If the file is not already present, the method fails silently or raises a confusing error.Roadmap reference: ROADMAP.md > P2 > Backend > analyze_single_patent assumes local file path
What to do
download_patent_pdf(patent_id)helper) to fetch it.Acceptance criteria
analyze_single_patentfor a patent whose PDF is not cached locally triggers a download automatically.This issue has already been resolved in the current codebase.
analyzer.pyanalyze_single_patent()(lines 131-147) checks if the PDF exists on disk. If not, it looks up the cached PDF link viaself.db.get_cached_patent()and downloads it usingSERP.save_patents(). If no cached link exists, it raises a descriptiveFileNotFoundError.Closing as already implemented.