<!-- 
  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 Wed, Apr 19, 2017 07:44+1000 for FHIR v3.0.1 

  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="ValueSet" type="ValueSet">
    <xs:annotation>
      <xs:documentation xml:lang="en">A value set specifies a set of codes drawn from one or more code systems.</xs:documentation>
    </xs:annotation>
  </xs:element>
  <xs:complexType name="ValueSet">
    <xs:annotation>
      <xs:documentation xml:lang="en">A value set specifies a set of codes drawn from one or more code systems.</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="url" minOccurs="0" maxOccurs="1" type="uri">
            <xs:annotation>
              <xs:documentation xml:lang="en">An absolute URI that is used to identify this value set when it is referenced in a specification, model, design or an instance. This SHALL be a URL, SHOULD be globally unique, and SHOULD be an address at which this value set is (or will be) published. The URL SHOULD include the major version of the value set. For more information see [Technical and Business Versions](resource.html#versions).</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="identifier" minOccurs="0" maxOccurs="unbounded" type="Identifier">
            <xs:annotation>
              <xs:documentation xml:lang="en">A formal identifier that is used to identify this value set when it is represented in other formats, or referenced in a specification, model, design or an instance.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="version" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation xml:lang="en">The identifier that is used to identify this version of the value set when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the value set author and is not expected to be globally unique. For example, it might be a timestamp (e.g. yyyymmdd) if a managed version is not available. There is also no expectation that versions can be placed in a lexicographical sequence.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="name" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation xml:lang="en">A natural language name identifying the value set. This name should be usable as an identifier for the module by machine processing applications such as code generation.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="title" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation xml:lang="en">A short, descriptive, user-friendly title for the value set.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="status" minOccurs="1" maxOccurs="1" type="PublicationStatus">
            <xs:annotation>
              <xs:documentation xml:lang="en">The status of this value set. Enables tracking the life-cycle of the content.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="experimental" minOccurs="0" maxOccurs="1" type="boolean">
            <xs:annotation>
              <xs:documentation xml:lang="en">A boolean value to indicate that this value set is authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="date" minOccurs="0" maxOccurs="1" type="dateTime">
            <xs:annotation>
              <xs:documentation xml:lang="en">The date  (and optionally time) when the value set was published. The date must change if and when the business version changes and it must change if the status code changes. In addition, it should change when the substantive content of the value set changes. (e.g. the 'content logical definition').</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="publisher" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation xml:lang="en">The name of the individual or organization that published the value set.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="contact" minOccurs="0" maxOccurs="unbounded" type="ContactDetail">
            <xs:annotation>
              <xs:documentation xml:lang="en">Contact details to assist a user in finding and communicating with the publisher.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="description" minOccurs="0" maxOccurs="1" type="markdown">
            <xs:annotation>
              <xs:documentation xml:lang="en">A free text natural language description of the value set from a consumer's perspective.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="useContext" minOccurs="0" maxOccurs="unbounded" type="UsageContext">
            <xs:annotation>
              <xs:documentation xml:lang="en">The content was developed with a focus and intent of supporting the contexts that are listed. These terms may be used to assist with indexing and searching for appropriate value set instances.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="jurisdiction" minOccurs="0" maxOccurs="unbounded" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation xml:lang="en">A legal or geographic region in which the value set is intended to be used.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="immutable" minOccurs="0" maxOccurs="1" type="boolean">
            <xs:annotation>
              <xs:documentation xml:lang="en">If this is set to 'true', then no new versions of the content logical definition can be created.  Note: Other metadata might still change.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="purpose" minOccurs="0" maxOccurs="1" type="markdown">
            <xs:annotation>
              <xs:documentation xml:lang="en">Explaination of why this value set is needed and why it has been designed as it has.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="copyright" minOccurs="0" maxOccurs="1" type="markdown">
            <xs:annotation>
              <xs:documentation xml:lang="en">A copyright statement relating to the value set and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the value set.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="extensible" minOccurs="0" maxOccurs="1" type="boolean">
            <xs:annotation>
              <xs:documentation xml:lang="en">Whether this is intended to be used with an extensible binding or not.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="compose" type="ValueSet.Compose" minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation xml:lang="en">A set of criteria that define the content logical definition of the value set by including or excluding codes from outside this value set. This I also known as the "Content Logical Definition" (CLD).</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="expansion" type="ValueSet.Expansion" minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation xml:lang="en">A value set can also be "expanded", where the value set is turned into a simple collection of enumerated codes. This element holds the expansion, if it has been performed.</xs:documentation>
            </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="ValueSet.Compose">
    <xs:annotation>
      <xs:documentation xml:lang="en">A value set specifies a set of codes drawn from one or more code systems.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="lockedDate" minOccurs="0" maxOccurs="1" type="date">
            <xs:annotation>
              <xs:documentation xml:lang="en">If a locked date is defined, then the Content Logical Definition must be evaluated using the current version as of the locked date for referenced code system(s) and value set instances where ValueSet.compose.include.version is not defined.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="inactive" minOccurs="0" maxOccurs="1" type="boolean">
            <xs:annotation>
              <xs:documentation xml:lang="en">Whether inactive codes - codes that are not approved for current use - are in the value set. If inactive = true, inactive codes are to be included in the expansion, if inactive = false, the inactive codes will not be included in the expansion. If absent, the behavior is determined by the implementation, or by the applicable ExpansionProfile (but generally, inactive codes would be expected to be included).</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="include" type="ValueSet.Include" minOccurs="1" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation xml:lang="en">Include one or more codes from a code system or other value set(s).</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="exclude" type="ValueSet.Include" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation xml:lang="en">Exclude one or more codes from the value set based on code system filters and/or other value sets.</xs:documentation>
            </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="ValueSet.Include">
    <xs:annotation>
      <xs:documentation xml:lang="en">A value set specifies a set of codes drawn from one or more code systems.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="system" minOccurs="0" maxOccurs="1" type="uri">
            <xs:annotation>
              <xs:documentation xml:lang="en">An absolute URI which is the code system from which the selected codes come from.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="version" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation xml:lang="en">The version of the code system that the codes are selected from.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="concept" type="ValueSet.Concept" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation xml:lang="en">Specifies a concept to be included or excluded.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="filter" type="ValueSet.Filter" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation xml:lang="en">Select concepts by specify a matching criteria based on the properties (including relationships) defined by the system. If multiple filters are specified, they SHALL all be true.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="valueSet" minOccurs="0" maxOccurs="unbounded" type="uri">
            <xs:annotation>
              <xs:documentation xml:lang="en">Selects concepts found in this value set. This is an absolute URI that is a reference to ValueSet.url.</xs:documentation>
            </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="ValueSet.Concept">
    <xs:annotation>
      <xs:documentation xml:lang="en">A value set specifies a set of codes drawn from one or more code systems.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="code" minOccurs="1" maxOccurs="1" type="code">
            <xs:annotation>
              <xs:documentation xml:lang="en">Specifies a code for the concept to be included or excluded.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="display" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation xml:lang="en">The text to display to the user for this concept in the context of this valueset. If no display is provided, then applications using the value set use the display specified for the code by the system.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="designation" type="ValueSet.Designation" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation xml:lang="en">Additional representations for this concept when used in this value set - other languages, aliases, specialized purposes, used for particular purposes, etc.</xs:documentation>
            </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="ValueSet.Designation">
    <xs:annotation>
      <xs:documentation xml:lang="en">A value set specifies a set of codes drawn from one or more code systems.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="language" minOccurs="0" maxOccurs="1" type="code">
            <xs:annotation>
              <xs:documentation xml:lang="en">The language this designation is defined for.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="use" minOccurs="0" maxOccurs="1" type="Coding">
            <xs:annotation>
              <xs:documentation xml:lang="en">A code that details how this designation would be used.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="value" minOccurs="1" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation xml:lang="en">The text value for this designation.</xs:documentation>
            </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="ValueSet.Filter">
    <xs:annotation>
      <xs:documentation xml:lang="en">A value set specifies a set of codes drawn from one or more code systems.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="property" minOccurs="1" maxOccurs="1" type="code">
            <xs:annotation>
              <xs:documentation xml:lang="en">A code that identifies a property defined in the code system.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="op" minOccurs="1" maxOccurs="1" type="FilterOperator">
            <xs:annotation>
              <xs:documentation xml:lang="en">The kind of operation to perform as a part of the filter criteria.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="value" minOccurs="1" maxOccurs="1" type="code">
            <xs:annotation>
              <xs:documentation xml:lang="en">The match value may be either a code defined by the system, or a string value, which is a regex match on the literal string of the property value when the operation is 'regex', or one of the values (true and false), when the operation is 'exists'.</xs:documentation>
            </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="ValueSet.Expansion">
    <xs:annotation>
      <xs:documentation xml:lang="en">A value set specifies a set of codes drawn from one or more code systems.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="identifier" minOccurs="1" maxOccurs="1" type="uri">
            <xs:annotation>
              <xs:documentation xml:lang="en">An identifier that uniquely identifies this expansion of the valueset. Systems may re-use the same identifier as long as the expansion and the definition remain the same, but are not required to do so.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="timestamp" minOccurs="1" maxOccurs="1" type="dateTime">
            <xs:annotation>
              <xs:documentation xml:lang="en">The time at which the expansion was produced by the expanding system.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="total" minOccurs="0" maxOccurs="1" type="integer">
            <xs:annotation>
              <xs:documentation xml:lang="en">The total number of concepts in the expansion. If the number of concept nodes in this resource is less than the stated number, then the server can return more using the offset parameter.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="offset" minOccurs="0" maxOccurs="1" type="integer">
            <xs:annotation>
              <xs:documentation xml:lang="en">If paging is being used, the offset at which this resource starts.  I.e. this resource is a partial view into the expansion. If paging is not being used, this element SHALL not be present.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="parameter" type="ValueSet.Parameter" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation xml:lang="en">A parameter that controlled the expansion process. These parameters may be used by users of expanded value sets to check whether the expansion is suitable for a particular purpose, or to pick the correct expansion.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="contains" type="ValueSet.Contains" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation xml:lang="en">The codes that are contained in the value set expansion.</xs:documentation>
            </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="ValueSet.Parameter">
    <xs:annotation>
      <xs:documentation xml:lang="en">A value set specifies a set of codes drawn from one or more code systems.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="name" minOccurs="1" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation xml:lang="en">The name of the parameter.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:choice minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation xml:lang="en">The value of the parameter.</xs:documentation>
            </xs:annotation>
            <xs:element name="valueString" type="string" />
            <xs:element name="valueBoolean" type="boolean" />
            <xs:element name="valueInteger" type="integer" />
            <xs:element name="valueDecimal" type="decimal" />
            <xs:element name="valueUri" type="uri" />
            <xs:element name="valueCode" type="code" />
          </xs:choice>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="ValueSet.Contains">
    <xs:annotation>
      <xs:documentation xml:lang="en">A value set specifies a set of codes drawn from one or more code systems.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="system" minOccurs="0" maxOccurs="1" type="uri">
            <xs:annotation>
              <xs:documentation xml:lang="en">An absolute URI which is the code system in which the code for this item in the expansion is defined.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="abstract" minOccurs="0" maxOccurs="1" type="boolean">
            <xs:annotation>
              <xs:documentation xml:lang="en">If true, this entry is included in the expansion for navigational purposes, and the user cannot select the code directly as a proper value.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="inactive" minOccurs="0" maxOccurs="1" type="boolean">
            <xs:annotation>
              <xs:documentation xml:lang="en">If the concept is inactive in the code system that defines it. Inactive codes are those that are no longer to be used, but are maintained by the code system for understanding legacy data.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="version" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation xml:lang="en">The version of this code system that defined this code and/or display. This should only be used with code systems that do not enforce concept permanence.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="code" minOccurs="0" maxOccurs="1" type="code">
            <xs:annotation>
              <xs:documentation xml:lang="en">The code for this item in the expansion hierarchy. If this code is missing the entry in the hierarchy is a place holder (abstract) and does not represent a valid code in the value set.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="display" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation xml:lang="en">The recommended display for this item in the expansion.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="designation" type="ValueSet.Designation" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation xml:lang="en">Additional representations for this item - other languages, aliases, specialized purposes, used for particular purposes, etc. These are relevant when the conditions of the expansion do not fix to a single correct representation.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="contains" type="ValueSet.Contains" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation xml:lang="en">Other codes and entries contained under this entry in the hierarchy.</xs:documentation>
            </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
</xs:schema>