<?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="Specimen" type="Specimen">
    <xs:annotation>
      <xs:documentation>Sample for analysis.</xs:documentation>
    </xs:annotation>
  </xs:element>
  <xs:complexType name="Specimen">
    <xs:annotation>
      <xs:documentation>Sample for analysis.</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="unbounded" type="Identifier">
            <xs:annotation>
              <xs:documentation>Id for specimen.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="type" minOccurs="0" maxOccurs="1" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>Kind of material that forms the specimen.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="source" type="Specimen.Source" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation>Parent specimen from which the focal specimen was a component.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="subject" minOccurs="1" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>Where the specimen came from. This may be the patient(s) or from the environment or  a device.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="accessionIdentifier" minOccurs="0" maxOccurs="1" type="Identifier">
            <xs:annotation>
              <xs:documentation>The identifier assigned by the lab when accessioning specimen(s). This is not necessarily the same as the specimen identifier, depending on local lab procedures.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="receivedTime" minOccurs="0" maxOccurs="1" type="dateTime">
            <xs:annotation>
              <xs:documentation>Time when specimen was received for processing or testing.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="collection" type="Specimen.Collection" minOccurs="1" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>Details concerning the specimen collection.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="treatment" type="Specimen.Treatment" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation>Details concerning treatment and processing steps for the specimen.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="container" type="Specimen.Container" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation>The container holding the specimen.  The recursive nature of containers; i.e. blood in tube in tray in rack is not addressed here.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="Specimen.Source">
    <xs:annotation>
      <xs:documentation>Sample for analysis.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="relationship" minOccurs="1" maxOccurs="1" type="HierarchicalRelationshipType">
            <xs:annotation>
              <xs:documentation>Whether this relationship is to a parent or to a child.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="target" minOccurs="0" maxOccurs="unbounded" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>The specimen resource that is the target of this relationship.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="Specimen.Collection">
    <xs:annotation>
      <xs:documentation>Sample for analysis.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="collector" minOccurs="0" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>Person who collected the specimen.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="comment" minOccurs="0" maxOccurs="unbounded" type="string">
            <xs:annotation>
              <xs:documentation>To communicate any details or issues encountered during the specimen collection procedure.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:choice minOccurs="0" maxOccurs="1" >
            <xs:annotation>
              <xs:documentation>Time when specimen was collected from subject - the physiologically relevant time.</xs:documentation>
            </xs:annotation>
            <xs:element name="collectedDateTime" type="dateTime"/>
            <xs:element name="collectedPeriod" type="Period"/>
          </xs:choice>
          <xs:element name="quantity" minOccurs="0" maxOccurs="1" type="Quantity">
            <xs:annotation>
              <xs:documentation>The quantity of specimen collected; for instance the volume of a blood sample, or the physical measurement of an anatomic pathology sample.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="method" minOccurs="0" maxOccurs="1" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>A coded value specifying the technique that is used to perform the procedure.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="sourceSite" minOccurs="0" maxOccurs="1" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>Anatomical location from which the specimen should be collected (if subject is a patient). This element is not used for environmental specimens.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="Specimen.Treatment">
    <xs:annotation>
      <xs:documentation>Sample for analysis.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="description" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>Textual description of procedure.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="procedure" minOccurs="0" maxOccurs="1" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>A coded value specifying the procedure used to process the specimen.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="additive" minOccurs="0" maxOccurs="unbounded" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>Material used in the processing step.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="Specimen.Container">
    <xs:annotation>
      <xs:documentation>Sample for analysis.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="identifier" minOccurs="0" maxOccurs="unbounded" type="Identifier">
            <xs:annotation>
              <xs:documentation>Id for container. There may be multiple; a manufacturer's bar code, lab assigned identifier, etc. The container ID may differ from the specimen id in some circumstances.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="description" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>Textual description of the container.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="type" minOccurs="0" maxOccurs="1" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>The type of container associated with the specimen (e.g. slide, aliquot, etc).</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="capacity" minOccurs="0" maxOccurs="1" type="Quantity">
            <xs:annotation>
              <xs:documentation>The capacity (volume or other measure) the container may contain.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="specimenQuantity" minOccurs="0" maxOccurs="1" type="Quantity">
            <xs:annotation>
              <xs:documentation>The quantity of specimen in the container; may be volume, dimensions, or other appropriate measurements, depending on the specimen type.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="additive" minOccurs="0" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>Additive associated with the container.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:simpleType name="HierarchicalRelationshipType-list">
    <xs:restriction base="xs:string">
      <xs:enumeration value="parent">
        <xs:annotation>
          <xs:documentation>The target resource is the parent of the focal specimen resource.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="child">
        <xs:annotation>
          <xs:documentation>The target resource is the child of the focal specimen resource.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>
  <xs:complexType name="HierarchicalRelationshipType">
    <xs:annotation>
      <xs:documentation>Type indicating if this is a parent or child relationship</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="HierarchicalRelationshipType-list" use="optional"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
</xs:schema>
