<StructureDefinition xmlns="http://hl7.org/fhir">
  <url value="http://electronichealth.se/fhir/StructureDefinition/NLLProvenanceMedicationRequestCancelled" />
  <version value="1.1.0" />
  <name value="NLLProvenanceMedicationRequestCancelled" />
  <status value="active" />
  <date value="2025-04-24" />
  <publisher value="Swedish eHealth Agency" />
  <description value="A derived profile of NLLProvenance. &#xD;&#xA;Used when creating a new Provenance when a prescription is cancelled (sv makulera)." />
  <fhirVersion value="4.0.1" />
  <mapping>
    <identity value="EHM" />
    <name value="E-hälsomyndigheten internal model" />
  </mapping>
  <kind value="resource" />
  <abstract value="false" />
  <type value="Provenance" />
  <baseDefinition value="http://electronichealth.se/fhir/StructureDefinition/NLLProvenance" />
  <derivation value="constraint" />
  <differential>
    <element id="Provenance.target">
      <path value="Provenance.target" />
      <short value="Target MedicationRequest" />
      <definition value="The MedicationRequest that was generated or updated by the activity described in this Provenance." />
      <type>
        <code value="Reference" />
        <targetProfile value="http://electronichealth.se/fhir/StructureDefinition/NLLMedicationRequest" />
      </type>
    </element>
    <element id="Provenance.reason">
      <path value="Provenance.reason" />
      <short value="The reason why the prescription was cancelled" />
      <definition value="The reason why the prescription was cancelled (sv Makulera). Only codes from the value set nll-reason-for-cancellation are allowed." />
      <min value="1" />
      <binding>
        <strength value="required" />
        <valueSet value="http://electronichealth.se/fhir/ValueSet/nll-reason-for-cancellation" />
      </binding>
    </element>
    <element id="Provenance.reason.coding">
      <path value="Provenance.reason.coding" />
      <min value="1" />
    </element>
    <element id="Provenance.reason.text">
      <path value="Provenance.reason.text" />
      <definition value="Plain text representation of the reason that the activity was taking place. &#xD;&#xA;Mandatory when the code &quot;OTH&quot; (other) is used.&#xD;&#xA;Can be used for adding optional information about the reason." />
    </element>
    <element id="Provenance.activity">
      <path value="Provenance.activity" />
      <short value="Activity that occurred on the MedicationRequest" />
      <definition value="Describes the activity that occurred on a MedicationRequest. This profile supports the scenario for cancelleing (sv makulera) a prescription, MAKULERA_FORSKRIVNING" />
      <binding>
        <strength value="required" />
        <valueSet value="http://ehalsomyndigheten.se/fhir/ValueSet/medication-request-activity-types" />
      </binding>
    </element>
    <element id="Provenance.agent">
      <path value="Provenance.agent" />
      <short value="Practitioner involved for the MedicationRequest" />
    </element>
    <element id="Provenance.agent.who">
      <path value="Provenance.agent.who" />
      <definition value="The practitioners that participated in the event as contained resources." />
      <type>
        <code value="Reference" />
        <targetProfile value="http://electronichealth.se/fhir/StructureDefinition/NLLPractitioner" />
        <aggregation value="contained" />
      </type>
    </element>
  </differential>
</StructureDefinition>