Merge remote-tracking branch 'origin/main' into wip/v140-I

# Conflicts:
#	docs/api/openapi.yaml
This commit is contained in:
Marc-André Bombeck committed 2026-10-03 22:16:29 +02:00
commit ef0028c020
45 files changed
+3161 -1010

No files matched your search

@@ -0,0 +1,22 @@
-- Three more kinds of background document AI run, and one more document kind.
--
-- Summaries, filing suggestions and fact extraction can now run in the same
-- background worker as "Read with AI" and the lab scan (0366): the request
-- queues the read and answers 202, and the result is polled from the run. The
-- synchronous routes are unchanged; the new kinds only name the run.
--
-- `SICK_NOTE` files a certificate of incapacity for work (in Germany the
-- Arbeitsunfähigkeitsbescheinigung) as its own document kind instead of
-- under Other.
--
-- Purely additive. `ADD VALUE IF NOT EXISTS` makes a rerun safe, and no new
-- value is used elsewhere in this migration, which is the one thing Postgres
-- forbids inside the transaction that adds it. No row is rewritten.
--
-- Reversibility: Postgres cannot drop an enum value, so the values would stay
-- (inert with no rows that carry them).
ALTER TYPE "document_ai_run_kind" ADD VALUE IF NOT EXISTS 'DOCUMENT_SUMMARY';
ALTER TYPE "document_ai_run_kind" ADD VALUE IF NOT EXISTS 'DOCUMENT_SUGGEST';
ALTER TYPE "document_ai_run_kind" ADD VALUE IF NOT EXISTS 'DOCUMENT_EXTRACT';
ALTER TYPE "inbound_document_kind" ADD VALUE IF NOT EXISTS 'SICK_NOTE';
+15
View File
@@ -8085,6 +8085,9 @@ enum InboundDocumentKind {
REFERRAL
INSURANCE
VACCINATION
/// A certificate of incapacity for work (in Germany the
/// Arbeitsunfähigkeitsbescheinigung) and its equivalents.
SICK_NOTE
OTHER
@@map("inbound_document_kind")
@@ -8097,6 +8100,9 @@ enum InboundDocumentKind {
/// every fact, DISCARDED on a soft delete.
enum InboundDocumentStatus {
STORED
/// @internal: reserved, no writer. An extraction in flight is the state of
/// its background run (`DocumentAiRun`), not of the document, so the vault
/// never shows a status nothing renders.
EXTRACTING
EXTRACTED
FAILED
@@ -9099,6 +9105,15 @@ enum DocumentAiRunKind {
/// A lab report scan (photo, PDF or browser-read text) into proposed rows
/// for the review screen. Nothing is written until the person commits.
LABS_OCR_EXTRACT
/// A plain-language summary or the transcribed text of a stored document;
/// stored on the document only when the request asked for that.
DOCUMENT_SUMMARY
/// Filing suggestions (title, kind, date) for a stored document. Drafts
/// only: nothing is written to the document.
DOCUMENT_SUGGEST
/// Structured facts read out of a stored document, staged PENDING for the
/// review step. The confirm route stays the only write into the record.
DOCUMENT_EXTRACT
@@map("document_ai_run_kind")
}