Release 5 Ballot

This page is part of the FHIR Specification (v5.0.0-ballot: FHIR R5 Ballot Preview). The current version which supercedes this version is 5.0.0. For a full list of available versions, see the Directory of published versions . Page versions: R5 R4B R4

Example StructureDefinition/Expression (JSON)

Modeling and Methodology Work GroupMaturity Level: N/AStandards Status: Informative

Raw JSON (canonical form + also see JSON Format Specification)

StructureDefinition for Expression

{
  "resourceType" : "StructureDefinition",
  "id" : "Expression",
  "text" : {
    "status" : "generated",
    "div" : "<div>!-- Snipped for Brevity --></div>"
  },
  "extension" : [{
    "url" : "http://hl7.org/fhir/StructureDefinition/structuredefinition-standards-status",
    "valueCode" : "trial-use"
  }],
  "url" : "http://hl7.org/fhir/StructureDefinition/Expression",
  "version" : "5.0.0-ballot",
  "name" : "Expression",
  "status" : "draft",
  "experimental" : false,
  "date" : "2022-09-07T10:58:29+10:00",
  "publisher" : "HL7 FHIR Standard",
  "contact" : [{
    "telecom" : [{
      "system" : "url",
      "value" : "http://hl7.org/fhir"
    }]
  }],
  "description" : "Expression Type: A expression that is evaluated in a specified context and returns a value. The context of use of the expression must specify the context in which the expression is evaluated, and how the result of the expression is used.",
  "fhirVersion" : "5.0.0-ballot",
  "mapping" : [{
    "identity" : "rim",
    "uri" : "http://hl7.org/v3",
    "name" : "RIM Mapping"
  }],
  "kind" : "complex-type",
  "abstract" : false,
  "type" : "Expression",
  "baseDefinition" : "http://hl7.org/fhir/StructureDefinition/DataType",
  "derivation" : "specialization",
  "snapshot" : {
    "element" : [{
      "id" : "Expression",
      "extension" : [{
        "url" : "http://hl7.org/fhir/StructureDefinition/structuredefinition-standards-status",
        "valueCode" : "trial-use"
      }],
      "path" : "Expression",
      "short" : "An expression that can be used to generate a value",
      "definition" : "A expression that is evaluated in a specified context and returns a value. The context of use of the expression must specify the context in which the expression is evaluated, and how the result of the expression is used.",
      "min" : 0,
      "max" : "*",
      "base" : {
        "path" : "Expression",
        "min" : 0,
        "max" : "*"
      },
      "constraint" : [{
        "key" : "ele-1",
        "severity" : "error",
        "human" : "All FHIR elements must have a @value or children",
        "expression" : "hasValue() or (children().count() > id.count())",
        "xpath" : "@value|f:*|h:div",
        "source" : "http://hl7.org/fhir/StructureDefinition/Element"
      },
      {
        "key" : "exp-1",
        "severity" : "error",
        "human" : "An expression or a reference must be provided",
        "expression" : "expression.exists() or reference.exists()",
        "xpath" : "exists(f:expression) or exists(f:reference)",
        "source" : "http://hl7.org/fhir/StructureDefinition/Expression"
      }],
      "isModifier" : false,
      "mapping" : [{
        "identity" : "rim",
        "map" : "n/a"
      }]
    },
    {
      "id" : "Expression.id",
      "path" : "Expression.id",
      "representation" : ["xmlAttr"],
      "short" : "Unique id for inter-element referencing",
      "definition" : "Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.",
      "min" : 0,
      "max" : "1",
      "base" : {
        "path" : "Element.id",
        "min" : 0,
        "max" : "1"
      },
      "type" : [{
        "extension" : [{
          "url" : "http://hl7.org/fhir/StructureDefinition/structuredefinition-fhir-type",
          "valueUrl" : "id"
        }],
        "code" : "http://hl7.org/fhirpath/System.String"
      }],
      "isModifier" : false,
      "isSummary" : false,
      "mapping" : [{
        "identity" : "rim",
        "map" : "n/a"
      }]
    },
    {
      "id" : "Expression.extension",
      "path" : "Expression.extension",
      "slicing" : {
        "discriminator" : [{
          "type" : "value",
          "path" : "url"
        }],
        "description" : "Extensions are always sliced by (at least) url",
        "rules" : "open"
      },
      "short" : "Additional content defined by implementations",
      "definition" : "May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.",
      "comment" : "There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone.",
      "alias" : ["extensions",
      "user content"],
      "min" : 0,
      "max" : "*",
      "base" : {
        "path" : "Element.extension",
        "min" : 0,
        "max" : "*"
      },
      "type" : [{
        "code" : "Extension"
      }],
      "constraint" : [{
        "key" : "ele-1",
        "severity" : "error",
        "human" : "All FHIR elements must have a @value or children",
        "expression" : "hasValue() or (children().count() > id.count())",
        "xpath" : "@value|f:*|h:div",
        "source" : "http://hl7.org/fhir/StructureDefinition/Element"
      },
      {
        "key" : "ext-1",
        "severity" : "error",
        "human" : "Must have either extensions or value[x], not both",
        "expression" : "extension.exists() != value.exists()",
        "xpath" : "exists(f:extension)!=exists(f:*[starts-with(local-name(.), \"value\")])",
        "source" : "http://hl7.org/fhir/StructureDefinition/Extension"
      }],
      "isModifier" : false,
      "isSummary" : false,
      "mapping" : [{
        "identity" : "rim",
        "map" : "n/a"
      }]
    },
    {
      "id" : "Expression.description",
      "path" : "Expression.description",
      "short" : "Natural language description of the condition",
      "definition" : "A brief, natural language description of the condition that effectively communicates the intended semantics.",
      "min" : 0,
      "max" : "1",
      "base" : {
        "path" : "Expression.description",
        "min" : 0,
        "max" : "1"
      },
      "type" : [{
        "code" : "string"
      }],
      "constraint" : [{
        "key" : "ele-1",
        "severity" : "error",
        "human" : "All FHIR elements must have a @value or children",
        "expression" : "hasValue() or (children().count() > id.count())",
        "xpath" : "@value|f:*|h:div",
        "source" : "http://hl7.org/fhir/StructureDefinition/Element"
      }],
      "isModifier" : false,
      "isSummary" : true
    },
    {
      "id" : "Expression.name",
      "path" : "Expression.name",
      "short" : "Short name assigned to expression for reuse",
      "definition" : "A short name assigned to the expression to allow for multiple reuse of the expression in the context where it is defined.",
      "min" : 0,
      "max" : "1",
      "base" : {
        "path" : "Expression.name",
        "min" : 0,
        "max" : "1"
      },
      "type" : [{
        "code" : "id"
      }],
      "constraint" : [{
        "key" : "ele-1",
        "severity" : "error",
        "human" : "All FHIR elements must have a @value or children",
        "expression" : "hasValue() or (children().count() > id.count())",
        "xpath" : "@value|f:*|h:div",
        "source" : "http://hl7.org/fhir/StructureDefinition/Element"
      }],
      "isModifier" : false,
      "isSummary" : true
    },
    {
      "id" : "Expression.language",
      "path" : "Expression.language",
      "short" : "text/cql | text/fhirpath | application/x-fhir-query | etc.",
      "definition" : "The media type of the language for the expression.",
      "requirements" : "The cardinality of this element is optional to allow text only as part of the authoring process.  However, in order to be executable, the expression element must be specified.",
      "min" : 0,
      "max" : "1",
      "base" : {
        "path" : "Expression.language",
        "min" : 0,
        "max" : "1"
      },
      "type" : [{
        "code" : "code"
      }],
      "constraint" : [{
        "key" : "ele-1",
        "severity" : "error",
        "human" : "All FHIR elements must have a @value or children",
        "expression" : "hasValue() or (children().count() > id.count())",
        "xpath" : "@value|f:*|h:div",
        "source" : "http://hl7.org/fhir/StructureDefinition/Element"
      }],
      "isModifier" : false,
      "isSummary" : true,
      "binding" : {
        "extension" : [{
          "url" : "http://hl7.org/fhir/build/StructureDefinition/binding-definition",
          "valueString" : "The media type of the expression language."
        },
        {
          "url" : "http://hl7.org/fhir/StructureDefinition/elementdefinition-maxValueSet",
          "valueCanonical" : "http://hl7.org/fhir/ValueSet/mimetypes"
        },
        {
          "url" : "http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName",
          "valueString" : "ExpressionLanguage"
        }],
        "strength" : "extensible",
        "valueSet" : "http://hl7.org/fhir/ValueSet/expression-language"
      }
    },
    {
      "id" : "Expression.expression",
      "path" : "Expression.expression",
      "short" : "Expression in specified language",
      "definition" : "An expression in the specified language that returns a value.",
      "comment" : "If Expression.expression and Expression.reference are both present, the Expression.expression might just be a name pointing something within the referenced content.",
      "min" : 0,
      "max" : "1",
      "base" : {
        "path" : "Expression.expression",
        "min" : 0,
        "max" : "1"
      },
      "type" : [{
        "code" : "string"
      }],
      "constraint" : [{
        "key" : "ele-1",
        "severity" : "error",
        "human" : "All FHIR elements must have a @value or children",
        "expression" : "hasValue() or (children().count() > id.count())",
        "xpath" : "@value|f:*|h:div",
        "source" : "http://hl7.org/fhir/StructureDefinition/Element"
      }],
      "isModifier" : false,
      "isSummary" : true
    },
    {
      "id" : "Expression.reference",
      "path" : "Expression.reference",
      "short" : "Where the expression is found",
      "definition" : "A URI that defines where the expression is found.",
      "comment" : "If both a reference and an expression is found, the reference SHALL point to the same expression.",
      "min" : 0,
      "max" : "1",
      "base" : {
        "path" : "Expression.reference",
        "min" : 0,
        "max" : "1"
      },
      "type" : [{
        "code" : "uri"
      }],
      "constraint" : [{
        "key" : "ele-1",
        "severity" : "error",
        "human" : "All FHIR elements must have a @value or children",
        "expression" : "hasValue() or (children().count() > id.count())",
        "xpath" : "@value|f:*|h:div",
        "source" : "http://hl7.org/fhir/StructureDefinition/Element"
      }],
      "isModifier" : false,
      "isSummary" : true
    }]
  },
  "differential" : {
    "element" : [{
      "id" : "Expression",
      "extension" : [{
        "url" : "http://hl7.org/fhir/StructureDefinition/structuredefinition-standards-status",
        "valueCode" : "trial-use"
      }],
      "path" : "Expression",
      "short" : "An expression that can be used to generate a value",
      "definition" : "A expression that is evaluated in a specified context and returns a value. The context of use of the expression must specify the context in which the expression is evaluated, and how the result of the expression is used.",
      "min" : 0,
      "max" : "*",
      "constraint" : [{
        "key" : "exp-1",
        "severity" : "error",
        "human" : "An expression or a reference must be provided",
        "expression" : "expression.exists() or reference.exists()",
        "xpath" : "exists(f:expression) or exists(f:reference)",
        "source" : "http://hl7.org/fhir/StructureDefinition/Expression"
      }]
    },
    {
      "id" : "Expression.description",
      "path" : "Expression.description",
      "short" : "Natural language description of the condition",
      "definition" : "A brief, natural language description of the condition that effectively communicates the intended semantics.",
      "min" : 0,
      "max" : "1",
      "type" : [{
        "code" : "string"
      }],
      "isSummary" : true
    },
    {
      "id" : "Expression.name",
      "path" : "Expression.name",
      "short" : "Short name assigned to expression for reuse",
      "definition" : "A short name assigned to the expression to allow for multiple reuse of the expression in the context where it is defined.",
      "min" : 0,
      "max" : "1",
      "type" : [{
        "code" : "id"
      }],
      "isSummary" : true
    },
    {
      "id" : "Expression.language",
      "path" : "Expression.language",
      "short" : "text/cql | text/fhirpath | application/x-fhir-query | etc.",
      "definition" : "The media type of the language for the expression.",
      "requirements" : "The cardinality of this element is optional to allow text only as part of the authoring process.  However, in order to be executable, the expression element must be specified.",
      "min" : 0,
      "max" : "1",
      "type" : [{
        "code" : "code"
      }],
      "isSummary" : true,
      "binding" : {
        "extension" : [{
          "url" : "http://hl7.org/fhir/build/StructureDefinition/binding-definition",
          "valueString" : "The media type of the expression language."
        },
        {
          "url" : "http://hl7.org/fhir/StructureDefinition/elementdefinition-maxValueSet",
          "valueCanonical" : "http://hl7.org/fhir/ValueSet/mimetypes"
        },
        {
          "url" : "http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName",
          "valueString" : "ExpressionLanguage"
        }],
        "strength" : "extensible",
        "valueSet" : "http://hl7.org/fhir/ValueSet/expression-language"
      }
    },
    {
      "id" : "Expression.expression",
      "path" : "Expression.expression",
      "short" : "Expression in specified language",
      "definition" : "An expression in the specified language that returns a value.",
      "comment" : "If Expression.expression and Expression.reference are both present, the Expression.expression might just be a name pointing something within the referenced content.",
      "min" : 0,
      "max" : "1",
      "type" : [{
        "code" : "string"
      }],
      "isSummary" : true
    },
    {
      "id" : "Expression.reference",
      "path" : "Expression.reference",
      "short" : "Where the expression is found",
      "definition" : "A URI that defines where the expression is found.",
      "comment" : "If both a reference and an expression is found, the reference SHALL point to the same expression.",
      "min" : 0,
      "max" : "1",
      "type" : [{
        "code" : "uri"
      }],
      "isSummary" : true
    }]
  }
}

Usage note: every effort has been made to ensure that the examples are correct and useful, but they are not a normative part of the specification.