<?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="Medication" type="Medication">
    <xs:annotation>
      <xs:documentation>Primarily used for identification and definition of Medication, but also covers ingredients and packaging.</xs:documentation>
    </xs:annotation>
  </xs:element>
  <xs:complexType name="Medication">
    <xs:annotation>
      <xs:documentation>Primarily used for identification and definition of Medication, but also covers ingredients and packaging.</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="name" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>The common/commercial name of the medication absent information such as strength, form, etc.  E.g. Acetaminophen, Tylenol 3, etc.  The fully coordinated name is communicated as the display of Medication.code.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="code" minOccurs="0" maxOccurs="1" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>A code (or set of codes) that identify this medication.   Usage note: This could be a standard drug code such as a drug regulator code, RxNorm code, SNOMED CT code, etc. It could also be a local formulary code, optionally with translations to the standard drug codes.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="isBrand" minOccurs="0" maxOccurs="1" type="boolean">
            <xs:annotation>
              <xs:documentation>Set to true if the item is attributable to a specific manufacturer (even if we don't know who that is).</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="manufacturer" minOccurs="0" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>Describes the details of the manufacturer.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="kind" minOccurs="0" maxOccurs="1" type="MedicationKind">
            <xs:annotation>
              <xs:documentation>Medications are either a single administrable product or a package that contains one or more products.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="product" type="Medication.Product" minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>Information that only applies to products (not packages).</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="package" type="Medication.Package" minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>Information that only applies to packages (not products).</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="Medication.Product">
    <xs:annotation>
      <xs:documentation>Primarily used for identification and definition of Medication, but also covers ingredients and packaging.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="form" minOccurs="0" maxOccurs="1" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>Describes the form of the item.  Powder; tables; carton.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="ingredient" type="Medication.Ingredient" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation>Identifies a particular constituent of interest in the product.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="Medication.Ingredient">
    <xs:annotation>
      <xs:documentation>Primarily used for identification and definition of Medication, but also covers ingredients and packaging.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="item" minOccurs="1" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>The actual ingredient - either a substance (simple ingredient) or another medication.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="amount" minOccurs="0" maxOccurs="1" type="Ratio">
            <xs:annotation>
              <xs:documentation>Specifies how many (or how much) of the items there are in this Medication.  E.g. 250 mg per tablet.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="Medication.Package">
    <xs:annotation>
      <xs:documentation>Primarily used for identification and definition of Medication, but also covers ingredients and packaging.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="container" minOccurs="0" maxOccurs="1" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>The kind of container that this package comes as.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="content" type="Medication.Content" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation>A set of components that go to make up the described item.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="Medication.Content">
    <xs:annotation>
      <xs:documentation>Primarily used for identification and definition of Medication, but also covers ingredients and packaging.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="item" minOccurs="1" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>Identifies one of the items in the package.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="amount" minOccurs="0" maxOccurs="1" type="Quantity">
            <xs:annotation>
              <xs:documentation>The amount of the product that is in the package.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:simpleType name="MedicationKind-list">
    <xs:restriction base="xs:string">
      <xs:enumeration value="product">
        <xs:annotation>
          <xs:documentation>The medication is a product.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="package">
        <xs:annotation>
          <xs:documentation>The medication is a package - a contained group of one of more products.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>
  <xs:complexType name="MedicationKind">
    <xs:annotation>
      <xs:documentation>Whether the medication is a product or a package</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="MedicationKind-list" use="optional"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
</xs:schema>
