<?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 Mon, Mar 9, 2026 22:30+0000 for FHIR v6.0.0-ballot4 

  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="Specimen" type="Specimen">
    <xs:annotation>
      <xs:documentation xml:lang="en">A sample to be used for analysis.</xs:documentation>
    </xs:annotation>
  </xs:element>
  <xs:complexType name="Specimen">
    <xs:annotation>
      <xs:documentation xml:lang="en">A sample to be used for analysis.</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">Identifiers used for specimen identification. These could include but are not limited to identifiers generated upon collection, accessioning, or other reasons for labeling a specimen.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="status" minOccurs="0" maxOccurs="1" type="SpecimenStatus">
            <xs:annotation>
              <xs:documentation xml:lang="en">The availability of the specimen.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="type" minOccurs="0" maxOccurs="1" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation xml:lang="en">The kind of material that forms the specimen.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="subject" minOccurs="0" maxOccurs="1" type="Reference">
            <xs:annotation>
              <xs:documentation xml:lang="en">Where the specimen came from. This may be from patient(s), from a location (e.g., the source of an environmental sample), or a sampling of a substance, a biologically-derived product, or a device.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="receivedTime" minOccurs="0" maxOccurs="1" type="dateTime">
            <xs:annotation>
              <xs:documentation xml:lang="en">Time when specimen is received by the testing laboratory for processing or testing.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="parent" minOccurs="0" maxOccurs="unbounded" type="Reference">
            <xs:annotation>
              <xs:documentation xml:lang="en">Reference to the parent (source) specimen which is used when the specimen was either derived from or a component of another specimen.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="request" minOccurs="0" maxOccurs="unbounded" type="Reference">
            <xs:annotation>
              <xs:documentation xml:lang="en">Details concerning a service request that required a specimen to be collected.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="combined" minOccurs="0" maxOccurs="1" type="SpecimenCombined">
            <xs:annotation>
              <xs:documentation xml:lang="en">This element signifies if the specimen is part of a group or pooled.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="role" minOccurs="0" maxOccurs="unbounded" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation xml:lang="en">The role or reason for the specimen in the testing workflow.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="feature" type="Specimen.Feature" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation xml:lang="en">A physical feature or landmark on a specimen, highlighted for context by the collector of the specimen (e.g. surgeon), that identifies the type of feature as well as its meaning (e.g. the red ink indicating the resection margin of the right lobe of the excised prostate tissue or wire loop at radiologically suspected tumor location).</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="collection" type="Specimen.Collection" minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation xml:lang="en">Details concerning the specimen collection.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="processing" type="Specimen.Processing" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation xml:lang="en">Details concerning processing 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 xml:lang="en">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:element name="condition" minOccurs="0" maxOccurs="unbounded" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation xml:lang="en">A mode or state of being that describes the nature of the specimen.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="note" minOccurs="0" maxOccurs="unbounded" type="Annotation">
            <xs:annotation>
              <xs:documentation xml:lang="en">To communicate any details or issues about the specimen or during the specimen collection. (for example: broken vial, sent with patient, frozen).</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="Specimen.Feature">
    <xs:annotation>
      <xs:documentation xml:lang="en">A sample to be used for analysis.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="type" minOccurs="1" maxOccurs="1" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation xml:lang="en">The landmark or feature being highlighted.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="description" minOccurs="1" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation xml:lang="en">Description of the feature of the specimen.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="Specimen.Collection">
    <xs:annotation>
      <xs:documentation xml:lang="en">A sample to be used for analysis.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="collector" minOccurs="0" maxOccurs="1" type="Reference">
            <xs:annotation>
              <xs:documentation xml:lang="en">Person who collected the specimen.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:choice minOccurs="0" maxOccurs="1" >
            <xs:annotation>
              <xs:documentation xml:lang="en">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="duration" minOccurs="0" maxOccurs="1" type="Duration">
            <xs:annotation>
              <xs:documentation xml:lang="en">The span of time over which the collection of a specimen occurred.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="quantity" minOccurs="0" maxOccurs="1" type="Quantity">
            <xs:annotation>
              <xs:documentation xml:lang="en">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 xml:lang="en">A coded value specifying the technique that is used to perform the procedure.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:choice minOccurs="0" maxOccurs="1" >
            <xs:annotation>
              <xs:documentation xml:lang="en">A coded value specifying the device that is used to perform the procedure.</xs:documentation>
            </xs:annotation>
            <xs:element name="deviceCodeableConcept" type="CodeableConcept"/>
            <xs:element name="deviceReference" type="Reference"/>
            <xs:element name="deviceCanonical" type="canonical"/>
          </xs:choice>
          <xs:element name="procedure" minOccurs="0" maxOccurs="1" type="Reference">
            <xs:annotation>
              <xs:documentation xml:lang="en">The procedure event during which the specimen was collected (e.g. the surgery leading to the collection of a pathology sample).</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="bodySite" minOccurs="0" maxOccurs="1" type="CodeableReference">
            <xs:annotation>
              <xs:documentation xml:lang="en">Anatomical location from which the specimen was collected (if subject is a patient). This is the target site.  This element is not used for environmental specimens.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:choice minOccurs="0" maxOccurs="1" >
            <xs:annotation>
              <xs:documentation xml:lang="en">Abstinence or reduction from some or all food, drink, or both, for a period of time prior to sample collection.</xs:documentation>
            </xs:annotation>
            <xs:element name="fastingStatusCodeableConcept" type="CodeableConcept"/>
            <xs:element name="fastingStatusDuration" type="Duration"/>
          </xs:choice>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="Specimen.Processing">
    <xs:annotation>
      <xs:documentation xml:lang="en">A sample to be used 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 xml:lang="en">Textual description of procedure.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="method" minOccurs="0" maxOccurs="1" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation xml:lang="en">A coded value specifying the method used to process the specimen.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="performer" minOccurs="0" maxOccurs="1" type="Reference">
            <xs:annotation>
              <xs:documentation xml:lang="en">The performer of the processing of the specimen.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:choice minOccurs="0" maxOccurs="1" >
            <xs:annotation>
              <xs:documentation xml:lang="en">The device used in the processing of the specimen.</xs:documentation>
            </xs:annotation>
            <xs:element name="deviceCodeableConcept" type="CodeableConcept"/>
            <xs:element name="deviceReference" type="Reference"/>
            <xs:element name="deviceCanonical" type="canonical"/>
          </xs:choice>
          <xs:element name="additive" minOccurs="0" maxOccurs="unbounded" type="CodeableReference">
            <xs:annotation>
              <xs:documentation xml:lang="en">Material used in the processing step.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:choice minOccurs="0" maxOccurs="1" >
            <xs:annotation>
              <xs:documentation xml:lang="en">A record of the time or period when the specimen processing occurred.  For example the time of sample fixation or the period of time the sample was in formalin.</xs:documentation>
            </xs:annotation>
            <xs:element name="timeDateTime" type="dateTime"/>
            <xs:element name="timePeriod" type="Period"/>
            <xs:element name="timeDuration" type="Duration"/>
          </xs:choice>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="Specimen.Container">
    <xs:annotation>
      <xs:documentation xml:lang="en">A sample to be used for analysis.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:choice minOccurs="1" maxOccurs="1" >
            <xs:annotation>
              <xs:documentation xml:lang="en">The device resource for the the container holding the specimen. If the container is in a holder then the referenced device will point to a parent device.</xs:documentation>
            </xs:annotation>
            <xs:element name="deviceCodeableConcept" type="CodeableConcept"/>
            <xs:element name="deviceReference" type="Reference"/>
            <xs:element name="deviceCanonical" type="canonical"/>
          </xs:choice>
          <xs:element name="specimenQuantity" minOccurs="0" maxOccurs="1" type="Quantity">
            <xs:annotation>
              <xs:documentation xml:lang="en">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:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:simpleType name="SpecimenStatusEnum">
    <xs:restriction base="code-primitive">
      <xs:enumeration value="available">
        <xs:annotation>
          <xs:documentation xml:lang="en">Available</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="unavailable">
        <xs:annotation>
          <xs:documentation xml:lang="en">Unavailable</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="unsatisfactory">
        <xs:annotation>
          <xs:documentation xml:lang="en">Unsatisfactory</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:restriction>
  </xs:simpleType>
  <xs:complexType name="SpecimenStatus">
    <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="SpecimenStatusEnum" use="optional"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
</xs:schema>
