All projects
Case study · synthetic data Updated: October 2026

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

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
IndustryTelecom
My roleMapping, rules, reconciliation
Volume4,060 customers · 6,500 contracts
Validation12 checks + 8 tests
Migration summary and reconciliation checks

Context

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.

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.

Approach

The mapping spec is the source of truthFor 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.
Transform, validate, decideAn 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.
Merge duplicates with a crosswalkCustomers 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.
ReconcileTwelve 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

Reconciliation

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

Customers: source = migrated + merged + rejected (4,060)PASS
Contracts: source = migrated + rejected (6,500)PASS
Each legacy key has exactly one outcomePASS
Unique customer ID in targetPASS
Unique national ID in target (duplicates merged)PASS
Unique contract ID in targetPASS
Every contract points to a migrated customerPASS
Fees: legacy cents = target amount × 100PASS
Field-level reverse check: statusPASS
Field-level reverse check: productPASS
Field-level reverse check: start datePASS
Field-level reverse check: feePASS

Result

Output of the test case on synthetic data:

3,976customers migrated59 duplicates merged · 25 rejected
6,384contracts migrated116 rejected, each with its reason
ARS 157,915,740in monthly feesidentical to the cent to the source

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.

Deliverables

  • 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.
Next caseAutomated daily reconciliation and cash