Inferensys

Glossary

StructureMap

A FHIR resource that defines a detailed, executable transformation from one set of FHIR resources or a legacy format to another, mapping element by element.
Overhead shot of a beautifully lit strategy meeting in a modern WeWork hot desk area, designers and executives gathered around a live AI system diagram projected on smart table surface.
FHIR TRANSFORMATION ENGINE

What is StructureMap?

A FHIR resource that defines a detailed, executable transformation from one set of FHIR resources or a legacy format to another, mapping element by element.

A StructureMap is a canonical FHIR resource that houses a FHIR Mapping Language script, providing a computable, step-by-step blueprint for converting source data into target FHIR resources. It acts as a deterministic transformation engine, explicitly defining how to map, translate, and restructure data elements from a legacy format like HL7 v2 or CDA into a conformant FHIR Bundle.

Unlike a ConceptMap, which only provides semantic translations between code systems, a StructureMap handles the full structural transformation of an entire document. It is executed by a FHIR mapping engine to automate the conversion process, ensuring consistent and repeatable data migration or normalization, and is often published within a FHIR Implementation Guide to standardize interoperability.

TRANSFORMATION ENGINE

Key Features of StructureMap

A FHIR resource that defines a detailed, executable transformation from one set of FHIR resources or a legacy format to another, mapping element by element.

01

Declarative Mapping Rules

StructureMap defines transformations using a declarative syntax, not procedural code. Each rule specifies a source context, a target context, and a transform expression. This allows the engine to optimize execution order and enables static analysis of the map for correctness. Rules can be conditional, using FHIRPath expressions to gate execution based on source data values. The declarative model separates the what from the how, making maps auditable by clinical informaticists without requiring deep programming knowledge.

02

Group-Based Structural Organization

Maps are organized into groups, which are logical containers for related rules. Each group has:

  • Input: One or more source resource types or data structures
  • Output: The target resource or element being constructed
  • Rule set: The transformations to execute

Groups can be nested and invoked like functions, enabling reuse. A group that maps a Patient resource can be called from multiple parent groups, ensuring consistent transformation logic across an entire implementation guide.

03

FHIRPath Expression Integration

StructureMap uses FHIRPath as its expression language for all value computation and conditional logic. This provides:

  • Source extraction: source.name.given to pull a patient's first name
  • Conditional execution: source.birthDate < today() - 18 years to gate rules
  • String manipulation: source.name.family & ', ' & source.name.given for formatting
  • Type checking: source.value is Quantity to branch logic

Because FHIRPath is a standardized, implementation-independent language, maps remain portable across different FHIR server implementations.

04

Variable Management and Scoping

StructureMap supports typed variables that hold intermediate results during transformation. Variables are scoped to their defining group and can store:

  • Primitive values: Strings, integers, booleans
  • FHIR resources: Fully constructed resources for later reference
  • Lists: Collections of elements for iteration

This enables complex multi-step transformations where a value extracted early in the map can be referenced in multiple target elements later, avoiding redundant extraction logic and ensuring consistency.

05

Dependency and Invocation Model

Maps can declare dependencies on other StructureMaps, enabling modular composition. A high-level map for converting a CDA document to a FHIR Bundle might invoke:

  • A CDAtoPatient map for the subject
  • A CDAtoMedicationRequest map for prescribed medications
  • A CDAtoObservation map for vital signs

Each dependency is resolved at execution time. This promotes a library of reusable, tested transformation components rather than monolithic, single-use maps. Circular dependencies are detected and rejected during parsing.

06

Target Transformation Directives

StructureMap provides explicit directives for how targets should be constructed:

  • create: Instantiate a new resource or element
  • copy: Duplicate a source element to the target
  • truncate: Copy but limit to a specified length
  • escape: Apply FHIR escaping rules to the value
  • cast: Convert between compatible data types
  • append: Add to an existing list rather than replacing
  • translate: Apply a ConceptMap to convert codes

These directives give precise control over data shaping, ensuring the output conforms exactly to the target FHIR profile's constraints.

FHIR STRUCTUREMAP

Frequently Asked Questions

Clear, technical answers to the most common questions about the FHIR StructureMap resource, its role in healthcare data transformation, and its relationship to the FHIR Mapping Language.

A FHIR StructureMap is a canonical resource that defines a detailed, executable transformation from a source data structure to a target data structure, mapping element by element. It serves as the blueprint for converting one set of FHIR resources or a legacy format like HL7 v2 or CDA into another. The StructureMap works by declaring a series of group elements, each containing input definitions and a set of rule statements. Each rule specifies a source context, a target context, and a transform operation (e.g., copy, append, reference, evaluate). The FHIR Mapping Language is the textual syntax used to author these rules, which is then compiled into the formal StructureMap resource. At runtime, a transformation engine like the FHIR Validator or a dedicated mapper executes the StructureMap against an input bundle, producing a new output bundle. This declarative approach ensures that complex healthcare data migrations are repeatable, testable, and standards-compliant, eliminating brittle, hand-coded point-to-point interfaces.

MAPPING TOOL COMPARISON

StructureMap vs. ConceptMap vs. FHIR Mapping Language

A comparison of the three primary FHIR-based mechanisms for defining data transformations and semantic equivalences.

FeatureStructureMapConceptMapFHIR Mapping Language

Primary Purpose

Executable data transformation between resources or formats

Semantic mapping between code system concepts

Authoring syntax for defining mapping rules

Defines Executable Logic

Handles Terminology Translation

Target Output

A modified or new FHIR resource instance

A relationship between two codes

A StructureMap instance

Input Scope

Any set of source data (FHIR, v2, CDA, JSON)

A source code system and concept

A source data structure definition

Human-Readable Syntax

Machine-Processable Format

Supports Conditional Logic

Prasad Kumkar

About the author

Prasad Kumkar

CEO & MD, Inference Systems

Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.

His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.