forked from 0xWheatyz/SPARC
Backend: Fix analyze_single_patent to download PDF before reading from disk #477
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
Problem
analyze_single_patentconstructspatents/{patent_id}.pdfand reads it from disk, but does not first download the PDF if it is absent. Calling this method on a patent that has not previously been fetched silently fails or raises an unhelpful FileNotFoundError.Task
analyze_single_patent: ifpatents/{patent_id}.pdfdoes not exist, download it before parsing.Acceptance Criteria
analyze_single_patenton a patent with no local PDF either downloads it automatically or raises a clear, descriptive error.FileNotFoundError.Already implemented.
analyze_single_patent()inSPARC/analyzer.py(lines 133-149) checks if the PDF exists on disk. If not, it looks up the cached PDF link and downloads it viaSERP.save_patents()before proceeding. Closing as completed.