Mapping legacy clinical data to FHIR R4 for Medplum: what the move involves
When a team moves clinical data from a legacy EHR, database or other store into Medplum, mapping is the step that decides whether meaning survives the move. Every source table, code and free-text field has to become a FHIR R4 resource that a clinician, auditor or downstream system will read the same way the source system intended. Medplum's FHIR R4 API is the target, so the mapping must produce resources that are valid against FHIR R4 and that Medplum stores, searches and returns without losing the relationships the source expressed.
The scope is wider than table-to-resource translation. It covers deciding which source entity becomes which resource, how identifiers are carried into Identifier elements, how local codes are translated to standard terminology or preserved with their original system, how one source row that holds several clinical facts is split, and what happens to fields that have no FHIR home. Each of these is a decision with clinical consequences, so the mapping needs a named owner from the clinical side as well as the engineers who write the transforms. Effort depends mostly on source complexity: the number of source systems, how inconsistent the codes are, how much history is stored as free text, and how many clinical domains are in scope. Ask any partner for a quote built from a written source inventory rather than from a generic estimate, and confirm which of those drivers the quote assumes.
Which legacy clinical concepts map cleanly to FHIR R4 and which do not
This table compares common legacy clinical capabilities with their closest FHIR R4 resources as used on Medplum, and notes the migration issues each one raises. Read each row as a prompt to profile your own source fields and confirm resource support in your Medplum version before fixing a mapping. The main takeaway is that most clinical content maps, but local codes, status meanings and multi-valued fields decide whether the meaning survives the move.
| Legacy concept | FHIR R4 resource | Migration issues to resolve |
|---|---|---|
| Patient demographics | Patient | Sex, gender and race values often use local lists. Duplicate records and conflicting identifiers need patient-matching rules before load. Confirm time zone handling for birth dates and timestamps. |
| Encounters and visits | Encounter | Visit class and status codes are local. Some systems merge outpatient, inpatient and telehealth visits into one table. Location and practitioner links may not exist in the source. |
| Observations and lab results | Observation | Local test codes need a terminology map to LOINC or another agreed code system. Units, reference ranges and result status values often vary between source feeds. |
| Medications | MedicationRequest, MedicationStatement, Medication | Orders and patient-reported lists are often stored in one table. Dose, route and frequency may be free text. Confirm which resource your team will use for each meaning. |
| Allergies and intolerances | AllergyIntolerance | Reaction severity and criticality are often free text. Negated or 'no known allergies' entries have no direct equivalent and need an explicit rule. |
| Problem lists and coded diagnoses | Condition | Problem list entries, encounter diagnoses and billing diagnoses can share one table with different meanings. ICD-10 versus SNOMED CT choices and clinical status values need a decision per field. |
| Free-text notes and scanned documents | DocumentReference, Binary, Composition or Observation text | Narrative notes have no single structured home and may lose authorship and signing data. Confirm how your Medplum version stores narrative text and attachments before choosing a target. |
| Fields with no FHIR home | Extension or a documented exclusion | Custom flags, internal workflow states and vendor-specific attributes need an extension, a stored source reference or an explicit decision to drop them, recorded in the mapping register. |
Four mapping decisions that determine whether meaning survives
Each source field that moves into FHIR R4 carries a meaning that the target resource must preserve or record as lost. The four decisions below determine whether that meaning survives the move, and each one leaves an artifact that a reviewer can check later.
Identifiers and namespaces
Every legacy identifier, such as a medical record number, account number or encounter key, needs a declared system URI before it is written to Patient.identifier or Encounter.identifier. Without a namespace, two sources that both issue an MRN of 100245 will collide during matching. Decide which identifier is the authority for each resource, record the namespace registry in the mapping register, and check that the same patient maps to one logical record across every load. Ask the team who owns each identifier domain before the first load.
Terminology and code system translation
Local codes for diagnoses, procedures, labs and units must be translated into standard code systems such as SNOMED CT, LOINC, ICD-10-CM or RxNorm, and the original local code should be kept alongside the translated one. Many local codes map one-to-many or not at all, so each translation needs a status: exact, broader, narrower or unmapped. Keep the terminology version used for each translation, because a code system release can change the meaning of a mapping without changing the source data.
Unsupported and split or merged fields
Some source fields have no clean FHIR home, and some values must be split across several resources or combined from several rows. A free-text comment field may need a Provenance or Observation note, while a single legacy status column may need to become both an Encounter.status and a separate flag. Decide in advance which fields are dropped, which are preserved as extensions, and which are carried in a notes resource, and record the reason for each choice. Reviewers will ask where every dropped value went.
Provenance of mapping approvals
A mapping is a decision made by people, so each version of the register needs a named reviewer, an approval date and the source system version it applies to. Medplum recommends treating mappings as reviewed, versioned specifications instead of logic hidden in migration code, so the approved register, not the loader script, is the record of intent. Store each approved version with its change history, and tie every migrated resource back to the register version used to create it so that a later question about a value can be answered.
Governing data mappings guideBuilding a versioned mapping register that auditors and clinicians can read
A mapping register is the single reviewed record of how each legacy field becomes a FHIR R4 element, and it should be readable by a clinical informaticist and an auditor without reading code. Each row should name the source table and column, the target resource and FHIR path (for example, Observation.valueQuantity or Patient.identifier), the transformation rule in plain language and in the expression the loader uses, the code system and value set for any coded field, a named owner, a version number, and an approval record showing who reviewed the rule, when, and against which profiling results. Medplum's governing data mappings guidance treats this as a versioned specification rather than logic buried in migration scripts, so the register is the artifact a reviewer signs, not the code.
The register must live in the same repository as the pipeline code and move with it. Tag each register release with a version and have the loader write that version into every resource it creates, for example in a Resource.meta.tag or an extension your team defines, together with the pipeline commit and the source extract identifier. With that stamp, any resource in Medplum can be traced back to the mapping version and approval that produced it, and a rule change can be scoped to the resources it affected. Confirm with your own team how to store the stamp so that it survives later updates, and decide whether a mapping change requires a full reload or a targeted correction. Auditors will ask for this trail, so test it on a sample chart before the first full load.
Documented import and export paths into Medplum
Bulk import suits large, file-based loads where the source can produce NDJSON files of FHIR resources that are already mapped. The mapping team's job is to deliver resources that validate against the target profiles, carry stable identifiers, and reference each other by IDs the load can resolve. Import tooling and its supported file formats change between releases, so confirm the current procedure in the Medplum documentation for the version you run.
- Pre-mapped output: Mapping must finish before the file is produced, so transformation logic lives in the versioned mapping register rather than in an import script.
- Reference integrity: Every
Patient,EncounterandObservationreference must point at an ID that exists in the same load or in a prior load. - Identifier stability: Source system identifiers go into
identifierwith a system URI, so a re-run updates the same resource instead of creating a duplicate. - Load sizing: Files split by resource type and ordered by dependency make failed batches easier to rerun.
- Validation before load: Run validation against the target profiles on a sample file first, because a rejected file can cost a full rerun.
Confirm the bulk import procedure and file limits in the Medplum documentation for your version before you fix the file format.
Bundles carry many resources in one HTTP request. A transaction bundle succeeds or fails as a unit, which suits a single encounter and its dependent resources. A batch bundle processes each entry separately, which suits loads where one bad record should not block the rest. The mapping team decides which entries belong together and what each entry must contain before the loader builds the bundle.
- Atomic groups: Group resources that must exist together, such as an encounter with its participants and diagnoses, into one transaction.
- Internal references: Use
urn:uuidplaceholders inside a bundle so the server resolves references between entries. - Per-entry outcomes: Batch responses report success or failure per entry, so the mapping register needs a field for the rejection reason.
- Size discipline: Keep bundles at a size your loader and the server can handle, and test the chosen size against your data.
- Request method: Each entry declares its method and URL, so mapping output should carry the intended operation (create, update or conditional update) explicitly.
Confirm bundle size limits and transaction behavior for your Medplum version before you finalize the loader design.
Conditional updates let a loader say 'update the resource matching this search, or create it if none exists'. They are the usual way to make a reload idempotent, so a retried batch does not produce duplicates. The mapping team must define the search criteria for each resource type, because the criteria become the key that links source records to target resources across every run.
- Search keys per type: Specify the identifier or combination of fields used in the conditional search for each resource type in the mapping register.
- Uniqueness assumptions: A search that matches more than one resource will fail or behave unpredictably, so profile the source for duplicate identifiers first.
- Source identifier quality: Blank, reused or formatted-differently identifiers break the key, so normalize them in the mapping rules.
- Version of the rule: When a search key changes between mapping versions, record the change, because old loads used the previous key.
- Verification: Check that a second run of the same extract produces zero new resources and only expected updates.
Confirm the exact conditional update syntax and any indexing requirements for your version in the Medplum documentation.
Interface data such as HL7 v2 messages from laboratory, admission or device feeds reaches Medplum through the HL7 client and server components and the Medplum Agent for on-premises systems. This path suits data that keeps arriving after the historical load. The mapping team maps message segments to FHIR resources as a continuing rule set, not a one-time extract, and must agree on which events create, update or ignore resources.
- Segment-level mapping: Document how each HL7 segment and field maps to a FHIR element, including the message types covered.
- Event rules: Define which trigger events create or update which resources, and how cancellations and merges are handled.
- Code translation: Map local codes in messages to standard terminology in the same register used for historical data.
- Acknowledgment and errors: Decide how rejected messages are queued and reviewed, and who owns the exception list.
- Parallel running: Compare interface output against the existing engine before switching a feed.
Confirm the current HL7 and Agent setup for your version and network layout in the Medplum integration documentation.
When the source is another FHIR server such as HAPI FHIR, the export step can often reuse FHIR interfaces instead of reading the underlying database. The mapping team must decide whether to export resources as they are stored or to transform them first, and must preserve source identifiers, versions and references so reconciliation remains possible. Export is only the start: profile differences between the source and Medplum still require mapping work.
- Export method: Choose between search-based export and bulk export based on volume, and confirm what the source server supports.
- Identifier preservation: Keep the source resource ID and original identifiers as separate, labeled values so they can be traced after load.
- Profile differences: Source profiles and extensions may not exist in the target, so each one needs a mapping decision.
- Reference rewriting: Source references must be rewritten to target IDs or stored as identifiers, with a clear rule for each resource type.
- Completeness checks: Compare resource counts by type between source and export before mapping starts.
For a dedicated procedure, see the Medplum migration guide for moving from HAPI FHIR, and confirm export options on the source server's own documentation.
How the mapping work runs from profiling to a parallel run
The sequence turns unknown source data into a reviewed, versioned set of FHIR R4 mappings and proves, step by step, that the resources in Medplum still say what the source said. Each step closes with a named output and an approver, so no stage moves forward on assumption.
Inventory sources and profile every field
The data owner and the integration engineer list every source system, table, file and code set in scope, then profile each field for formats, nulls, distinct values, duplicates, referential integrity and time zone behavior. Medplum's guidance is to profile every source field before any mapping is written, because surprises found later cost rework across the whole pipeline. The output is a profiling report per source, signed off by the data owner, that names every field the mapping must account for.
Write the mapping specification and register
The integration engineer writes each source-to-FHIR rule in a versioned mapping register: source field, target resource and element, transformation, code system, default and the reason for each decision. Logic stays in the register rather than hidden in loader code, so a reviewer can read the rule without running it. The output is version 1 of the register, approved by the data owner and the clinical informatics lead, with each change recorded as a new version.
Test the mapping on a representative sample
The engineer runs the register against a sample chosen to include the awkward cases found during profiling: duplicate patients, unusual codes, free text in coded fields and records with missing references. Each output resource is checked for FHIR R4 structural validity against the target Medplum server. The output is a defect log that links each failure to a register line, and the sample is re-run until the register produces no unexplained errors.
Review clinical meaning with clinicians
Clinical informatics staff and clinicians compare source records with their generated FHIR resources and confirm that codes, dates, statuses and free-text notes mean what they meant in the source. This review is where one-to-many fields and unsupported fields are settled, with each decision recorded in the register as an explicit rule. The output is a signed clinical review record for the sample, and any open question blocks the full transform until it is resolved.
Run the full transform with provenance
The engineer runs the approved register version across the complete source population and records the register version, run identifier and source extract on every batch. Provenance is kept so any resource can be traced back to the rule and approval that produced it. The output is a transform manifest per run that lists input counts, output counts and rejected records, which feeds the validation step.
Validate against written acceptance criteria
The QA lead checks the transform output against acceptance criteria agreed before the run, covering counts, mandatory elements, reference integrity and coded value coverage. Failures return to the register as a new version rather than being patched in place. The output is a validation report that the data owner and the clinical lead both sign, and it is the evidence that the transform meets its written criteria.
Run the parallel comparison before cutover
The mapped data runs alongside the legacy system for a period agreed in the plan, and users or reconciliation jobs compare results for the same patients and encounters. Differences are logged and classified as mapping defects, source data issues or accepted differences. The output is a parallel run report with each difference assigned an owner, and cutover is approved only by the business owner once that report shows no open mapping defects.
How source data flows through mapping into Medplum
The flow starts with legacy source extracts, which are profiled before any mapping is written. Profiling findings feed a versioned mapping register, and transformation runs only from approved register entries. A review gate records who approved each mapping before loading into Medplum. Validation reports and an exception queue come out of the load, and provenance records link every loaded resource back to its source rows and mapping version. Check that no transformation runs from unreviewed logic and that every exception has an owner.
Mapping flow from legacy extracts to validated Medplum resources, with provenance and exceptions.
What drives mapping effort and cost up or down
This table lists the factors that change how much mapping work a legacy clinical data move needs, whether each cost is paid once or repeats, and what to request in a written quote. Use it to compare scope options and to see which inputs your team must gather before a fixed-scope estimate can be agreed.
| Driver | One-time or recurring | What to ask for in a quote |
|---|---|---|
| Number of source systems and code sets | One-time, but grows with each added source | Itemized source list with owners, export formats and the code sets each one uses |
| Quality of source data | One-time, with rework if profiling finds new issues late | Profiling scope covering formats, nulls, duplicates, referential integrity and time zone behavior, and how findings feed back into the mapping |
| Number of distinct clinical concepts | One-time for initial mapping, recurring when new concepts appear in later loads | Count of local codes to map per domain, and how unmapped codes are logged and escalated |
| Need for terminology services | Recurring if codes are maintained against an external terminology service | Which code systems and versions are in scope, who maintains the value sets, and where lookups run in your infrastructure |
| Clinical review capacity | Recurring for the length of the review cycle, with reviewer time that rarely scales down | Named clinical reviewers, their available hours, the review sampling method and the approval record kept for each mapping version |
| Unsupported fields requiring decisions | One-time per decision, but each one can reopen earlier mappings | Register of unsupported fields with the proposed handling for each: extension, observation, note or retained in the source archive |
| One-to-many and many-to-one field splits | One-time in design, with testing repeated on each rerun | How splits are specified, which test records prove them, and how partial mappings are versioned |
What usually goes wrong in clinical mapping and how to prevent it
Most mapping defects are not crashes. They load cleanly, pass row counts, and then mislead clinicians or reports. The cards below cover the failure modes that recur in legacy-to-FHIR work, each paired with the control that catches it before cutover.
Local codes lose their meaning
A legacy lab or order code that is mapped to a generic LOINC or SNOMED CT concept often keeps the broad meaning and drops the local distinction, such as specimen type or method. Clinicians then see results that look equivalent but are not. Keep the original code and display in the resource, record the mapping's equivalence level, and have a clinical owner approve every local-to-standard mapping before load. Sample the most frequent local codes first.
Free text truncated silently
Target fields on FHIR resources have no fixed length in the way many legacy columns do, but the loader, the database column or an intermediate CSV can still cut long narrative notes. The truncation raises no error and only shows up when a clinician reads a note that stops mid-sentence. Measure the longest value in every free-text source field during profiling, then compare character counts for a sample of loaded notes against the source.
Patient identifiers collide across sources
Two source systems may issue the same medical record number for different people, or the same person may carry different numbers in each system. If the mapping writes raw identifiers into Patient.identifier without a system URI and an agreed matching rule, records merge or split incorrectly. Each identifier needs a namespace, a documented source authority, and a duplicate-candidate report reviewed before any Patient is created or updated.
Time zones shift clinical timestamps
Legacy systems often store local wall-clock times without an offset, or switch zones during daylight saving transitions. When these values are converted to FHIR dateTime fields without a stated zone, an encounter can start an hour early or a medication can appear to be given before it was ordered. Profile how each source stores time, record the assumed zone in the mapping register, and test a set of timestamps around daylight saving changes.
Mappings changed in code only
When a developer fixes a mapping inside a migration script and nothing changes in the register, the specification and the loaded data drift apart. Later reviewers approve a document that no longer describes what ran. Treat the mapping register as a versioned specification, require each code change to reference a register version, and store the approver and date with that version. Medplum's guidance on governing data mappings describes this approach.
Governing data mappings guideQuestions buyers ask before mapping clinical data to Medplum
What drives the cost of mapping legacy clinical data to FHIR R4?
Cost follows the number of source systems, the number of distinct fields and codes that need a decision, and how many clinical reviewers must sign off on each decision. Most of the work is one-time: profiling the source, writing the mapping register, building and testing the transforms, and getting approvals recorded. Some work recurs when a mapping changes after a source system update or a new clinical rule. Ask any partner for a quote built from a written scope that lists source tables, code sets, unsupported fields and the review steps, and ask which of those items are priced separately. DeployOpen does not publish a price list, so the quote follows from the agreed scope.
How long does FHIR mapping take for a typical legacy clinical source?
Duration depends mainly on source complexity: how many tables and interfaces feed the target, how inconsistent the codes are, how many fields have no clean FHIR home, and how quickly clinical reviewers can respond. A single system with well-maintained code tables is far shorter to map than several systems with free-text fields and local codes. Profiling every source field for formats, nulls, distinct values, duplicates, referential integrity and time zone behavior is often the step that sets the schedule, because it reveals the exceptions the mapping must handle. Ask for a timeline that separates profiling, mapping review, transform build and approval, since each depends on different people.
What must our team provide for a mapping project?
The engagement needs named people, not only access to systems. Expect to provide data owners who can explain what each source field means and how it is entered, clinical reviewers who can approve mappings for diagnoses, medications, results and encounters, a source system administrator for extracts and read access, and a security or compliance contact who approves handling of protected health information in non-production environments. You should also provide a decision log owner who keeps the mapping register current. Confirm with your partner how many hours per week each role must commit, and whether reviewers are needed during profiling or only at approval gates.
Can our internal team map clinical data to Medplum without a partner?
Yes, a capable internal team can do this, provided it has engineers who know FHIR R4 and the source system, and clinical reviewers who can make the decisions. The harder parts are rarely the JSON. They are deciding how local codes translate to standard terminology, handling one source field that must become several resources, and recording why each decision was approved. A partner is most useful when the team lacks FHIR or terminology experience, has a short window, or needs an independent reviewer for the mapping register. Compare the internal and external options against the same written scope, including the reviewer time your own clinicians would have to give up.
Which mapping decisions need clinical sign-off?
Any decision that changes the clinical meaning of a record needs sign-off from a qualified clinician or the data owner who can speak for the clinical content. This includes how local diagnosis and procedure codes map to standard terminology, how medication statuses and doses translate, how result units and reference ranges are handled, how encounter types and statuses are set, and which records are dropped or summarized because FHIR R4 has no direct equivalent. Technical decisions such as identifier namespaces, date formats and reference ordering still need review, but they rarely need clinical approval. Record each approval in the versioned mapping register with the reviewer, date and reason.
How is compliance responsibility shared between us and Medplum?
Medplum describes compliance as a shared responsibility between Medplum and its customers. Medplum's compliance documentation covers HIPAA, SOC 2 Type II, ONC certification, CFR Part 11, HITRUST e1, CLIA/CAP and ISO 9001, but those attestations describe the platform and its operating controls, not your data mapping or your deployment choices. On Medplum Cloud, the provider's controls and agreements apply to the service it runs. On a self-hosted deployment, your organization also owns the infrastructure, access, backups and audit evidence. DeployOpen prepares systems, controls and evidence for compliance assessments, but it does not issue audit reports, attestations or certifications. Ask your compliance team to map each control to an owner before mapping starts, and ask your auditor which evidence they will accept.
What does a mapping register need to contain so the work can be audited?
A mapping register is a versioned specification that lists each source field, its target FHIR R4 resource and element, the transform applied, the terminology system used, known exceptions, the reviewer who approved it and the version it applies to. Medplum recommends treating data mappings as reviewed, versioned specifications rather than logic hidden in migration code, so a change to a mapping becomes a new, approved version with its own record. Add provenance for each approval: who decided, when, based on which source evidence and which clinical rule. Keep the register in version control alongside the loaders, so that a reviewer can trace any loaded resource back to the decision that produced it.
What should we ask about the Medplum version and license before we start?
Ask which Medplum version the target will run and how it will be upgraded, because the mapping must target the FHIR R4 behavior of that release. Medplum is released under the Apache 2.0 license and its releases are published on GitHub, and it ships major versions annually in Q4, with minor versions two to three times a year and weekly patch versions. Self-hosted deployments must be upgraded through each minor version in sequence, so a mapping written for one version may need retesting after an upgrade. Confirm the support window for the version you choose, since each major version gets one year of Active support and one year of Maintenance, with an Enterprise extension of twelve more months of security patches.
How DeployOpen scopes and delivers Medplum mapping work
DeployOpen approaches mapping legacy clinical data to FHIR R4 for Medplum as a written, versioned engagement inside infrastructure you control. The work covers source profiling, the mapping register, terminology decisions and the evidence that each approval was made.
How we scope
- Agree in writing which source systems, tables, code sets and FHIR R4 resource types the mapping covers
- Define how unsupported fields, one-to-many fields and identifiers are handled before any mapping is built
- Set the review roles and approval points for each mapping version, and confirm them in the written scope
- Engagements are fixed-scope, so deliverables and timelines are agreed before work starts
How we build
- Profile every source field for formats, nulls, distinct values, duplicates, referential integrity and time zone behavior
- Maintain a versioned mapping register so each source-to-FHIR rule has an owner, a version and a change history
- Document terminology and identifier decisions, including source code system mapping and the exceptions that need manual review
- Record provenance of each mapping approval so reviewers can trace who approved which rule and when
How we hand over
- Deliver the mapping register, profiling reports and mapping specifications in a form your team can maintain
- Walk through unsupported and one-to-many field decisions with the clinical and data owners who must sign them off
- Document how the mapping feeds the Medplum load pipeline and how to review changes to it later
- Provide the approval records and version history your compliance and security reviewers will ask for
How we support
- Retest mappings against refreshed source extracts when the source system or code sets change
- Offer ongoing support, upgrades and continuous testing as a retainer after the initial delivery
- Review proposed mapping changes against the register so changes stay traceable to an approval
- Confirm with your team which support hours, response expectations and change processes apply before signing

