TECHPARTNER CONSULTING

Codester demo · Scripts & Code → Python

Spreadsheet Migration QA — Check Nothing Was Lost in the Move

Record-by-record checker for spreadsheet migrations: missing IDs, lost values, mapped-field mismatches, review queue.

$12 on CodesterTest suite: 19 passedChecks below: run on the bundled demo files

The demo files

The package ships demo files with fictional data that produce all three outcomes: a clean migration, a missing record, and swapped fields. Two of them:

original.csv — the source

Record IDNameNotes
1Demo CustomerFollow up on Friday
2Sample ContactRequested a quote

swapped-fields.csv — Name and Notes traded places on record 1

Record IDNameNotes
1Follow up on FridayDemo Customer
2Sample ContactRequested a quote

Three checks, three verdicts

The real checker (data_mapping_qa.py, standard library only) run on the demo files: the clean pair passes with exit code 0; the missing record is named by ID; and with the optional field map, the swapped Name/Notes values are caught value-for-value. Exit code is 0 only on a full pass, so the checker can gate a delivery.

$ python3 data_mapping_qa.py original.csv migrated.csv --id-field "Record ID" --notes-field Notes
{
  "source_count": 2,
  "destination_count": 2,
  "duplicate_source_ids": [],
  "duplicate_destination_ids": [],
  "missing_destination_ids": [],
  "unexpected_destination_ids": [],
  "notes_with_line_breaks": [],
  "potentially_lost_values": {},
  "checked_field_map": {},
  "field_mismatches": {},
  "passed": true
}
exit code: 0

$ python3 data_mapping_qa.py original.csv missing-record.csv --id-field "Record ID" --notes-field Notes
{
  "source_count": 2,
  "destination_count": 1,
  "duplicate_source_ids": [],
  "duplicate_destination_ids": [],
  "missing_destination_ids": [
    "2"
  ],
  "unexpected_destination_ids": [],
  "notes_with_line_breaks": [],
  "potentially_lost_values": {},
  "checked_field_map": {},
  "field_mismatches": {},
  "passed": false
}
exit code: 1

$ python3 data_mapping_qa.py original.csv swapped-fields.csv --id-field "Record ID" --field-map field-map.json
{
  "source_count": 2,
  "destination_count": 2,
  "duplicate_source_ids": [],
  "duplicate_destination_ids": [],
  "missing_destination_ids": [],
  "unexpected_destination_ids": [],
  "notes_with_line_breaks": [],
  "potentially_lost_values": {},
  "checked_field_map": {
    "Name": "Name",
    "Notes": "Notes"
  },
  "field_mismatches": {
    "1": [
      {
        "source_field": "Name",
        "destination_field": "Name",
        "expected": "Demo Customer",
        "actual": "Follow up on Friday"
      },
      {
        "source_field": "Notes",
        "destination_field": "Notes",
        "expected": "Follow up on Friday",
        "actual": "Demo Customer"
      }
    ]
  },
  "passed": false
}
exit code: 1

The desktop app

The same checked code behind a desktop front end — pick both files, type the column names, read the findings, save a JSON report.

The Spreadsheet Migration QA desktop app after a clean pass — real screenshot from the package.

What it does