<StructureDefinition xmlns="http://hl7.org/fhir">
  <id value="nl-vzvz-TaskNotifiedPull" />
  <language value="nl-NL" />
  <url value="http://vzvz.nl/fhir/StructureDefinition/nl-vzvz-TaskNotifiedPull" />
  <version value="2.0.0-beta.2" />
  <name value="NLVZVZNotifiedPull" />
  <status value="active" />
  <publisher value="VZVZ" />
  <contact>
    <name value="VZVZ" />
    <telecom>
      <system value="email" />
      <value value="standaardisatie@vzvz.nl" />
      <use value="work" />
    </telecom>
  </contact>
  <description value="Task profile for Notified Pull" />
  <jurisdiction>
    <coding>
      <system value="urn:iso:std:iso:3166" />
      <code value="NL" />
      <display value="Netherlands" />
    </coding>
  </jurisdiction>
  <copyright value="VZVZ" />
  <fhirVersion value="4.0.1" />
  <kind value="resource" />
  <abstract value="false" />
  <type value="Task" />
  <baseDefinition value="http://hl7.org/fhir/StructureDefinition/Task" />
  <derivation value="constraint" />
  <differential>
    <element id="Task">
      <path value="Task" />
      <constraint>
        <key value="np-1" />
        <severity value="error" />
        <human value="Restriction should have an end date when status is 'requested'" />
        <expression value="Task.status='requested' implies Task.restriction.period.end.exists()" />
        <source value="http://vzvz.nl/fhir/StructureDefinition/nl-vzvz-TaskNotifiedPull" />
      </constraint>
    </element>
    <element id="Task.instantiatesUri">
      <path value="Task.instantiatesUri" />
      <comment value="Reference to an ActivityDefinition to conform to the TA NP" />
    </element>
    <element id="Task.status">
      <path value="Task.status" />
      <fixedCode value="requested" />
    </element>
    <element id="Task.intent">
      <path value="Task.intent" />
      <fixedCode value="proposal" />
    </element>
    <element id="Task.code">
      <path value="Task.code" />
      <min value="1" />
    </element>
    <element id="Task.code.coding.system">
      <path value="Task.code.coding.system" />
      <fixedUri value="http://vzvz.nl/fhir/CodeSystem/aorta-taskcode" />
    </element>
    <element id="Task.code.coding.code">
      <path value="Task.code.coding.code" />
      <fixedCode value="notified_pull" />
    </element>
    <element id="Task.for">
      <path value="Task.for" />
      <short value="Patient" />
      <definition value="Reference to the patient to whom this notified pull relates.&#xD;&#xA;&#xD;&#xA;The entity who benefits from the performance of the service specified in the task (e.g., the patient)." />
      <min value="1" />
    </element>
    <element id="Task.for.identifier.system">
      <path value="Task.for.identifier.system" />
      <fixedUri value="http://fhir.nl/fhir/NamingSystem/bsn" />
    </element>
    <element id="Task.requester">
      <path value="Task.requester" />
      <definition value="Reference to Device that requests to execute the Task" />
      <min value="1" />
      <type>
        <code value="Reference" />
        <targetProfile value="http://vzvz.nl/fhir/StructureDefinition/nl-vzvz-Device" />
      </type>
    </element>
    <element id="Task.owner">
      <path value="Task.owner" />
      <definition value="Reference to Organization responsible for the execution of the Task." />
      <min value="1" />
      <type>
        <code value="Reference" />
        <targetProfile value="http://nictiz.nl/fhir/StructureDefinition/nl-core-HealthcareProvider-Organization" />
        <targetProfile value="http://hl7.org/fhir/StructureDefinition/PractitionerRole" />
        <targetProfile value="http://hl7.org/fhir/StructureDefinition/Organization" />
        <targetProfile value="http://hl7.org/fhir/StructureDefinition/CareTeam" />
        <targetProfile value="http://hl7.org/fhir/StructureDefinition/HealthcareService" />
        <targetProfile value="http://hl7.org/fhir/StructureDefinition/Patient" />
        <targetProfile value="http://hl7.org/fhir/StructureDefinition/Device" />
        <targetProfile value="http://hl7.org/fhir/StructureDefinition/RelatedPerson" />
      </type>
    </element>
    <element id="Task.restriction">
      <path value="Task.restriction" />
      <short value="Period to execute the task" />
      <definition value="Period within which the task should be executed." />
      <comment value="If the status is requested, restriction.period.end should contain an end date to retrieve the information. This end date must be before or on the end date of the consent token." />
    </element>
    <element id="Task.input">
      <path value="Task.input" />
      <slicing>
        <discriminator>
          <type value="value" />
          <path value="type" />
        </discriminator>
        <rules value="open" />
      </slicing>
      <min value="1" />
    </element>
    <element id="Task.input:consentToken">
      <path value="Task.input" />
      <sliceName value="consentToken" />
      <short value="consent Token" />
      <definition value="The consent token respresents the patient's consent to retrieve this information" />
      <comment value="The consent token is base64 encoded (not base64urlencoded)." />
      <min value="1" />
      <max value="1" />
    </element>
    <element id="Task.input:consentToken.type">
      <path value="Task.input.type" />
      <patternCodeableConcept>
        <coding>
          <system value="http://vzvz.nl/fhir/CodeSystem/TaskParameterType" />
          <code value="consent_token" />
        </coding>
      </patternCodeableConcept>
      <binding>
        <strength value="preferred" />
        <valueSet value="http://vzvz.nl/fhir/ValueSet/nl-vzvz-TaskParameterType" />
      </binding>
    </element>
    <element id="Task.input:consentToken.value[x]">
      <path value="Task.input.value[x]" />
      <short value="base64 encoded consent token" />
      <type>
        <code value="string" />
      </type>
    </element>
    <element id="Task.input:queryString">
      <path value="Task.input" />
      <sliceName value="queryString" />
      <short value="query string to execute" />
      <min value="0" />
      <max value="*" />
    </element>
    <element id="Task.input:queryString.type">
      <path value="Task.input.type" />
      <patternCodeableConcept>
        <coding>
          <system value="http://vzvz.nl/fhir/CodeSystem/TaskParameterType" />
          <code value="query_string" />
        </coding>
      </patternCodeableConcept>
      <binding>
        <strength value="preferred" />
        <valueSet value="http://vzvz.nl/fhir/ValueSet/nl-vzvz-TaskParameterType" />
      </binding>
    </element>
    <element id="Task.input:queryString.value[x]">
      <path value="Task.input.value[x]" />
      <short value="query string to execute" />
      <type>
        <code value="string" />
      </type>
    </element>
  </differential>
</StructureDefinition>