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.
Recommended Migration Order
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.
| Order | Data element | Common FHIR resources | Why it comes here |
|---|---|---|---|
| 1 | Organizations and locations | Organization, Location | Referenced by roles, patients, encounters, and other records |
| 2 | Providers and roles | Practitioner, PractitionerRole | Load practitioners and organizations before roles that connect them |
| 3 | Patient identity and administration | Patient, RelatedPerson, Coverage | Load Patient before RelatedPerson and Coverage records that reference it |
| 4 | Operational context | Encounter, Appointment | Load these before clinical records that preserve encounter or appointment context |
| 5 | Current clinical state | Condition, AllergyIntolerance, MedicationRequest | Gives users an immediately useful patient summary |
| 6 | Longitudinal clinical history | Observation, DiagnosticReport, Procedure | Load Observation before DiagnosticReport records that reference it in result |
| 7 | Documents and workflow history | DocumentReference, Communication, Task | These 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.