R4 Ballot #2 (Mixed Normative/Trial use)

This page is part of the FHIR Specification (v3.5.0: R4 Ballot #2). 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: R4B R4

Extension: constraint

FHIR Infrastructure Work Group Maturity Level: 1InformativeUse Context: Any

URL for this extension:

http://hl7.org/fhir/StructureDefinition/questionnaire-constraint

Status: draft. Extension maintained by: HL7

An invariant that must be satisfied before responses to the questionnaire can be considered "complete".

Comment:

This maps to the ElementDefinition.constraint element.

Context of Use: Use on Element ID Questionnaire, Element ID Questionnaire.item or Element ID Questionnaire.item.item

usage info: insert a list of places where this extension is used

Extension Content

Summary

NameFlagsCard.TypeDescription & Constraintsdoco
.. constraint0..*ExtensionURL = http://hl7.org/fhir/StructureDefinition/questionnaire-constraint
constraint: An invariant that must be satisfied before responses to the questionnaire can be considered "complete".


Use on Element ID Questionnaire, Element ID Questionnaire.item or Element ID Questionnaire.item.item
... key1..1idUnique id for the constraint within the questionnaire.

... requirements0..1stringAn explanation of why this extension is required (for documentation purposes).

... severity1..1codeIndicates how serious violating the invariant is.

... expression1..1stringThe FHIRPath expression of the rule for computable interpretation.

... human1..1stringA free text expression of the rule to display to the user if the rule is violated.

... location0..*stringRelative paths to the questions this rule is enforced against.


doco Documentation for this format

Full Structure

NameFlagsCard.TypeDescription & Constraintsdoco
.. extension0..*ExtensionURL = http://hl7.org/fhir/StructureDefinition/questionnaire-constraint
constraint: An invariant that must be satisfied before responses to the questionnaire can be considered "complete".


Use on Element ID Questionnaire, Element ID Questionnaire.item or Element ID Questionnaire.item.item
... extension 0..*ExtensionAdditional content defined by implementations
Slice: Unordered, Open by value:url
... extension 1..1ExtensionUnique identifier
.... extension 0..0
.... url 1..1uri"key"
.... valueId 0..1idValue of extension
... extension 0..1ExtensionWhy needed
.... extension 0..0
.... url 1..1uri"requirements"
.... valueString 0..1stringValue of extension
... extension 1..1Extensionerror|warning
.... extension 0..0
.... url 1..1uri"severity"
.... valueCode 0..1codeValue of extension
Binding: ConstraintSeverity (required)
... extension 1..1ExtensionFormal rule
.... extension 0..0
.... url 1..1uri"expression"
.... valueString 0..1stringValue of extension
... extension 1..1ExtensionHuman-readable rule
.... extension 0..0
.... url 1..1uri"human"
.... valueString 0..1stringValue of extension
... extension 0..*ExtensionRelative path to elements
.... extension 0..0
.... url 1..1uri"location"
.... valueString 0..1stringValue of extension
... url 1..1uri"http://hl7.org/fhir/StructureDefinition/questionnaire-constraint"
... value[x] 0..0

doco Documentation for this format

XML Template

<!-- constraint -->doco

<extension xmlns="http://hl7.org/fhir"
     url="http://hl7.org/fhir/StructureDefinition/questionnaire-constraint" >
 <-- extension sliced by value:url  in the specified orderOpen-->
 <extension url="key"> 1..1 Extension  <!-- 1..1 Unique identifier -->
  <valueId value="[id]"/><!-- 0..1 Value of extension -->
 </extension>
 <extension url="requirements"> 0..1 Extension  <!-- 0..1 Why needed -->
  <valueString value="[string]"/><!-- 0..1 Value of extension -->
 </extension>
 <extension url="severity"> 1..1 Extension  <!-- 1..1 error|warning -->
  <valueCode value="[code]"/><!-- 0..1 Value of extension -->
 </extension>
 <extension url="expression"> 1..1 Extension  <!-- 1..1 Formal rule -->
  <valueString value="[string]"/><!-- 0..1 Value of extension -->
 </extension>
 <extension url="human"> 1..1 Extension  <!-- 1..1 Human-readable rule -->
  <valueString value="[string]"/><!-- 0..1 Value of extension -->
 </extension>
 <extension url="location"> 0..* Extension  <!-- 0..* Relative path to elements -->
  <valueString value="[string]"/><!-- 0..1 Value of extension -->
 </extension>
</extension>

JSON Template

{ // constraint
    "extension" : [ //  sliced by value:url  in the specified order, Open 
      { // Unique identifier // R! 
        // from Element: extension
        "extension" : [ //  sliced by value:url  in the specified order, Open ]
        "url" : "key", // R! 
        "valueId" : "<id>" //Value of extension
      },
      { // Why needed //
        // from Element: extension
        "extension" : [ //  sliced by value:url  in the specified order, Open ]
        "url" : "requirements", // R! 
        "valueString" : "<string>" //Value of extension
      },
      { // error|warning // R! 
        // from Element: extension
        "extension" : [ //  sliced by value:url  in the specified order, Open ]
        "url" : "severity", // R! 
        "valueCode" : "<code>" //Value of extension
      },
      { // Formal rule // R! 
        // from Element: extension
        "extension" : [ //  sliced by value:url  in the specified order, Open ]
        "url" : "expression", // R! 
        "valueString" : "<string>" //Value of extension
      },
      { // Human-readable rule // R! 
        // from Element: extension
        "extension" : [ //  sliced by value:url  in the specified order, Open ]
        "url" : "human", // R! 
        "valueString" : "<string>" //Value of extension
      },
      { // Relative path to elements //
        // from Element: extension
        "extension" : [ //  sliced by value:url  in the specified order, Open ]
        "url" : "location", // R! 
        "valueString" : "<string>" //Value of extension
      }
    ],
    "url" : "http://hl7.org/fhir/StructureDefinition/questionnaire-constraint", // R! 
// value[x]: Value of extension. One of these 49:
  }

Summary

NameFlagsCard.TypeDescription & Constraintsdoco
.. constraint0..*ExtensionURL = http://hl7.org/fhir/StructureDefinition/questionnaire-constraint
constraint: An invariant that must be satisfied before responses to the questionnaire can be considered &quot;complete&quot;.


Use on Element ID Questionnaire, Element ID Questionnaire.item or Element ID Questionnaire.item.item
... key1..1idUnique id for the constraint within the questionnaire.

... requirements0..1stringAn explanation of why this extension is required (for documentation purposes).

... severity1..1codeIndicates how serious violating the invariant is.

... expression1..1stringThe FHIRPath expression of the rule for computable interpretation.

... human1..1stringA free text expression of the rule to display to the user if the rule is violated.

... location0..*stringRelative paths to the questions this rule is enforced against.


doco Documentation for this format

Full Structure

NameFlagsCard.TypeDescription & Constraintsdoco
.. extension0..*ExtensionURL = http://hl7.org/fhir/StructureDefinition/questionnaire-constraint
constraint: An invariant that must be satisfied before responses to the questionnaire can be considered &quot;complete&quot;.


Use on Element ID Questionnaire, Element ID Questionnaire.item or Element ID Questionnaire.item.item
... extension 0..*ExtensionAdditional content defined by implementations
Slice: Unordered, Open by value:url
... extension 1..1ExtensionUnique identifier
.... extension 0..0
.... url 1..1uri"key"
.... valueId 0..1idValue of extension
... extension 0..1ExtensionWhy needed
.... extension 0..0
.... url 1..1uri"requirements"
.... valueString 0..1stringValue of extension
... extension 1..1Extensionerror|warning
.... extension 0..0
.... url 1..1uri"severity"
.... valueCode 0..1codeValue of extension
Binding: ConstraintSeverity (required)
... extension 1..1ExtensionFormal rule
.... extension 0..0
.... url 1..1uri"expression"
.... valueString 0..1stringValue of extension
... extension 1..1ExtensionHuman-readable rule
.... extension 0..0
.... url 1..1uri"human"
.... valueString 0..1stringValue of extension
... extension 0..*ExtensionRelative path to elements
.... extension 0..0
.... url 1..1uri"location"
.... valueString 0..1stringValue of extension
... url 1..1uri"http://hl7.org/fhir/StructureDefinition/questionnaire-constraint"
... value[x] 0..0

doco Documentation for this format

XML Template

<!-- constraint -->doco

<extension xmlns="http://hl7.org/fhir"
     url="http://hl7.org/fhir/StructureDefinition/questionnaire-constraint" >
 <-- extension sliced by value:url  in the specified orderOpen-->
 <extension url="key"> 1..1 Extension  <!-- 1..1 Unique identifier -->
  <valueId value="[id]"/><!-- 0..1 Value of extension -->
 </extension>
 <extension url="requirements"> 0..1 Extension  <!-- 0..1 Why needed -->
  <valueString value="[string]"/><!-- 0..1 Value of extension -->
 </extension>
 <extension url="severity"> 1..1 Extension  <!-- 1..1 error|warning -->
  <valueCode value="[code]"/><!-- 0..1 Value of extension -->
 </extension>
 <extension url="expression"> 1..1 Extension  <!-- 1..1 Formal rule -->
  <valueString value="[string]"/><!-- 0..1 Value of extension -->
 </extension>
 <extension url="human"> 1..1 Extension  <!-- 1..1 Human-readable rule -->
  <valueString value="[string]"/><!-- 0..1 Value of extension -->
 </extension>
 <extension url="location"> 0..* Extension  <!-- 0..* Relative path to elements -->
  <valueString value="[string]"/><!-- 0..1 Value of extension -->
 </extension>
</extension>

JSON Template

{ // constraint
    "extension" : [ //  sliced by value:url  in the specified order, Open 
      { // Unique identifier // R! 
        // from Element: extension
        "extension" : [ //  sliced by value:url  in the specified order, Open ]
        "url" : "key", // R! 
        "valueId" : "<id>" //Value of extension
      },
      { // Why needed //
        // from Element: extension
        "extension" : [ //  sliced by value:url  in the specified order, Open ]
        "url" : "requirements", // R! 
        "valueString" : "<string>" //Value of extension
      },
      { // error|warning // R! 
        // from Element: extension
        "extension" : [ //  sliced by value:url  in the specified order, Open ]
        "url" : "severity", // R! 
        "valueCode" : "<code>" //Value of extension
      },
      { // Formal rule // R! 
        // from Element: extension
        "extension" : [ //  sliced by value:url  in the specified order, Open ]
        "url" : "expression", // R! 
        "valueString" : "<string>" //Value of extension
      },
      { // Human-readable rule // R! 
        // from Element: extension
        "extension" : [ //  sliced by value:url  in the specified order, Open ]
        "url" : "human", // R! 
        "valueString" : "<string>" //Value of extension
      },
      { // Relative path to elements //
        // from Element: extension
        "extension" : [ //  sliced by value:url  in the specified order, Open ]
        "url" : "location", // R! 
        "valueString" : "<string>" //Value of extension
      }
    ],
    "url" : "http://hl7.org/fhir/StructureDefinition/questionnaire-constraint", // R! 
// value[x]: Value of extension. One of these 49:
  }

 

Constraints

  • ele-1: All FHIR elements must have a @value or children (xpath: @value|f:*|h:div)
  • ext-1: Must have either extensions or value[x], not both (xpath: exists(f:extension)!=exists(f:*[starts-with(local-name(.), 'value')]))