Written and maintained by CASRAI Editorial Board
Published
On this page
A FHIR StructureDefinition is the foundational conformance and schema metadata resource in HL7 Fast Healthcare Interoperability Resources (FHIR). Every base data type (such as Coding or Quantity), every core clinical or administrative resource (such as Patient or Observation), every profile constraint in a FHIR Implementation Guide, and every custom extension is formally specified and machine-validated using a StructureDefinition instance.
Because the base FHIR R4 specification is intentionally designed as an 80% global baseline with permissive cardinalities (often 0..1 or 0..*), national standards bodies, clinical trial networks, and health systems use StructureDefinition profiles to constrain optionality, bind elements to domain-specific terminology value sets, slice repeating arrays, and register computable extensions.
What Is a FHIR StructureDefinition and What Can It Define?
A StructureDefinition resource identifies itself globally via its canonical url and classifies its structural role using two core metadata attributes: kind and derivation.
kind: Indicates the structural category being defined:primitive-type(such asstring,boolean,dateTime),complex-type(such asCodeableConcept,Identifier,Period),resource(such asPatient,Condition, orObservation), orlogical(an abstract logical data model not directly serialized as a standard FHIR resource).derivation: Distinguishes betweenspecialization(which defines a brand-new base resource or data type in the core specification) andconstraint(which profiles an existing base resource or parent profile identified inbaseDefinitionwithout adding arbitrary undeclared root elements).- Extensions: In FHIR, an extension is itself defined by a
StructureDefinitionwheretype = "Extension"andderivation = "constraint", accompanied by acontextarray specifying which resource paths are permitted to host the extension.
How Do Differential and Snapshot Views Work in FHIR Profiling?
Inside a StructureDefinition, the element hierarchy is represented as an ordered list of ElementDefinition objects contained in either or both of two structural views:
| View | StructureDefinition Path | Contents & Authoring Role | Validation & Runtime Role |
|---|---|---|---|
| Differential | StructureDefinition.differential.element |
Contains only the elements modified, constrained, sliced, or bound relative to the parent baseDefinition. |
Sparse delta authored via FHIR Shorthand (FSH) or Forge; cannot validate an instance alone without resolving parent profiles. |
| Snapshot | StructureDefinition.snapshot.element |
Contains the complete flattened tree of every inherited and constrained ElementDefinition down from the base resource. |
Generated by the HL7 IG Publisher or a FHIR server; used directly by runtime schema and profile validators. |
Monotonic Constraint Rules in Profile Inheritance
When a profile sets derivation = "constraint" against a baseDefinition (including multi-level inheritance chains such as a clinical study profile derived from US Core, which is itself derived from base FHIR R4), every constraint must narrow or maintain the rules of its parent—never widen them:
- Cardinality tightening: Minimum cardinality (
min) can be increased (for example,0to1) and maximum cardinality (max) can be decreased (for example,*to1or0to forbid an element), but a0..1element in the base resource can never be widened to0..*in a profile. - Type restriction: Choice data types (such as
Observation.value[x]) can be restricted to a subset of allowed types (for example, permitting onlyvalueQuantityandvalueCodeableConcept). - Terminology binding strength: A profile can replace an
example,preferred, orextensiblevalue set binding with a stronger binding (up torequired), or narrow a value set, but cannot weaken a parent’srequiredbinding. - FHIRPath invariants: Custom co-occurrence and cross-element validation expressions declared in
ElementDefinition.constraint.expressionare evaluated alongside all inherited base invariants.
What Is MustSupport and Slicing in HL7 FHIR Implementation Guides?
Two of the most frequently misunderstood mechanisms in ElementDefinition are slicing and MustSupport.
Slicing Repeating Elements and Discriminators
Many FHIR elements repeat (0..*)—such as Patient.identifier, Observation.component, or Observation.category. When a profile requires that at least one entry in Observation.component represent systolic blood pressure (LOINC 8480-6) and another represent diastolic blood pressure (LOINC 8462-4), a simple cardinality constraint on Observation.component is insufficient. Slicing splits a single repeating list into named sub-constraints (slices):
- Slicing root (
ElementDefinition.slicing): Declares how validators distinguish which slice an incoming array item belongs to using one or morediscriminatordefinitions (typeofvalue,pattern,type,profile, orexistspaired with a relativepath) and whether additional unsliced array items are allowed (rules = "open" | "closed" | "openAtEnd"). - Named slices (
ElementDefinition.sliceName): Each slice specifies its own minimum/maximum cardinality, fixed value orpatternCodeableConcept, and terminology binding. In blood pressure profiles,slicing.rulesis typicallyopenso that additional components (such as mean arterial pressure) can still be transmitted without failing validation.
MustSupport (ElementDefinition.mustSupport = true)
Unlike setting minimum cardinality to 1 (which causes every resource instance missing that element to fail validation even when the clinical datum is genuinely unknown), setting mustSupport: true on a 0..1 or 0..* element is a functional conformance requirement directed at implementing systems rather than individual payload instances. Its exact operational obligations are defined by each Implementation Guide’s conformance section: typically, a Data Sender (Server) must be capable of populating the element whenever the data exists in its underlying database, and a Data Consumer (Client) must be capable of parsing, processing, displaying, or storing the element without throwing errors or silently discarding it.
Frequently Asked Questions
What is the difference between fixed[x] and pattern[x] in an ElementDefinition?
In a FHIR StructureDefinition, fixed[x] requires the instance element to match the specified structure exactly, prohibiting any additional properties, extra coding translations, or human-readable text elements inside a CodeableConcept. By contrast, pattern[x] requires only that the specified sub-properties be present (for example, at least one coding with a required system and code) while allowing additional codings, display strings, and extensions. For complex types like CodeableConcept, HL7 profiling best practices strongly prefer pattern[x] over fixed[x].
How does FHIR Shorthand (FSH) relate to StructureDefinition?
FHIR Shorthand (FSH) is a domain-specific language standardized by HL7 that allows authors to write concise text definitions for profiles, extensions, value sets, and examples. The SUSHI compiler translates FSH source files into standard JSON StructureDefinition resources containing differential element trees, which the HL7 IG Publisher then expands into full snapshots.
How can a profile prohibit an element or require a Data Absent Reason?
To prohibit an element entirely (for example, stripping direct identifiers in a de-identified research profile), the profile constrains its maximum cardinality to max: "0". When a required element (min: 1) is temporarily unknown or masked in a real-world clinical record, profiles bind the HL7 data-absent-reason extension together with a FHIRPath invariant requiring either a populated value or a valid data-absent-reason code.







