<StructureDefinition xmlns="http://hl7.org/fhir">
  <url value="http://telus.com/fhir/patientChart/StructureDefinition/profile-questionnaire" />
  <name value="Questionnaire" />
  <status value="draft" />
  <description value="This is created/used by the RAPIDS project within TELUS.   May also have use within the Patient Chart project" />
  <fhirVersion value="4.0.1" />
  <kind value="resource" />
  <abstract value="false" />
  <type value="Questionnaire" />
  <baseDefinition value="http://hl7.org/fhir/StructureDefinition/Questionnaire" />
  <derivation value="constraint" />
  <differential>
    <element id="Questionnaire.id">
      <path value="Questionnaire.id" />
      <mustSupport value="true" />
    </element>
    <element id="Questionnaire.identifier">
      <path value="Questionnaire.identifier" />
      <mustSupport value="true" />
    </element>
    <element id="Questionnaire.version">
      <path value="Questionnaire.version" />
      <mustSupport value="true" />
    </element>
    <element id="Questionnaire.name">
      <path value="Questionnaire.name" />
      <mustSupport value="true" />
    </element>
    <element id="Questionnaire.title">
      <path value="Questionnaire.title" />
      <mustSupport value="true" />
    </element>
    <element id="Questionnaire.status">
      <path value="Questionnaire.status" />
      <mustSupport value="true" />
    </element>
    <element id="Questionnaire.publisher">
      <path value="Questionnaire.publisher" />
      <comment value="Usage:   If the publisher is known, this can be included, eg MMSE, MOCA&#xD;&#xA;&#xD;&#xA;Usually an organization but may be an individual. The publisher (or steward) of the questionnaire is the organization or individual primarily responsible for the maintenance and upkeep of the questionnaire. This is not necessarily the same individual or organization that developed and initially authored the content. The publisher is the primary point of contact for questions or issues with the questionnaire. This item SHOULD be populated unless the information is available from context." />
      <mustSupport value="true" />
    </element>
    <element id="Questionnaire.description">
      <path value="Questionnaire.description" />
      <comment value="Usage Note:   If present, this can be populated.   PSS has a text area in the custom form that may map here.   Other EMRs may also have this&#xD;&#xA;&#xD;&#xA;This description can be used to capture details such as why the questionnaire was built, comments about misuse, instructions for clinical use and interpretation, literature references, examples from the paper world, etc. It is not a rendering of the questionnaire as conveyed in the 'text' field of the resource itself. This item SHOULD be populated unless the information is available from context (e.g. the language of the questionnaire is presumed to be the predominant language in the place the questionnaire was created)." />
      <mustSupport value="true" />
    </element>
    <element id="Questionnaire.code">
      <path value="Questionnaire.code" />
      <comment value="Usage Note:   This can be used to capture a LOINC code to represent the questionnaire, eg PHQ-9&#xD;&#xA;&#xD;&#xA;Codes may be defined very casually in enumerations or code lists, up to very formal definitions such as SNOMED CT - see the HL7 v3 Core Principles for more information." />
      <mustSupport value="true" />
    </element>
    <element id="Questionnaire.code.system">
      <path value="Questionnaire.code.system" />
      <mustSupport value="true" />
    </element>
    <element id="Questionnaire.code.code">
      <path value="Questionnaire.code.code" />
      <mustSupport value="true" />
    </element>
    <element id="Questionnaire.code.display">
      <path value="Questionnaire.code.display" />
      <mustSupport value="true" />
    </element>
    <element id="Questionnaire.item">
      <path value="Questionnaire.item" />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="Questionnaire.item.linkId">
      <path value="Questionnaire.item.linkId" />
      <comment value="Usage Note:    A LOINC code should be used if it exists; otherwise create a GUID.  eg for PHQ-9, each question has a LOINC code;.   For other custom questionnaires this can be structured in any logical way.   Example:   Custom Form Name + version + field identifier/field name.    &#xD;&#xA;&#xD;&#xA;This ''can'' be a meaningful identifier (e.g. a LOINC code) but is not intended to have any meaning.  GUIDs or sequential numbers are appropriate here." />
      <mustSupport value="true" />
    </element>
    <element id="Questionnaire.item.definition">
      <path value="Questionnaire.item.definition" />
      <comment value="Usage:  If this is tied to a data dictionary, this can be referenced.   This is not relevant to porting across and therefore will not be used.&#xD;&#xA;&#xD;&#xA;The uri refers to an ElementDefinition in a [StructureDefinition](structuredefinition.html#) and always starts with the [canonical URL](references.html#canonical) for the target resource. When referring to a StructureDefinition, a fragment identifier is used to specify the element definition by its id [Element.id](element-definitions.html#Element.id). E.g. http://hl7.org/fhir/StructureDefinition/Observation#Observation.value[x]. In the absence of a fragment identifier, the first/root element definition in the target is the matching element definition." />
    </element>
    <element id="Questionnaire.item.code">
      <path value="Questionnaire.item.code" />
      <comment value="Usage note:   This should be populated with a LOINC code if it exists.&#xD;&#xA;&#xD;&#xA;The value may come from the ElementDefinition referred to by .definition." />
      <mustSupport value="true" />
    </element>
    <element id="Questionnaire.item.prefix">
      <path value="Questionnaire.item.prefix" />
      <comment value="Usage Note:   If this exists on a given form this may be populated.&#xD;&#xA;&#xD;&#xA;These are generally unique within a questionnaire, though this is not guaranteed. Some questionnaires may have multiple questions with the same label with logic to control which gets exposed.  Typically, these won't be used for &quot;display&quot; items, though such use is not prohibited.  Systems SHOULD NOT generate their own prefixes if prefixes are defined for any items within a Questionnaire." />
      <mustSupport value="true" />
    </element>
    <element id="Questionnaire.item.text">
      <path value="Questionnaire.item.text" />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="Questionnaire.item.type">
      <path value="Questionnaire.item.type" />
      <comment value="Usage note:   Every widget in the template maps to one of these choices.&#xD;&#xA;&#xD;&#xA;Additional constraints on the type of answer can be conveyed by extensions. The value may come from the ElementDefinition referred to by .definition." />
      <mustSupport value="true" />
    </element>
    <element id="Questionnaire.item.enableWhen">
      <path value="Questionnaire.item.enableWhen" />
      <comment value="Usage Note:   This may be difficult to extract from the template.   For simple data structures this should be conveyed.  &#xD;&#xA;Use case:  This is valuable when migrating data from one EMR to another or when transferring a patient from one EMR to another.&#xD;&#xA;*See HL7 extensions for questionnaires&#xD;&#xA;&#xD;&#xA;If multiple repetitions of this extension are present, the item should be enabled when the condition for *any* of the repetitions is true.  I.e. treat &quot;enableWhen&quot;s as being joined by an &quot;or&quot; clause.  This element is a modifier because if enableWhen is present for an item, &quot;required&quot; is ignored unless one of the enableWhen conditions is met. When an item is disabled, all of its descendants are disabled, regardless of what their own enablic might evaluate to." />
      <mustSupport value="true" />
    </element>
    <element id="Questionnaire.item.enableBehavior">
      <path value="Questionnaire.item.enableBehavior" />
      <comment value="Use case:  This is valuable when migrating data from one EMR to another or when transferring a patient from one EMR to another.&#xD;&#xA;&#xD;&#xA;element must be specified if more than one enableWhen value is provided." />
      <mustSupport value="true" />
    </element>
    <element id="Questionnaire.item.required">
      <path value="Questionnaire.item.required" />
      <comment value="Usage note:   This applies to all use cases as there is some clinical value in knowing this, though its primary value is the migration use case.&#xD;&#xA;&#xD;&#xA;Questionnaire.item.required only has meaning for elements that are conditionally enabled with enableWhen if the condition evaluates to true.  If an item that contains other items is marked as required, that does not automatically make the contained elements required (though required groups must contain at least one child element). The value may come from the ElementDefinition referred to by .definition." />
      <mustSupport value="true" />
    </element>
    <element id="Questionnaire.item.repeats">
      <path value="Questionnaire.item.repeats" />
      <comment value="Use case:  This is valuable when migrating data from one EMR to another or when transferring a patient from one EMR to another.&#xD;&#xA;Usage Note:   If you are dealing with a group (repetition for each family member), this repeats for each relative.   If you are allowed to pick one answer, repeats = false, if you are allowed to pick more than one, repeates = true&#xD;&#xA;&#xD;&#xA;If a question is marked as repeats=true, then multiple answers can be provided for the question in the corresponding QuestionnaireResponse.  When rendering the questionnaire, it is up to the rendering software whether to render the question text for each answer repetition (i.e. &quot;repeat the question&quot;) or to simply allow entry/selection of multiple answers for the question (repeat the answers).  Which is most appropriate visually may depend on the type of answer as well as whether there are nested items.&#xA;&#xA;The resulting QuestionnaireResponse will be populated the same way regardless of rendering - one 'question' item with multiple answer values.&#xA;&#xA; The value may come from the ElementDefinition referred to by .definition." />
      <mustSupport value="true" />
    </element>
    <element id="Questionnaire.item.readOnly">
      <path value="Questionnaire.item.readOnly" />
      <comment value="Use Case:   This would apply to all use cases and should be populated when this is &quot;true&quot; only.   A value of &quot;false&quot; is not required.&#xD;&#xA;&#xD;&#xA;The value of readOnly elements can be established by asserting  extensions for defaultValues, linkages that support pre-population and/or extensions that support calculation based on other answers." />
      <mustSupport value="true" />
    </element>
    <element id="Questionnaire.item.maxLength">
      <path value="Questionnaire.item.maxLength" />
      <comment value="Use case:  This is valuable when migrating data from one EMR to another or when transferring a patient from one EMR to another.&#xD;&#xA;&#xD;&#xA;For base64binary, reflects the number of characters representing the encoded data, not the number of bytes of the binary data. The value may come from the ElementDefinition referred to by .definition." />
      <mustSupport value="true" />
    </element>
    <element id="Questionnaire.item.answerValueSet">
      <path value="Questionnaire.item.answerValueSet" />
      <comment value="Usage Note:  This could be used when migrating data from one EMR to another or when transferring a patient from one EMR to another, however this requires a fairly deep level of sophistication and will therefore not be used at this time.   The real value comes from template maintenance.&#xD;&#xA;&#xD;&#xA;Usage Note:   This is useful when defining a value set and pointing to that, rather than including all possible answers.   If there is a value set, this can be included here.   Terminology will need to be published as an external value set, or it could be contained within this resource, or you can define all answer options, in which case you do not need this data element.&#xD;&#xA;&#xD;&#xA;LOINC defines many useful value sets for questionnaire responses. See [LOINC Answer Lists](loinc.html#alist). The value may come from the ElementDefinition referred to by .definition." />
    </element>
    <element id="Questionnaire.item.answerOption">
      <path value="Questionnaire.item.answerOption" />
      <comment value="Use case:  This is valuable when migrating data from one EMR to another or when transferring a patient from one EMR to another as we can transfer templates.&#xD;&#xA;&#xD;&#xA;This element can be used when the value set machinery of answerValueSet is deemed too cumbersome or when there's a need to capture possible answers that are not codes." />
      <mustSupport value="true" />
    </element>
    <element id="Questionnaire.item.answerOption.value[x]">
      <path value="Questionnaire.item.answerOption.value[x]" />
      <mustSupport value="true" />
    </element>
    <element id="Questionnaire.item.answerOption.initialSelected">
      <path value="Questionnaire.item.answerOption.initialSelected" />
      <mustSupport value="true" />
    </element>
    <element id="Questionnaire.item.initial">
      <path value="Questionnaire.item.initial" />
      <comment value="Usage Note:  This is setting the default value for your question &#xD;&#xA;Use Case:   The primary value is migrating templates from one EMR to another.     &#xD;&#xA;&#xD;&#xA;See HL7 extension for Initial Exptression. http://build.fhir.org/ig/HL7/sdc/StructureDefinition-sdc-questionnaire-initialExpression.html&#xD;&#xA;&#xD;&#xA;The user is allowed to change the value and override the default (unless marked as read-only). If the user doesn't change the value, then this initial value will be persisted when the QuestionnaireResponse is initially created.  Note that initial values can influence results.  The data type of initial[x] must agree with the item.type, and only repeating items can have more then one initial value." />
      <mustSupport value="true" />
    </element>
    <element id="Questionnaire.item.initial.value[x]">
      <path value="Questionnaire.item.initial.value[x]" />
      <mustSupport value="true" />
    </element>
    <element id="Questionnaire.item.item">
      <path value="Questionnaire.item.item" />
      <comment value="Usage Note:   For nested items, the same rules apply as for Questionnarire.item &#xD;&#xA;&#xD;&#xA;There is no specified limit to the depth of nesting.  However, Questionnaire authors are encouraged to consider the impact on the user and user interface of overly deep nesting." />
      <contentReference value="http://hl7.org/fhir/StructureDefinition/Questionnaire#Questionnaire.item" />
      <mustSupport value="true" />
    </element>
    <element id="Questionnaire.item.item.linkId">
      <path value="Questionnaire.item.item.linkId" />
      <mustSupport value="true" />
    </element>
    <element id="Questionnaire.item.item.code">
      <path value="Questionnaire.item.item.code" />
      <mustSupport value="true" />
    </element>
    <element id="Questionnaire.item.item.prefix">
      <path value="Questionnaire.item.item.prefix" />
      <mustSupport value="true" />
    </element>
    <element id="Questionnaire.item.item.text">
      <path value="Questionnaire.item.item.text" />
      <mustSupport value="true" />
    </element>
    <element id="Questionnaire.item.item.type">
      <path value="Questionnaire.item.item.type" />
      <mustSupport value="true" />
    </element>
    <element id="Questionnaire.item.item.item">
      <path value="Questionnaire.item.item.item" />
      <contentReference value="http://hl7.org/fhir/StructureDefinition/Questionnaire#Questionnaire.item" />
      <mustSupport value="true" />
    </element>
  </differential>
</StructureDefinition>