<StructureDefinition xmlns="http://hl7.org/fhir">
  <id value="QuestionnaireResponse" />
  <meta>
    <lastUpdated value="2019-11-01T09:29:23.356+11:00" />
  </meta>
  <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-category">
    <valueString value="Clinical.Diagnostics" />
  </extension>
  <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-standards-status">
    <valueCode value="trial-use" />
  </extension>
  <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-fmm">
    <valueInteger value="3" />
  </extension>
  <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-security-category">
    <valueCode value="patient" />
  </extension>
  <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-wg">
    <valueCode value="fhir" />
  </extension>
  <url value="https://fhir.kemkes.go.id/r4/StructureDefinition/QuestionnaireResponse" />
  <version value="4.0.1" />
  <name value="QuestionnaireResponse" />
  <status value="draft" />
  <date value="2022-07-08T15:10:50.6856647+00:00" />
  <publisher value="Health Level Seven International (FHIR Infrastructure)" />
  <contact>
    <telecom>
      <system value="url" />
      <value value="http://hl7.org/fhir" />
    </telecom>
  </contact>
  <contact>
    <telecom>
      <system value="url" />
      <value value="http://www.hl7.org/Special/committees/fiwg/index.cfm" />
    </telecom>
  </contact>
  <description value="A structured set of questions and their answers. The questions are ordered and grouped into coherent subsets, corresponding to the structure of the grouping of the questionnaire being responded to." />
  <purpose value="To support structured, hierarchical reporting of data gathered using digital forms and other questionnaires." />
  <fhirVersion value="4.0.1" />
  <mapping>
    <identity value="workflow" />
    <uri value="http://hl7.org/fhir/workflow" />
    <name value="Workflow Pattern" />
  </mapping>
  <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/fivews" />
    <name value="FiveWs Pattern Mapping" />
  </mapping>
  <kind value="resource" />
  <abstract value="false" />
  <type value="QuestionnaireResponse" />
  <baseDefinition value="http://hl7.org/fhir/StructureDefinition/DomainResource" />
  <derivation value="specialization" />
  <differential>
    <element id="QuestionnaireResponse">
      <path value="QuestionnaireResponse" />
      <short value="A structured set of questions and their answers" />
      <definition value="A structured set of questions and their answers. The questions are ordered and grouped into coherent subsets, corresponding to the structure of the grouping of the questionnaire being responded to." />
      <comment value="The QuestionnaireResponse contains enough information about the questions asked and their organization that it can be interpreted somewhat independently from the Questionnaire it is based on.  I.e. You don't need access to the Questionnaire in order to extract basic information from a QuestionnaireResponse." />
      <alias value="Form" />
      <alias value="QuestionnaireAnswers" />
      <mapping>
        <identity value="workflow" />
        <map value="Event" />
      </mapping>
      <mapping>
        <identity value="rim" />
        <map value="Observation[moodCode=EVN]" />
      </mapping>
    </element>
    <element id="QuestionnaireResponse.identifier">
      <path value="QuestionnaireResponse.identifier" />
      <short value="Unique id for this set of answers" />
      <definition value="A business identifier assigned to a particular completed (or partially completed) questionnaire." />
      <requirements value="Used for tracking, registration and other business purposes." />
      <max value="1" />
      <type>
        <code value="Identifier" />
      </type>
      <isSummary value="true" />
      <mapping>
        <identity value="workflow" />
        <map value="Event.identifier" />
      </mapping>
      <mapping>
        <identity value="w5" />
        <map value="FiveWs.identifier" />
      </mapping>
      <mapping>
        <identity value="rim" />
        <map value=".id" />
      </mapping>
    </element>
    <element id="QuestionnaireResponse.basedOn">
      <path value="QuestionnaireResponse.basedOn" />
      <short value="Request fulfilled by this QuestionnaireResponse" />
      <definition value="The order, proposal or plan that is fulfilled in whole or in part by this QuestionnaireResponse.  For example, a ServiceRequest seeking an intake assessment or a decision support recommendation to assess for post-partum depression." />
      <requirements value="Supports traceability of responsibility for the action and allows linkage of an action to the recommendations acted upon." />
      <alias value="order" />
      <type>
        <code value="Reference" />
        <targetProfile value="http://hl7.org/fhir/StructureDefinition/CarePlan" />
        <targetProfile value="http://hl7.org/fhir/StructureDefinition/ServiceRequest" />
      </type>
      <isSummary value="true" />
      <mapping>
        <identity value="workflow" />
        <map value="Event.basedOn" />
      </mapping>
      <mapping>
        <identity value="rim" />
        <map value=".outboundRelationship[typeCode=FLFS].target" />
      </mapping>
    </element>
    <element id="QuestionnaireResponse.partOf">
      <path value="QuestionnaireResponse.partOf" />
      <short value="Part of this action" />
      <definition value="A procedure or observation that this questionnaire was performed as part of the execution of.  For example, the surgery a checklist was executed as part of." />
      <comment value="Composition of questionnaire responses will be handled by the parent questionnaire having answers that reference the child questionnaire.  For relationships to referrals, and other types of requests, use basedOn." />
      <type>
        <code value="Reference" />
        <targetProfile value="http://hl7.org/fhir/StructureDefinition/Observation" />
        <targetProfile value="http://hl7.org/fhir/StructureDefinition/Procedure" />
      </type>
      <isSummary value="true" />
      <mapping>
        <identity value="workflow" />
        <map value="Event.partOf" />
      </mapping>
      <mapping>
        <identity value="rim" />
        <map value=".inboundRelationship[typeCode=COMP].source[moodCode=EVN]" />
      </mapping>
    </element>
    <element id="QuestionnaireResponse.questionnaire">
      <path value="QuestionnaireResponse.questionnaire" />
      <short value="Form being answered" />
      <definition value="The Questionnaire that defines and organizes the questions for which answers are being provided." />
      <comment value="If a QuestionnaireResponse references a Questionnaire, then the QuestionnaireResponse structure must be consistent with the Questionnaire (i.e. questions must be organized into the same groups, nested questions must still be nested, etc.)." />
      <requirements value="Needed to allow editing of the questionnaire response in a manner that enforces the constraints of the original form." />
      <alias value="Form" />
      <max value="1" />
      <type>
        <code value="canonical" />
        <targetProfile value="http://hl7.org/fhir/StructureDefinition/Questionnaire" />
      </type>
      <isSummary value="true" />
      <mapping>
        <identity value="workflow" />
        <map value="Event.instantiates" />
      </mapping>
      <mapping>
        <identity value="rim" />
        <map value="./outboundRelationship[typeCode=INST]/target[classCode=OBS, moodCode=DEFN]" />
      </mapping>
    </element>
    <element id="QuestionnaireResponse.status">
      <path value="QuestionnaireResponse.status" />
      <short value="in-progress | completed | amended | entered-in-error | stopped" />
      <definition value="The position of the questionnaire response within its overall lifecycle." />
      <comment value="This element is labeled as a modifier because the status contains codes that mark the resource as not currently valid." />
      <requirements value="The information on Questionnaire resources  may possibly be gathered during multiple sessions and altered after considered being finished." />
      <min value="1" />
      <max value="1" />
      <type>
        <code value="code" />
      </type>
      <isModifier value="true" />
      <isModifierReason value="This element is labelled as a modifier because it is a status element that contains status entered-in-error which means that the resource should not be treated as valid" />
      <isSummary value="true" />
      <binding>
        <extension url="http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName">
          <valueString value="QuestionnaireResponseStatus" />
        </extension>
        <strength value="required" />
        <description value="Lifecycle status of the questionnaire response." />
        <valueSet value="http://hl7.org/fhir/ValueSet/questionnaire-answers-status|4.0.1" />
      </binding>
      <mapping>
        <identity value="workflow" />
        <map value="Event.status" />
      </mapping>
      <mapping>
        <identity value="w5" />
        <map value="FiveWs.status" />
      </mapping>
      <mapping>
        <identity value="rim" />
        <map value=".statusCode (also whether there's a revisionControlAct - and possibly mood to distinguish &quot;in-progress&quot; from &quot;published)" />
      </mapping>
    </element>
    <element id="QuestionnaireResponse.subject">
      <path value="QuestionnaireResponse.subject" />
      <short value="The subject of the questions" />
      <definition value="The subject of the questionnaire response.  This could be a patient, organization, practitioner, device, etc.  This is who/what the answers apply to, but is not necessarily the source of information." />
      <comment value="If the Questionnaire declared a subjectType, the resource pointed to by this element must be an instance of one of the listed types." />
      <requirements value="Allows linking the answers to the individual the answers describe.  May also affect access control." />
      <alias value="Patient" />
      <alias value="Focus" />
      <max value="1" />
      <type>
        <code value="Reference" />
        <targetProfile value="http://hl7.org/fhir/StructureDefinition/Resource" />
      </type>
      <isSummary value="true" />
      <mapping>
        <identity value="workflow" />
        <map value="Event.subject" />
      </mapping>
      <mapping>
        <identity value="w5" />
        <map value="FiveWs.subject[x]" />
      </mapping>
      <mapping>
        <identity value="rim" />
        <map value=".participation[typeCode=SBJ].role" />
      </mapping>
      <mapping>
        <identity value="w5" />
        <map value="FiveWs.subject" />
      </mapping>
    </element>
    <element id="QuestionnaireResponse.encounter">
      <path value="QuestionnaireResponse.encounter" />
      <short value="Encounter created as part of" />
      <definition value="The Encounter during which this questionnaire response was created or to which the creation of this record is tightly associated." />
      <comment value="This will typically be the encounter the event occurred within, but some activities may be initiated prior to or after the official completion of an encounter but still be tied to the context of the encounter. A questionnaire that was initiated during an encounter but not fully completed during the encounter would still generally be associated with the encounter." />
      <requirements value="Provides context for the information that was captured.  May also affect access control." />
      <max value="1" />
      <type>
        <code value="Reference" />
        <targetProfile value="http://hl7.org/fhir/StructureDefinition/Encounter" />
      </type>
      <isSummary value="true" />
      <mapping>
        <identity value="workflow" />
        <map value="Event.encounter" />
      </mapping>
      <mapping>
        <identity value="w5" />
        <map value="FiveWs.context" />
      </mapping>
      <mapping>
        <identity value="rim" />
        <map value=".inboundRelationship(typeCode=COMP].source[classCode&lt;=PCPR, moodCode=EVN]" />
      </mapping>
    </element>
    <element id="QuestionnaireResponse.authored">
      <path value="QuestionnaireResponse.authored" />
      <short value="Date the answers were gathered" />
      <definition value="The date and/or time that this set of answers were last changed." />
      <comment value="May be different from the lastUpdateTime of the resource itself, because that reflects when the data was known to the server, not when the data was captured.&#xA;&#xA;This element is optional to allow for systems that might not know the value, however it SHOULD be populated if possible." />
      <requirements value="Clinicians need to be able to check the date that the information in the questionnaire was collected, to derive the context of the answers." />
      <alias value="Date Created" />
      <alias value="Date published" />
      <alias value="Date Issued" />
      <alias value="Date updated" />
      <max value="1" />
      <type>
        <code value="dateTime" />
      </type>
      <isSummary value="true" />
      <mapping>
        <identity value="workflow" />
        <map value="Event.occurrence[x]" />
      </mapping>
      <mapping>
        <identity value="w5" />
        <map value="FiveWs.recorded" />
      </mapping>
      <mapping>
        <identity value="rim" />
        <map value=".participation[typeCode=AUT].time" />
      </mapping>
    </element>
    <element id="QuestionnaireResponse.author">
      <path value="QuestionnaireResponse.author" />
      <short value="Person who received and recorded the answers" />
      <definition value="Person who received the answers to the questions in the QuestionnaireResponse and recorded them in the system." />
      <comment value="Mapping a subject's answers to multiple choice options and determining what to put in the textual answer is a matter of interpretation.  Authoring by device would indicate that some portion of the questionnaire had been auto-populated." />
      <requirements value="Need to know who interpreted the subject's answers to the questions in the questionnaire, and selected the appropriate options for answers." />
      <alias value="Laboratory" />
      <alias value="Service" />
      <alias value="Practitioner" />
      <alias value="Department" />
      <alias value="Company" />
      <alias value="Performer" />
      <max value="1" />
      <type>
        <code value="Reference" />
        <targetProfile value="http://hl7.org/fhir/StructureDefinition/Device" />
        <targetProfile value="http://hl7.org/fhir/StructureDefinition/Practitioner" />
        <targetProfile value="http://hl7.org/fhir/StructureDefinition/PractitionerRole" />
        <targetProfile value="http://hl7.org/fhir/StructureDefinition/Patient" />
        <targetProfile value="http://hl7.org/fhir/StructureDefinition/RelatedPerson" />
        <targetProfile value="http://hl7.org/fhir/StructureDefinition/Organization" />
      </type>
      <isSummary value="true" />
      <mapping>
        <identity value="workflow" />
        <map value="Event.performer" />
      </mapping>
      <mapping>
        <identity value="w5" />
        <map value="FiveWs.author" />
      </mapping>
      <mapping>
        <identity value="rim" />
        <map value=".participation[typeCode=AUT].role" />
      </mapping>
    </element>
    <element id="QuestionnaireResponse.source">
      <path value="QuestionnaireResponse.source" />
      <short value="The person who answered the questions" />
      <definition value="The person who answered the questions about the subject." />
      <comment value="If not specified, no inference can be made about who provided the data." />
      <requirements value="When answering questions about a subject that is minor, incapable of answering or an animal, another human source may answer the questions." />
      <max value="1" />
      <type>
        <code value="Reference" />
        <targetProfile value="http://hl7.org/fhir/StructureDefinition/Patient" />
        <targetProfile value="http://hl7.org/fhir/StructureDefinition/Practitioner" />
        <targetProfile value="http://hl7.org/fhir/StructureDefinition/PractitionerRole" />
        <targetProfile value="http://hl7.org/fhir/StructureDefinition/RelatedPerson" />
      </type>
      <isSummary value="true" />
      <mapping>
        <identity value="w5" />
        <map value="FiveWs.source" />
      </mapping>
      <mapping>
        <identity value="rim" />
        <map value=".participation[typeCode=INF].role" />
      </mapping>
    </element>
    <element id="QuestionnaireResponse.item">
      <path value="QuestionnaireResponse.item" />
      <short value="Groups and questions" />
      <definition value="A group or question item from the original questionnaire for which answers are provided." />
      <comment value="Groups cannot have answers and therefore must nest directly within item. When dealing with questions, nesting must occur within each answer because some questions may have multiple answers (and the nesting occurs for each answer)." />
      <type>
        <code value="BackboneElement" />
      </type>
      <constraint>
        <key value="qrs-1" />
        <severity value="error" />
        <human value="Nested item can't be beneath both item and answer" />
        <expression value="(answer.exists() and item.exists()).not()" />
        <xpath value="not(exists(f:answer) and exists(f:item))" />
        <source value="http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse" />
      </constraint>
      <mapping>
        <identity value="rim" />
        <map value=".outboundRelationship[typeCode=COMP].target[classCode=OBS, moodCode=EVN]" />
      </mapping>
    </element>
    <element id="QuestionnaireResponse.item.linkId">
      <path value="QuestionnaireResponse.item.linkId" />
      <short value="Pointer to specific item from Questionnaire" />
      <definition value="The item from the Questionnaire that corresponds to this item in the QuestionnaireResponse resource." />
      <requirements value="Items can repeat in the answers, so a direct 1..1 correspondence by position might not exist - requiring correspondence by identifier." />
      <min value="1" />
      <max value="1" />
      <type>
        <code value="string" />
      </type>
      <mapping>
        <identity value="rim" />
        <map value=".outboundRelationship[typeCode=DEFN].target[classCode=OBS, moodCode=DEFN].id" />
      </mapping>
    </element>
    <element id="QuestionnaireResponse.item.definition">
      <path value="QuestionnaireResponse.item.definition" />
      <short value="ElementDefinition - details for the item" />
      <definition value="A reference to an [ElementDefinition](elementdefinition.html) that provides the details for the item." />
      <comment value="The ElementDefinition must be in a [StructureDefinition](structuredefinition.html#), and must have a fragment identifier that identifies the specific data element by its id (Element.id). E.g. http://hl7.org/fhir/StructureDefinition/Observation#Observation.value[x].&#xA;&#xA;There is no need for this element if the item pointed to by the linkId has a definition listed." />
      <requirements value="A common pattern is to define a set of data elements, and then build multiple different questionnaires for different circumstances to gather the data. This element provides traceability to the common definition." />
      <max value="1" />
      <type>
        <code value="uri" />
      </type>
      <mapping>
        <identity value="rim" />
        <map value=".outboundRelationship[typeCode=DEFN].target[classCode=OBS, moodCode=DEFN].code" />
      </mapping>
    </element>
    <element id="QuestionnaireResponse.item.text">
      <path value="QuestionnaireResponse.item.text" />
      <short value="Name for group or question text" />
      <definition value="Text that is displayed above the contents of the group or as the text of the question being answered." />
      <requirements value="Allows the questionnaire response to be read without access to the questionnaire." />
      <max value="1" />
      <type>
        <code value="string" />
      </type>
      <mapping>
        <identity value="rim" />
        <map value=".text" />
      </mapping>
    </element>
    <element id="QuestionnaireResponse.item.answer">
      <path value="QuestionnaireResponse.item.answer" />
      <short value="The response(s) to the question" />
      <definition value="The respondent's answer(s) to the question." />
      <comment value="The value is nested because we cannot have a repeating structure that has variable type." />
      <type>
        <code value="BackboneElement" />
      </type>
      <mapping>
        <identity value="rim" />
        <map value=".value[type=LIST_ANY]" />
      </mapping>
    </element>
    <element id="QuestionnaireResponse.item.answer.value[x]">
      <path value="QuestionnaireResponse.item.answer.value[x]" />
      <short value="Single-valued answer to the question" />
      <definition value="The answer (or one of the answers) provided by the respondent to the question." />
      <comment value="More complex structures (Attachment, Resource and Quantity) will typically be limited to electronic forms that can expose an appropriate user interface to capture the components and enforce the constraints of a complex data type.  Additional complex types can be introduced through extensions. Must match the datatype specified by Questionnaire.item.type in the corresponding Questionnaire." />
      <requirements value="Ability to retain a single-valued answer to a question." />
      <max value="1" />
      <type>
        <code value="boolean" />
      </type>
      <type>
        <code value="decimal" />
      </type>
      <type>
        <code value="integer" />
      </type>
      <type>
        <code value="date" />
      </type>
      <type>
        <code value="dateTime" />
      </type>
      <type>
        <code value="time" />
      </type>
      <type>
        <code value="string" />
      </type>
      <type>
        <code value="uri" />
      </type>
      <type>
        <code value="Attachment" />
      </type>
      <type>
        <code value="Coding" />
      </type>
      <type>
        <code value="Quantity" />
      </type>
      <type>
        <code value="Reference" />
        <targetProfile value="http://hl7.org/fhir/StructureDefinition/Resource" />
      </type>
      <binding>
        <extension url="http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName">
          <valueString value="QuestionnaireAnswer" />
        </extension>
        <strength value="example" />
        <description value="Code indicating the response provided for a question." />
        <valueSet value="http://hl7.org/fhir/ValueSet/questionnaire-answers" />
      </binding>
      <mapping>
        <identity value="rim" />
        <map value=".item" />
      </mapping>
    </element>
    <element id="QuestionnaireResponse.item.answer.item">
      <path value="QuestionnaireResponse.item.answer.item" />
      <short value="Nested groups and questions" />
      <definition value="Nested groups and/or questions found within this particular answer." />
      <requirements value="It is useful to have &quot;sub-questions&quot;, questions which normally appear when certain answers are given and which collect additional details." />
      <min value="0" />
      <max value="*" />
      <contentReference value="#QuestionnaireResponse.item" />
      <mapping>
        <identity value="rim" />
        <map value=".outboundRelationship[typeCode=COMP].target[classCode=OBS, moodCode=EVN]" />
      </mapping>
    </element>
    <element id="QuestionnaireResponse.item.item">
      <path value="QuestionnaireResponse.item.item" />
      <short value="Nested questionnaire response items" />
      <definition value="Questions or sub-groups nested beneath a question or group." />
      <requirements value="Reports can consist of complex nested groups." />
      <min value="0" />
      <max value="*" />
      <contentReference value="#QuestionnaireResponse.item" />
      <mapping>
        <identity value="rim" />
        <map value=".outboundRelationship[typeCode=COMP].target[classCode=OBS, moodCode=EVN]" />
      </mapping>
    </element>
  </differential>
</StructureDefinition>