Modelo de datos (MVP)
Azure SQL — esquema lógico
Suppliers
| Columna |
Tipo |
Notas |
| SupplierId |
uniqueidentifier / nvarchar |
PK |
| Name |
nvarchar |
|
| TaxId |
nvarchar |
NIT / Tax ID |
| Status |
nvarchar |
Active / Inactive |
| RiskLevel |
nvarchar |
Low / Medium / High |
PurchaseOrders
| Columna |
Tipo |
Notas |
| PurchaseOrderId |
nvarchar |
PK (ej. PO-90219) |
| SupplierId |
FK |
|
| Amount |
decimal |
|
| Currency |
char(3) |
USD / COP |
| Status |
nvarchar |
Open / Closed |
| Date |
date |
|
Invoices
| Columna |
Tipo |
Notas |
| InvoiceId |
uniqueidentifier |
PK |
| SupplierId |
FK nullable hasta extract |
|
| PurchaseOrderId |
FK nullable |
|
| InvoiceNumber |
nvarchar |
|
| Amount / Tax / Total |
decimal |
|
| Currency |
char(3) |
|
| Status |
nvarchar |
ver estados HITL |
| BlobUrl |
nvarchar |
|
| CorrelationId |
nvarchar |
|
| CreatedAt / UpdatedAt |
datetime2 |
|
InvoiceLines
Líneas opcionales para demo (description, qty, unit_price, line_total).
BusinessRules
| Columna |
Tipo |
Notas |
| RuleId |
nvarchar |
FIN-001 |
| Name |
nvarchar |
|
| Version |
nvarchar |
3.2 |
| Description |
nvarchar |
|
| RuleType |
nvarchar |
validation / threshold |
| Expression |
nvarchar/json |
parámetros (ej. maxAmount=50000) |
| Severity |
nvarchar |
Block / Review |
| Active |
bit |
|
Tablas de auditoría funcional
- AgentExecutions — agent, model, tokens, latency, status, correlationId, executionId
- ToolExecutions — tool name, input hash, result, latency
- RuleExecutions — ruleId, version, result, reason
- HumanDecisions — user, action, comment, fromStatus, toStatus
- TokenUsage — FinOps (DEV):
token_usage · correlation_id, agent, app, input/output/total tokens, estimated_cost_usd, created_at
TokenUsage (implementado)
| Columna |
Tipo |
Notas |
| id |
nvarchar(36) |
PK |
| correlation_id |
nvarchar(64) |
index |
| agent |
nvarchar(128) |
Foundry agent name |
| app |
nvarchar(64) |
finance-api |
| input_tokens / output_tokens / total_tokens |
int nullable |
|
| estimated_cost_usd |
decimal(18,6) |
estimación retail DEV |
| created_at |
datetime2 |
UTC |
Estados de factura (HITL)
Received → Processing → Data Extracted → Supplier Validation → Purchase Order Validation → Policy Validation → Requires Human Review | Approved | Rejected | Returned
AI Search (HR)
Índice sugerido: hr-policies
Campos: id, content, source_file, policy_type, chunk_id, vector (si embeddings).