<StructureDefinition xmlns="http://hl7.org/fhir">
  <id value="cqif-questionnaire" />
  <text>
    <status value="generated" />
    <div xmlns="http://www.w3.org/1999/xhtml">to do</div>
  </text>
  <url value="http://hl7.org/fhir/StructureDefinition/cqif-questionnaire" />
  <name value="CQIF-Questionnaire" />
  <status value="draft" />
  <experimental value="false" />
  <date value="2015-05-30" />
  <publisher value="Health Level Seven, Inc. - CDS WG" />
  <contact>
    <telecom>
      <system value="url" />
      <value value="http://hl7.org/special/committees/dss" />
    </telecom>
  </contact>
  <description value="A questionnaire with the ability to specify behavior associated with questions or groups of questions" />
  <fhirVersion value="3.0.1" />
  <mapping>
    <identity value="rim" />
    <uri value="http://hl7.org/v3" />
    <name value="RIM Mapping" />
  </mapping>
  <mapping>
    <identity value="w5" />
    <uri value="http://hl7.org/fhir/w5" />
    <name value="W5 Mapping" />
  </mapping>
  <mapping>
    <identity value="objimpl" />
    <uri value="http://hl7.org/fhir/object-implementation" />
    <name value="Object Implementation Information" />
  </mapping>
  <mapping>
    <identity value="v2" />
    <uri value="http://hl7.org/v2" />
    <name value="HL7 v2 Mapping" />
  </mapping>
  <kind value="resource" />
  <abstract value="false" />
  <type value="Questionnaire" />
  <baseDefinition value="http://hl7.org/fhir/StructureDefinition/Questionnaire" />
  <derivation value="constraint" />
  <differential>
    <element id="Questionnaire">
      <path value="Questionnaire" />
      <short value="A questionnaire with the ability to specify behavior associated with questions or groups of questions" />
      <definition value="A CQIF questionnaire is a questionnaire with the added ability to describe behavior associated with questions. For example, whether or not to display a particular question or group of questions, or automatically calculating the value of an answer based on the answers to previous questions." />
      <min value="0" />
      <max value="*" />
    </element>
    <element id="Questionnaire.extension:library">
      <path value="Questionnaire.extension" />
      <sliceName value="library" />
      <short value="A library containing logic referenced by the questionnaire" />
      <definition value="A CQL or ELM library containing any logic referenced by the questionnaire." />
      <alias value="library" />
      <type>
        <code value="Extension" />
        <profile value="http://hl7.org/fhir/StructureDefinition/cqif-library" />
      </type>
    </element>
    <element id="Questionnaire.item">
      <path value="Questionnaire.item" />
    </element>
    <element id="Questionnaire.item.extension:condition">
      <path value="Questionnaire.item.extension" />
      <sliceName value="condition" />
      <short value="A condition that determines whether or not the group is applicable" />
      <definition value="The name of an expression that determines whether the group on which it appears is applicable. The expression is evaluated within the current context. If the result of evaluating the expression is true, the group is applicable. The expression has access to the current value of answered questions by the linkId of the question." />
      <comment value="Note that per Lloyd this extension may not be necessary, it may be able to specified structurally using the elements already available within Questionnaire." />
      <alias value="condition" />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="Extension" />
        <profile value="http://hl7.org/fhir/StructureDefinition/cqif-condition" />
      </type>
    </element>
    <element id="Questionnaire.item.extension:initialvalue">
      <path value="Questionnaire.item.extension" />
      <sliceName value="initialValue" />
      <short value="An expression that provides the initial value for the answer to the question" />
      <definition value="The name of an expression that determines the initial value for the answer to the question. This expression is evaluated once as part of displaying the form, and does not have access to the answers to other questions." />
      <alias value="initialValue" />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="Extension" />
        <profile value="http://hl7.org/fhir/StructureDefinition/cqif-initialValue" />
      </type>
    </element>
    <element id="Questionnaire.item.extension:calculatedvalue">
      <path value="Questionnaire.item.extension" />
      <sliceName value="calculatedValue" />
      <short value="An expression that provides a calculated value for the answer to the question" />
      <definition value="The name of an expression that determines a calculated value for the answer to the question. The expression is evaluated as necessary and has access to the answers to other questions by the linkId of the question." />
      <alias value="calculatedValue" />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="Extension" />
        <profile value="http://hl7.org/fhir/StructureDefinition/cqif-calculatedValue" />
      </type>
    </element>
    <element id="Questionnaire.item.option">
      <path value="Questionnaire.item.option" />
    </element>
    <element id="Questionnaire.item.option.extension:optioncode">
      <path value="Questionnaire.item.option.extension" />
      <sliceName value="optionCode" />
      <short value="Meaning of the response option" />
      <definition value="A CodeableConcept that assigns meaning to the response object on which it appears." />
      <requirements value="Need to be able to determine the semantics of each potential response in order to interpret the meaning when processing the questionnaire response.  For example, the response option &quot;Severe migraines within the past year&quot; to the question &quot;Select all that apply&quot; needs detailed coding (such as via CodeableConcept) at the option level, as well as a way to represent that an affirmation/negative response should result in (perhaps) an Observation in the QuestionnaireResponse tied to a clinical model (such as CIMI). This is key to support sophisticated CDS based on the semantics of the QuestionnaireResponse -- not just the codes." />
      <alias value="optionCode" />
      <min value="0" />
      <max value="*" />
      <type>
        <code value="Extension" />
        <profile value="http://hl7.org/fhir/StructureDefinition/cqif-optionCode" />
      </type>
    </element>
  </differential>
</StructureDefinition>