<StructureDefinition xmlns="http://hl7.org/fhir">
  <id value="cio-SurveillanceDecision" />
  <url value="http://nictiz.nl/fhir/StructureDefinition/cio-SurveillanceDecision" />
  <version value="1.0.0-beta.5" />
  <name value="CioSurveillanceDecision" />
  <title value="cio SurveillanceDecision" />
  <status value="draft" />
  <publisher value="Nictiz" />
  <contact>
    <name value="Nictiz" />
    <telecom>
      <system value="url" />
      <value value="https://www.nictiz.nl" />
      <use value="work" />
    </telecom>
  </contact>
  <description value="The decision to initiate or terminate surveillance for a substance or group of substances that may cause an adverse reaction in the patient." />
  <purpose value="This Flag resource represents the SurveillanceDecision building block for implementations following the information standard [CiO](https://informatiestandaarden.nictiz.nl/wiki/Landingspagina_Contra-indicaties_en_Overgevoeligheden). This profile is based on the Dutch zib ('Zorginformatiebouwsteen', i.e. Health and Care Information Model) SurveillanceDecision that is part of the 2024 prepublication. Therefore it has no dependency on a corresponding nl-core profile and mappings to zib concepts are not defined. Instead mappings to the CiO data set have been added. It is the intention to derive this profile from a more general nl-core-SurveillanceDecision profile in the future." />
  <copyright value="Copyright and related rights waived via CC0, https://creativecommons.org/publicdomain/zero/1.0/. This does not apply to information from third parties, for example a medical terminology system. The implementer alone is responsible for identifying and obtaining any necessary licenses or authorizations to utilize third party IP in connection with the specification or otherwise." />
  <fhirVersion value="4.0.1" />
  <mapping>
    <identity value="cio-dataset-200-beta2-20231214" />
    <uri value="https://decor.nictiz.nl/pub/cio/cio-html-20231214T100742/ds-2.16.840.1.113883.2.4.3.11.60.26.1.2-2020-04-02T000000.html" />
    <name value="ART-DECOR Dataset Contraindications and hypersensitivities 2.0.0-beta.2 20231214" />
  </mapping>
  <mapping>
    <identity value="cio-dataset-200-beta3-20241023" />
    <uri value="https://decor.nictiz.nl/pub/cio/cio-html-20241023T071643/ds-2.16.840.1.113883.2.4.3.11.60.26.1.2-2020-04-02T000000.html" />
    <name value="ART-DECOR Dataset Contraindications and hypersensitivities 2.0.0-beta.3 20241023" />
  </mapping>
  <kind value="resource" />
  <abstract value="false" />
  <type value="Flag" />
  <baseDefinition value="http://hl7.org/fhir/StructureDefinition/Flag" />
  <derivation value="constraint" />
  <differential>
    <element id="Flag">
      <path value="Flag" />
      <short value="SurveillanceDecision" />
      <comment value="In order to convey the registration information of a SurveillanceDecision building block, this profile is used together with an instance conforming to the [cio-RegistrationInformation](http://nictiz.nl/fhir/StructureDefinition/cio-RegistrationInformation) profile wherein `Provenance.target` refers to the Flag resource.&#xD;&#xA;&#xD;&#xA;Note that not all concepts within the SurveillanceDecision building block are mapped to elements within this profile (e.g. DecisionMaker (cio-dataelement-20-763)). To convey the complete SurveillanceDecision building block, a Flag resource conforming to this profile SHOULD always be used together with an instance conforming to the cio-RegistrationInformation profile." />
      <alias value="BewakingBesluit" />
      <constraint>
        <key value="cio-SurveillanceDecision-1" />
        <severity value="error" />
        <human value="If Flag.status is 'inactive', Flag.period.end SHALL exist." />
        <expression value="(status = 'inactive') implies period.end.exists()" />
      </constraint>
      <constraint>
        <key value="cio-SurveillanceDecision-2" />
        <severity value="error" />
        <human value="If the surveillance is stopped (i.e. Flag.status is 'inactive'), a reference to the previous surveillance decision that was active SHALL be present in Flag.extension:relationSurveillanceDecision." />
        <expression value="(status = 'inactive') implies extension('http://nictiz.nl/fhir/StructureDefinition/ext-SurveillanceDecision.RelationSurveillanceDecision').exists()" />
      </constraint>
      <constraint>
        <key value="cio-SurveillanceDecision-3" />
        <severity value="error" />
        <human value="A decision basis SHALL be given, either as a reference to a hypersensitivity/intolerance or reaction in Flag.extension:decisionBasisReference, or as text in Flag.extension:decisionBasisReason." />
        <expression value="extension('http://hl7.org/fhir/StructureDefinition/flag-detail').exists() or extension('http://nictiz.nl/fhir/StructureDefinition/ext-SurveillanceDecision.SurveillanceDecision').exists()" />
      </constraint>
      <mapping>
        <identity value="cio-dataset-200-beta2-20231214" />
        <map value="cio-dataelement-20-754" />
        <comment value="SurveillanceDecision" />
      </mapping>
      <mapping>
        <identity value="cio-dataset-200-beta3-20241023" />
        <map value="cio-dataelement-20-754" />
        <comment value="SurveillanceDecision" />
      </mapping>
    </element>
    <element id="Flag.extension">
      <path value="Flag.extension" />
      <min value="1" />
    </element>
    <element id="Flag.extension:decisionBasisReference">
      <path value="Flag.extension" />
      <sliceName value="decisionBasisReference" />
      <max value="1" />
      <type>
        <code value="Extension" />
        <profile value="http://hl7.org/fhir/StructureDefinition/flag-detail" />
      </type>
      <condition value="cio-SurveillanceDecision-3" />
    </element>
    <element id="Flag.extension:decisionBasisReference.value[x]">
      <path value="Flag.extension.value[x]" />
      <short value="HypersensitivityIntolerance / Reaction" />
      <definition value="The hypersensitivity/intolerance or reaction in the patient as reason for the surveillance decision." />
      <comment value="Whenever the surveillance decision has been taken on another basis than a hypersensitivity/intolerance or reaction, that basis SHALL be communicated via `.extension:decisionBasisReason`." />
      <alias value="Overgevoeligheid" />
      <alias value="Reactie" />
      <type>
        <code value="Reference" />
        <targetProfile value="http://nictiz.nl/fhir/StructureDefinition/cio-HypersensitivityIntolerance" />
        <targetProfile value="http://nictiz.nl/fhir/StructureDefinition/cio-Reaction" />
      </type>
      <condition value="cio-SurveillanceDecision-3" />
      <mapping>
        <identity value="cio-dataset-200-beta2-20231214" />
        <map value="cio-dataelement-20-765" />
        <comment value="Hypersensitivity [DEPRECATED]" />
      </mapping>
      <mapping>
        <identity value="cio-dataset-200-beta3-20241023" />
        <map value="cio-dataelement-20-765" />
        <comment value="HypersensitivityIntolerance" />
      </mapping>
      <mapping>
        <identity value="cio-dataset-200-beta2-20231214" />
        <map value="cio-dataelement-20-766" />
        <comment value="Reaction" />
      </mapping>
      <mapping>
        <identity value="cio-dataset-200-beta3-20241023" />
        <map value="cio-dataelement-20-766" />
        <comment value="Reaction" />
      </mapping>
    </element>
    <element id="Flag.extension:decisionBasisReason">
      <path value="Flag.extension" />
      <sliceName value="decisionBasisReason" />
      <type>
        <code value="Extension" />
        <profile value="http://nictiz.nl/fhir/StructureDefinition/ext-SurveillanceDecision.SurveillanceDecision" />
      </type>
      <condition value="cio-SurveillanceDecision-3" />
    </element>
    <element id="Flag.extension:decisionBasisReason.value[x]">
      <path value="Flag.extension.value[x]" />
      <comment value="Whenever the surveillance decision has been taken on another basis than a hypersensitivity/intolerance or reaction, that basis SHALL be communicated via this element." />
      <condition value="cio-SurveillanceDecision-3" />
      <mapping>
        <identity value="cio-dataset-200-beta3-20241023" />
        <map value="cio-dataelement-20-916" />
        <comment value="SurveillanceDecision" />
      </mapping>
    </element>
    <element id="Flag.extension:relationSurveillanceDecision">
      <path value="Flag.extension" />
      <sliceName value="relationSurveillanceDecision" />
      <type>
        <code value="Extension" />
        <profile value="http://nictiz.nl/fhir/StructureDefinition/ext-SurveillanceDecision.RelationSurveillanceDecision" />
      </type>
      <condition value="cio-SurveillanceDecision-2" />
    </element>
    <element id="Flag.extension:relationSurveillanceDecision.value[x]">
      <path value="Flag.extension.value[x]" />
      <condition value="cio-SurveillanceDecision-2" />
      <mapping>
        <identity value="cio-dataset-200-beta2-20231214" />
        <map value="cio-dataelement-20-828" />
        <comment value="RelationSurveillanceDecision" />
      </mapping>
      <mapping>
        <identity value="cio-dataset-200-beta3-20241023" />
        <map value="cio-dataelement-20-828" />
        <comment value="RelationSurveillanceDecision" />
      </mapping>
    </element>
    <element id="Flag.extension:comment">
      <path value="Flag.extension" />
      <sliceName value="comment" />
      <max value="1" />
      <type>
        <code value="Extension" />
        <profile value="http://nictiz.nl/fhir/StructureDefinition/ext-Comment" />
      </type>
    </element>
    <element id="Flag.extension:comment.value[x]">
      <path value="Flag.extension.value[x]" />
      <short value="Comment" />
      <definition value="Textual explanation of the surveillance decision which cannot be expressed in any of the other fields." />
      <alias value="Toelichting" />
      <mapping>
        <identity value="cio-dataset-200-beta2-20231214" />
        <map value="cio-dataelement-20-764" />
        <comment value="Comment [DEPRECATED]" />
      </mapping>
      <mapping>
        <identity value="cio-dataset-200-beta3-20241023" />
        <map value="cio-dataelement-20-764" />
        <comment value="Comment" />
      </mapping>
    </element>
    <element id="Flag.extension:medicationHypersensitivityIdentifier">
      <path value="Flag.extension" />
      <sliceName value="medicationHypersensitivityIdentifier" />
      <min value="1" />
      <type>
        <code value="Extension" />
        <profile value="http://nictiz.nl/fhir/StructureDefinition/ext-MedicationHypersensitivity.Identifier" />
      </type>
    </element>
    <element id="Flag.extension:medicationHypersensitivityIdentifier.value[x]">
      <path value="Flag.extension.value[x]" />
      <mapping>
        <identity value="cio-dataset-200-beta3-20241023" />
        <map value="cio-dataelement-20-888" />
        <comment value="IdentificationGMO" />
      </mapping>
    </element>
    <element id="Flag.identifier">
      <path value="Flag.identifier" />
      <short value="IdentificationNumber" />
      <definition value="Globally unique number that identifies the instantiation of the information model. The number is composed of an identification of the issuer organization and a unique number assigned by this organization." />
      <alias value="Identificatienummer" />
      <min value="1" />
      <mapping>
        <identity value="cio-dataset-200-beta2-20231214" />
        <map value="cio-dataelement-20-780" />
        <comment value="IdentificationNumber" />
      </mapping>
      <mapping>
        <identity value="cio-dataset-200-beta3-20241023" />
        <map value="cio-dataelement-20-780" />
        <comment value="IdentificationNumber" />
      </mapping>
    </element>
    <element id="Flag.status">
      <path value="Flag.status" />
      <comment value="Sending systems that don't record an explicit status, SHOULD use the following guidance to infer a value from DecisionType:&#xD;&#xA;&#xD;&#xA;* When the value of DecisionType is _385652002_, `.status` will be set to _active_.&#xD;&#xA;* When the value of DecisionType is _410546004_, `.status` will be set to _inactive_." />
      <condition value="cio-SurveillanceDecision-1" />
      <condition value="cio-SurveillanceDecision-2" />
      <mapping>
        <identity value="cio-dataset-200-beta2-20231214" />
        <map value="cio-dataelement-20-755" />
        <comment value="DecisionType (implicit)" />
      </mapping>
      <mapping>
        <identity value="cio-dataset-200-beta3-20241023" />
        <map value="cio-dataelement-20-755" />
        <comment value="DecisionType (implicit)" />
      </mapping>
    </element>
    <element id="Flag.category">
      <path value="Flag.category" />
      <slicing>
        <discriminator>
          <type value="value" />
          <path value="$this" />
        </discriminator>
        <rules value="open" />
      </slicing>
      <min value="1" />
    </element>
    <element id="Flag.category:surveillanceDecisionCode">
      <path value="Flag.category" />
      <sliceName value="surveillanceDecisionCode" />
      <min value="1" />
      <max value="1" />
      <patternCodeableConcept>
        <coding>
          <system value="http://snomed.info/sct" />
          <code value="225419007" />
        </coding>
      </patternCodeableConcept>
    </element>
    <element id="Flag.code">
      <path value="Flag.code" />
      <short value="UnsafeSubstance" />
      <definition value="The substance or group of substances that must be monitored completely or with exceptions." />
      <comment value="The message that is be displayed to the user, should indicate the necessity of surveillance on the substance or group of substances present in the UnsafeSubstance concept with the exception of the substances indicated by the SafeWithinUnsafeGroup concept. Since it's semantically not possible to include the content of both concepts within `.code` (e.g. in different `.code.coding`s), the latter concept is represented by the `.extension:safeWithinUnsafeGroup` on `.code`, and the `.code.text` element SHOULD be used to convey the textual representation of the SubstanceForSurveillance concept as a whole. The `.code.text` could read for instance:&#xD;&#xA;* If UnsafeSubstance refers to a single substance:&#xD;&#xA;    * (English) 'Monitor the use of {UnsafeSubstance} as treatment for the patient, since this substance is unsafe for the patient.'&#xD;&#xA;    * (Dutch) 'Let op het gebruik van {UnsafeSubstance} als behandeling voor de patiënt, aangezien deze stof onveilig is voor de patiënt.'&#xD;&#xA;* If UnsafeSubstance refers to a group of substances, and there possibly are several substances specified within SafeWithinUnsafeGroup:&#xD;&#xA;    * (English) 'Monitor the use of {UnsafeSubstance} as treatment for the patient, since this group of substances is unsafe for the patient (with the exception of {SafeWithinUnsafeGroup}).'&#xD;&#xA;    * (Dutch) 'Let op het gebruik van {UnsafeSubstance} als behandeling voor de patiënt, aangezien deze groep van stoffen onveilig is voor de patiënt (met uitzondering van {SafeWithinUnsafeGroup}).'" />
      <alias value="OnveiligeStof" />
      <binding>
        <strength value="required" />
        <valueSet value="http://decor.nictiz.nl/fhir/ValueSet/2.16.840.1.113883.2.4.3.11.60.26.11.27--20231129131119" />
      </binding>
      <mapping>
        <identity value="cio-dataset-200-beta2-20231214" />
        <map value="cio-dataelement-20-761" />
        <comment value="UnsafeSubstance" />
      </mapping>
      <mapping>
        <identity value="cio-dataset-200-beta3-20241023" />
        <map value="cio-dataelement-20-761" />
        <comment value="UnsafeSubstance" />
      </mapping>
    </element>
    <element id="Flag.code.extension:safeWithinUnsafeGroup">
      <path value="Flag.code.extension" />
      <sliceName value="safeWithinUnsafeGroup" />
      <type>
        <code value="Extension" />
        <profile value="http://nictiz.nl/fhir/StructureDefinition/ext-SurveillanceDecision.SafeWithinUnsafeGroup" />
      </type>
    </element>
    <element id="Flag.code.extension:safeWithinUnsafeGroup.value[x]">
      <path value="Flag.code.extension.value[x]" />
      <mapping>
        <identity value="cio-dataset-200-beta2-20231214" />
        <map value="cio-dataelement-20-762" />
        <comment value="SafeWithinUnsafeGroup" />
      </mapping>
      <mapping>
        <identity value="cio-dataset-200-beta3-20241023" />
        <map value="cio-dataelement-20-762" />
        <comment value="SafeWithinUnsafeGroup" />
      </mapping>
    </element>
    <element id="Flag.code.text">
      <path value="Flag.code.text" />
      <comment value="For guidance on how to populate this element, see the comment on `.code`." />
      <mapping>
        <identity value="cio-dataset-200-beta2-20231214" />
        <map value="cio-dataelement-20-760" />
        <comment value="SubstanceForSurveillance (implicit)" />
      </mapping>
      <mapping>
        <identity value="cio-dataset-200-beta3-20241023" />
        <map value="cio-dataelement-20-760" />
        <comment value="SubstanceForSurveillance (implicit)" />
      </mapping>
    </element>
    <element id="Flag.subject">
      <path value="Flag.subject" />
      <type>
        <code value="Reference" />
        <targetProfile value="http://hl7.org/fhir/StructureDefinition/Patient" />
        <targetProfile value="http://nictiz.nl/fhir/StructureDefinition/nl-core-Patient" />
      </type>
    </element>
    <element id="Flag.period">
      <path value="Flag.period" />
      <min value="1" />
    </element>
    <element id="Flag.period.start">
      <path value="Flag.period.start" />
      <short value="DecisionEffectiveDateTime" />
      <definition value="Moment (date and time) when the decision (of type 'start surveillance') should take effect." />
      <comment value="When the value of DecisionType is _385652002_ the DecisionEffectiveDateTime SHALL be mapped to `.period.start`. Whenever the DecisionType is _410546004_, the DecisionEffectiveDateTime SHALL be mapped to `.period.end`, and the `.period.start` SHALL not change (i.e. it should be the same as in the Flag resource that is referenced via `.extension:relationSurveillanceDecision`)." />
      <alias value="BesluitIngangsDatumTijd" />
      <min value="1" />
      <mapping>
        <identity value="cio-dataset-200-beta2-20231214" />
        <map value="cio-dataelement-20-757" />
        <comment value="DecisionEffectiveDateTime" />
      </mapping>
      <mapping>
        <identity value="cio-dataset-200-beta3-20241023" />
        <map value="cio-dataelement-20-757" />
        <comment value="DecisionEffectiveDateTime" />
      </mapping>
    </element>
    <element id="Flag.period.end">
      <path value="Flag.period.end" />
      <short value="DecisionEffectiveDateTime" />
      <definition value="Moment (date and time) when the decision (of type 'discontinue surveillance') should take effect." />
      <comment value="When the value of DecisionType is _385652002_ the DecisionEffectiveDateTime SHALL be mapped to `.period.start`. Whenever the DecisionType is _410546004_, the DecisionEffectiveDateTime SHALL be mapped to `.period.end`, and the `.period.start` SHALL not change (i.e. it should be the same as in the Flag resource that is referenced via `.extension:relationSurveillanceDecision`)." />
      <alias value="BesluitIngangsDatumTijd" />
      <condition value="cio-SurveillanceDecision-1" />
      <mapping>
        <identity value="cio-dataset-200-beta2-20231214" />
        <map value="cio-dataelement-20-757" />
        <comment value="DecisionEffectiveDateTime" />
      </mapping>
      <mapping>
        <identity value="cio-dataset-200-beta3-20241023" />
        <map value="cio-dataelement-20-757" />
        <comment value="DecisionEffectiveDateTime" />
      </mapping>
    </element>
    <element id="Flag.author">
      <path value="Flag.author" />
      <short value="Author" />
      <definition value="The person who has registered or had someone else register the information in the patient record." />
      <alias value="Auteur" />
      <type>
        <code value="Reference" />
        <profile value="http://nictiz.nl/fhir/StructureDefinition/pattern-NlCoreHealthProfessionalReference" />
        <targetProfile value="http://hl7.org/fhir/StructureDefinition/Practitioner" />
        <targetProfile value="http://hl7.org/fhir/StructureDefinition/PractitionerRole" />
        <targetProfile value="http://nictiz.nl/fhir/StructureDefinition/nl-core-HealthProfessional-PractitionerRole" />
      </type>
      <mapping>
        <identity value="cio-dataset-200-beta2-20231214" />
        <map value="cio-dataelement-20-781" />
        <comment value="Author" />
      </mapping>
      <mapping>
        <identity value="cio-dataset-200-beta3-20241023" />
        <map value="cio-dataelement-20-781" />
        <comment value="Author" />
      </mapping>
    </element>
  </differential>
</StructureDefinition>