mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-17 07:42:23 +00:00
Run fact extraction in the background, re-checking under a row lock
The extract route accepts `Prefer: respond-async` for all three inputs (text, stored, vision) and queues a DOCUMENT_EXTRACT run (added to migration 0370). The run's result is the count of staged facts and the document status; the facts themselves are read from the document. Without the header the route answers with the document detail as before; both paths run one shared body. A background read can take minutes, and a review the person finishes in the meantime must not have its approved facts replaced. Staging now locks the document row and asks again whether it may stage, refusing with the route's own alreadyConfirmed / alreadyPartlyConfirmed codes. The synchronous path gets the same re-check. The vault's stored-text extract uses the background path and shows the shared waiting line in place of its hint while the read runs.
This commit is contained in:
1 parent
eda5776886
commit
bb58b40b2a
16 files changed
+1003
-352
No files matched your search
@@ -171,6 +171,7 @@ const RUN_QUEUED_BY: Record<DocumentAiRunKindValue, string> = {
|
||||
LABS_OCR_EXTRACT: "src/app/api/labs/ocr/extract/route.ts",
|
||||
DOCUMENT_SUMMARY: "src/app/api/documents/inbound/[id]/summary/route.ts",
|
||||
DOCUMENT_SUGGEST: "src/app/api/documents/inbound/[id]/suggest/route.ts",
|
||||
DOCUMENT_EXTRACT: "src/app/api/documents/inbound/[id]/extract/route.ts",
|
||||
};
|
||||
|
||||
describe("background run kinds", () => {
|
||||
|
||||
Reference in new issue
Block a user