<StructureDefinition xmlns="http://hl7.org/fhir">
  <url value="http://electronichealth.se/fhir/StructureDefinition/NLLDetectedIssue" />
  <version value="1.0.0" />
  <name value="NLLDetectedIssue" />
  <status value="active" />
  <date value="2022-02-02" />
  <publisher value="Swedish eHealth Agency" />
  <fhirVersion value="4.0.1" />
  <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>
  <mapping>
    <identity value="EHM" />
    <name value="E-hälsomyndigheten concept" />
  </mapping>
  <kind value="resource" />
  <abstract value="false" />
  <type value="DetectedIssue" />
  <baseDefinition value="http://hl7.org/fhir/StructureDefinition/DetectedIssue" />
  <derivation value="constraint" />
  <differential>
    <element id="DetectedIssue">
      <path value="DetectedIssue" />
      <short value="Issue according to Automatic Format and Constitution Control (AFF)" />
      <definition value="Indicates a issue with a MedcationRequest or a MedicationDispense according to the Automatic Format and Constitution Control (AFF) ." />
    </element>
    <element id="DetectedIssue.extension">
      <path value="DetectedIssue.extension" />
      <slicing>
        <discriminator>
          <type value="value" />
          <path value="url" />
        </discriminator>
        <rules value="open" />
      </slicing>
      <min value="0" />
    </element>
    <element id="DetectedIssue.extension:nllDispatchRowNo">
      <path value="DetectedIssue.extension" />
      <sliceName value="nllDispatchRowNo" />
      <short value="Identifier for MedicationDispense within dispatch" />
      <definition value="Used when communicationg an error or warning for a MedicationDispense within a dispatch. The DispatchRowNo (sv Aktörens expeditionsradnummer) uniquely identifies a MediationDispense within a dispatch." />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="Extension" />
        <profile value="http://electronichealth.se/fhir/StructureDefinition/NLLDispatchRowNo" />
      </type>
      <mustSupport value="true" />
      <mapping>
        <identity value="EHM" />
        <map value="Aktörens expeditionsradnummer" />
      </mapping>
    </element>
    <element id="DetectedIssue.status">
      <path value="DetectedIssue.status" />
      <short value="preliminary" />
      <definition value="Indicates the status of the detected issue.&#xD;&#xA;The status &quot;preliminary&quot; is used for in the Swedish National Medication List as the detected issues always are generated from the current conditions." />
      <mustSupport value="true" />
      <binding>
        <strength value="required" />
        <valueSet value="http://electronichealth.se/fhir/ValueSet/detected-issue-status" />
      </binding>
      <mapping>
        <identity value="EHM" />
        <map value="Status på avvikelse" />
      </mapping>
    </element>
    <element id="DetectedIssue.code">
      <path value="DetectedIssue.code" />
      <short value="AFF error or warning" />
      <definition value="Code identifying the Automatic Format and Constitution Control (AFF) error or warning." />
      <min value="1" />
      <mustSupport value="true" />
      <binding>
        <strength value="required" />
        <description value="Codes identifying the Automatic Format and Constitution Control (AFF) error or warning" />
        <valueSet value="http://ehalsomyndigheten.se/fhir/ValueSet/aff-codes" />
      </binding>
      <mapping>
        <identity value="EHM" />
        <map value="AFF-resultat" />
      </mapping>
    </element>
    <element id="DetectedIssue.code.coding">
      <path value="DetectedIssue.code.coding" />
      <min value="1" />
      <max value="1" />
      <mustSupport value="true" />
    </element>
    <element id="DetectedIssue.code.coding.system">
      <path value="DetectedIssue.code.coding.system" />
      <mustSupport value="true" />
    </element>
    <element id="DetectedIssue.code.coding.version">
      <path value="DetectedIssue.code.coding.version" />
      <mustSupport value="true" />
    </element>
    <element id="DetectedIssue.code.coding.code">
      <path value="DetectedIssue.code.coding.code" />
      <short value="Issue code" />
      <definition value="A code identifying the reason of the issue" />
      <min value="1" />
      <mustSupport value="true" />
      <mapping>
        <identity value="EHM" />
        <map value="AFF-felkod" />
      </mapping>
    </element>
    <element id="DetectedIssue.code.coding.display">
      <path value="DetectedIssue.code.coding.display" />
      <short value="Error description" />
      <definition value="A short text describing the meaning of the error code" />
      <mustSupport value="true" />
      <mapping>
        <identity value="EHM" />
        <map value="AFF-felmeddelande" />
      </mapping>
    </element>
    <element id="DetectedIssue.severity">
      <path value="DetectedIssue.severity" />
      <short value="moderate | low" />
      <definition value="In the Swedish National Medication List there are two severety levels: &#xD;&#xA;&quot;Low&quot; which corresponds to &quot;Accepted with a warning&quot; (Accepterad med varning)&#xD;&#xA;or&#xD;&#xA;&quot;Moderate&quot; which corresponds to &quot;Rejected&quot; (Avvisad)" />
      <mustSupport value="true" />
      <binding>
        <strength value="required" />
        <valueSet value="http://electronichealth.se/fhir/ValueSet/detected-issue-severity" />
      </binding>
      <mapping>
        <identity value="EHM" />
        <map value="Allvarlighetsgrad" />
      </mapping>
    </element>
    <element id="DetectedIssue.identified[x]">
      <path value="DetectedIssue.identified[x]" />
      <short value="Date and time when identified" />
      <definition value="The date and time when the Automatic Format and Constitution Control (Automatisk format- och författningskontroll, AFF) was made." />
      <type>
        <code value="dateTime" />
      </type>
      <mustSupport value="true" />
      <mapping>
        <identity value="EHM" />
        <map value="Kontrolltidpunkt" />
      </mapping>
    </element>
  </differential>
</StructureDefinition>