Spaces:
Runtime error
Runtime error
File size: 2,706 Bytes
a263bf4 | 1 2 | <!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><title>Architecture | PDF Extractor Docs</title><link rel="stylesheet" href="guide.css"></head><body><a class="skip-link" href="#content">Skip to content</a><header class="topbar"><a class="brand" href="index.html">PDF Extractor <span>Docs</span></a><button class="menu-button" type="button" aria-expanded="false" aria-controls="navigation">Menu</button><button class="theme-button" type="button">Theme</button></header><div class="layout"><nav id="navigation" class="navigation" aria-label="Documentation"><a href="index.html">Overview</a><a href="architecture.html">Architecture</a><a href="low-level-design.html">Low-level design</a><a href="dependencies.html">External dependencies</a><a href="api.html">API contract</a><a href="operations.html">Operations and limits</a><a href="setup.html">Local setup</a></nav><main id="content"><p class="eyebrow">System view</p><h1>Architecture</h1><section><h2>Components</h2><table><thead><tr><th>Component</th><th>Responsibility</th></tr></thead><tbody><tr><td>Browser</td><td>Uploads a PDF. Reads status. Shows JSON.</td></tr><tr><td>FastAPI</td><td>Validates requests. Starts external jobs. Provides the public API.</td></tr><tr><td>SQLite</td><td>Stores local job state and final JSON.</td></tr><tr><td>LlamaCloud</td><td>Uploads the file and runs extraction.</td></tr></tbody></table></section><section><h2>Upload flow</h2><ol><li>The browser sends a PDF to <code>POST /api/v1/documents</code>.</li><li>FastAPI validates the file.</li><li>FastAPI creates a local job with status <code>PENDING</code>.</li><li>FastAPI uploads the file to LlamaCloud.</li><li>FastAPI creates an extraction job in LlamaCloud.</li><li>FastAPI stores the two external IDs.</li><li>FastAPI sets the local status to <code>PROCESSING</code>.</li><li>FastAPI returns <code>202 Accepted</code> and the local job ID.</li></ol></section><section><h2>Status flow</h2><ol><li>The browser reads <code>GET /api/v1/jobs/{job_id}</code>.</li><li>FastAPI reads the local job.</li><li>FastAPI checks LlamaCloud only when the job is not final.</li><li>FastAPI saves the result when LlamaCloud reports completion.</li><li>FastAPI returns the local status.</li></ol><p>The browser polls every 2.5 seconds. It stops when the job is complete, failed, or cancelled.</p></section><section><h2>Why no worker exists</h2><p>LlamaCloud already runs the long extraction task. FastAPI only submits the job and reads its state. A Celery worker would add operations work without improving this first version.</p></section></main></div><script src="guide.js"></script></body></html>
|