<?xml version="1.0" encoding="UTF-8"?>
<!-- 
 * #%L
 * org.hl7.fhir.r5
 * %%
 * Copyright (C) 2014 - 2019 Health Level 7
 * %%
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *      http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * #L%
 */

/*
  Copyright (c) 2011+, HL7, Inc.
  All rights reserved.
  
  Redistribution and use in source and binary forms, with or without modification, 
  are permitted provided that the following conditions are met:
  
   * Redistributions of source code must retain the above copyright notice, this 
     list of conditions and the following disclaimer.
   * Redistributions in binary form must reproduce the above copyright notice, 
     this list of conditions and the following disclaimer in the documentation 
     and/or other materials provided with the distribution.
   * Neither the name of HL7 nor the names of its contributors may be used to 
     endorse or promote products derived from this software without specific 
     prior written permission.
  
  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
  POSSIBILITY OF SUCH DAMAGE.
  

  Generated on Sun, Mar 26, 2023 15:21+1100 for FHIR v5.0.0 

  Note: the schemas &amp; schematrons do not contain all of the rules about what makes resources
  valid. Implementers will still need to be familiar with the content of the specification and with
  any profiles that apply to the resources in order to make a conformant implementation.

-->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://hl7.org/fhir" xmlns:xhtml="http://www.w3.org/1999/xhtml" targetNamespace="http://hl7.org/fhir" elementFormDefault="qualified" version="1.0">
  <xs:include schemaLocation="fhir-base.xsd"/>
  <xs:element name="Goal" type="Goal">
    <xs:annotation>
      <xs:documentation xml:lang="en">Describes the intended objective(s) for a patient, group or organization care, for example, weight loss, restoring an activity of daily living, obtaining herd immunity via immunization, meeting a process improvement objective, etc.</xs:documentation>
    </xs:annotation>
  </xs:element>
  <xs:complexType name="Goal">
    <xs:annotation>
      <xs:documentation xml:lang="en">Describes the intended objective(s) for a patient, group or organization care, for example, weight loss, restoring an activity of daily living, obtaining herd immunity via immunization, meeting a process improvement objective, etc.</xs:documentation>
      <xs:documentation xml:lang="en">If the element is present, it must have either a @value, an @id, or extensions</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="DomainResource">
        <xs:sequence>
          <xs:element name="identifier" minOccurs="0" maxOccurs="unbounded" type="Identifier">
            <xs:annotation>
              <xs:documentation xml:lang="en">Business identifiers assigned to this goal by the performer or other systems which remain constant as the resource is updated and propagates from server to server.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="lifecycleStatus" minOccurs="1" maxOccurs="1" type="GoalLifecycleStatus">
            <xs:annotation>
              <xs:documentation xml:lang="en">The state of the goal throughout its lifecycle.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="achievementStatus" minOccurs="0" maxOccurs="1" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation xml:lang="en">Describes the progression, or lack thereof, towards the goal against the target.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="category" minOccurs="0" maxOccurs="unbounded" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation xml:lang="en">Indicates a category the goal falls within.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="continuous" minOccurs="0" maxOccurs="1" type="boolean">
            <xs:annotation>
              <xs:documentation xml:lang="en">After meeting the goal, ongoing activity is needed to sustain the goal objective.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="priority" minOccurs="0" maxOccurs="1" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation xml:lang="en">Identifies the mutually agreed level of importance associated with reaching/sustaining the goal.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="description" minOccurs="1" maxOccurs="1" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation xml:lang="en">Human-readable and/or coded description of a specific desired objective of care, such as &quot;control blood pressure&quot; or &quot;negotiate an obstacle course&quot; or &quot;dance with child at wedding&quot;.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="subject" minOccurs="1" maxOccurs="1" type="Reference">
            <xs:annotation>
              <xs:documentation xml:lang="en">Identifies the patient, group or organization for whom the goal is being established.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:choice minOccurs="0" maxOccurs="1" >
            <xs:annotation>
              <xs:documentation xml:lang="en">The date or event after which the goal should begin being pursued.</xs:documentation>
            </xs:annotation>
            <xs:element name="startDate" type="date"/>
            <xs:element name="startCodeableConcept" type="CodeableConcept"/>
          </xs:choice>
          <xs:element name="target" type="Goal.Target" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation xml:lang="en">Indicates what should be done by when.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="statusDate" minOccurs="0" maxOccurs="1" type="date">
            <xs:annotation>
              <xs:documentation xml:lang="en">Identifies when the current status.  I.e. When initially created, when achieved, when cancelled, etc.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="statusReason" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation xml:lang="en">Captures the reason for the current status.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="source" minOccurs="0" maxOccurs="1" type="Reference">
            <xs:annotation>
              <xs:documentation xml:lang="en">Indicates whose goal this is - patient goal, practitioner goal, etc.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="addresses" minOccurs="0" maxOccurs="unbounded" type="Reference">
            <xs:annotation>
              <xs:documentation xml:lang="en">The identified conditions and other health record elements that are intended to be addressed by the goal.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="note" minOccurs="0" maxOccurs="unbounded" type="Annotation">
            <xs:annotation>
              <xs:documentation xml:lang="en">Any comments related to the goal.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="outcome" minOccurs="0" maxOccurs="unbounded" type="CodeableReference">
            <xs:annotation>
              <xs:documentation xml:lang="en">Identifies the change (or lack of change) at the point when the status of the goal is assessed.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="Goal.Target">
    <xs:annotation>
      <xs:documentation xml:lang="en">Describes the intended objective(s) for a patient, group or organization care, for example, weight loss, restoring an activity of daily living, obtaining herd immunity via immunization, meeting a process improvement objective, etc.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="measure" minOccurs="0" maxOccurs="1" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation xml:lang="en">The parameter whose value is being tracked, e.g. body weight, blood pressure, or hemoglobin A1c level.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:choice minOccurs="0" maxOccurs="1" >
            <xs:annotation>
              <xs:documentation xml:lang="en">The target value of the focus to be achieved to signify the fulfillment of the goal, e.g. 150 pounds, 7.0%. Either the high or low or both values of the range can be specified. When a low value is missing, it indicates that the goal is achieved at any focus value at or below the high value. Similarly, if the high value is missing, it indicates that the goal is achieved at any focus value at or above the low value.</xs:documentation>
            </xs:annotation>
            <xs:element name="detailQuantity" type="Quantity"/>
            <xs:element name="detailRange" type="Range"/>
            <xs:element name="detailCodeableConcept" type="CodeableConcept"/>
            <xs:element name="detailString" type="string"/>
            <xs:element name="detailBoolean" type="boolean"/>
            <xs:element name="detailInteger" type="integer"/>
            <xs:element name="detailRatio" type="Ratio"/>
          </xs:choice>
          <xs:choice minOccurs="0" maxOccurs="1" >
            <xs:annotation>
              <xs:documentation xml:lang="en">Indicates either the date or the duration after start by which the goal should be met.</xs:documentation>
            </xs:annotation>
            <xs:element name="dueDate" type="date"/>
            <xs:element name="dueDuration" type="Duration"/>
          </xs:choice>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:simpleType name="GoalLifecycleStatusEnum">
    <xs:restriction base="code-primitive">
      <xs:enumeration value="proposed">
        <xs:annotation>
          <xs:documentation xml:lang="en">Proposed</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="planned">
        <xs:annotation>
          <xs:documentation xml:lang="en">Planned</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="accepted">
        <xs:annotation>
          <xs:documentation xml:lang="en">Accepted</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="active">
        <xs:annotation>
          <xs:documentation xml:lang="en">Active</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="on-hold">
        <xs:annotation>
          <xs:documentation xml:lang="en">On Hold</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="completed">
        <xs:annotation>
          <xs:documentation xml:lang="en">Completed</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="cancelled">
        <xs:annotation>
          <xs:documentation xml:lang="en">Cancelled</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="entered-in-error">
        <xs:annotation>
          <xs:documentation xml:lang="en">Entered in Error</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="rejected">
        <xs:annotation>
          <xs:documentation xml:lang="en">Rejected</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>
  <xs:complexType name="GoalLifecycleStatus">
    <xs:annotation>
      <xs:documentation xml:lang="en"></xs:documentation>
      <xs:documentation xml:lang="en">If the element is present, it must have either a @value, an @id, or extensions</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="Element">
        <xs:attribute name="value" type="GoalLifecycleStatusEnum" use="optional"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
</xs:schema>
