<?xml version="1.0" encoding="UTF-8"?>
<!-- 
  Copyright (c) 2011-2013, 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 Tue, Sep 30, 2014 18:08+1000 for FHIR v0.0.82 
-->
<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="0.0.82">
  <xs:include schemaLocation="fhir-base.xsd"/>
  <xs:element name="ValueSet" type="ValueSet">
    <xs:annotation>
      <xs:documentation>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>A value set specifies a set of codes drawn from one or more code systems.</xs:documentation>
      <xs:documentation>If the element is present, it must have either a @value, an @id, or extensions</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="Resource">
        <xs:sequence>
          <xs:element name="identifier" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>The identifier that is used to identify this value set when it is referenced in a specification, model, design or an instance (should be globally unique OID, UUID, or URI).</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="version" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>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 profile author manually and the value should be a timestamp.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="name" minOccurs="1" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>A free text natural language name describing the value set.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="publisher" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>The name of the individual or organization that published the value set.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="telecom" minOccurs="0" maxOccurs="unbounded" type="Contact">
            <xs:annotation>
              <xs:documentation>Contacts of the publisher to assist a user in finding and communicating with the publisher.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="description" minOccurs="1" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>A free text natural language description of the use of the value set - reason for definition, conditions of use, etc.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="copyright" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>A copyright statement relating to the value set and/or its contents.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="status" minOccurs="1" maxOccurs="1" type="ValueSetStatus">
            <xs:annotation>
              <xs:documentation>The status of the value set.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="experimental" minOccurs="0" maxOccurs="1" type="boolean">
            <xs:annotation>
              <xs:documentation>This valueset was 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="extensible" minOccurs="0" maxOccurs="1" type="boolean">
            <xs:annotation>
              <xs:documentation>Whether this is intended to be used with an extensible binding or not.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="date" minOccurs="0" maxOccurs="1" type="dateTime">
            <xs:annotation>
              <xs:documentation>The date that the value set status was last changed.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="define" type="ValueSet.Define" minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>When value set defines its own codes.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="compose" type="ValueSet.Compose" minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>When value set includes codes from elsewhere.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="expansion" type="ValueSet.Expansion" minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>When value set is an expansion.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="ValueSet.Define">
    <xs:annotation>
      <xs:documentation>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="1" maxOccurs="1" type="uri">
            <xs:annotation>
              <xs:documentation>URI to identify the code system.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="version" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>The version of this code system that defines the codes. Note that the version is optional because a well maintained code system does not suffer from versioning, and therefore the version does not need to be maintained. However many code systems are not well maintained, and the version needs to be defined and tracked.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="caseSensitive" minOccurs="0" maxOccurs="1" type="boolean">
            <xs:annotation>
              <xs:documentation>If code comparison is case sensitive when codes within this system are compared to each other.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="concept" type="ValueSet.Concept" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation>Concepts in the code system.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="ValueSet.Concept">
    <xs:annotation>
      <xs:documentation>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>Code that identifies concept.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="abstract" minOccurs="0" maxOccurs="1" type="boolean">
            <xs:annotation>
              <xs:documentation>If this code is not for use as a real concept.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="display" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>Text to Display to the user.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="definition" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>The formal definition of the concept. Formal definitions are not required, because of the prevalence of legacy systems without them, but they are highly recommended, as without them there is no formal meaning associated with the concept.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="concept" type="ValueSet.Concept" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation>Child Concepts (is-a / contains).</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="ValueSet.Compose">
    <xs:annotation>
      <xs:documentation>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="import" minOccurs="0" maxOccurs="unbounded" type="uri">
            <xs:annotation>
              <xs:documentation>Includes the contents of the referenced value set as a part of the contents of this value set.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="include" type="ValueSet.Include" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation>Include one or more codes from a code system.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="exclude" type="ValueSet.Include" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation>Exclude one or more codes from the value set.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="ValueSet.Include">
    <xs:annotation>
      <xs:documentation>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="1" maxOccurs="1" type="uri">
            <xs:annotation>
              <xs:documentation>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>The version of the code system that the codes are selected from.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="code" minOccurs="0" maxOccurs="unbounded" type="code">
            <xs:annotation>
              <xs:documentation>Specifies a code or concept to be included or excluded. The list of codes is considered ordered, though the order may not have any particular significance.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="filter" type="ValueSet.Filter" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation>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:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="ValueSet.Filter">
    <xs:annotation>
      <xs:documentation>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>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>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>The match value may be either a code defined by the system, or a string value which is used a regex match on the literal string of the property value.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="ValueSet.Expansion">
    <xs:annotation>
      <xs:documentation>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="0" maxOccurs="1" type="Identifier">
            <xs:annotation>
              <xs:documentation>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="instant">
            <xs:annotation>
              <xs:documentation>Time valueset expansion happened.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="contains" type="ValueSet.Contains" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation>Codes in the value set.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="ValueSet.Contains">
    <xs:annotation>
      <xs:documentation>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>System value for the code.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="code" minOccurs="0" maxOccurs="1" type="code">
            <xs:annotation>
              <xs:documentation>Code - if blank, this is not a choosable code.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="display" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>User display for the concept.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="contains" type="ValueSet.Contains" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation>Codes contained in this concept.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:simpleType name="FilterOperator-list">
    <xs:restriction base="xs:string">
      <xs:enumeration value="=">
        <xs:annotation>
          <xs:documentation>The property value has the concept specified by the value.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="is-a">
        <xs:annotation>
          <xs:documentation>The property value has a concept that has an is-a relationship with the value.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="is-not-a">
        <xs:annotation>
          <xs:documentation>The property value has a concept that does not have an is-a relationship with the value.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="regex">
        <xs:annotation>
          <xs:documentation>The property value representation matches the regex specified in the value.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="in">
        <xs:annotation>
          <xs:documentation>The property value is in the set of codes or concepts identified by the value.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="not in">
        <xs:annotation>
          <xs:documentation>The property value is not in the set of codes or concepts identified by the value.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>
  <xs:complexType name="FilterOperator">
    <xs:annotation>
      <xs:documentation>The kind of operation to perform as a part of a property based filter</xs:documentation>
      <xs:documentation>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="FilterOperator-list" use="optional"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
</xs:schema>
