<?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="DocumentReference" type="DocumentReference">
    <xs:annotation>
      <xs:documentation>A reference to a document.</xs:documentation>
    </xs:annotation>
  </xs:element>
  <xs:complexType name="DocumentReference">
    <xs:annotation>
      <xs:documentation>A reference to a document.</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="masterIdentifier" minOccurs="1" maxOccurs="1" type="Identifier">
            <xs:annotation>
              <xs:documentation>Document identifier as assigned by the source of the document. This identifier is specific to this version of the document. This unique identifier may be used elsewhere to identify this version of the document.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="identifier" minOccurs="0" maxOccurs="unbounded" type="Identifier">
            <xs:annotation>
              <xs:documentation>Other identifiers associated with the document, including version independent, source record and workflow related identifiers.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="subject" minOccurs="1" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>Who or what the document is about. The document can be about a person, (patient or healthcare practitioner), a device (I.e. machine) or even a group of subjects (such as a document about a herd of farm animals, or a set of patients that share a common exposure).</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="type" minOccurs="1" maxOccurs="1" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>Specifies the particular kind of document (e.g. Patient Summary, Discharge Summary, Prescription, etc.).</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="class" minOccurs="0" maxOccurs="1" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>A categorization for the type of the document. This may be implied by or derived from the code specified in the Document Type.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="author" minOccurs="1" maxOccurs="unbounded" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>Identifies who is responsible for adding the information to the document.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="custodian" minOccurs="0" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>Identifies the organization or group who is responsible for ongoing maintenance of and access to the document.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="policyManager" minOccurs="0" maxOccurs="1" type="uri">
            <xs:annotation>
              <xs:documentation>A reference to a domain or server that manages policies under which the document is accessed and/or made available.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="authenticator" minOccurs="0" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>Which person or organization authenticates that this document is valid.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="created" minOccurs="0" maxOccurs="1" type="dateTime">
            <xs:annotation>
              <xs:documentation>When the document was created.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="indexed" minOccurs="1" maxOccurs="1" type="instant">
            <xs:annotation>
              <xs:documentation>When the document reference was created.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="status" minOccurs="1" maxOccurs="1" type="DocumentReferenceStatus">
            <xs:annotation>
              <xs:documentation>The status of this document reference.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="docStatus" minOccurs="0" maxOccurs="1" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>The status of the underlying document.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="relatesTo" type="DocumentReference.RelatesTo" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation>Relationships that this document has with other document references that already exist.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="description" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>Human-readable description of the source document. This is sometimes known as the &quot;title&quot;.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="confidentiality" minOccurs="0" maxOccurs="unbounded" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>A code specifying the level of confidentiality of the XDS Document.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="primaryLanguage" minOccurs="0" maxOccurs="1" type="code">
            <xs:annotation>
              <xs:documentation>The primary language in which the source document is written.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="mimeType" minOccurs="1" maxOccurs="1" type="code">
            <xs:annotation>
              <xs:documentation>The mime type of the source document.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="format" minOccurs="0" maxOccurs="unbounded" type="uri">
            <xs:annotation>
              <xs:documentation>An identifier that identifies that the format and content of the document conforms to additional rules beyond the base format indicated in the mimeType.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="size" minOccurs="0" maxOccurs="1" type="integer">
            <xs:annotation>
              <xs:documentation>The size of the source document this reference refers to in bytes.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="hash" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>A hash of the source document to ensure that changes have not occurred.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="location" minOccurs="0" maxOccurs="1" type="uri">
            <xs:annotation>
              <xs:documentation>A url at which the document can be accessed.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="service" type="DocumentReference.Service" minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>A description of a service call that can be used to retrieve the document.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="context" type="DocumentReference.Context" minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>The clinical context in which the document was prepared.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="DocumentReference.RelatesTo">
    <xs:annotation>
      <xs:documentation>A reference to a document.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="code" minOccurs="1" maxOccurs="1" type="DocumentRelationshipType">
            <xs:annotation>
              <xs:documentation>The type of relationship that this document has with anther document.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="target" minOccurs="1" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>The target document of this relationship.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="DocumentReference.Service">
    <xs:annotation>
      <xs:documentation>A reference to a document.</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>The type of the service that can be used to access the documents.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="address" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>Where the service end-point is located.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="parameter" type="DocumentReference.Parameter" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation>A list of named parameters that is used in the service call.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="DocumentReference.Parameter">
    <xs:annotation>
      <xs:documentation>A reference to a document.</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>The name of a parameter.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="value" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>The value of the named parameter.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="DocumentReference.Context">
    <xs:annotation>
      <xs:documentation>A reference to a document.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="event" minOccurs="0" maxOccurs="unbounded" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>This list of codes represents the main clinical acts, such as a colonoscopy or an appendectomy, being documented. In some cases, the event is inherent in the typeCode, such as a &quot;History and Physical Report&quot; in which the procedure being documented is necessarily a &quot;History and Physical&quot; act.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="period" minOccurs="0" maxOccurs="1" type="Period">
            <xs:annotation>
              <xs:documentation>The time period over which the service that is described by the document was provided.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="facilityType" minOccurs="0" maxOccurs="1" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>The kind of facility where the patient was seen.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:simpleType name="DocumentRelationshipType-list">
    <xs:restriction base="xs:string">
      <xs:enumeration value="replaces">
        <xs:annotation>
          <xs:documentation>This document logically replaces or supercedes the target document.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="transforms">
        <xs:annotation>
          <xs:documentation>This document was generated by transforming the target document (e.g. format or language conversion).</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="signs">
        <xs:annotation>
          <xs:documentation>This document is a signature of the target document.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="appends">
        <xs:annotation>
          <xs:documentation>This document adds additional information to the target document.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>
  <xs:complexType name="DocumentRelationshipType">
    <xs:annotation>
      <xs:documentation>The type of relationship between documents</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="DocumentRelationshipType-list" use="optional"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
</xs:schema>
