FHIR CI-Build

This is the Continuous Integration Build of FHIR (will be incorrect/inconsistent at times).
See the Directory of published versions icon

7.9 Resource StructureMap - Content

FHIR Infrastructure icon Work GroupMaturity Level: 4 Trial UseSecurity Category: Anonymous Compartments: No defined compartments

A Map of relationships between 2 structures that can be used to transform data.

The StructureMap resource defines a detailed set of rules that describe how one Structure is related to another and provides sufficient detail to allow for automated conversion of instances.

The intention of the structure map resource is to allow a specialist in formats and interoperability to specify the full relationships between two structures (e.g. a CDA document and a set of FHIR resources), and then many different systems - both testing and production clinical systems - can leverage that to automatically transform from one format to the other.

Maps are unidirectional: they map from the source structure to the target structure, and no reverse map is implied. Even if the mapping is simple, and loss-less, it cannot be assumed that there are no conditions that might additionally apply in the reverse direction.

The mapping language, along with a concrete syntax, is defined in detail in the FHIR Mapping Language. The StructureMap resource represents the abstract syntax, and the concrete syntax is the recommended narrative representation for a StructureMap. See also the Tutorial.

Note that many mappings between models only establish conceptual equivalence between the structures. These models are useful because they quickly convey how the structures are related to humans, whereas more maps with sufficient detail to support instance transformation are necessarily full of fine detail that can obscure the conceptual relationships. The ConceptMap resource is suitable for representing high level relationships between models, while this StructureMap resource is intended to describe the full details that need to be known in order to transform an instance of data from one structure to another.

The StructureMap resource assumes that both the source and the target models are fully defined using StructureDefinition resources - either resources, or logical models, and is described accordingly. However, there is no direct relationship between the mapping language contained in the StructureMap resource, and the existence of the appropriate structure definitions, so that this mapping language could be used to define a map from an HL7 V2 message to a CDA document. Note, that various implementation contexts may introduce a direct relationship (e.g. see [op to defined]).

It's possible to apply the mapping language to structures that do not even have (or cannot have) formally defined types, although the type-related parts of the mapping language cannot be used in these cases.

The Mapping Language and the StructureMap resource are built on top of FHIRPath, and a FHIRPath implementation is required in order to execute a StructureMap.

Each structure map contains, in addition to the standard metadata that all conformance resources contain, the following information:

  • A list of the structure definitions referenced by the map
  • A list of other structure maps that the map uses
  • One or more groups of rules that describe how content in the source is transformed to content in the target

Each group of rules defines a set of input and output variables that must be passed when the group is invoked in a particular context. When a group is invoked, all the rules in the group are checked to see whether they apply.

Each rule may have some or all of the following properties:

  • A name - used as the identity in internal references, and traces
  • Contexts in both source and target models that define where the rule applies
  • A set of source elements that provide data to be mapped
  • Conditions that specify if the rule is to apply
  • A set of target elements that will be created
  • Transform rules that describe how raw data is converted from the source format to the target format (e.g. string manipulation)
  • Flags for how instances that can repeat are handled
  • Additional rules that apply to the newly created elements (e.g. new contexts)

The mapping language is entirely declarative; there is no imperative or procedural aspects to the definitions.

Structure

NameFlagsCard.TypeDescription & Constraintsdoco
.. StructureMap TU DomainResource A Map of relationships between 2 structures that can be used to transform data
+ Warning: Name should be usable as an identifier for the module by machine processing applications such as code generation

Elements defined in Ancestors: id, meta, implicitRules, language, text, contained, extension, modifierExtension
Interfaces Implemented: CanonicalResource
... url ΣC 1..1 uri Canonical identifier for this structure map, represented as a URI (globally unique)
+ Warning: URL should not contain | or # - these characters make processing canonical references problematic
... identifier Σ 0..* Identifier Additional identifier for the structure map

... version Σ 0..1 string Business version of the structure map
.... versionAlgorithmString string
.... versionAlgorithmCoding Coding
... name ΣC 1..1 string Name for this structure map (computer friendly)
... title ΣT 0..1 string Name for this structure map (human friendly)
... status ?!Σ 1..1 code draft | active | retired | unknown
Binding: PublicationStatus (Required)
... experimental Σ 0..1 boolean For testing only - never for real usage
... date Σ 0..1 dateTime Date last changed
... publisher ΣT 0..1 string Name of the publisher/steward (organization or individual)
... contact Σ 0..* ContactDetail Contact details for the publisher

... description T 0..1 markdown Natural language description of the structure map
... useContext Σ 0..* UsageContext The context that the content is intended to support

... jurisdiction ΣXD 0..* CodeableConcept Intended jurisdiction for structure map (if applicable)
Binding: Jurisdiction ValueSet (Extensible)

... purpose T 0..1 markdown Why this structure map is defined
... copyright T 0..1 markdown Use and/or publishing restrictions
... copyrightLabel T 0..1 string Copyright holder and year(s)
... structure Σ 0..* BackboneElement Structure Definition used by this map

.... url Σ 1..1 canonical(StructureDefinition) Canonical reference to structure definition
.... mode Σ 1..1 code source | queried | target | produced
Binding: Structure Map Model Mode (Required)
.... alias Σ 0..1 string Name for type in this map
.... documentation 0..1 string Documentation on use of structure
... import Σ 0..* canonical(StructureMap) Other maps used by this map (canonical URLs)

... const Σ 0..* BackboneElement Definition of the constant value used in the map rules

.... name Σ 0..1 id Constant name
.... value Σ 0..1 string FHIRPath exression - value of the constant
... group Σ 1..* BackboneElement Named sections for reader convenience

.... name Σ 1..1 id Human-readable label
.... extends Σ 0..1 id Another group that this group adds rules to
.... typeMode Σ 0..1 code types | type-and-types
Binding: Structure Map Group Type Mode (Required)
.... documentation Σ 0..1 string Additional description/explanation for group
.... input Σ 1..* BackboneElement Named instance provided when invoking the map

..... name Σ 1..1 id Name for this instance of data
..... type Σ 0..1 string Type for this instance of data
..... mode Σ 1..1 code source | target
Binding: Structure Map Input Mode (Required)
..... documentation 0..1 string Documentation for this instance of data
.... rule Σ 0..* BackboneElement Transform Rule from source to target

..... name Σ 0..1 id Name of the rule for internal references
..... source ΣC 1..* BackboneElement Source inputs to the mapping
+ Rule: Min <= Max

...... context Σ 1..1 id Type or variable this rule applies to
...... min Σ 0..1 unsignedInt Specified minimum cardinality
...... max ΣC 0..1 string Specified maximum cardinality (number or *)
+ Rule: Max SHALL be a number or "*"
...... type Σ 0..1 string Rule only applies if source has this type
...... defaultValue Σ 0..1 string Default value if no value exists
...... element Σ 0..1 string Optional field for this source
...... listMode Σ 0..1 code first | not_first | last | not_last | only_one
Binding: Structure Map Source List Mode (Required)
...... variable Σ 0..1 id Named context for field, if a field is specified
...... condition Σ 0..1 string FHIRPath expression - must be true or the rule does not apply
...... check Σ 0..1 string FHIRPath expression - must be true or the mapping engine throws an error instead of completing
...... logMessage Σ 0..1 string Message to put in log if source exists (FHIRPath)
..... target ΣC 0..* BackboneElement Content to create because of this mapping rule
+ Rule: Can only have an element if you have a context

...... context ΣC 0..1 string Variable this rule applies to
...... element ΣC 0..1 string Field to create in the context
...... variable Σ 0..1 id Named context for field, if desired, and a field is specified
...... listMode Σ 0..* code first | share | last | single
Binding: Structure Map Target List Mode (Required)

...... listRuleId Σ 0..1 id Internal rule reference for shared list items
...... transform Σ 0..1 code create | copy +
Binding: Structure Map Transform (Required)
...... parameter Σ 0..* BackboneElement Parameters to the transform

....... value[x] Σ 1..1 Parameter value - variable or literal
........ valueId id
........ valueString string
........ valueBoolean boolean
........ valueInteger integer
........ valueDecimal decimal
........ valueDate date
........ valueTime time
........ valueDateTime dateTime
..... rule Σ 0..* see rule Rules contained in this rule

..... dependent Σ 0..* BackboneElement Which other rules to apply in the context of this rule

...... name Σ 1..1 id Name of a rule or group to apply
...... parameter Σ 1..* see parameter Parameter to pass to the rule or group

..... documentation 0..1 string Documentation for this instance of data

doco Documentation for this format icon

See the Extensions for this resource

 

Additional definitions: Master Definition XML + JSON, XML Schema/Schematron + JSON Schema, ShEx (for Turtle) , the spreadsheet version & the dependency analysis

Path ValueSet Type Documentation
StructureMap.versionAlgorithm[x] VersionAlgorithm Extensible

Indicates the mechanism used to compare versions to determine which is more current.

StructureMap.status PublicationStatus Required

The lifecycle status of an artifact.

StructureMap.jurisdiction JurisdictionValueSet Extensible

This value set defines a base set of codes for country, country subdivision and region for indicating where a resource is intended to be used.

Note: The codes for countries and country subdivisions are taken from ISO 3166 icon while the codes for "supra-national" regions are from UN Standard country or area codes for statistical use (M49) icon.

StructureMap.structure.mode StructureMapModelMode Required

How the referenced structure is used in this mapping.

StructureMap.group.typeMode StructureMapGroupTypeMode Required

If this is the default rule set to apply for the source type, or this combination of types.

StructureMap.group.input.mode StructureMapInputMode Required

Mode for this instance of data.

StructureMap.group.rule.source.listMode StructureMapSourceListMode Required

If field is a list, how to manage the source.

StructureMap.group.rule.target.listMode StructureMapTargetListMode Required

If field is a list, how to manage the production.

StructureMap.group.rule.target.transform StructureMapTransform Required

How data is copied/created.

UniqueKeyLevelLocationDescriptionExpression
img cnl-0Warning (base)Name should be usable as an identifier for the module by machine processing applications such as code generationname.exists() implies name.matches('^[A-Z]([A-Za-z0-9_]){1,254}$')
img cnl-1Warning StructureMap.urlURL should not contain | or # - these characters make processing canonical references problematicexists() implies matches('^[^|# ]+$')
img smp-1Rule StructureMap.group.rule.targetCan only have an element if you have a contextelement.exists() implies context.exists()
img smp-2Rule StructureMap.group.rule.sourceMin <= Maxmin.empty() or max.empty() or (max = '*') or iif(max != '*', min <= max.toInteger())
img smp-3Rule StructureMap.group.rule.source.maxMax SHALL be a number or "*"empty() or ($this = '*') or (toInteger() >= 0)

Search parameters for this resource. See also the full list of search parameters for this resource, and check the Extensions registry for search parameters on extensions related to this resource. The common parameters also apply. See Searching for more information about searching in REST, messaging, and services.

Name Type Description Expression In Common
context token A use context assigned to the structure map (StructureMap.useContext.value.ofType(CodeableConcept)) 30 Resources
context-quantity quantity A quantity- or range-valued use context assigned to the structure map (StructureMap.useContext.value.ofType(Quantity)) | (StructureMap.useContext.value.ofType(Range)) 30 Resources
context-type token A type of use context assigned to the structure map StructureMap.useContext.code 30 Resources
context-type-quantity composite A use context type and quantity- or range-based value assigned to the structure map On StructureMap.useContext:
  context-type: code
  context-quantity: value.ofType(Quantity) | value.ofType(Range)
30 Resources
context-type-value composite A use context type and value assigned to the structure map On StructureMap.useContext:
  context-type: code
  context: value.ofType(CodeableConcept)
30 Resources
date date The structure map publication date StructureMap.date 31 Resources
description string The description of the structure map StructureMap.description 29 Resources
identifier token External identifier for the structure map StructureMap.identifier 35 Resources
jurisdiction token Intended jurisdiction for the structure map StructureMap.jurisdiction 27 Resources
name string Computationally friendly name of the structure map StructureMap.name 28 Resources
publisher string Name of the publisher of the structure map StructureMap.publisher 31 Resources
status token The current status of the structure map StructureMap.status 35 Resources
title string The human-friendly name of the structure map StructureMap.title 28 Resources
url uri The uri that identifies the structure map StructureMap.url 34 Resources
version token The business version of the structure map StructureMap.version 32 Resources