Files
0pt/src/types/document-extraction.ts
T
adminandClaude Sonnet 5 c89731115c feat: add 0pt.query_source, 0pt.document_ocr, 0pt.write_external_record capabilities
Three new, tenant-agnostic P0 capabilities:

- 0pt.query_source: bounded, timeout/row-capped ad-hoc SQL query execution
  against registered database sources, via a Fabric/OneLake adapter
  (Azure AD credential-based mssql connection), with AUD0 audit events
  and an app/api/0pt/sources/[sourceId]/query endpoint.

- 0pt.document_ocr (document capture + extraction): mailbox-based document
  intake via Microsoft Graph, OCR/field extraction via Azure Document
  Intelligence, with capture/extraction API endpoints and services that
  never fabricate extracted values.

- 0pt.write_external_record (external writeback): a generic writeback-adapter
  contract plus a concrete Odoo bills adapter that matches partners via
  Fabric, backing an external-writeback-service for pushing records to
  downstream systems of record.

Known interim gaps:
- src/adapters/local-blob-store.ts is an interim ST0RE substitute pending
  the real ST0RE artifact-store integration.
- mssql is used by the Fabric/OneLake adapter but deliberately not yet
  added to package.json (pending `pnpm add mssql` once the concurrent
  session's package.json/dependency changes settle).

A separate, concurrently-active session has unrelated in-flight changes
in this same working tree (data-platform catalog/lineage/feature-store,
dataset quality, lakehouse/Iceberg docs, deploy scaffolding, package.json/
pnpm-lock.yaml updates, etc.) — none of that is touched or included here.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-08 19:32:43 +02:00

28 lines
854 B
TypeScript

import type { ExtractedField } from "../adapters/document-intelligence-adapter";
export type { ExtractedField };
export type DocumentExtractionStatus = "requested" | "completed" | "failed";
export interface DocumentExtractionRecord {
extraction_id: string;
document_id: string;
tenant_id: string;
project_id: string;
model_id: string;
status: DocumentExtractionStatus;
/** Every key DI reported, evidence-based: never fabricated, always carries a confidence. */
fields: Record<string, ExtractedField>;
line_items: Array<Record<string, ExtractedField>>;
fields_found_count: number;
fields_total_count: number;
average_confidence: number | null;
document_confidence: number | null;
st0re_artifact_id?: string;
n0d_job_id?: string;
error?: string;
correlation_id?: string;
created_at: string;
updated_at?: string;
}