<StructureDefinition xmlns="http://hl7.org/fhir">
  <url value="http://ehealth.bc.ca/fhir/StructureDefinition/bc-bcyimmunizationdistribution/Consent" />
  <name value="Consent" />
  <status value="draft" />
  <fhirVersion value="4.0.1" />
  <kind value="resource" />
  <abstract value="false" />
  <type value="Consent" />
  <baseDefinition value="http://hl7.org/fhir/StructureDefinition/Consent" />
  <derivation value="constraint" />
  <differential>
    <element id="Consent.id">
      <path value="Consent.id" />
      <comment value="See Mappings" />
      <min value="1" />
      <mapping>
        <identity value="source-PIR" />
        <map value="CONSENT.CONSENT_DIRECTIVE.CONSENT_DIRECTIVE_ID" />
      </mapping>
    </element>
    <element id="Consent.meta">
      <path value="Consent.meta" />
    </element>
    <element id="Consent.meta.versionId">
      <path value="Consent.meta.versionId" />
      <comment value="Apply &quot;2025.01.1&quot;.  This indicates the FHIR Specs as of year 2025 Jan." />
    </element>
    <element id="Consent.meta.lastUpdated">
      <path value="Consent.meta.lastUpdated" />
      <comment value="Updated: Relax the previously crossed-out elements." />
    </element>
    <element id="Consent.meta.profile">
      <path value="Consent.meta.profile" />
      <comment value="Apply &quot;http://ehealth.bc.ca/fhir/StructureDefinition/bc-bcyimmunizationdistribution/Consent&quot;" />
      <min value="1" />
      <max value="1" />
    </element>
    <element id="Consent.meta.security">
      <path value="Consent.meta.security" />
      <max value="1" />
    </element>
    <element id="Consent.meta.tag">
      <path value="Consent.meta.tag" />
      <max value="1" />
    </element>
    <element id="Consent.contained">
      <path value="Consent.contained" />
      <min value="1" />
      <type>
        <code value="Resource" />
        <profile value="RelatedPerson" />
        <profile value="PractitionerConsentGivenTo" />
      </type>
    </element>
    <element id="Consent.extension">
      <path value="Consent.extension" />
      <min value="2" />
    </element>
    <element id="Consent.extension:consentExtension">
      <path value="Consent.extension" />
      <sliceName value="consentExtension" />
      <type>
        <code value="Extension" />
        <profile value="http://ehealth.bc.ca/fhir/StructureDefinition/bc-bcyimmunizationdistribution/consent-type-form-doses-comments" />
      </type>
    </element>
    <element id="Consent.extension:consentExtension.extension:consentDirectiveComments">
      <path value="Consent.extension.extension" />
      <sliceName value="consentDirectiveComments" />
    </element>
    <element id="Consent.extension:consentExtension.extension:consentDirectiveComments.value[x].extension">
      <path value="Consent.extension.extension.value[x].extension" />
      <min value="2" />
    </element>
    <element id="Consent.extension:pIRIdentifierExtension">
      <path value="Consent.extension" />
      <sliceName value="pIRIdentifierExtension" />
      <type>
        <code value="Extension" />
        <profile value="https://ehealth.bc.ca/fhir/StructureDefinition/bcy-ids-pir-identifier" />
      </type>
      <isModifier value="false" />
    </element>
    <element id="Consent.extension:pIRLockSeqNumberExtension">
      <path value="Consent.extension" />
      <sliceName value="pIRLockSeqNumberExtension" />
      <type>
        <code value="Extension" />
        <profile value="https://ehealth.bc.ca/fhir/StructureDefinition/bcy-ids-pir-lock-sequence-number" />
      </type>
      <isModifier value="false" />
    </element>
    <element id="Consent.identifier">
      <path value="Consent.identifier" />
      <min value="1" />
      <max value="1" />
    </element>
    <element id="Consent.identifier.type">
      <path value="Consent.identifier.type" />
      <min value="1" />
    </element>
    <element id="Consent.identifier.type.coding">
      <path value="Consent.identifier.type.coding" />
      <max value="1" />
    </element>
    <element id="Consent.identifier.type.text">
      <path value="Consent.identifier.type.text" />
      <comment value="See Mappings" />
      <min value="1" />
      <mapping>
        <identity value="source-PIR" />
        <map value="&quot;PANORAMACONSENTID&quot;" />
      </mapping>
    </element>
    <element id="Consent.identifier.system">
      <path value="Consent.identifier.system" />
      <comment value="See Mappings" />
      <min value="1" />
      <mapping>
        <identity value="source-PIR" />
        <map value="https://health.gov.bc.ca/fhir/NamingSystem/ca-bc-panorama-consent-id" />
      </mapping>
    </element>
    <element id="Consent.identifier.value">
      <path value="Consent.identifier.value" />
      <comment value="See Mappings" />
      <min value="1" />
      <mapping>
        <identity value="source-PIR" />
        <map value="CONSENT.CONSENT_DIRECTIVE.CONSENT_DIRECTIVE_ID" />
      </mapping>
    </element>
    <element id="Consent.status">
      <path value="Consent.status" />
      <code>
        <system value="http://hl7.org/fhir/ValueSet/consent-state-codes" />
        <code value="active" />
      </code>
      <comment value="Confirmed (PIR) maps to Active (FHIR).  See Mappings." />
      <mapping>
        <identity value="source-PIR" />
        <map value="CONSENT.CONSENT_DIRECTIVE.DIRECTIVE_STATUS_CODE_CNCPT_ID" />
      </mapping>
    </element>
    <element id="Consent.scope.coding">
      <path value="Consent.scope.coding" />
      <min value="1" />
    </element>
    <element id="Consent.scope.coding.system">
      <path value="Consent.scope.coding.system" />
      <code>
        <system value="http://terminology.hl7.org/CodeSystem/consentscope" />
      </code>
      <comment value="See Code" />
      <min value="1" />
    </element>
    <element id="Consent.scope.coding.code">
      <path value="Consent.scope.coding.code" />
      <comment value="Apply &quot;treatment&quot;" />
      <min value="1" />
    </element>
    <element id="Consent.category.coding.system">
      <path value="Consent.category.coding.system" />
      <code>
        <system value="http://loinc.org" />
      </code>
      <comment value="See Code" />
      <min value="1" />
    </element>
    <element id="Consent.category.coding.code">
      <path value="Consent.category.coding.code" />
      <comment value="Apply &quot;59284-0&quot;" />
      <min value="1" />
    </element>
    <element id="Consent.patient.reference">
      <path value="Consent.patient.reference" />
      <comment value="See Mappings" />
      <min value="1" />
      <mapping>
        <identity value="source-PIR" />
        <map value="fullURL + &quot;Patient/&quot; + (Patient ID)" />
        <comment value="e.g. http://ehealth.bc.ca/panorama/fhir/Patient/59900999&quot;" />
      </mapping>
    </element>
    <element id="Consent.performer">
      <path value="Consent.performer" />
      <max value="1" />
    </element>
    <element id="Consent.performer.reference">
      <path value="Consent.performer.reference" />
      <comment value="See Mappings" />
      <min value="1" />
      <mapping>
        <identity value="source-PIR" />
        <map value="&quot;#RelatedPerson&quot;+(CONSENT.CONSENT_DIRECTIVE.CONSENT_DIRECTIVE_ID)&quot;" />
      </mapping>
    </element>
    <element id="Consent.organization">
      <path value="Consent.organization" />
      <max value="1" />
    </element>
    <element id="Consent.policy">
      <path value="Consent.policy" />
      <max value="1" />
    </element>
    <element id="Consent.policyRule">
      <path value="Consent.policyRule" />
      <min value="1" />
    </element>
    <element id="Consent.policyRule.coding">
      <path value="Consent.policyRule.coding" />
      <min value="1" />
    </element>
    <element id="Consent.policyRule.coding.system">
      <path value="Consent.policyRule.coding.system" />
      <code>
        <system value="http://terminology.hl7.org/CodeSystem/consentpolicycodes" />
      </code>
      <comment value="See Code" />
      <min value="1" />
    </element>
    <element id="Consent.policyRule.coding.code">
      <path value="Consent.policyRule.coding.code" />
      <comment value="Apply &quot;cric&quot; (Common Rule Informed Consent)." />
      <min value="1" />
    </element>
    <element id="Consent.verification">
      <path value="Consent.verification" />
      <max value="1" />
    </element>
    <element id="Consent.provision">
      <path value="Consent.provision" />
      <min value="1" />
    </element>
    <element id="Consent.provision.period">
      <path value="Consent.provision.period" />
      <min value="1" />
    </element>
    <element id="Consent.provision.period.start">
      <path value="Consent.provision.period.start" />
      <comment value="See Mappings." />
      <min value="1" />
      <mapping>
        <identity value="source-PIR" />
        <map value="CONSENT.CONSENT_DIRECTIVE.EFFECT_FROM_DATE" />
      </mapping>
    </element>
    <element id="Consent.provision.period.end">
      <path value="Consent.provision.period.end" />
      <comment value="See Mappings" />
      <mapping>
        <identity value="source-PIR" />
        <map value="CONSENT.CONSENT_DIRECTIVE.EFFECT_TO_DATE" />
      </mapping>
    </element>
    <element id="Consent.provision.actor.role.coding">
      <path value="Consent.provision.actor.role.coding" />
      <min value="1" />
    </element>
    <element id="Consent.provision.actor.role.coding.system">
      <path value="Consent.provision.actor.role.coding.system" />
      <code>
        <system value="http://terminology.hl7.org/CodeSystem/v3-RoleCode" />
      </code>
      <min value="1" />
    </element>
    <element id="Consent.provision.actor.role.coding.code">
      <path value="Consent.provision.actor.role.coding.code" />
      <comment value="Apply &quot;CONSENTER&quot;" />
      <min value="1" />
    </element>
    <element id="Consent.provision.actor.reference.reference">
      <path value="Consent.provision.actor.reference.reference" />
      <comment value="See Mappings" />
      <min value="1" />
      <mapping>
        <identity value="source-PIR" />
        <map value="&quot;#PractitionerConsentGivenTo&quot;+(CONSENT.CONSENT_DIRECTIVE.CONSENT_DIRECTIVE_ID)&quot;" />
      </mapping>
    </element>
    <element id="Consent.provision.action">
      <path value="Consent.provision.action" />
      <short value="Consent or Refusal" />
      <definition value="Consent or Refusal" />
      <min value="1" />
      <max value="1" />
    </element>
    <element id="Consent.provision.action.coding">
      <path value="Consent.provision.action.coding" />
      <slicing>
        <discriminator>
          <type value="pattern" />
          <path value="system" />
        </discriminator>
        <discriminator>
          <type value="pattern" />
          <path value="code" />
        </discriminator>
        <rules value="open" />
      </slicing>
      <min value="1" />
    </element>
    <element id="Consent.provision.action.coding:sliceConsentInstruction">
      <path value="Consent.provision.action.coding" />
      <sliceName value="sliceConsentInstruction" />
      <min value="1" />
      <max value="1" />
    </element>
    <element id="Consent.provision.action.coding:sliceConsentInstruction.system">
      <path value="Consent.provision.action.coding.system" />
      <code>
        <system value="http://hl7.org/fhir/sid/icd9" />
      </code>
      <comment value="See Code" />
      <min value="1" />
    </element>
    <element id="Consent.provision.action.coding:sliceConsentInstruction.code">
      <path value="Consent.provision.action.coding.code" />
      <comment value="G | R.&#xD;&#xA;Refer to IMMS codeset spreadsheet: Consent - Instruction.  See Mappings." />
      <min value="1" />
      <mapping>
        <identity value="source-PIR" />
        <map value="CONSENT.CONSENT_DIRECTIVE.CONSENT_VALUE_CODED_CNCPT_ID" />
      </mapping>
    </element>
    <element id="Consent.provision.action.coding:sliceConsentInstruction.display">
      <path value="Consent.provision.action.coding.display" />
      <comment value="Grant | Refuse" />
      <min value="1" />
    </element>
    <element id="Consent.provision.action.coding:sliceConsentRefusalReaason">
      <path value="Consent.provision.action.coding" />
      <sliceName value="sliceConsentRefusalReaason" />
      <max value="1" />
    </element>
    <element id="Consent.provision.action.coding:sliceConsentRefusalReaason.system">
      <path value="Consent.provision.action.coding.system" />
      <code>
        <system value="https://fhir.infoway-inforoute.ca/NamingSystem/ca-bc-panorama-consent-refusal-reason" />
      </code>
      <comment value="See Code" />
      <min value="1" />
    </element>
    <element id="Consent.provision.action.coding:sliceConsentRefusalReaason.code">
      <path value="Consent.provision.action.coding.code" />
      <comment value="Refer to IMMS codeset spreadsheet: Consent - Reason.  See Mappings" />
      <min value="1" />
      <mapping>
        <identity value="source-PIR" />
        <map value="CONSENT.CONSENT_DIRECTIVE.REFUSAL_REASON_CODE_CNCPT_ID" />
      </mapping>
    </element>
    <element id="Consent.provision.action.coding:sliceConsentRefusalReaason.display">
      <path value="Consent.provision.action.coding.display" />
      <comment value="Refer to IMMS codeset spreadsheet: Consent - Reason" />
      <min value="1" />
    </element>
    <element id="Consent.provision.action.text">
      <path value="Consent.provision.action.text" />
      <comment value="Mandatory if Reason for Refusal = &quot;O&quot;ther.  See Mappings." />
      <mapping>
        <identity value="source-PIR" />
        <map value="CONSENT.CONSENT_DIRECTIVE.REFUSAL_REASON_OTHER" />
      </mapping>
    </element>
    <element id="Consent.provision.securityLabel">
      <path value="Consent.provision.securityLabel" />
      <max value="1" />
    </element>
    <element id="Consent.provision.purpose">
      <path value="Consent.provision.purpose" />
      <max value="1" />
    </element>
    <element id="Consent.provision.class">
      <path value="Consent.provision.class" />
      <max value="1" />
    </element>
    <element id="Consent.provision.code">
      <path value="Consent.provision.code" />
      <min value="1" />
    </element>
    <element id="Consent.provision.code.coding">
      <path value="Consent.provision.code.coding" />
      <min value="1" />
    </element>
    <element id="Consent.provision.code.coding.system">
      <path value="Consent.provision.code.coding.system" />
      <comment value="See Mappings" />
      <min value="1" />
      <mapping>
        <identity value="code-NVC" />
        <map value="https://nvc-cnv.canada.ca" />
      </mapping>
      <mapping>
        <identity value="code-SNOMED" />
        <map value="http://snomed.info/sct" />
      </mapping>
      <mapping>
        <identity value="code-PIR" />
        <map value="https://fhir.infoway-inforoute.ca/NamingSystem/ca-bc-panorama-code" />
      </mapping>
    </element>
    <element id="Consent.provision.code.coding.code">
      <path value="Consent.provision.code.coding.code" />
      <comment value="Enter Vaccine code for both consent and Consent Refussal.  See Mappings." />
      <min value="1" />
      <mapping>
        <identity value="source-PIR" />
        <map value="CONSENT.CONSENT_DIRECTIVE.DIRECTIVE_ANTIGEN_ID" />
      </mapping>
    </element>
    <element id="Consent.provision.code.coding.display">
      <path value="Consent.provision.code.coding.display" />
      <comment value="Enter Vaccine Name for Consent or Consent Refussal" />
      <min value="1" />
    </element>
    <element id="Consent.provision.data">
      <path value="Consent.provision.data" />
      <max value="1" />
    </element>
    <element id="Consent.provision.provision">
      <path value="Consent.provision.provision" />
      <max value="1" />
    </element>
  </differential>
</StructureDefinition>