On this page

Sequencing Your Migration

When migrating data to OpenOrchid, maintain the relationships between data types. FHIR splits data across multiple Resources that contain References to each other.

The order below is a practical starting point, not a rule that applies to every migration. Walk through the references produced by your approved mappings and adjust the sequence when your data model differs. Loading a record early is not useful if doing so requires dropping the context that makes it meaningful.

We generally recommend starting with shared records, then loading the resources that refer to them. This sequence also prioritizes current clinical information before lower-priority history.

OrderData elementCommon FHIR resourcesWhy it comes here
1Organizations and locationsOrganization, LocationReferenced by roles, patients, encounters, and other records
2Providers and rolesPractitioner, PractitionerRoleLoad practitioners and organizations before roles that connect them
3Patient identity and administrationPatient, RelatedPerson, CoverageLoad Patient before RelatedPerson and Coverage records that reference it
4Operational contextEncounter, AppointmentLoad these before clinical records that preserve encounter or appointment context
5Current clinical stateCondition, AllergyIntolerance, MedicationRequestGives users an immediately useful patient summary
6Longitudinal clinical historyObservation, DiagnosticReport, ProcedureLoad Observation before DiagnosticReport records that reference it in result
7Documents and workflow historyDocumentReference, Communication, TaskThese often refer to patients, encounters, authors, or clinical records loaded earlier

Install required profiles and terminology before validating these stages.

Check the Order Against Your References​

The table is a starting point. Inspect the references produced by your approved mappings before finalizing the sequence. For example, a Condition without an encounter reference can load before encounter history, while a Condition.encounter reference requires that Encounter to be saved successfully before the dependent Condition is loaded.

This diagram illustrates common dependencies. Arrows point from prerequisite data to records that commonly depend on it:

  flowchart TD
    Organizations[Organizations] --> Locations[Locations]
    Organizations --> Roles[Practitioner roles]
    Practitioners[Practitioners] --> Roles
    Organizations --> Patients[Patients]
    Patients --> Encounters[Encounters]
    Roles --> Encounters
    Patients --> Clinical[Clinical data]
    Encounters --> Clinical
    Clinical --> Documents[Documents and workflow history]
    Encounters --> Documents

When a target reference does not exist yet, prefer loading that resource first and confirming success before loading its dependents. Use the saved ID or a conditional reference that resolves uniquely to the existing resource. See staged upserts.

If the target will arrive later, and profiles and workflows permit an unresolved relationship, use a two-pass backfill with logical references. Preserve the target's source identifier, track the pending link, and resolve it explicitly after the target is loaded. Keep patient-compartment references established before exposing clinical data. A conditional reference cannot defer resolution to a later import.

Do not drop the relationship merely to make the load succeed. Atomic transaction Bundles require the transaction-bundles project feature.

Next, define and approve the rules for governing data mappings.