<?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="Provenance" type="Provenance">
    <xs:annotation>
      <xs:documentation>Provenance information that describes the activity that led to the creation of a set of resources. This information can be used to help determine their reliability or trace where the information in them came from. The focus of the provenance resource is record keeping, audit and traceability, and not explicit statements of clinical significance.</xs:documentation>
    </xs:annotation>
  </xs:element>
  <xs:complexType name="Provenance">
    <xs:annotation>
      <xs:documentation>Provenance information that describes the activity that led to the creation of a set of resources. This information can be used to help determine their reliability or trace where the information in them came from. The focus of the provenance resource is record keeping, audit and traceability, and not explicit statements of clinical significance.</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="target" minOccurs="1" maxOccurs="unbounded" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>The resource(s) that were generated by  the activity described in this resource. A provenance can point to more than one target if multiple resources were created/updated by the same activity.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="period" minOccurs="0" maxOccurs="1" type="Period">
            <xs:annotation>
              <xs:documentation>The period during which the activity occurred.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="recorded" minOccurs="1" maxOccurs="1" type="instant">
            <xs:annotation>
              <xs:documentation>The instant of time at which the activity was recorded.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="reason" minOccurs="0" maxOccurs="1" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>The reason that the activity was taking place.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="location" minOccurs="0" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>Where the activity occurred, if relevant.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="policy" minOccurs="0" maxOccurs="unbounded" type="uri">
            <xs:annotation>
              <xs:documentation>Policy or plan the activity was defined by. Typically, a single activity may have multiple applicable policy documents, such as patient consent, guarantor funding, etc.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="agent" type="Provenance.Agent" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation>An agent takes a role in an activity such that the agent can be assigned some degree of responsibility for the activity taking place. An agent can be a person, a piece of software, an inanimate object, an organization, or other entities that may be ascribed responsibility.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="entity" type="Provenance.Entity" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation>An entity used in this activity.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="integritySignature" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>A digital signature on the target resource(s). The signature should match a Provenance.agent.reference in the provenance resource. The signature is only added to support checking cryptographic integrity of the resource, and not to represent workflow and clinical aspects of the signing process, or to support non-repudiation.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="Provenance.Agent">
    <xs:annotation>
      <xs:documentation>Provenance information that describes the activity that led to the creation of a set of resources. This information can be used to help determine their reliability or trace where the information in them came from. The focus of the provenance resource is record keeping, audit and traceability, and not explicit statements of clinical significance.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="role" minOccurs="1" maxOccurs="1" type="Coding">
            <xs:annotation>
              <xs:documentation>The role that the participant played.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="type" minOccurs="1" maxOccurs="1" type="Coding">
            <xs:annotation>
              <xs:documentation>The type of the participant.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="reference" minOccurs="1" maxOccurs="1" type="uri">
            <xs:annotation>
              <xs:documentation>Identity of participant. May be a logical or physical uri and maybe absolute or relative.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="display" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>Human-readable description of the participant.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="Provenance.Entity">
    <xs:annotation>
      <xs:documentation>Provenance information that describes the activity that led to the creation of a set of resources. This information can be used to help determine their reliability or trace where the information in them came from. The focus of the provenance resource is record keeping, audit and traceability, and not explicit statements of clinical significance.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="role" minOccurs="1" maxOccurs="1" type="ProvenanceEntityRole">
            <xs:annotation>
              <xs:documentation>How the entity was used during the activity.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="type" minOccurs="1" maxOccurs="1" type="Coding">
            <xs:annotation>
              <xs:documentation>The type of the entity. If the entity is a resource, then this is a resource type.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="reference" minOccurs="1" maxOccurs="1" type="uri">
            <xs:annotation>
              <xs:documentation>Identity of participant. May be a logical or physical uri and maybe absolute or relative.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="display" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>Human-readable description of the entity.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="agent" type="Provenance.Agent" minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>The entity is attributed to an agent to express the agent's responsibility for that entity, possibly along with other agents. This description can be understood as shorthand for saying that the agent was responsible for the activity which generated the entity.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:simpleType name="ProvenanceEntityRole-list">
    <xs:restriction base="xs:string">
      <xs:enumeration value="derivation">
        <xs:annotation>
          <xs:documentation>A transformation of an entity into another, an update of an entity resulting in a new one, or the construction of a new entity based on a preexisting entity.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="revision">
        <xs:annotation>
          <xs:documentation>A derivation for which the resulting entity is a revised version of some original.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="quotation">
        <xs:annotation>
          <xs:documentation>The repeat of (some or all of) an entity, such as text or image, by someone who may or may not be its original author.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="source">
        <xs:annotation>
          <xs:documentation>A primary source for a topic refers to something produced by some agent with direct experience and knowledge about the topic, at the time of the topic's study, without benefit from hindsight.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>
  <xs:complexType name="ProvenanceEntityRole">
    <xs:annotation>
      <xs:documentation>How an entity was used in an activity</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="ProvenanceEntityRole-list" use="optional"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
</xs:schema>
