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

Migrar un sistema sin perder un solo cliente ni un solo peso.

Move a system without losing a single customer or a single peso.

Una migración desde un sistema de facturación heredado a una plataforma nueva, guiada por una especificación de mapeo que negocio y sistemas revisan juntos, y cerrada con doce controles de conciliación.

A migration from a legacy billing system to a new platform, driven by a mapping spec that business and IT review together, and closed with twelve reconciliation checks.

PythonpandaspytestMapping specData qualityReconciliation
SectorIndustryTelecomunicacionesTelecom
Mi rolMy roleMapeo, reglas y conciliaciónMapping, rules, reconciliation
VolumenVolume4.060 clientes · 6.500 contratos4,060 customers · 6,500 contracts
ValidaciónValidation12 controles + 8 tests12 checks + 8 tests
Resumen de la migración y de los controles de conciliación

Contexto

Context

Un proveedor regional de internet y TV (ficticio) da de baja su sistema de facturación. La exportación trae lo de siempre: clientes cargados dos veces, contratos de clientes que no existen, fechas como 31.02.2019, códigos de estado que nadie documentó, importes guardados como texto en centavos.

A regional internet and TV provider (fictional) is retiring its billing system. The export has the usual problems: customers entered twice, contracts pointing to customers that do not exist, dates like 31.02.2019, undocumented status codes, amounts stored as text in cents.

Lo difícil de una migración casi nunca es copiar los datos. Es poder explicarle al negocio, registro por registro, qué pasó con su información, con números que pueda verificar.The hard part of a migration is rarely copying the data. It is being able to tell the business, record by record, what happened to their information, with numbers they can check.

Enfoque

Approach

La especificación de mapeo es la fuente de verdadThe mapping spec is the source of truthPara cada campo destino: campo origen, transformación, si es obligatorio y por qué. Si la especificación nombra una transformación que no existe, el código no corre.For every target field: source field, transformation, whether it is mandatory and why. If the spec names a transformation that does not exist, the code refuses to run.
Transformar, validar, decidirTransform, validate, decideUn error en un campo obligatorio rechaza el registro con su motivo. Uno en un campo opcional deja el valor vacío y queda registrado: no se pierde un cliente por un mail mal escrito.An error on a mandatory field rejects the record with a reason. One on an optional field blanks the value and logs it: no customer is lost over a typo in an e-mail.
Unificar duplicados con tabla de equivalenciasMerge duplicates with a crosswalkClientes con el mismo documento se unifican. La tabla guarda cada número viejo con su ID nuevo, así los contratos del duplicado encuentran a su cliente.Customers with the same national ID are merged. The crosswalk keeps every legacy number with its new ID, so contracts of the duplicate still find their customer.
ConciliarReconcileDoce controles corren después de cada migración. Si uno falla, la migración falla.Twelve checks run after every migration. If one fails, the migration fails.
# mapping/mapping_spec.csv (excerpt)
entity,target_field,source_field,transform,required
customer,customer_id,CUST_NO,surrogate_after_dedup,yes
customer,national_id,DOC_NR,digits_only,yes
customer,last_name,NAME_1,strip_title,yes
customer,email,EMAIL,lower_validate_email,no

Conciliación

Reconciliation

Estos son los doce controles tal como salen de la última corrida:

These are the twelve checks as they come out of the last run:

Clientes: origen = migrados + unificados + rechazados (4.060)Customers: source = migrated + merged + rejected (4,060)PASS
Contratos: origen = migrados + rechazados (6.500)Contracts: source = migrated + rejected (6,500)PASS
Cada clave de origen tiene un único destinoEach legacy key has exactly one outcomePASS
ID de cliente único en destinoUnique customer ID in targetPASS
Documento único en destino (duplicados unificados)Unique national ID in target (duplicates merged)PASS
ID de contrato único en destinoUnique contract ID in targetPASS
Todo contrato apunta a un cliente migradoEvery contract points to a migrated customerPASS
Abonos: centavos de origen = importe destino × 100Fees: legacy cents = target amount × 100PASS
Control inverso campo a campo: estadoField-level reverse check: statusPASS
Control inverso campo a campo: productoField-level reverse check: productPASS
Control inverso campo a campo: fecha de altaField-level reverse check: start datePASS
Control inverso campo a campo: abonoField-level reverse check: feePASS

Resultado

Result

Salida del caso de prueba sobre datos sintéticos:

Output of the test case on synthetic data:

3.9763,976clientes migradoscustomers migrated59 duplicados unificados · 25 rechazados59 duplicates merged · 25 rejected
6.3846,384contratos migradoscontracts migrated116 rechazados, cada uno con su motivo116 rejected, each with its reason
ARS 157.915.740ARS 157,915,740de abono mensualin monthly feesidéntico al centavo al origenidentical to the cent to the source

Los 116 contratos rechazados se explican solos: 51 porque su cliente fue rechazado, 30 huérfanos, 20 con fechas imposibles y 15 con códigos de estado desconocidos. Vuelven al negocio en rejects.csv para corregirse en origen.

The 116 rejected contracts explain themselves: 51 because their customer was rejected, 30 orphans, 20 with impossible dates and 15 with unknown status codes. They go back to the business in rejects.csv to be fixed at source.

Entregables

Deliverables

  • Especificación de mapeo revisable por negocio y sistemas.
  • Tabla de equivalencias entre IDs viejos y nuevos.
  • Reporte de conciliación y lista de rechazados con motivo.
  • 8 tests que verifican cada problema cargado en los datos de origen.
  • Mapping spec that business and IT can review.
  • Crosswalk between legacy and new IDs.
  • Reconciliation report and rejects list with reasons.
  • 8 tests that check every problem planted in the legacy data.
Siguiente casoNext caseConciliación y caja diaria automáticasAutomated daily reconciliation and cash