<StructureDefinition xmlns="http://hl7.org/fhir" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hl7.org/fhir ../../input-cache/schemas/R5/fhir-single.xsd">
  <id value="profile-Observation-alert-base" />
  <url value="https://bpcs.exchange/fhir/StructureDefinition/profile-Observation-alert-base" />
  <name value="ObservationAlertBase" />
  <title value="Observation Alert Base Profile" />
  <status value="active" />
  <experimental value="false" />
  <description value="An abstract profile that for alert and special handling observation that covers common elements independent of type of operation" />
  <fhirVersion value="5.0.0" />
  <mapping>
    <identity value="BPCS" />
    <name value="Internal BPCS API" />
  </mapping>
  <kind value="resource" />
  <abstract value="true" />
  <type value="Observation" />
  <baseDefinition value="http://hl7.org/fhir/StructureDefinition/Observation" />
  <derivation value="constraint" />
  <differential>
    <element id="Observation.id">
      <path value="Observation.id" />
      <comment value="This will be a concatenation of the odbNum or applicationNum with '-' then the alert or special handling observation code." />
      <min value="1" />
      <mustSupport value="true" />
      <mapping>
        <identity value="BPCS" />
        <map value="AlertSpecialHandlingDTO.recCreateCustomTimestamp" />
      </mapping>
    </element>
    <element id="Observation.status">
      <path value="Observation.status" />
      <patternCode value="final" />
      <mustSupport value="true" />
    </element>
    <element id="Observation.category">
      <path value="Observation.category" />
      <slicing>
        <discriminator>
          <type value="value" />
          <path value="$this" />
        </discriminator>
        <rules value="open" />
      </slicing>
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="Observation.category:alertSH">
      <path value="Observation.category" />
      <sliceName value="alertSH" />
      <short value="Alert vs. Special Handling" />
      <min value="1" />
      <max value="1" />
      <mustSupport value="true" />
      <binding>
        <strength value="required" />
        <valueSet value="https://bpcs.exchange/fhir/ValueSet/vs-NoteCode-alert-category" />
      </binding>
      <mapping>
        <identity value="BPCS" />
        <map value="ApplicationNoteDTO.category, AlertSpecialHandlingDTO.category" />
      </mapping>
    </element>
    <element id="Observation.code">
      <path value="Observation.code" />
      <short value="Note type" />
      <comment value="The binding is extensible to allow for the addition of new codes.  Codes must be found in the current expansion of the value set." />
      <mustSupport value="true" />
      <binding>
        <strength value="extensible" />
        <valueSet value="https://bpcs.exchange/fhir/ValueSet/vs-NoteCode-alert" />
      </binding>
      <mapping>
        <identity value="BPCS" />
        <map value="ApplicationNoteDTO.activity, AlertSpecialHandlingDTO.activity" />
      </mapping>
    </element>
    <element id="Observation.subject">
      <path value="Observation.subject" />
      <min value="1" />
      <type>
        <code value="Reference" />
        <profile value="https://bpcs.exchange/fhir/StructureDefinition/profile-Reference-rest" />
        <targetProfile value="https://bpcs.exchange/fhir/StructureDefinition/profile-Patient-search" />
        <targetProfile value="https://bpcs.exchange/fhir/StructureDefinition/profile-Group" />
      </type>
      <mustSupport value="true" />
      <mapping>
        <identity value="BPCS" />
        <map value="ApplicationNoteDTO.applicationNum, AlertSpecialHandlingDTO.applicationNum" />
      </mapping>
    </element>
    <element id="Observation.focus">
      <path value="Observation.focus" />
      <type>
        <code value="Reference" />
        <profile value="https://bpcs.exchange/fhir/StructureDefinition/profile-Reference-rest" />
        <targetProfile value="https://bpcs.exchange/fhir/StructureDefinition/profile-Coverage-family" />
      </type>
      <mustSupport value="true" />
      <mapping>
        <identity value="BPCS" />
        <map value="ApplicationNoteDTO.applicationNum, AlertSpecialHandlingDTO.applicationNum" />
      </mapping>
    </element>
    <element id="Observation.effective[x]">
      <path value="Observation.effective[x]" />
      <min value="1" />
      <type>
        <code value="dateTime" />
        <profile value="https://bpcs.exchange/fhir/StructureDefinition/profile-dateTime-date" />
      </type>
      <mustSupport value="true" />
      <mapping>
        <identity value="BPCS" />
        <map value="ApplicationNoteDTO.activityDate" />
      </mapping>
    </element>
    <element id="Observation.issued">
      <path value="Observation.issued" />
      <mustSupport value="true" />
      <mapping>
        <identity value="BPCS" />
        <map value="ApplicationNoteDTO.activityDate" />
      </mapping>
    </element>
    <element id="Observation.value[x]">
      <path value="Observation.value[x]" />
      <min value="1" />
      <type>
        <code value="boolean" />
      </type>
      <mustSupport value="true" />
      <mapping>
        <identity value="BPCS" />
        <map value="AlertSpecialHandlingDTO.selected" />
      </mapping>
    </element>
  </differential>
</StructureDefinition>