Todos los proyectosAll projects
Caso de estudio · datos sintéticosCase study · synthetic data

La IA redacta el reporte. Ningún número sale sin verificar.

AI drafts the report. No number goes out unchecked.

Un reporte mensual de KPIs en el que un modelo de lenguaje escribe el comentario y un control revisa cada cifra contra los datos. Si un solo número no se puede respaldar, el reporte queda bloqueado.

A monthly KPI report where a language model writes the commentary and a checker tests every figure against the data. If a single number cannot be backed, the report is blocked.

PythonLLMpandaspytestKPI reportingRelease gate
SectorIndustryE-commerceE-commerce
Mi rolMy roleDiseño del control y QAControl design and QA
VolumenVolume~47.000 órdenes~47,000 orders
ValidaciónValidationCompuerta + 4 testsRelease gate + 4 tests
Reporte bloqueado: cinco números del comentario no se respaldan con los datos

Contexto

Context

Los modelos de lenguaje escriben buenos primeros borradores de un comentario mensual. También cometen exactamente los errores que hacen que finanzas deje de confiar en un reporte: una cifra parecida pero no exacta, el interanual citado como mensual, “creció” cuando el dato cayó, el número de otra métrica, o un dato externo sin fuente.

Language models write good first drafts of a monthly commentary. They also make exactly the mistakes that make finance stop trusting a report: a figure that is close but not right, year-on-year quoted as month-on-month, “grew” where the data fell, a number borrowed from another metric, or an outside figure nobody sourced.

Revisar oración por oración a mano anula el beneficio de automatizar.

Checking sentence by sentence by hand defeats the point of automating.

Enfoque

Approach

Primero los datosFacts firstSe calculan los KPIs del mes desde las órdenes: facturación, órdenes, ticket promedio, margen, devoluciones, clientes nuevos y CAC, contra el mes anterior y el mismo mes del año pasado.The month's KPIs are computed from raw orders: revenue, orders, average ticket, margin, returns, new customers and CAC, against the previous month and the same month last year.
El modelo redactaThe model draftsRecibe solo esos datos y una instrucción breve. No tiene de dónde sacar otra cosa.It receives only those facts and a short instruction. It has nowhere else to take numbers from.
Cada número se verificaEvery number is checkedQue exista con el redondeo que muestra el texto, que sea de la métrica que nombra la oración, del período que dice, y que el verbo coincida con el signo.That it exists at the rounding the text shows, belongs to the metric the sentence names, to the period it states, and that the verb matches the sign.
Compuerta de publicaciónRelease gateEl reporte marca cada número en verde o en rojo. Si hay uno en rojo, el proceso termina con error y no se publica.The report marks every number green or red. If one is red, the job exits with an error and nothing is published.

Prueba

Test

Dos borradores incluidos en el repositorio: uno correcto y otro con cinco errores típicos plantados a propósito. Esta es la salida real:

Two drafts ship with the repository: one correct and one with five typical mistakes planted on purpose. This is the actual output:

kpicheck
$ python run.py --draft examples/draft_ok.md
18 numbers checked, 0 problems -> RELEASED

$ python run.py --draft examples/draft_with_errors.md
13 numbers checked, 5 problems -> BLOCKED
  NOT_FOUND             4,8  | La facturación bajó 4,8% contra agosto ...
  WRONG_DIRECTION      10,6  | Los clientes nuevos crecieron 10,6% contra agosto ...
  WRONG_METRIC          7,9  | La tasa de devolución fue 7,9% ...
  WRONG_PERIOD         30,7  | El CAC subió 30,7% contra agosto.
  NOT_FOUND              30  | ... una inflación cercana al 30% anual.

Resultado

Result

Salida del caso de prueba (datos sintéticos, errores cargados a propósito):

Output of the test case (synthetic data, errors planted on purpose):

1818números en el borrador correctonumbers in the correct drafttodos verificados: se publicaall verified: released
55errores típicos plantadostypical errors plantedtodos marcados: se bloqueaall flagged: blocked
44tipos de error distintosdistinct error typesdato, métrica, período, direcciónvalue, metric, period, direction
Límite, dicho claro: el control asegura que cada número es correcto. Si la explicación es la acertada lo sigue decidiendo el analista, y por eso el reporte tiene un responsable humano.Limit, stated plainly: the checker proves every number is right. Whether the explanation is the right one is still the analyst's call, which is why the report has a human owner.

Entregables

Deliverables

  • Cálculo de KPIs reproducible desde los datos crudos.
  • Verificador de números en formato argentino (1.234,5).
  • Reporte HTML con cada cifra en verde o rojo.
  • Compuerta que bloquea la publicación, lista para un job programado.
  • Reproducible KPI computation from raw data.
  • Number checker for Argentine formatting (1.234,5).
  • HTML report with every figure in green or red.
  • Release gate that blocks publishing, ready for a scheduled job.
Siguiente casoNext caseMigración de datos con conciliaciónData migration with reconciliation