Legacy Migration Plan
Legacy Data Migration & Validation Blueprint
Data Migration Guardrail
This document blueprints the production extraction, transformation, cryptographic cleansing, and validation steps required to safely move legacy patient records into the new system architecture.
1. Migration Scope & Schema Strategy
The legacy system stores patient records, visit histories, and financial ledgers across an un-indexed SQL database filled with cleartext identifiers and un-coded, free-text diagnoses.
1.1 Legacy-to-Target Domain Target Matrix
| Legacy Entity Type | Target Module Schema | Transformation Constraint | Coding Standard Applied |
|---|---|---|---|
| tbl_demographics | master_patient_index | Convert names to byte arrays using AES-256-GCM field encryption. Generate deterministically hashed phone records for lookups. | National Unique Patient ID (NUPI) |
| tbl_visit_history | patient_encounters | Parse text strings into discrete encounter class attributes (OUTPATIENT, INPATIENT). | Dual-token identity matching |
| tbl_diagnoses | clinical_consultations | Run string-matching scripts to map legacy text inputs to standardized codes. Unmapped entries default to a REVIEWS_PENDING flag. | WHO ICD-11 Taxonomy |
| tbl_billing_ledger | financial_ledger_entries | Re-aggregate raw balance parameters into an append-only, transaction split architecture. | Double-Entry Bookkeeping |
2. Production Extraction, Transformation & Loading (ETL) Script
The production ETL migration utility runs within an isolated staging container. It streams legacy records sequentially to protect system memory limits.
3. Data Cleansing & Validation Controls
To ensure data accuracy post-migration, the system runs automated validation tests across the target database before going live.
3.1 Data Validation Procedures
- Row Count Verification: Matches total records extracted from the legacy system against total entries populated in PostgreSQL to verify that no rows were dropped during migration.
- Cryptographic Decryption Test: Extracts a random sample of encrypted binary records from master_patient_index and verifies they can be decrypted back to their original cleartext format, ensuring encryption keys are configured correctly.
- ICD-11 Diagnostics Validation Check: Runs an automated audit query to catch any diagnostic records that failed the string-matching transformation step, tracking unmapped entries for the medical records team:
Document Verification Block
Author: Ian Wataka
Target Scope: Legacy System ETL, Data Validation, and Cryptographic Cleansing