Operations

Data Migration

Plan and carry out a migration into AMCDR, including identity matching, clinical mappings, validation, and cutover.

Migration principle

Before importing legacy clinical data, match patient identities, map terminology and templates, and validate the records. Create compositions through the clinical lifecycle so each imported record has the same checks and history as a record captured in AMCDR.

Scope

Assessment

Inventory source systems, files, identifiers, clinical domains, code systems, date ranges, and ownership.

Target Design

Choose patient, visit, encounter, EHR, template, FHIR profile, and terminology targets before loading.

Mapping

Map legacy fields to openEHR templates, FHIR StructureDefinitions, internal MPI, and catalogue types.

Validation

Run dry-runs, profile validation, terminology validation, duplicate detection, and mandatory-field checks.

Loading

Load in batches, retain provenance, record validation results, and reconcile counts before cutover.

Cutover

Plan freeze windows, rollback, rejected-record handling, post-load reporting, and support after go-live.

Migration Operating Model

Plan the migration with named owners, reviewed mappings and a clear cutover process. Every imported record needs its source, mapping version, validation result, patient/EHR context and reconciliation result. Follow the same order as clinical data capture: establish patient identity, resolve the encounter, then create the composition.

Migration flow
Source inventory
->
Patient/MPI matching
->
FHIR/profile or template mapping
->
Dry-run validation
->
Batch load
->
Reconciliation and cutover

Phase 1: Source Assessment

List the records to migrate and any exclusions. Review old, duplicate, inactive and legally restricted records before including them in the import.

Assessment itemQuestions to answer
Source systemsWhich EMR, LIS, pharmacy, registry, paper-scanned, FHIR, HL7v2, CSV, XML, or NDJSON source produced the data?
Clinical scopeWhich domains are included: demographics, encounters, diagnoses, lab results, medications, immunisations, procedures, documents, deaths, births, or referrals?
Patient identifiersWhich identifiers are reliable: MRN, national ID, refugee number, passport, phone, family links, facility birth number, or old system id?
Code systemsWhich terminology systems exist: SNOMED CT, LOINC, ICD-10, ATC, EDQM, local lab codes, local drug codes, or free text?
Date qualityAre timestamps exact, date-only, partial, missing timezone, or copied from registration dates?
Data ownershipWho approves mappings, validation rules, patient merge decisions, and final go-live sign-off?

Phase 2: Target Model Design

Define where every source data class lands in AMCDR. Demographics belong in client/patient/MPI structures. Clinical facts belong in template-governed openEHR compositions. Operational state belongs in visit, encounter, movement, workflow, or relationship records. FHIR resources may be retained as exchange provenance, but they must not replace canonical openEHR clinical storage when a template target exists.

Source dataAMCDR targetNotes
Demographic CSVClient registry, patient, identity party, MPI linksRun duplicate checks before patient/EHR creation.
FHIR PatientFHIR facade plus AMCDR patient identityUse POST /fhir/Patient for direct create or MPI import workflows for duplicate-sensitive projects.
FHIR ObservationMapped openEHR composition or direct FHIR resourceUse /fhir/ingest when it must become canonical clinical data.
FHIR BundleLinked FHIR resources, then mapped compositions where configuredUse /fhir/Bundle for reference resolution; use profile mappings for canonical composition creation.
Lab CSV/HL7v2Laboratory result template compositionMap local test codes to LOINC or configured terminology before import.
Medication listMedication statement/request/administration template or FHIR medication resourcesMap product codes and active ingredients through the medication product source and terminology maps.
Documents/mediaDocumentReference and media/document storageKeep source file reference, checksum, and patient/encounter link.

Phase 3: FHIR StructureDefinitions And Mapping

For FHIR sources, including data converted to FHIR, import the relevant StructureDefinitions first. These define the expected exchange format. Then map the FHIR profile paths to openEHR template fields. See FHIR Mapping and SDs for examples and API details.

1. Import FHIR StructureDefinition
   POST /fhir/profiles/import-file

2. Create transformation map
   POST /fhir/mappings

3. Run governed ingest
   POST /fhir/ingest

4. Review failures
   GET /fhir/validation-results

Use direct FHIR APIs only when direct FHIR facade storage is the intended outcome. Use mapping-based ingest when the intended outcome is a canonical openEHR composition.

Phase 3b: TDS/TDD Template-Based Imports

When a source system is not FHIR-native but maps records to an openEHR template, export the target template's TDS XSD, import that schema into the mapping tool, map source values into the TDD XML structure, then submit the mapped XML through the governed template composition endpoint.

StepEndpointPurpose
Export target schemaGET /templates/{template_key}/exports/tdsGenerates on demand when needed and gives migration tooling the schema contract for Talend, Mirth, ALUR, or XML validation.
Export sample documentGET /templates/{template_key}/examples/tddGives migration tooling a template-specific TDD Example XML with namespace, schema-location, context, and data elements.
Load one mapped recordPOST /records/ingestUse the governed TDD transformation envelope; TDD is not exposed as an alternative composition CRUD representation.
Verify loaded recordGET /openehr/v1/ehr/{ehr_id}/composition/{uid_based_id}Returns the canonical or simplified representation selected by Accept.
Batch safelysame endpoint, batched by migration workerKeep source row id, batch id, mapping version, and validation result in provenance or migration logs.
{
  "template_key": "vitals",
  "format": "tdd_example",
  "patient_id": "00000000-0000-0000-0000-000000000000",
  "payload": {
    "xml": "<?xml version=\"1.0\" encoding=\"UTF-8\"?><Vital_Signs xmlns=\"http://schemas.oceanehr.com/templates\" xmlns:oe=\"http://schemas.openehr.org/v1\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" template_id=\"vitals.v1\"><context><language><terminology_id><value>ISO_639-1</value></terminology_id><code_string>en</code_string></language><time><value>2026-03-13T10:15:00Z</value></time></context><data><systolic><value xsi:type=\"oe:DV_QUANTITY\"><oe:magnitude>120</oe:magnitude><oe:units>mm[Hg]</oe:units></value></systolic><diastolic><value xsi:type=\"oe:DV_QUANTITY\"><oe:magnitude>80</oe:magnitude><oe:units>mm[Hg]</oe:units></value></diastolic></data></Vital_Signs>"
  }
}

TDS/TDD is preferred for template-first migration where the source produces template-specific XML. Flat JSON and structured JSON remain available for direct AMCDR integrations. FHIR mapping remains preferred when the source is already FHIR-profiled. XDS-style document sharing is intentionally separate from this path because it requires registry/repository policy, document metadata, and retrieval workflows rather than a single composition payload format.

Phase 4: Identity And MPI Reconciliation

Do not create a new patient for every source row. Match identity first, then create or link the patient record. Refugees, foreign nationals, newborns, undocumented persons, unknown emergency patients, and unknown deceased persons need identity workflows that preserve uncertainty instead of creating fake names or duplicate records.

Phase 5: Terminology Normalisation

Clinical imports often fail because old systems used local codes or free text. Prepare terminology mapping before the first dry run. Preserve the original source code and display, but map to the target system required by the template, FHIR profile, or report.

DomainTypical sourcePreferred target
Lab testsLocal LIS test codesLOINC or configured national lab code system.
DiagnosesFree text, ICD-10, local codesICD-10, SNOMED CT, or configured national diagnosis terminology.
MedicinesProduct names, stock codesMediServe / Medication Tracker product source, ATC/RxNorm where relevant, active ingredient, route, form, strength.
RoutesFree text routesEDQM or configured route code system.
FHIR administrative codesGender, encounter status, observation statusFHIR code systems and value sets.

Phase 6: Dry Run And Validation

Run at least one dry run before loading production data. Save the validation results and reject unmapped or invalid clinical data. Separate technical failures from issues that need clinical review, and assign each to the responsible team.

Validation classExamplesAction
File-levelBad encoding, duplicate file, wrong delimiter, corrupt JSON, invalid NDJSON line.Reject file and fix extract.
Record-levelMissing patient id, invalid date, impossible age, missing subject reference.Reject row/resource and send to correction queue.
Profile-levelFHIR SD cardinality or required field failure.Review /fhir/validation-results and fix profile/source/mapping.
Template-levelRequired openEHR field missing, wrong datatype, invalid composition category.Fix mapping or source transformation.
Terminology-levelUnknown code, inactive code, wrong system, untranslatable local code.Add ConceptMap/local mapping or mark for clinical review.
Identity-levelDuplicate patient, uncertain newborn match, unknown deceased person, refugee identity conflict.Create MPI reconciliation task.

Phase 7: Batch Loading

Load production data in batches small enough to retry, roll back and reconcile. Each batch must have a manifest, checksum, source system, date range, mapping version, profile version, operator and expected counts.

Recommended batch metadata:
  batch_id
  source_system
  source_extract_datetime
  source_file_name
  source_file_checksum
  source_record_count
  expected_patient_count
  expected_composition_count
  profile_key
  mapping_key
  template_key
  terminology_map_version
  operator
  approval_reference

For FHIR NDJSON, process one resource per line, retain the line number, and include it in provenance or validation errors. For XML, store the original file reference and the parsed resource id. For CSV, keep source row number and primary key.

Phase 7b: Shared Health Record And IPS Readiness

After loading, open patient records and check that the imported information is useful to the care team. Confirm that migrated compositions appear in current summaries, timelines, annual snapshots, FHIR output and IPS-style summaries before treating the migration as complete.

Readiness checkWhy it mattersExample check
Current summaryConfirms key migrated facts are visible for care, not only stored.GET /records/patient/{patient_id}/summary/current
Timeline queryConfirms migrated records have usable dates, entry types, template keys, and pagination.GET /records/patient/{patient_id}/timeline/query?page=1&page_size=25
FHIR patient bundleConfirms exchange consumers are able to pull patient-wide FHIR output.GET /fhir/Patient/{patient_id}/$everything
Population SHR or IPSConfirms cohorts, facilities, locations, or date ranges return the expected migrated patients without opening each chart.GET /records/patients/summary?profile=ips&include=index&date_from=2026-01-01&date_to=2026-06-30
IPS-style summaryConfirms problems, allergies, medications, results, procedures, immunisations, and care context are projected into a continuity summary.Run the approved IPS saved query or projection for representative patients.
Relationship-aware viewsConfirms mother-newborn, transfer, referral, and guardian links survived migration.GET /patients/{patient_id}/ehr-context-links

If the shared record is empty after migration, check template keys, composition dates, patient/EHR links, FHIR bindings, summary projection settings and protected-record filters.

Phase 8: Reconciliation Reports

After each batch, compare source and AMCDR counts. Document the reconciliation and obtain sign-off; a visual check in the application is not enough.

ReportPurpose
Patient count by source systemConfirm expected number of unique people created, linked, merged, or rejected.
Composition count by templateConfirm the expected number of clinical records by template and facility.
Validation failures by typeShow missing fields, invalid dates, invalid codes, duplicate identities, and mapping errors.
Terminology exceptionsList unmapped local codes and free-text values requiring clinical review.
FHIR exchange recordsShow processed/rejected profile and mapping results from FHIR ingest/projection.
Protected recordsConfirm VIP/protected records were not exposed in standard migration review outputs.

Phase 9: Cutover And Rollback

At cutover, users begin relying on AMCDR for the records being migrated. Freeze writes in the old system, take the final extract, load the changes and reconcile counts before approving go-live. Keep a rollback or read-only fallback available until sign-off.

  1. Announce source-system freeze and final extraction window.
  2. Run final identity reconciliation and duplicate review.
  3. Load delta batches using the same mapping versions approved during dress rehearsal.
  4. Run reconciliation reports and compare with signed expected counts.
  5. Keep rejected records in a controlled correction queue; do not hide them.
  6. Switch users to AMCDR once clinical leads, data migration lead, and operational owner approve.
  7. Keep old system read-only for an agreed period if legally and operationally required.

Migration Artifacts To Retain

Production Rule

If a source field cannot be mapped, validated or explained, hold it for review. Retain it as source provenance, add a reviewed mapping, or send it to the correction queue before including it in the clinical record.