Business · Product · Technology · AI

Medical data migration retries: stable identity, baseline checks and edited destinations

How the reviewed Movo-X patient importer separates unchanged retries from conflicts, checks mapped fields and protects unrelated clinic data.

Work directly with Omer Muneer Qazi · Reviewed 29 November 2026

The scenario: the first run did not finish cleanly

A migration process ends before the operator has an accepted result. Rerunning it should not create another patient for each source record. But avoiding duplicates is not the only concern. Perhaps the source snapshot changed, an operator corrected the destination, or the destination now contains unrelated records. A broad upsert can turn a retry into an unintended overwrite.

The inspected Movo-X patient importer illustrates a narrower contract. It imports from a reconciled private snapshot, uses stable source-to-target identity and checks the existing imported baseline. This chapter describes source behaviour. It does not execute the importer or use real patient data, and it does not claim that an unchanged retry provides a complete source-refresh strategy.

Begin with an accepted snapshot context

The SQL template requires a matching reconciled migration-run context. It also checks the intended destination operating state before proceeding. The Python wrapper supplies validated run identifiers and chooses whether the transaction ends in commit or rollback. These are separate responsibilities from ordinary patient-creation endpoints. Historical import should not acquire side effects merely by reusing a command intended for live clinical work.

For a commissioning team, the required decision is explicit: what snapshot and destination state is this run allowed to affect? A vague instruction to import the latest records is not enough. The run needs a defined identity, transformation version and acceptance owner so a later investigation can reconstruct the meaning of a completed transaction.

Use stable identity instead of matching on resemblance

The reviewed SQL derives destination patient identifiers deterministically within the intended tenant namespace and retains a source identity map. It validates the source identity representation before constructing candidates. Comments in the implementation make the intended boundary clear: matching names, telephone numbers or displayed record numbers are not an instruction to merge people.

Consider two synthetic source rows with similar names and a shared household phone. They may still represent different people. Conversely, a source system may expose a current and historical representation of the same stable identity. The migration design needs an explicit rule for that relationship. Preserving lineage is more useful than choosing whichever record makes a uniqueness constraint disappear.

Distinguish an unchanged retry from an edited target

The inspected importer stores a digest of the accepted destination representation in the identity map. On a later run, it checks whether the existing imported row still matches that baseline and whether it belongs to the expected import context. A changed imported target causes an explicit reconciliation requirement rather than an automatic overwrite.

This is a meaningful restriction. Suppose a destination operator corrected a synthetic patient address after the first copy. Reapplying the original source payload would erase that accepted destination work if the process used unconditional last-write-wins. A baseline comparison lets the tool stop and ask for a conflict decision. It does not decide which address is clinically or operationally correct; that remains a separate reviewed process.

A no-op retry is not a source refresh

The migration documentation describes source refresh as a separate acceptance gate. New source snapshots can contain updates, deletions, voided financial entries, corrected links and late-arriving children. A filter that selects only recently created records misses many of those changes. Likewise, a stable patient identifier alone does not prove that all transformed fields remain equivalent.

A refresh design needs source versions or hashes, target versions and a reviewed rule for conflicts. Missing source records should not automatically delete signed clinical or financial history in the destination. The implementation inspected here supports an explanation of baseline-guarded patient copying; a complete bidirectional synchronization or ongoing change-capture system would require additional design and evidence.

Reconcile fields, not just totals

The SQL compares mapped candidate fields with the destination representation and checks patient totals. It separately preserves original record numbering while allowing the destination to maintain its own internal numbering. This avoids a misleading conclusion in which the number of patients is correct but a mapping error moved an allergy or historical identifier into the wrong place.

A useful synthetic rehearsal changes one mapped field while holding the total count constant. The acceptance report should expose the mismatch. Further cases include missing timestamps, an unsupported profile shape and an identity-map disagreement. These are proposed additional rehearsal cases for a suitable isolated environment; this chapter does not report that the PostgreSQL import was newly executed for publication.

Protect other clinics and separate transaction success from readiness

The reviewed template captures counts and digests for unrelated clinic rows before the import and compares them before completion. That is a valuable additional boundary around a tenant-scoped migration. It still does not replace runtime authorization tests: a correct import could coexist with an application reader that exposes too much data. Both kinds of evidence are necessary.

The wrapper also records runtime readiness as false in its import result. That reflects an important distinction between storing mapped data and operating a clinical workflow. A team still needs role-based history review, document readability, financial reconciliation where relevant and user-interface acceptance. No importer should activate a destination merely to make the migration demonstration look finished.

Acceptance and handover for a repeatable import

A focused acceptance plan covers first import, unchanged retry, interrupted-run recovery, changed source, changed target and unrelated destination data. Record the snapshot identity, transformation revision, committed outcome and exact reason for any conflict. Keep actual row payloads and diagnostics private; the public account can explain the method with synthetic examples.

The first delivery milestone should be a repeatable isolated rehearsal and a reconciliation report, not an irreversible production switch. The handover identifies who resolves conflicts, what constitutes an accepted baseline and what further evidence is required for cutover. This makes idempotency a specific tested property rather than a blanket label attached to a migration script.

About this engineering series

Written by Omer Muneer Qazi from a review of Movo-X implementation and dated engineering records. This article explains source behaviour and historical observations; current production, clinical outcomes and store availability require their own verification. Examples are synthetic and proposed test cases are identified as such.

Explore the Movo-X engineering series → · Related implementation experience →

Discuss a similar engineering problem

Send the workflow, current platform and the decision your team needs to make. I can help define an implementation or review scope with concrete acceptance evidence.

Discuss your project on WhatsApp ↗
WhatsApp Omer about this project ↗