<StructureDefinition xmlns="http://hl7.org/fhir">
  <id value="ee2a543e-a134-4c01-8821-e4469a25e981" />
  <meta>
    <lastUpdated value="2019-12-10T14:38:31.282+00:00" />
  </meta>
  <url value="http://electronichealth.se/fhir-testing/StructureDefinition/NLLProvenance" />
  <name value="NLLProvenance" />
  <status value="draft" />
  <date value="2019-12-10T14:38:31.1800218+00:00" />
  <fhirVersion value="4.0.0" />
  <mapping>
    <identity value="EHM" />
    <name value="E-hälsomyndigheten internal model" />
  </mapping>
  <kind value="resource" />
  <abstract value="false" />
  <type value="Provenance" />
  <baseDefinition value="http://hl7.org/fhir/StructureDefinition/Provenance" />
  <derivation value="constraint" />
  <differential>
    <element id="Provenance">
      <path value="Provenance" />
      <short value="Who, What, When describing a change on the patient medications list" />
      <definition value="NLLProvenance describes a change made on a resource affecting a patient medications list, e.g. a MedicationRequest, MedicationDispense or resource related to multi dose dispensing (sv: dosunderlag, dossamtycke). The change is describes What - in the form of which resource is the target in combination with a reason and activity. It describes by Who - in the form of agent and it describes When it occurred." />
      <mapping>
        <identity value="EHM" />
        <map value="Händelse avseende patients läkemedelslista" />
      </mapping>
    </element>
    <element id="Provenance.target">
      <path value="Provenance.target" />
      <type>
        <code value="Reference" />
        <targetProfile value="http://electronichealth.se/fhir/StructureDefinition/NLLMedicationRequest" />
        <targetProfile value="http://electronichealth.se/fhir/StructureDefinition/NLLMultiDoseDispMedList" />
        <targetProfile value="http://electronichealth.se/fhir/StructureDefinition/NLLMedicationDispense" />
        <targetProfile value="http://electronichealth.se/fhir/StructureDefinition/NLLMultiDoseDispConsent" />
        <aggregation value="referenced" />
      </type>
      <mustSupport value="true" />
    </element>
    <element id="Provenance.occurred[x]">
      <path value="Provenance.occurred[x]" />
      <type>
        <code value="dateTime" />
      </type>
      <mustSupport value="true" />
      <mapping>
        <identity value="EHM" />
        <map value="Händelse.Tidpunkt" />
      </mapping>
    </element>
    <element id="Provenance.reason">
      <path value="Provenance.reason" />
      <slicing>
        <discriminator>
          <type value="value" />
          <path value="coding.system" />
        </discriminator>
        <rules value="open" />
      </slicing>
      <min value="1" />
    </element>
    <element id="Provenance.reason:reasonForRevision">
      <path value="Provenance.reason" />
      <sliceName value="reasonForRevision" />
      <definition value="The reason that the activity was taking place, in NLL used to describe the reqason for change e.g. wrong patient (sv: FEL_PATIENT), medication interaction (sv: INTERAKTION), side effects noticed." />
      <min value="1" />
      <max value="1" />
      <binding>
        <strength value="required" />
        <valueSet value="http://electronichealth.se/fhir/ValueSet/ml-reason-for-revision" />
      </binding>
      <mapping>
        <identity value="EHM" />
        <map value="Händelseorsak" />
      </mapping>
    </element>
    <element id="Provenance.reason:reasonForRevision.coding">
      <path value="Provenance.reason.coding" />
      <min value="1" />
      <max value="1" />
      <binding>
        <strength value="required" />
        <valueSet value="http://electronichealth.se/fhir/ValueSet/ml-reason-for-revision" />
      </binding>
    </element>
    <element id="Provenance.reason:reasonForRevision.coding.system">
      <path value="Provenance.reason.coding.system" />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="Provenance.reason:reasonForRevision.coding.code">
      <path value="Provenance.reason.coding.code" />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="Provenance.activity">
      <path value="Provenance.activity" />
      <definition value="This type describes the activity that occurred, e.g. change on a MedicationRequest (sv: UPPDATERA_FORSKRVNING), cancelling a MedicationRequest (sv: MAKULERA_FORSKRIVNING)" />
      <mustSupport value="true" />
      <binding>
        <strength value="required" />
        <valueSet value="http://electronichealth.se/fhir/ValueSet/ml-activity-types" />
      </binding>
      <mapping>
        <identity value="EHM" />
        <map value="Händelsetyp" />
      </mapping>
    </element>
    <element id="Provenance.agent">
      <path value="Provenance.agent" />
      <definition value="Allowed actors in NLL are: performer (sv: utförare) and author (sv: uppdragsgivare). Author MUST always be present, performer CAN be present in case a practitioner is performing a change on behalf of someone" />
      <mapping>
        <identity value="EHM" />
        <map value="Uppdragsgivare / Utförare" />
      </mapping>
    </element>
    <element id="Provenance.agent.type">
      <path value="Provenance.agent.type" />
      <mustSupport value="true" />
    </element>
    <element id="Provenance.agent.who">
      <path value="Provenance.agent.who" />
      <type>
        <code value="Reference" />
        <targetProfile value="http://electronichealth.se/fhir/StructureDefinition/NLLPractitioner" />
        <aggregation value="contained" />
        <aggregation value="referenced" />
      </type>
      <mustSupport value="true" />
      <mapping>
        <identity value="EHM" />
        <map value="Utförare / Uppdragsgivare" />
        <comment value="Depending on type, could be the performer (sv: utförare) or author (sv: uppdragsgivare)" />
      </mapping>
    </element>
  </differential>
</StructureDefinition>