Data migration validation, reporting, and preflight toolkit.
Project description
migration-tools
A Python toolkit for data migration validation, preflight checks, and reporting.
Install
pip install migration-tools
Quick start
from migration_tools import (
setup_logger,
load_dataset,
load_mapper,
init_outputs,
run_preflight_checks,
check_output_date_formats,
run_date_correlation_check,
write_outputs,
print_summary,
generate_html_report,
)
logger = setup_logger(log_dir="logs")
data = load_dataset("dataset1.xlsx", logger=logger)
migration = load_mapper("mapper.xlsx", logger=logger)
output_success, output_failed = init_outputs(migration)
# Pre-flight: column presence, mapping coverage, date format
run_preflight_checks(
data,
migration,
date_columns=["PaatosPaiva", "VoimassaolonAlkamisPaiva"],
date_format="%d.%m.%Y",
logger=logger,
)
# ... your conversion loop ...
# Post-conversion checks
check_output_date_formats(output_success, date_format="%d.%m.%Y", logger=logger)
run_date_correlation_check(output_success, logger=logger)
# Write outputs and summary
output_zucc, output_fail = write_outputs(output_success, output_failed, "dataset1", logger)
print_summary(len(data), len(output_success), len(output_failed), output_zucc, output_fail, 12.4, logger)
# Generate HTML report
generate_html_report(
dataset_name="dataset1",
total_rows=len(data),
success_count=len(output_success),
failed_count=len(output_failed),
execution_time=12.4,
output_success=output_success,
output_failed=output_failed,
logger=logger,
)
CLI
# Run preflight checks only
migration-tools validate --dataset dataset1.xlsx --mapper mapper.xlsx
# Validate and generate an HTML report
migration-tools report --dataset dataset1.xlsx --mapper mapper.xlsx --format html
# Validate and generate an Excel report
migration-tools report --dataset dataset1.xlsx --mapper mapper.xlsx --format excel
# Both formats at once
migration-tools report --dataset dataset1.xlsx --mapper mapper.xlsx --format both
# Custom date columns and format
migration-tools validate \
--dataset dataset1.xlsx \
--mapper mapper.xlsx \
--date-cols PaatosPaiva VoimassaolonAlkamisPaiva \
--date-format "%d.%m.%Y"
Supported file formats
| File | Formats supported |
|---|---|
| Dataset | .xlsx, .csv, .json |
| Mapper | .xlsx, .json |
What gets validated
| Check | When |
|---|---|
| Required columns present in dataset | Pre-flight |
| Mapping coverage (all value combos have a mapper row) | Pre-flight |
| Source date format | Pre-flight |
| Near-duplicate / whitespace column names | Pre-flight |
| Output date format after transformation | Post-conversion |
Decision_FromDate ≤ Decision_ToDate |
Post-conversion |
Actualization_Date matches Decision_FromDate |
Post-conversion |
Publishing a new version
- Bump
versioninpyproject.tomland__init__.py - Commit and push to
main - Create a GitHub Release — CI will build and publish to PyPI automatically
Development
git clone https://github.com/yourname/migration-tools
cd migration-tools
pip install -e ".[dev]"
pytest tests/ -v --cov=migration_tools
License
MIT
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file autom8s-0.1.0.tar.gz.
File metadata
- Download URL: autom8s-0.1.0.tar.gz
- Upload date:
- Size: 14.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c954ea1ec808e947249f8f94683564f1082fe7b0a3b35cb631036e8de82edb33
|
|
| MD5 |
b90f5772ba58bb3db46aacb2e0cc3f55
|
|
| BLAKE2b-256 |
0d798af10dc5f567f18d8ed37bab0c117fff2c8a51a798698d4745c2eee94a87
|
Provenance
The following attestation bundles were made for autom8s-0.1.0.tar.gz:
Publisher:
ci.yml on DrinasKastrati/Autom8s
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
autom8s-0.1.0.tar.gz -
Subject digest:
c954ea1ec808e947249f8f94683564f1082fe7b0a3b35cb631036e8de82edb33 - Sigstore transparency entry: 1042871971
- Sigstore integration time:
-
Permalink:
DrinasKastrati/Autom8s@25a2a76d115af37085f77181bb5eb585f68a8ad8 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/DrinasKastrati
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@25a2a76d115af37085f77181bb5eb585f68a8ad8 -
Trigger Event:
release
-
Statement type:
File details
Details for the file autom8s-0.1.0-py3-none-any.whl.
File metadata
- Download URL: autom8s-0.1.0-py3-none-any.whl
- Upload date:
- Size: 15.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f8ff54d050f723af5ecfb9a1b3d59d9e89dabf2130474b9d41c9dcc4762f85d8
|
|
| MD5 |
452038e3bed7eb310307b1066b5007ee
|
|
| BLAKE2b-256 |
bba28e23549edf4bff7a008a371de22592015cb2d5805b944ff2929c57d23b31
|
Provenance
The following attestation bundles were made for autom8s-0.1.0-py3-none-any.whl:
Publisher:
ci.yml on DrinasKastrati/Autom8s
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
autom8s-0.1.0-py3-none-any.whl -
Subject digest:
f8ff54d050f723af5ecfb9a1b3d59d9e89dabf2130474b9d41c9dcc4762f85d8 - Sigstore transparency entry: 1042871997
- Sigstore integration time:
-
Permalink:
DrinasKastrati/Autom8s@25a2a76d115af37085f77181bb5eb585f68a8ad8 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/DrinasKastrati
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@25a2a76d115af37085f77181bb5eb585f68a8ad8 -
Trigger Event:
release
-
Statement type: