forked from 0xWheatyz/SPARC
Fix analyze_single_patent to download PDF before reading from disk #1203
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_patentin the backend constructs a local pathpatents/{patent_id}.pdfand reads it directly, but does not trigger a download first. If the file does not exist the method will fail with an unhandled file-not-found error.Roadmap reference: ROADMAP.md > P2 > Backend > analyze_single_patent assumes local file path
What to do
patents/{patent_id}.pdfalready exists before attempting to read it.PatentNotFoundError(or equivalent) rather than a bareFileNotFoundError.Acceptance criteria
analyze_single_patentfor a patent whose PDF has not been downloaded succeeds (file is fetched automatically).This issue has been resolved on main.
SPARC/analyzer.pylines 133-149 inanalyze_single_patent()check if the PDF exists on disk, and if not, look up the cached PDF link in the database and download it automatically before proceeding with analysis. Closing as complete.