Codester demo · Scripts & Code → Python
Record-by-record checker for spreadsheet migrations: missing IDs, lost values, mapped-field mismatches, review queue.
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:
| Record ID | Name | Notes |
|---|---|---|
| 1 | Demo Customer | Follow up on Friday |
| 2 | Sample Contact | Requested a quote |
| Record ID | Name | Notes |
|---|---|---|
| 1 | Follow up on Friday | Demo Customer |
| 2 | Sample Contact | Requested a quote |
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: 1The same checked code behind a desktop front end — pick both files, type the column names, read the findings, save a JSON report.
