Saltar al contenido

← IA empresarial sin enviar datos afuera: la arquitectura que estoy usando para convertir Excel en evidencia

IA empresarial sin enviar datos afuera: la arquitectura que estoy usando para convertir Excel en evidencia

Español ↔ English

El proyecto empezó con una restricción que eliminó la mitad de las soluciones de moda

El requisito era sencillo de decir:

los datos corporativos no pueden salir del entorno controlado.

Eso cambia toda la arquitectura.

No basta con ejecutar el modelo local si prompts, logs, archivos temporales, embeddings o backups terminan en servicios externos.

El boundary incluye datos, inferencia, observabilidad, almacenamiento temporal y herramientas de soporte.

Ahí la IA deja de ser una feature y empieza a parecer infraestructura.

Empezar por un chatbot habría sido el error

La fuente era un Excel mantenido continuamente, con muchas hojas, celdas combinadas, fórmulas, colores con significado y layouts variables.

Las preguntas reales eran analíticas: qué aumentó, desde cuándo, en qué productos o lotes, qué evento operacional ocurrió cerca y qué evidencia sostiene una hipótesis.

Por eso la arquitectura no fue Excel → LLM → respuesta.

txt
Excel
  ↓
extracción raw
  ↓
registros normalizados
  ↓
modelo canónico
  ↓
enriquecimiento / agrupamiento por IA
  ↓
corrección humana
  ↓
tablas analíticas curadas
  ↓
Power BI

Antes de IA existe ingeniería de ingestión

Una planilla es una interfaz semiestructurada para humanos.

Celdas combinadas pueden expresar jerarquía. Color puede ser status. Fórmulas pueden ser más valiosas que el número mostrado.

Un extractor serio necesita preservar cuando importa:

  • hoja;
  • fila y columna;
  • valor raw;
  • fórmula;
  • formato;
  • color/estilo usado por el negocio;
  • rango combinado;
  • versión o hash del archivo.

Así cada registro normalizado puede rastrearse hasta su origen.

Me gusta crear una capa raw casi intocable

La capa raw no debe ser bonita. Debe conservar suficiente información para reprocesar cuando las reglas mejoren.

txt
raw_file
raw_sheet
raw_cell / raw_row
      ↓
normalización versión N
      ↓
registro canónico

Sin eso, cada mejora del parser obliga a confiar en datos ya transformados o a recuperar archivos históricos.

El modelo canónico es la parte menos glamorosa y más valiosa

La misma idea puede aparecer de formas distintas entre hojas y años.

No quiero que Power BI ni la IA hereden cada rareza del Excel.

ts
type ComplaintRecord = {
  id: string
  occurredAt: Date | null
  productCode?: string
  lot?: string
  productionLine?: string
  category?: string
  description: string
  confirmed: boolean
  source: SourceReference
}

Con una capa estable, reglas, IA y dashboard comparten vocabulario.

El color es dato cuando el negocio decidió que el color es dato

Para un desarrollador, formatting parece cosmético. En planillas operacionales puede cargar significado.

Si rojo significa confirmado y amarillo investigación, el fill es en la práctica un enum sin schema.

A largo plazo conviene migrar ese significado a campos explícitos. Pero la ingestión primero necesita respetar la realidad existente.

La IA entra mejor después de estabilizar la estructura

Texto libre es un buen problema para IA porque personas describen el mismo defecto con palabras distintas.

Puede ayudar en agrupamiento semántico, categorías sugeridas, extracción de entidades y resumen de patrones.

Pero si confirmed ya es un dato de negocio, el modelo no debería decidirlo nuevamente.

La IA enriquece. No reemplaza hechos autoritativos.

Hipótesis y hecho necesitan tipos diferentes

No quiero una gran respuesta textual mezclando todo.

ts
type InvestigationFinding = {
  observation: string
  evidenceIds: string[]
  hypothesis?: string
  confidence?: number
  humanStatus: 'unreviewed' | 'accepted' | 'rejected' | 'edited'
}

"Aumentó después del cambio de selladora" no es lo mismo que "la selladora causó el aumento".

El sistema debe preservar diferencia entre correlación, hipótesis y evidencia.

La corrección humana no es parche; es parte del producto

La especialista necesita poder decir:

  • esta categoría está mal;
  • la línea 3 no usa esta máquina;
  • estas dos descripciones son equivalentes;
  • esta hipótesis es operacionalmente imposible;
  • esta fila fue interpretada incorrectamente.

Esas correcciones deben persistir estructuradas y alimentar procesamientos futuros. No pueden desaparecer en un chat.

No haría fine-tuning como primera respuesta

Ante una clasificación incorrecta primero pregunto si falta contexto, si el schema es pobre, si una regla determinista resolvería mejor, si retrieval falló o si el prompt está ambiguo.

Muchos "errores de IA" empresariales son errores de datos y workflow disfrazados.

Un modelo local también necesita evaluación

On-prem reduce una clase de riesgo de exposición. No garantiza calidad.

Necesito un conjunto de casos revisados por especialista y métricas por tarea: clasificación, extracción, agrupamiento y sugerencia de hipótesis.

Entonces cambiar de modelo se vuelve una decisión medible y no una comparación de demos.

"Los datos no salen" también debe valer para logs

Es fácil correr inferencia local y aun así filtrar valores por stack traces, tracing externo, screenshots, analytics o backups.

Por eso observabilidad y soporte entran en el modelo de seguridad.

Redacción, retención local y políticas de egress importan tanto como el servidor del modelo.

Power BI entra al final, no como fuente de verdad

Power BI es excelente para filtrar, explorar y comunicar.

No quiero que correcciones semánticas y estados de IA vivan solo dentro del reporte.

El pipeline publica tablas curadas y el dashboard las consume. Así las transformaciones son testeables y otra visualización puede aparecer después.

El gateway on-premises es una decisión de boundary

El on-premises data gateway de Microsoft puede conectar fuentes locales con servicios de Power BI.

Eso es útil, pero sigue implicando comunicación con servicios cloud de Microsoft.

Si la política significa literalmente que ningún dato corporativo puede salir de la red local, hay que validar si ese flujo está permitido. "Gateway" no significa automáticamente "100% local".

Una tabla de evidencia cambia la calidad del dashboard

Me gusta poder descender desde una métrica hasta los registros que la originaron:

txt
métrica
  ↓
cluster / categoría
  ↓
casos individuales
  ↓
archivo / hoja / fila de origen

Eso hace que la analítica sea discutible y verificable, no una colección de resúmenes de IA sin trazabilidad.

El producto final no es la IA; es un sistema de investigación

Las preguntas reales son qué aumentó, desde cuándo, en qué productos, lotes o líneas, qué evento ocurrió, qué hipótesis existe, qué evidencia la sostiene y qué corrigió la especialista.

La IA es importante porque el texto libre es difícil de agrupar a escala.

Pero el valor nace cuando esa capacidad entra en una cadena de datos, reglas, revisión y evidencia.

Así estoy empezando a ver Enterprise AI: menos chatbot en el centro y más capa de inteligencia verificable entre datos operacionales y decisión humana.

Referencias

The project started with one constraint that eliminated half the fashionable solutions

The business requirement was simple to state and difficult to satisfy:

corporate data must not leave the controlled environment.

That immediately changes the architecture.

A workflow that casually uploads spreadsheets to an external model endpoint, sends traces to a public observability SaaS or stores prompts in a third-party analytics service is no longer acceptable just because the model itself is "private".

The boundary has to include data, inference, logs, temporary files, embeddings, backups and support tooling.

This is the kind of requirement that turns AI from a feature into infrastructure.

Starting with a chatbot would have been the wrong move

The source data was a continuously maintained Excel workbook with many worksheets, merged cells, formulas, color conventions and inconsistent layouts.

The useful business questions were analytical:

  • what problem increased?
  • since when?
  • on which products, lots or lines?
  • what operational event happened around the same period?
  • what hypothesis exists?
  • what evidence supports it?

A chat interface cannot compensate for a weak data foundation.

So the first version of the architecture was not "Excel → LLM → answer". It was closer to:

txt
Excel
  ↓
raw extraction
  ↓
normalized records
  ↓
canonical business model
  ↓
AI enrichment / grouping
  ↓
human correction
  ↓
curated analytical tables
  ↓
Power BI

Before AI comes ingestion engineering

Messy spreadsheets are semi-structured interfaces built for humans.

Merged cells may carry hierarchy. Blank rows may separate sections. Colors may encode status. Formulas may be more valuable than their current displayed value.

A robust extractor therefore needs to understand more than pandas.read_excel() followed by dropna().

I want to capture, when relevant:

  • worksheet name;
  • row and column coordinates;
  • raw cell value;
  • formula;
  • formatted value;
  • fill/style signals used by the business;
  • merged-range membership;
  • source file version or hash.

That metadata gives me a way to trace a normalized record back to its origin.

I like creating an almost untouched raw layer

The raw layer is not pretty. That is the point.

Its job is to preserve enough of the source to let me reprocess later when extraction rules improve.

txt
raw_file
raw_sheet
raw_cell / raw_row
      ↓
normalization version N
      ↓
canonical record

Without that layer, every parser improvement requires trusting the already-transformed data or asking someone to upload old workbooks again.

Reproducibility starts before the model.

The canonical model is the least glamorous and most valuable part

The spreadsheet may express the same idea differently across tabs or years.

The analytical layer should not inherit every layout quirk.

I prefer mapping source variations into stable concepts such as:

ts
type ComplaintRecord = {
  id: string
  occurredAt: Date | null
  productCode?: string
  lot?: string
  productionLine?: string
  category?: string
  description: string
  confirmed: boolean
  source: SourceReference
}

Once this layer exists, Power BI, rules and AI all consume the same vocabulary.

That is what makes future changes cheaper.

Color is data when the business decided color is data

Engineers often treat formatting as cosmetic noise.

In operational spreadsheets, that assumption can destroy meaning.

If red fill means "confirmed", yellow means "under investigation" and green means "closed", fill color is effectively an undocumented enum.

The long-term goal should be to migrate meaning into explicit fields. But during ingestion, I still have to preserve what the source actually uses.

A good data pipeline respects reality before improving it.

AI works better after the structure is stable

Free-text complaints are a good fit for AI because people describe similar problems with different words.

The model can help with:

  • semantic grouping;
  • category suggestions;
  • entity extraction;
  • summarizing recurring descriptions;
  • linking similar cases for review.

But I do not let the model decide whether a complaint was confirmed if confirmation already exists as a business field.

The AI enriches the canonical record. It does not overwrite authoritative facts.

Hypothesis and fact need different types

One of the most important decisions is to stop putting everything in a single text answer.

I want a result to distinguish:

ts
type InvestigationFinding = {
  observation: string
  evidenceIds: string[]
  hypothesis?: string
  confidence?: number
  humanStatus: 'unreviewed' | 'accepted' | 'rejected' | 'edited'
}

"Complaints increased after the sealer change" is a much stronger statement than "complaints increased in the same period as the sealer change".

The first implies causality. The second describes temporal evidence.

A useful system should preserve that distinction instead of letting fluent text erase it.

Human correction is not a patch; it is part of the product

The domain specialist needs to be able to say things such as:

  • this category is wrong;
  • line 3 does not use this machine;
  • these two descriptions are equivalent;
  • this hypothesis is not operationally possible;
  • this source row was interpreted incorrectly.

Those corrections should not disappear into a chat history.

I store them as structured feedback tied to the record, rule or model output they modify.

Then the next processing run can reuse known corrections instead of making the specialist teach the system the same fact again.

I would not fine-tune as the first response

When an AI classification is wrong, fine-tuning is only one possible solution and usually not the first one I want.

First I ask:

  • is the source ambiguous?
  • is the canonical schema missing a field?
  • does a deterministic rule solve this better?
  • is retrieval missing relevant context?
  • is the prompt unclear?
  • is this actually a stable pattern worth learning?

Many enterprise AI errors are data and workflow errors wearing an AI costume.

A local model still needs evaluation

Running inference on-premises reduces one class of data-exposure risk. It does not make the output correct.

I still need a benchmark built from reviewed real cases.

For each task—classification, grouping, extraction, hypothesis suggestion—I can compare model output with a specialist-approved reference set and track precision, recall or task-specific acceptance metrics.

That makes model replacement a measurable engineering decision instead of a demo contest.

"Data does not leave" has to include logs

This is one of the easiest boundaries to accidentally break.

An application can run the model locally and still send:

  • stack traces containing row values;
  • prompts to an external tracing platform;
  • screenshots to remote support tooling;
  • backups to an uncontrolled bucket;
  • analytics events containing identifiers.

So I treat observability and support as part of the security model.

Redaction, local log retention and strict egress policies matter as much as the inference server.

Power BI belongs at the end, not as the source of truth

Power BI is excellent for exploration, filtering and executive communication.

I do not want the semantic corrections and AI state to live only inside a report.

The pipeline should publish curated tables that Power BI consumes.

That keeps transformations testable and makes another visualization layer possible later without recreating the domain logic.

The on-premises gateway is a boundary decision, not a checkbox

Microsoft's on-premises data gateway can bridge local data sources with Power BI services.

That is useful, but it matters to understand the boundary: using the gateway still involves communication with Microsoft's cloud services.

If an organization's policy literally means no corporate data may leave the local environment, the architecture must validate whether that usage is allowed instead of assuming "gateway" means "fully local".

Security requirements have to be translated into network and data-flow diagrams, not product names.

An evidence table changes the quality of the dashboard

Instead of a chart ending in a number, I like being able to drill down to the records that produced it.

txt
metric
  ↓
cluster/category
  ↓
individual cases
  ↓
source workbook / sheet / row

That traceability makes executive analytics more credible and gives the specialist a way to challenge a conclusion.

The dashboard becomes a view over evidence rather than a collection of untraceable AI summaries.

The final product is not the AI; it is an investigation system

The real questions are not "what did the model say?".

They are:

  • what increased?
  • since when?
  • on which products?
  • which lots or lines?
  • was there a nearby operational event?
  • what hypothesis exists?
  • which evidence supports it?
  • what did the specialist correct?

AI matters because free text is difficult to group and interpret at scale.

But the value appears when that ability is placed inside a chain of data engineering, rules, review and evidence.

That is increasingly how I see Enterprise AI: less chatbot at the center and more verifiable intelligence layer between operational data and human decisions.

References