Business · Product · Technology · AI

Before copying medical data: prove ownership, relationships and unresolved scope

A Movo-X source walkthrough of read-only migration discovery, parent ownership checks and why an inventory is not a backup or cutover.

Work directly with Omer Muneer Qazi · Reviewed 29 November 2026

The scenario: a clinic identifier is necessary but insufficient

Imagine an encounter carrying the selected clinic identifier while its patient reference points to a record owned by a different clinic. A filter on the encounter alone would include the row. A migration that also copies the referenced patient could cross an ownership boundary; one that drops the parent could leave a clinically unusable encounter. The important question is not simply how many rows match. It is whether the selected records form an explainable ownership graph.

The reviewed Movo-X discovery tooling treats this as a separate stage from export and import. This chapter explains that discovery implementation and an isolated synthetic test run. It does not report a new production data extract or establish that an entire migration has passed acceptance.

Discover the schema before fixing the selection rules

An inventory needs relation names, columns and relationships before it can explain the selected scope. The inspected tool builds ownership rules from catalog information and classifies relations that can be associated with the selected clinic. Direct ownership and ownership derived through a parent relationship are different kinds of evidence. A shared reference table or unresolved message record should not be silently treated as ordinary clinic-owned data.

This prevents a common failure in long-running migrations: the first table list becomes an unquestioned permanent definition of the product. New relations, changed links and previously empty tables can alter what the application needs. A repeat inventory should surface those changes so someone can decide their disposition rather than reuse an old export predicate blindly.

Check all relevant parents, not just the convenient one

The source tests include a child that depends on multiple known scoped parents. They also include a directly scoped child whose referenced parent belongs elsewhere, and a parent whose ownership is resolved later in discovery. These are materially different cases from a simple parent-to-child join. A final relationship audit matters because the order in which relations are discovered must not decide whether a conflict is noticed.

For a synthetic example, define two unrelated clinics, two patients and an encounter whose clinic and patient ownership disagree. The expected result is an explicit conflict requiring disposition. It is not a successful export with a warning hidden in a log. Where parent ownership remains unresolved, that uncertainty needs to remain visible in the inventory and later approval record.

Keep unresolved relationships explicit

A phone number, name or historical identifier can be useful for an investigation, but similarity alone does not establish the right owner of a clinical record. The reviewed inventory tests deliberately leave ambiguous messaging or shared-reference relations unresolved rather than adding an export predicate. This is a product-data decision, not merely a SQL convenience.

An operator needs a disposition for each unresolved relation: prove its ownership, preserve it in a restricted recovery archive, exclude it with a reason, or defer the migration feature that depends on it. The right choice depends on the source and the operational requirement. The article does not prescribe deleting unresolved records or weakening the destination model to make an import appear complete.

Use read-only discovery, but understand its consistency boundary

The inspected query wrapper requests read-only transactions and bounded execution. The inventory output explicitly says that catalog, counts and relationship checks occur in separate transactions. Each query can be read-only while the combined report still observes different moments in an actively changing source. That is a useful discovery report, not a transactionally consistent backup snapshot.

A migration team should decide when it needs one consistent snapshot and record the boundary used to obtain it. An estimate of candidate rows should not be relabelled as the number successfully recovered. The discovery result also keeps export authorization and backup completeness false, so downstream work cannot reasonably infer permission or readiness from an inventory command returning successfully.

What the isolated test run establishes

For this review, nine existing synthetic tests were rerun from the pinned source files in an isolated local folder. They passed. The cases exercise direct clinic and seed exclusion, multiple scoped parents, deep parent aliases, conflicting current and historical patient relationships, unresolved relations, identifier rejection and final relationship-audit behaviour. Their fixtures are synthetic in-memory database structures; no production database connection or clinical row was used.

This result is deliberately narrow. It supports discussion of the tested discovery rules. It does not certify the PostgreSQL importer, object recovery, runtime authorization, rendered medical history or present production configuration. Those are separate components with different evidence requirements. A useful engineering report should preserve that distinction instead of promoting a small green test suite into a general claim of migration safety.

Turn the inventory into a reviewable migration manifest

The next deliverable is a versioned manifest mapping each selected relation to its ownership proof, key, dependencies, intended target representation and archival disposition. Record unresolved questions and the person who can accept their resolution. Keep source identifiers separate from newly generated destination identifiers so later reconciliation can explain where a record came from.

The manifest should also name non-row dependencies, including referenced attachments, document decryption requirements and operational integrations that must remain disabled during rehearsal. A database table count cannot show whether a scanned document is readable or whether a copied historical action might accidentally trigger a reminder. These checks belong in the acceptance plan before a copying tool is granted write authority.

A practical first milestone for a CTO

Commission a read-only ownership map and a synthetic conflict demonstration before authorizing an operational migration. The output should list the source revision, discovery boundary, selected and unresolved relation classes, known parent conflicts and the evidence needed for the next stage. Keep the source writer and customer-facing endpoints unchanged while the scope is being established.

That milestone makes the next decision concrete: which records can be copied, which need further investigation and which dependencies block a useful rehearsal. It also exposes the actual engineering effort behind a migration without publishing private records or asserting that source discovery alone delivers a working clinical system.

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 ↗