<StructureDefinition xmlns="http://hl7.org/fhir">
  <url value="http://electronichealth.se/fhir/StructureDefinition/NLLAccessConsent" />
  <version value="1.2.0" />
  <name value="NLLAccessConsent" />
  <status value="active" />
  <experimental value="false" />
  <date value="2024-08-28" />
  <publisher value="Swedish eHealth Agency" />
  <fhirVersion value="4.0.1" />
  <mapping>
    <identity value="EHM" />
    <name value="E-hälsomyndigheten concept" />
  </mapping>
  <mapping>
    <identity value="workflow" />
    <uri value="http://hl7.org/fhir/workflow" />
    <name value="Workflow Pattern" />
  </mapping>
  <mapping>
    <identity value="v2" />
    <uri value="http://hl7.org/v2" />
    <name value="HL7 v2 Mapping" />
  </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="Consent" />
  <baseDefinition value="http://hl7.org/fhir/StructureDefinition/Consent" />
  <derivation value="constraint" />
  <differential>
    <element id="Consent">
      <path value="Consent" />
      <comment value="This profile is intended for Consents of the type access to information within the Swedish National Medication List (sv. åtkomstsamtycke)." />
      <mapping>
        <identity value="EHM" />
        <map value="Registrerat samtycke" />
      </mapping>
    </element>
    <element id="Consent.id">
      <path value="Consent.id" />
      <definition value="UUID identifying the consent" />
      <comment value="The only time that a resource does not have an id is when it is being submitted to the server using a create operation.&#xD;&#xA;This id is identified by the URI http://electronichealth.se/identifier/nllconsentid in documentation and external systems." />
      <mustSupport value="true" />
      <mapping>
        <identity value="EHM" />
        <map value="Samtyckes-id" />
      </mapping>
    </element>
    <element id="Consent.meta">
      <path value="Consent.meta" />
      <mustSupport value="true" />
    </element>
    <element id="Consent.meta.lastUpdated">
      <path value="Consent.meta.lastUpdated" />
      <mustSupport value="true" />
    </element>
    <element id="Consent.meta.security">
      <path value="Consent.meta.security" />
      <mustSupport value="true" />
      <binding>
        <strength value="extensible" />
        <valueSet value="http://ehalsomyndigheten.se/fhir/ValueSet/security-labels" />
      </binding>
    </element>
    <element id="Consent.meta.security.system">
      <path value="Consent.meta.security.system" />
      <mustSupport value="true" />
    </element>
    <element id="Consent.meta.security.version">
      <path value="Consent.meta.security.version" />
      <mustSupport value="true" />
    </element>
    <element id="Consent.meta.security.code">
      <path value="Consent.meta.security.code" />
      <mustSupport value="true" />
    </element>
    <element id="Consent.extension:nllInqueryPeriod">
      <path value="Consent.extension" />
      <sliceName value="nllInqueryPeriod" />
      <short value="Inquery period" />
      <definition value="An access consent with status proposed must have an inquery period. The period starts when the consent was requested and ends when the consent is terminated unless it is approved by the patient." />
      <max value="1" />
      <type>
        <code value="Extension" />
        <profile value="http://electronichealth.se/fhir/StructureDefinition/NLLPeriod" />
      </type>
      <mustSupport value="true" />
    </element>
    <element id="Consent.extension:nllInqueryPeriod.value[x]">
      <path value="Consent.extension.value[x]" />
    </element>
    <element id="Consent.extension:nllInqueryPeriod.value[x].start">
      <path value="Consent.extension.value[x].start" />
      <short value="Inquery start time" />
      <definition value="Start date and time of the proposal period.&#xD;&#xA;Calculated by the Swedish eHealth Agency. Not used for input." />
      <min value="1" />
      <mustSupport value="true" />
      <mapping>
        <identity value="EHM" />
        <map value="Förfrågan giltigt från och med" />
      </mapping>
    </element>
    <element id="Consent.extension:nllInqueryPeriod.value[x].end">
      <path value="Consent.extension.value[x].end" />
      <short value="Inquery end time" />
      <definition value="End date and time of the proposal period. The consent is terminated automatically unless it is approved before the inquery end time.&#xD;&#xA;Calculated by the Swedish eHealth Agency. Not used for input." />
      <min value="1" />
      <mustSupport value="true" />
      <mapping>
        <identity value="EHM" />
        <map value="Förfrågan giltigt till och med" />
      </mapping>
    </element>
    <element id="Consent.status">
      <path value="Consent.status" />
      <short value="proposed | active | inactive" />
      <definition value="Indicates the state of this consent." />
      <mustSupport value="true" />
      <binding>
        <strength value="required" />
        <valueSet value="http://ehalsomyndigheten.se/fhir/ValueSet/access-consent-status" />
      </binding>
      <mapping>
        <identity value="EHM" />
        <map value="Samtyckesstatus" />
      </mapping>
    </element>
    <element id="Consent.scope">
      <path value="Consent.scope" />
      <definition value="An access consent gives healthcare personnel a possibility to retrieve the specified patient's prescriptions and dispenses depending.&#xD;&#xA;Calculated by the Swedish eHealth Agency." />
      <mustSupport value="true" />
    </element>
    <element id="Consent.scope.coding">
      <path value="Consent.scope.coding" />
      <mustSupport value="true" />
    </element>
    <element id="Consent.scope.coding.system">
      <path value="Consent.scope.coding.system" />
      <fixedUri value="http://terminology.hl7.org/CodeSystem/consentscope" />
      <mustSupport value="true" />
    </element>
    <element id="Consent.scope.coding.version">
      <path value="Consent.scope.coding.version" />
      <mustSupport value="true" />
    </element>
    <element id="Consent.scope.coding.code">
      <path value="Consent.scope.coding.code" />
      <fixedCode value="patient-privacy" />
      <mustSupport value="true" />
      <mapping>
        <identity value="EHM" />
        <map value="Tillämpningsområde" />
      </mapping>
    </element>
    <element id="Consent.category">
      <path value="Consent.category" />
      <definition value="The category code INFA is used within the Swedish National Medication List for access consents (sv. åtkomstsamtycke)." />
      <mustSupport value="true" />
      <binding>
        <strength value="extensible" />
        <valueSet value="http://ehalsomyndigheten.se/fhir/ValueSet/consent-category-codes" />
      </binding>
    </element>
    <element id="Consent.category.coding">
      <path value="Consent.category.coding" />
      <mustSupport value="true" />
    </element>
    <element id="Consent.category.coding.system">
      <path value="Consent.category.coding.system" />
      <fixedUri value="http://terminology.hl7.org/CodeSystem/v3-ActCode" />
      <mustSupport value="true" />
    </element>
    <element id="Consent.category.coding.version">
      <path value="Consent.category.coding.version" />
      <mustSupport value="true" />
    </element>
    <element id="Consent.category.coding.code">
      <path value="Consent.category.coding.code" />
      <definition value="The category code INFA is used within the Swedish National Medication List for access consents (sv. åtkomstsamtycke)." />
      <fixedCode value="INFA" />
      <mustSupport value="true" />
      <mapping>
        <identity value="EHM" />
        <map value="Samtyckestyp" />
      </mapping>
    </element>
    <element id="Consent.patient">
      <path value="Consent.patient" />
      <definition value="The patient to whom this consent applies." />
      <mustSupport value="true" />
      <mapping>
        <identity value="EHM" />
        <map value="Patientreferens" />
      </mapping>
    </element>
    <element id="Consent.patient.reference">
      <path value="Consent.patient.reference" />
      <definition value="A reference to a patient in the form Patient/&lt;uuid&gt;" />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="Consent.policy">
      <path value="Consent.policy" />
      <definition value="The references to the policies that are included in this consent scope. Policies may be organizational, but are often defined jurisdictionally, or in law.&#xD;&#xA;Calculated by the Swedish eHealth Agency. Not used for input." />
      <mustSupport value="true" />
    </element>
    <element id="Consent.policy.uri">
      <path value="Consent.policy.uri" />
      <fixedUri value="https://ehalsomyndigheten.se/nationellalakemedelslistan/policy" />
      <mustSupport value="true" />
    </element>
    <element id="Consent.provision">
      <path value="Consent.provision" />
      <mustSupport value="true" />
    </element>
    <element id="Consent.provision.period">
      <path value="Consent.provision.period" />
      <comment value="A Period specifies a range of time; the context of use will specify whether the entire range applies.&#xA;&#xA;Period is not used for a duration (a measure of elapsed time). See [Duration](datatypes.html#Duration)." />
      <mustSupport value="true" />
    </element>
    <element id="Consent.provision.period.start">
      <path value="Consent.provision.period.start" />
      <short value="Start time of the consent." />
      <definition value="The start of the period. The boundary is inclusive. The practitioner has access to the patient's information from this time.&#xD;&#xA;Calculated by the Swedish eHealth Agency. Not used for input." />
      <min value="1" />
      <mustSupport value="true" />
      <mapping>
        <identity value="EHM" />
        <map value="Giltigt från och med" />
      </mapping>
    </element>
    <element id="Consent.provision.period.end">
      <path value="Consent.provision.period.end" />
      <short value="End time of the consent." />
      <definition value="The end of the period. If the end of the period is missing, it means no end was known or planned at the time the instance was created. The practitioner has access to the patient's information until this time.&#xD;&#xA;Calculated by the Swedish eHealth Agency. Not used for input." />
      <min value="1" />
      <mustSupport value="true" />
      <mapping>
        <identity value="EHM" />
        <map value="Giltigt till och med" />
      </mapping>
    </element>
    <element id="Consent.provision.actor">
      <path value="Consent.provision.actor" />
      <mustSupport value="true" />
    </element>
    <element id="Consent.provision.actor.role">
      <path value="Consent.provision.actor.role" />
      <mustSupport value="true" />
    </element>
    <element id="Consent.provision.actor.role.coding">
      <path value="Consent.provision.actor.role.coding" />
      <mustSupport value="true" />
    </element>
    <element id="Consent.provision.actor.role.coding.system">
      <path value="Consent.provision.actor.role.coding.system" />
      <fixedUri value="http://terminology.hl7.org/CodeSystem/v3-RoleCode" />
      <mustSupport value="true" />
    </element>
    <element id="Consent.provision.actor.role.coding.version">
      <path value="Consent.provision.actor.role.coding.version" />
      <mustSupport value="true" />
    </element>
    <element id="Consent.provision.actor.role.coding.code">
      <path value="Consent.provision.actor.role.coding.code" />
      <fixedCode value="GRANTEE" />
      <mustSupport value="true" />
    </element>
    <element id="Consent.provision.actor.reference">
      <path value="Consent.provision.actor.reference" />
      <definition value="A reference to the practitioner the consent is intended for, i.e. the person who will have access to the patient's information." />
      <type>
        <code value="Reference" />
        <targetProfile value="http://hl7.org/fhir/StructureDefinition/Practitioner" />
      </type>
      <mustSupport value="true" />
      <mapping>
        <identity value="EHM" />
        <map value="Samtyckestagare" />
      </mapping>
    </element>
    <element id="Consent.provision.actor.reference.reference">
      <path value="Consent.provision.actor.reference.reference" />
      <mustSupport value="true" />
    </element>
    <element id="Consent.provision.actor.reference.type">
      <path value="Consent.provision.actor.reference.type" />
      <mustSupport value="true" />
    </element>
    <element id="Consent.provision.securityLabel">
      <path value="Consent.provision.securityLabel" />
      <definition value="A security label, comprised of 0..* security label fields (Privacy tags), which define which resources are controlled by this exception.&#xD;&#xA;Calculated by the Swedish eHealth Agency. Not used for input." />
      <mustSupport value="true" />
    </element>
    <element id="Consent.provision.securityLabel.system">
      <path value="Consent.provision.securityLabel.system" />
      <fixedUri value="http://terminology.hl7.org/CodeSystem/v3-ActCode" />
      <mustSupport value="true" />
    </element>
    <element id="Consent.provision.securityLabel.version">
      <path value="Consent.provision.securityLabel.version" />
      <mustSupport value="true" />
    </element>
    <element id="Consent.provision.securityLabel.code">
      <path value="Consent.provision.securityLabel.code" />
      <short value="Classification of information" />
      <definition value="The precise meaning of IDSCL in the context of Swedish National Medication List is that the patient gives the actor (e.g. a practitioner) access to his/her information in the Swedish National Medication List excluding information having a data lock (represented by a Basic based on the profile NLLDataLock). It is currently not possible to create a consent of locked information." />
      <fixedCode value="IDSCL" />
      <mustSupport value="true" />
      <mapping>
        <identity value="EHM" />
        <map value="Informationsklass" />
      </mapping>
    </element>
  </differential>
</StructureDefinition>