forked from 0xWheatyz/SPARC
Fix analyze_single_patent to download PDF before reading from disk #437
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?
Summary
analyze_single_patentconstructs a local pathpatents/{patent_id}.pdfand reads it from disk, but does not download the PDF first. Calling this method on a patent whose PDF has not been pre-downloaded silently fails or raises a file-not-found error.What to do
analyze_single_patentmethod, check whetherpatents/{patent_id}.pdfalready exists on diskValueErrorwith an explicit message explaining the prerequisite and document it in the method docstringAcceptance Criteria
analyze_single_patenton a patent whose PDF is not cached either downloads it automatically or raises a clear, descriptive errorFileNotFoundErrortracebacks are surfaced to API callersReference
Roadmap: P2 - Backend - analyze_single_patent assumes local file path
Triage: Priority Wave 2 (Bug fix). Assigned to @AI-Engineer. Dispatching agent for implementation.
Resolution: Already implemented.
analyzer.pylines 131-149:analyze_single_patent()checksos.path.exists(patent_path). If not found, looks updb.get_cached_patent(patent_id)for a stored PDF link and downloads it viaSERP.save_patents(). If no link is cached, raises a descriptiveFileNotFoundErrorexplaining how to obtain the PDF.api.pylines 852-853: The endpoint catchesFileNotFoundErrorand returns HTTP 404 with the error message.All acceptance criteria are met. Closing.