FHIR © HL7.org  |  Server Home  |  XIG Home  |  XIG Stats  |  Server Source  |  FHIR  

FHIR IG Statistics: StructureDefinition/sdc-questionnaire-enableWhenExpression

Packagehl7.fhir.uv.sdc
Resource TypeStructureDefinition
Idsdc-questionnaire-enableWhenExpression
FHIR VersionR4
Sourcehttp://hl7.org/fhir/uv/sdc/https://build.fhir.org/ig/HL7/sdc/StructureDefinition-sdc-questionnaire-enableWhenExpression.html
URLhttp://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-enableWhenExpression
Version4.0.0-ballot
Statusactive
Date2025-08-07T06:58:13+00:00
NameEnableWhenExpressionExtension
TitleEnable when expression
Realmuv
Authorityhl7
DescriptionAn expression that returns a boolean value for whether to enable the item. If the expression does not resolve to a boolean, it is considered an error in the design of the Questionnaire. Form renderer behavior is undefined. Some tools may attempt to force the value to be a boolean (e.g. is it a non-empty collection, non-null, non-zero - if so, then true). Systems SHOULD present a warning to the user if a non-boolean valued expression result does not trigger an all-out error.
TypeExtension
Kindcomplex-type

Resources that use this resource

StructureDefinition
sdc-questionnaire-behaveAdvanced Behavior Questionnaire
dtr-std-questionnaireDTR Standard Questionnaire
EcpFormDefinitionDefinition für Anamnese- und Aufklärungsbögen in ECP
FormDefinitionGlobale Definition für Anamnese- und Aufklärungsbögen

Resources that this resource uses

No resources found


Examples of Use for Extension

ResourceVersion
csiro.fhir.au.smartforms#current:Questionnaire/AboriginalTorresStraitIslanderHealthCheckR4
csiro.fhir.au.smartforms#current:Questionnaire/AboutTheHealthCheckR4
csiro.fhir.au.smartforms#current:Questionnaire/AbsoluteCVDRiskCalculationR4
csiro.fhir.au.smartforms#current:Questionnaire/AllergiesAdverseReactionsR4
csiro.fhir.au.smartforms#current:Questionnaire/ChronicDiseaseAgeingR4
csiro.fhir.au.smartforms#current:Questionnaire/ConsentR4
csiro.fhir.au.smartforms#current:Questionnaire/CurrentPrioritiesR4
csiro.fhir.au.smartforms#current:Questionnaire/EarHealthAndHearingR4
csiro.fhir.au.smartforms#current:Questionnaire/ExaminationR4
csiro.fhir.au.smartforms#current:Questionnaire/EyeHealthR4
csiro.fhir.au.smartforms#current:Questionnaire/FamilyHistoryR4
csiro.fhir.au.smartforms#current:Questionnaire/FinalisingHealthCheckR4
csiro.fhir.au.smartforms#current:Questionnaire/GamblingR4
csiro.fhir.au.smartforms#current:Questionnaire/HealthPrioritiesSummaryR4
csiro.fhir.au.smartforms#current:Questionnaire/HealthyEatingR4
csiro.fhir.au.smartforms#current:Questionnaire/HomeAndFamilyR4
csiro.fhir.au.smartforms#current:Questionnaire/ImmunisationR4
csiro.fhir.au.smartforms#current:Questionnaire/InvestigationsR4
csiro.fhir.au.smartforms#current:Questionnaire/LearningAndDevelopmentR4
csiro.fhir.au.smartforms#current:Questionnaire/LearningAndWorkR4
csiro.fhir.au.smartforms#current:Questionnaire/MedicalHistoryCurrentProblemsR4
csiro.fhir.au.smartforms#current:Questionnaire/MemoryAndThinkingR4
csiro.fhir.au.smartforms#current:Questionnaire/MoodR4
csiro.fhir.au.smartforms#current:Questionnaire/OralAndDentalHealthR4
csiro.fhir.au.smartforms#current:Questionnaire/PatientDetailsR4
csiro.fhir.au.smartforms#current:Questionnaire/PhysicalActivityAndScreenTimeR4
csiro.fhir.au.smartforms#current:Questionnaire/RedFlagsEarlyIdentificationGuideR4
csiro.fhir.au.smartforms#current:Questionnaire/RegularMedicationsR4
csiro.fhir.au.smartforms#current:Questionnaire/ScreeningProgramsR4
csiro.fhir.au.smartforms#current:Questionnaire/SexualHealthR4
csiro.fhir.au.smartforms#current:Questionnaire/SkinR4
csiro.fhir.au.smartforms#current:Questionnaire/SocialAndEmotionalWellbeingR4
csiro.fhir.au.smartforms#current:Questionnaire/SocialHistoryChildR4
csiro.fhir.au.smartforms#current:Questionnaire/SubstanceUseR4
hl7.fhir.uv.sdc#current:Questionnaire/questionnaire-sdc-profile-example-form-behaviorR4
smart.who.int.immunizations#current:Questionnaire/QIMMZD1R4
smart.who.int.immunizations#current:Questionnaire/QIMMZD13R4

Narrative

Note: links and images are rebased to the (stated) source

Generated Narrative: StructureDefinition sdc-questionnaire-enableWhenExpression

NameFlagsCard.TypeDescription & Constraintsdoco
.. Extension 0..1ExtensionExpression for when to enable the item
... extension 0..0
... url 1..1uri"http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-enableWhenExpression"
... value[x] C0..1ExpressionValue of extension
Constraints: sdc-inv1

doco Documentation for this format

Source

{
  "resourceType": "StructureDefinition",
  "id": "sdc-questionnaire-enableWhenExpression",
  "text": {
    "status": "extensions",
    "div": "<!-- snip (see above) -->"
  },
  "extension": [
    {
      "url": "http://hl7.org/fhir/StructureDefinition/structuredefinition-wg",
      "valueCode": "fhir"
    },
    {
      "url": "http://hl7.org/fhir/StructureDefinition/structuredefinition-fmm",
      "valueInteger": 4,
      "_valueInteger": {
        "extension": [
          {
            "url": "http://hl7.org/fhir/StructureDefinition/structuredefinition-conformance-derivedFrom",
            "valueCanonical": "http://hl7.org/fhir/uv/sdc/ImplementationGuide/hl7.fhir.uv.sdc"
          }
        ]
      }
    },
    {
      "url": "http://hl7.org/fhir/StructureDefinition/structuredefinition-standards-status",
      "valueCode": "trial-use",
      "_valueCode": {
        "extension": [
          {
            "url": "http://hl7.org/fhir/StructureDefinition/structuredefinition-conformance-derivedFrom",
            "valueCanonical": "http://hl7.org/fhir/uv/sdc/ImplementationGuide/hl7.fhir.uv.sdc"
          }
        ]
      }
    }
  ],
  "url": "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-enableWhenExpression",
  "identifier": [
    {
      "system": "urn:ietf:rfc:3986",
      "value": "urn:oid:2.16.840.1.113883.4.642.40.17.42.22"
    }
  ],
  "version": "4.0.0-ballot",
  "name": "EnableWhenExpressionExtension",
  "title": "Enable when expression",
  "status": "active",
  "experimental": false,
  "date": "2025-08-07T06:58:13+00:00",
  "publisher": "HL7 International / FHIR Infrastructure",
  "contact": [
    {
      "name": "HL7 International / FHIR Infrastructure",
      "telecom": [
        {
          "system": "url",
          "value": "http://www.hl7.org/Special/committees/fiwg"
        }
      ]
    },
    {
      "telecom": [
        {
          "system": "url",
          "value": "http://www.hl7.org/Special/committees/fiwg"
        }
      ]
    }
  ],
  "description": "An expression that returns a boolean value for whether to enable the item. If the expression does not resolve to a boolean, it is considered an error in the design of the Questionnaire.  Form renderer behavior is undefined.  Some tools may attempt to force the value to be a boolean (e.g. is it a non-empty collection, non-null, non-zero - if so, then true).  Systems SHOULD present a warning to the user if a non-boolean valued expression result does not trigger an all-out error.",
  "jurisdiction": [
    {
      "coding": [
        {
          "system": "http://unstats.un.org/unsd/methods/m49/m49.htm",
          "code": "001",
          "display": "World"
        }
      ]
    }
  ],
  "fhirVersion": "4.0.1",
  "mapping": [
    {
      "identity": "rim",
      "uri": "http://hl7.org/v3",
      "name": "RIM Mapping"
    }
  ],
  "kind": "complex-type",
  "abstract": false,
  "context": [
    {
      "type": "element",
      "expression": "Questionnaire.item"
    },
    {
      "type": "element",
      "expression": "ElementDefinition"
    }
  ],
  "type": "Extension",
  "baseDefinition": "http://hl7.org/fhir/StructureDefinition/Extension",
  "derivation": "constraint",
  "snapshot": {
    "extension": [
      {
        "url": "http://hl7.org/fhir/tools/StructureDefinition/snapshot-base-version",
        "valueString": "4.0.1"
      }
    ],
    "element": [
      {
        "id": "Extension",
        "path": "Extension",
        "short": "Expression for when to enable the item",
        "definition": "An expression that returns a boolean value for whether to enable the item.",
        "comment": "This is only permitted when the containing item does NOT have any enableWhen elements.\r\n\r\nIf the expression involves comparisons between elements that have different precisions but are otherwise equal, FHIRPath will resolve the expression to an empty set, which will in turn evaluate to false (meaning the item won't be enabled).  If this is not the desired behavior, the author should add a `.allTrue()` to the end of the expression, which will result in an indeterminate outcome because of precision differences being handled as 'true' and the item being enabled.  Questionnaires SHOULD be designed to take into account challenges around varying precision to minimize non-deterministic situations by setting constraints around expected precision, etc.\r\n\r\nIf the expression evaluates to something other than a boolean true or false, the Form Filler SHOULD still display the form, and if it does so, SHOULD treat the element as 'enabled' and display a warning to the user that the questionnaire logic was faulty and it's possible that the item shouldn't be enabled.",
        "min": 0,
        "max": "1",
        "base": {
          "path": "Extension",
          "min": 0,
          "max": "*"
        },
        "condition": [
          "ele-1"
        ],
        "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
      },
      {
        "id": "Extension.id",
        "path": "Extension.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": "string"
              }
            ],
            "code": "http://hl7.org/fhirpath/System.String"
          }
        ],
        "isModifier": false,
        "isSummary": false,
        "mapping": [
          {
            "identity": "rim",
            "map": "n/a"
          }
        ]
      },
      {
        "id": "Extension.extension",
        "path": "Extension.extension",
        "slicing": {
          "discriminator": [
            {
              "type": "value",
              "path": "url"
            }
          ],
          "description": "Extensions are always sliced by (at least) url",
          "rules": "open"
        },
        "short": "Extension",
        "definition": "An Extension",
        "min": 0,
        "max": "0",
        "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
      },
      {
        "id": "Extension.url",
        "path": "Extension.url",
        "representation": [
          "xmlAttr"
        ],
        "short": "identifies the meaning of the extension",
        "definition": "Source of the definition for the extension code - a logical name or a URL.",
        "comment": "The definition may point directly to a computable or human-readable definition of the extensibility codes, or it may be a logical URI as declared in some other specification. The definition SHALL be a URI for the Structure Definition defining the extension.",
        "min": 1,
        "max": "1",
        "base": {
          "path": "Extension.url",
          "min": 1,
          "max": "1"
        },
        "type": [
          {
            "extension": [
              {
                "url": "http://hl7.org/fhir/StructureDefinition/structuredefinition-fhir-type",
                "valueUrl": "uri"
              }
            ],
            "code": "http://hl7.org/fhirpath/System.String"
          }
        ],
        "fixedUri": "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-enableWhenExpression",
        "isModifier": false,
        "isSummary": false,
        "mapping": [
          {
            "identity": "rim",
            "map": "N/A"
          }
        ]
      },
      {
        "id": "Extension.value[x]",
        "path": "Extension.value[x]",
        "short": "Value of extension",
        "definition": "Value of extension - must be one of a constrained set of the data types (see [Extensibility](http://hl7.org/fhir/R4/extensibility.html) for a list).",
        "min": 0,
        "max": "1",
        "base": {
          "path": "Extension.value[x]",
          "min": 0,
          "max": "1"
        },
        "type": [
          {
            "code": "Expression"
          }
        ],
        "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": "sdc-inv1",
            "severity": "error",
            "human": "FHIR query language not allowed.",
            "expression": "language!='application/x-fhir-query'",
            "xpath": "not(f:language/@value='application/x-fhir-query')",
            "source": "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-enableWhenExpression"
          }
        ],
        "isModifier": false,
        "isSummary": false,
        "mapping": [
          {
            "identity": "rim",
            "map": "N/A"
          }
        ]
      }
    ]
  },
  "differential": {
    "element": [
      {
        "id": "Extension",
        "path": "Extension",
        "short": "Expression for when to enable the item",
        "definition": "An expression that returns a boolean value for whether to enable the item.",
        "comment": "This is only permitted when the containing item does NOT have any enableWhen elements.\r\n\r\nIf the expression involves comparisons between elements that have different precisions but are otherwise equal, FHIRPath will resolve the expression to an empty set, which will in turn evaluate to false (meaning the item won't be enabled).  If this is not the desired behavior, the author should add a `.allTrue()` to the end of the expression, which will result in an indeterminate outcome because of precision differences being handled as 'true' and the item being enabled.  Questionnaires SHOULD be designed to take into account challenges around varying precision to minimize non-deterministic situations by setting constraints around expected precision, etc.\r\n\r\nIf the expression evaluates to something other than a boolean true or false, the Form Filler SHOULD still display the form, and if it does so, SHOULD treat the element as 'enabled' and display a warning to the user that the questionnaire logic was faulty and it's possible that the item shouldn't be enabled.",
        "max": "1"
      },
      {
        "id": "Extension.extension",
        "path": "Extension.extension",
        "max": "0"
      },
      {
        "id": "Extension.url",
        "path": "Extension.url",
        "fixedUri": "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-enableWhenExpression"
      },
      {
        "id": "Extension.value[x]",
        "path": "Extension.value[x]",
        "type": [
          {
            "code": "Expression"
          }
        ],
        "constraint": [
          {
            "key": "sdc-inv1",
            "severity": "error",
            "human": "FHIR query language not allowed.",
            "expression": "language!='application/x-fhir-query'",
            "xpath": "not(f:language/@value='application/x-fhir-query')",
            "source": "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-enableWhenExpression"
          }
        ]
      }
    ]
  }
}