<?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 Mon, Feb 3, 2014 23:47+1100 for FHIR v0.80 
-->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://hl7.org/fhir" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:xml="http://www.w3.org/XML/1998/namespace" targetNamespace="http://hl7.org/fhir" elementFormDefault="qualified" version="0.80">
  <!-- Note: When using this schema with some tools, it may also be necessary to declare xmlns:xml="http://www.w3.org/XML/1998/namespace", however this causes performance issues with other tools and thus is not in the base schemas. -->
  <xs:import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="xml.xsd"/>
  <xs:import namespace="http://www.w3.org/1999/xhtml" schemaLocation="xhtml1-strict.xsd"/>
  <!-- change this to xs:IDREF and all id attributes to type xs:ID to enforce internal references by schema,
       but note that this can't work in bundles (see comments in Resource Format section) -->
  <xs:simpleType name="xmlIdRef">
    <xs:restriction base="id-primitive">
      <xs:pattern value="[a-z0-9\-\.]{1,36}"/>
    </xs:restriction>
  </xs:simpleType>
  <xs:complexType name="Element">
    <xs:annotation>
      <xs:documentation>The base element used for all FHIR elements and resources - allows for them to be extended with extensions</xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="extension" type="Extension" minOccurs="0" maxOccurs="unbounded">
        <xs:annotation>
          <xs:documentation>An extension - additional local content. The extension URL defines it's meaning</xs:documentation>
        </xs:annotation>
      </xs:element>
    </xs:sequence>
    <xs:attribute name="id" type="id-primitive"/>
  </xs:complexType>

  <xs:complexType name="BackboneElement">
    <xs:annotation>
      <xs:documentation>An element defined in a FHIR resources - can have modifierExtension elements</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="Element">
        <xs:sequence>
          <xs:element name="modifierExtension" type="Extension" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation>An extension that modifies the meaning of the element that contains it - additional local content. The extension URL defines it's meaning</xs:documentation>
            </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>


  <xs:simpleType name="integer-primitive">
    <xs:restriction base="xs:int"/>
  </xs:simpleType>
  <xs:complexType name="integer">
    <xs:annotation>
      <xs:documentation>A whole number</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="integer-primitive" use="optional"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
<xs:simpleType name="dateTime-primitive">
  <xs:restriction>
    <xs:simpleType>
      <xs:union memberTypes="xs:gYear xs:gYearMonth xs:date xs:dateTime"/>
    </xs:simpleType>
    <xs:pattern value="\d{4}(\-\d{2}(\-\d{2}(T\d{2}(:\d{2}(:\d{2}(\.\d+)?)?)?)?)?)?(Z|(\+|\-)\d{2}:\d{2})?"/>
  </xs:restriction>
</xs:simpleType>
  <xs:complexType name="dateTime">
    <xs:annotation>
      <xs:documentation>A date, date-time or partial date (e.g. just year or year + month).  If hours and minutes are specified, a time zone SHALL be populated. The format is a union of the schema types gYear, gYearMonth, date and dateTime. Seconds may be provided but may also be ignored.  Dates SHALL be valid dates.</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="dateTime-primitive" use="optional"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:simpleType name="code-primitive">
    <xs:restriction base="xs:token">
      <xs:minLength value="1"/>
    </xs:restriction>
  </xs:simpleType>
  <xs:complexType name="code">
    <xs:annotation>
      <xs:documentation>A string which has at least one character and no leading or trailing whitespace and where there is no whitespace other than single spaces in the contents</xs:documentation>
      <xs:documentation>If the element is present, it must have either a @value, an @id referenced from the Narrative, or extensions</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="Element">
        <xs:attribute name="value" type="code-primitive"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
<xs:simpleType name="date-primitive">
  <xs:restriction>
    <xs:simpleType>
      <xs:union memberTypes="xs:gYear xs:gYearMonth xs:date"/>
    </xs:simpleType>
    <xs:pattern value="\d{4}(\-\d{2}(\-\d{2})?)?(Z|(\+|\-)\d{2}:\d{2})?"/>
  </xs:restriction>
</xs:simpleType>
  <xs:complexType name="date">
    <xs:annotation>
      <xs:documentation>A date, or partial date (e.g. just year or year + month). There is no time zone. The format is a union of the schema types gYear, gYearMonth and date.  Dates SHALL be valid dates.</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="date-primitive" use="optional"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:simpleType name="decimal-primitive">
    <xs:restriction base="xs:decimal"/>
  </xs:simpleType>
  <xs:complexType name="decimal">
    <xs:annotation>
      <xs:documentation>A rational number with implicit precision</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="decimal-primitive" use="optional"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:simpleType name="uri-primitive">
    <xs:restriction base="xs:anyURI"/>
  </xs:simpleType>
  <xs:complexType name="uri">
    <xs:annotation>
      <xs:documentation>String of characters used to identify a name or a resource</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="uri-primitive" use="optional"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:simpleType name="id-primitive">
    <xs:restriction base="xs:string">
      <xs:pattern value="[a-z0-9\-\.]{1,36}"/>
      <xs:minLength value="1"/>
    </xs:restriction>
  </xs:simpleType>
  <xs:complexType name="id">
    <xs:annotation>
      <xs:documentation>A whole number in the range 0 to 2^64-1, optionally represented in hex, a uuid, an oid or any other combination of lower-case letters a-z, numerals, &quot;-&quot; and &quot;.&quot;, with a length limit of 36 characters</xs:documentation>
      <xs:documentation>If the element is present, it must have either a @value, an @id referenced from the Narrative, or extensions</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="Element">
        <xs:attribute name="value" type="id-primitive"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:simpleType name="base64Binary-primitive">
    <xs:restriction base="xs:base64Binary"/>
  </xs:simpleType>
  <xs:complexType name="base64Binary">
    <xs:annotation>
      <xs:documentation>A stream of bytes</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="base64Binary-primitive" use="optional"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:simpleType name="oid-primitive">
    <xs:restriction base="xs:anyURI">
      <xs:pattern value="urn:oid:(0|[1-9][0-9]*)(\.(0|[1-9][0-9]*))*"/>
      <xs:minLength value="1"/>
    </xs:restriction>
  </xs:simpleType>
  <xs:complexType name="oid">
    <xs:annotation>
      <xs:documentation>An oid represented as a URI</xs:documentation>
      <xs:documentation>If the element is present, it must have either a @value, an @id referenced from the Narrative, or extensions</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="Element">
        <xs:attribute name="value" type="oid-primitive"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:simpleType name="string-primitive">
    <xs:restriction base="xs:string">
      <xs:minLength value="1"/>
    </xs:restriction>
  </xs:simpleType>
  <xs:complexType name="string">
    <xs:annotation>
      <xs:documentation>A sequence of Unicode characters</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="string-primitive" use="optional"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:simpleType name="boolean-primitive">
    <xs:restriction base="xs:boolean"/>
  </xs:simpleType>
  <xs:complexType name="boolean">
    <xs:annotation>
      <xs:documentation>Value of &quot;true&quot; or &quot;false&quot;</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="boolean-primitive" use="optional"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:simpleType name="uuid-primitive">
    <xs:restriction base="xs:anyURI">
      <xs:pattern value="urn:uuid:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}"/>
      <xs:minLength value="1"/>
    </xs:restriction>
  </xs:simpleType>
  <xs:complexType name="uuid">
    <xs:annotation>
      <xs:documentation>A UUID, represented as a URI</xs:documentation>
      <xs:documentation>If the element is present, it must have either a @value, an @id referenced from the Narrative, or extensions</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="Element">
        <xs:attribute name="value" type="uuid-primitive"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:simpleType name="instant-primitive">
    <xs:restriction base="xs:dateTime"/>
  </xs:simpleType>
  <xs:complexType name="instant">
    <xs:annotation>
      <xs:documentation>An instant in time - known at least to the second</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="instant-primitive" use="optional"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>

  <xs:simpleType name="ResourceType">
    <xs:restriction base="xs:string">
      <xs:enumeration value="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:enumeration>
      <xs:enumeration value="Condition">
        <xs:annotation>
          <xs:documentation>Use to record detailed information about conditions, problems or diagnoses recognized by a clinician. There are many uses including: recording a Diagnosis during an Encounter; populating a problem List or a Summary Statement, such as a Discharge Summary.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="CarePlan">
        <xs:annotation>
          <xs:documentation>Describes the intention of how one or more practitioners intend to deliver care for a particular patient for a period of time, possibly limited to care for a specific condition or set of conditions.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="Supply">
        <xs:annotation>
          <xs:documentation>A supply - a  request for something, and provision of what is supplied.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="Device">
        <xs:annotation>
          <xs:documentation>This resource identifies an instance of a manufactured thing that is used in the provision of healthcare without being substantially changed through that activity. The device may be a machine, an insert, a computer, an application, etc. This includes durable (reusable) medical equipment as well as disposable equipment used for diagnostic, treatment, and research for healthcare and public health.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="Query">
        <xs:annotation>
          <xs:documentation>A description of a query with a set of parameters.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="Order">
        <xs:annotation>
          <xs:documentation>A request to perform an action.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="Organization">
        <xs:annotation>
          <xs:documentation>A formally or informally recognized grouping of people or organizations formed for the purpose of achieving some form of collective action.  Includes companies, institutions, corporations, departments, community groups, healthcare practice groups, etc.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="Procedure">
        <xs:annotation>
          <xs:documentation>An action that is performed on a patient. This can be a physical 'thing' like an operation, or less invasive like counseling or hypnotherapy.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="Substance">
        <xs:annotation>
          <xs:documentation>A homogeneous material with a definite composition.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="DiagnosticReport">
        <xs:annotation>
          <xs:documentation>The findings and interpretation of diagnostic  tests performed on patients, groups of patients, devices, and locations, and/or specimens derived from these. The report includes clinical context such as requesting and provider information, and some mix of atomic results, images, textual and coded interpretation, and formatted representation of diagnostic reports.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="Group">
        <xs:annotation>
          <xs:documentation>Represents a defined collection of entities that may be discussed or acted upon collectively but which are not expected to act collectively and are not formally or legally recognized.  I.e. A collection of entities that isn't an Organization.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="ValueSet">
        <xs:annotation>
          <xs:documentation>A value set specifies a set of codes drawn from one or more code systems.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="Medication">
        <xs:annotation>
          <xs:documentation>Primarily used for identification and definition of Medication, but also covers ingredients and packaging.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="MessageHeader">
        <xs:annotation>
          <xs:documentation>The header for a message exchange that is either requesting or responding to an action.  The resource(s) that are the subject of the action as well as other Information related to the action are typically transmitted in a bundle in which the MessageHeader resource instance is the first resource in the bundle.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="ImmunizationRecommendation">
        <xs:annotation>
          <xs:documentation>A patient's point-of-time immunization status and recommendation with optional supporting justification.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="DocumentManifest">
        <xs:annotation>
          <xs:documentation>A manifest that defines a set of documents.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="MedicationDispense">
        <xs:annotation>
          <xs:documentation>Dispensing a medication to a named patient.  This includes a description of the supply provided and the instructions for administering the medication.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="MedicationPrescription">
        <xs:annotation>
          <xs:documentation>An order for both supply of the medication and the instructions for administration of the medicine to a patient.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="MedicationAdministration">
        <xs:annotation>
          <xs:documentation>Describes the event of a patient being given a dose of a medication.  This may be as simple as swallowing a tablet or it may be a long running infusion.

Related resources tie this event to the authorizing prescription, and the specific encounter between patient and health care practitioner.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="Encounter">
        <xs:annotation>
          <xs:documentation>An interaction between a patient and healthcare provider(s) for the purpose of providing healthcare service(s) or assessing the health status of a patient.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="SecurityEvent">
        <xs:annotation>
          <xs:documentation>A record of an event made for purposes of maintaining a security log. Typical uses include detection of intrusion attempts and monitoring for inappropriate usage.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="MedicationStatement">
        <xs:annotation>
          <xs:documentation>A record of medication being taken by a patient, or that the medication has been given to a patient where the record is the result of a report from the patient or another clinician.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="List">
        <xs:annotation>
          <xs:documentation>A set of information summarized from a list of other resources.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="Questionnaire">
        <xs:annotation>
          <xs:documentation>A structured set of questions and their answers. The Questionnaire may contain questions, answers or both. The questions are ordered and grouped into coherent subsets, corresponding to the structure of the grouping of the underlying questions.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="Composition">
        <xs:annotation>
          <xs:documentation>A set of healthcare-related information that is assembled together into a single logical document that provides a single coherent statement of meaning, establishes its own context and that has clinical attestation with regard to who is making the statement.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="DeviceObservationReport">
        <xs:annotation>
          <xs:documentation>Describes the data produced by a device at a point in time.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="OperationOutcome">
        <xs:annotation>
          <xs:documentation>A collection of error, warning or information messages that result from a system action.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="Conformance">
        <xs:annotation>
          <xs:documentation>A conformance statement is a set of requirements for a desired implementation or a description of how a target application fulfills those requirements in a particular implementation.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="Media">
        <xs:annotation>
          <xs:documentation>A photo, video, or audio recording acquired or used in healthcare. The actual content may be inline or provided by direct reference.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="FamilyHistory">
        <xs:annotation>
          <xs:documentation>Significant health events and conditions for people related to the subject relevant in the context of care for the subject.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="Other">
        <xs:annotation>
          <xs:documentation>Other is a conformant for handling resource concepts not yet defined for FHIR or outside HL7's scope of interest.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="Profile">
        <xs:annotation>
          <xs:documentation>A Resource Profile - a statement of use of one or more FHIR Resources.  It may include constraints on Resources and Data Types, Terminology Binding Statements and Extension Definitions.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="Location">
        <xs:annotation>
          <xs:documentation>Details and position information for a physical place where services are provided  and resources and participants may be stored, found, contained or accommodated.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="Observation">
        <xs:annotation>
          <xs:documentation>Measurements and simple assertions made about a patient, device or other subject.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="AllergyIntolerance">
        <xs:annotation>
          <xs:documentation>Indicates the patient has a susceptibility to an adverse reaction upon exposure to a specified substance.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="DocumentReference">
        <xs:annotation>
          <xs:documentation>A reference to a document.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="Immunization">
        <xs:annotation>
          <xs:documentation>Immunization event information.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="RelatedPerson">
        <xs:annotation>
          <xs:documentation>Information about a person that is involved in the care for a patient, but who is not the target of healthcare, nor has a formal responsibility in the care process.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="Specimen">
        <xs:annotation>
          <xs:documentation>Sample for analysis.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="OrderResponse">
        <xs:annotation>
          <xs:documentation>A response to an order.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="Alert">
        <xs:annotation>
          <xs:documentation>Prospective warnings of potential issues when providing care to the patient.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="ConceptMap">
        <xs:annotation>
          <xs:documentation>A statement of relationships from one set of concepts to one or more other concept systems.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="Patient">
        <xs:annotation>
          <xs:documentation>Demographics and other administrative information about a person or animal receiving care or other health-related services.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="Practitioner">
        <xs:annotation>
          <xs:documentation>A person who is directly or indirectly involved in the provisioning of healthcare.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="AdverseReaction">
        <xs:annotation>
          <xs:documentation>Records an unexpected reaction suspected to be related to the exposure of the reaction subject to a substance.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="ImagingStudy">
        <xs:annotation>
          <xs:documentation>Manifest of a set of images produced in study. The set of images may include every image in the study, or it may be an incomplete sample, such as a list of key images.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="DiagnosticOrder">
        <xs:annotation>
          <xs:documentation>A request for a diagnostic investigation service to be performed.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>
  <xs:complexType name="Resource.Inline">
    <xs:choice minOccurs="1" maxOccurs="1">
      <xs:element ref="Binary"/>
      <xs:element ref="Provenance"/>
      <xs:element ref="Condition"/>
      <xs:element ref="CarePlan"/>
      <xs:element ref="Supply"/>
      <xs:element ref="Device"/>
      <xs:element ref="Query"/>
      <xs:element ref="Order"/>
      <xs:element ref="Organization"/>
      <xs:element ref="Procedure"/>
      <xs:element ref="Substance"/>
      <xs:element ref="DiagnosticReport"/>
      <xs:element ref="Group"/>
      <xs:element ref="ValueSet"/>
      <xs:element ref="Medication"/>
      <xs:element ref="MessageHeader"/>
      <xs:element ref="ImmunizationRecommendation"/>
      <xs:element ref="DocumentManifest"/>
      <xs:element ref="MedicationDispense"/>
      <xs:element ref="MedicationPrescription"/>
      <xs:element ref="MedicationAdministration"/>
      <xs:element ref="Encounter"/>
      <xs:element ref="SecurityEvent"/>
      <xs:element ref="MedicationStatement"/>
      <xs:element ref="List"/>
      <xs:element ref="Questionnaire"/>
      <xs:element ref="Composition"/>
      <xs:element ref="DeviceObservationReport"/>
      <xs:element ref="OperationOutcome"/>
      <xs:element ref="Conformance"/>
      <xs:element ref="Media"/>
      <xs:element ref="FamilyHistory"/>
      <xs:element ref="Other"/>
      <xs:element ref="Profile"/>
      <xs:element ref="Location"/>
      <xs:element ref="Observation"/>
      <xs:element ref="AllergyIntolerance"/>
      <xs:element ref="DocumentReference"/>
      <xs:element ref="Immunization"/>
      <xs:element ref="RelatedPerson"/>
      <xs:element ref="Specimen"/>
      <xs:element ref="OrderResponse"/>
      <xs:element ref="Alert"/>
      <xs:element ref="ConceptMap"/>
      <xs:element ref="Patient"/>
      <xs:element ref="Practitioner"/>
      <xs:element ref="AdverseReaction"/>
      <xs:element ref="ImagingStudy"/>
      <xs:element ref="DiagnosticOrder"/>
    </xs:choice>
  </xs:complexType>
  <xs:complexType name="Resource">
    <xs:annotation>
      <xs:documentation>The base resource declaration used for all FHIR resource types - adds Narrative and xml:lang</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="language" type="code" minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>The human language of the content. The value can be any valid value according to BCP-47</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="text" type="Narrative" minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>Text summary of resource content (for human interpretation)</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="contained" type="Resource.Inline" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation>Contained, inline Resources. These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope</xs:documentation>
            </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>

  <xs:complexType name="Extension">
    <xs:annotation>
      <xs:documentation>Optional Extensions Element - found in all resources.</xs:documentation>
      <xs:documentation>If the element is present, it must have a value for at least one of the defined elements, an @id referenced from the Narrative, or extensions</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="Element">
        <xs:sequence>
        <xs:choice minOccurs="0" maxOccurs="1">
           <xs:annotation>
             <xs:documentation>Value of extension - may be a resource or one of a constrained set of the data types (see Extensibility in the spec for list).</xs:documentation>
           </xs:annotation>
           <xs:element name="valueBoolean" type="boolean"/>
           <xs:element name="valueInteger" type="integer"/>
           <xs:element name="valueDecimal" type="decimal"/>
           <xs:element name="valueBase64Binary" type="base64Binary"/>
           <xs:element name="valueInstant" type="instant"/>
           <xs:element name="valueString" type="string"/>
           <xs:element name="valueUri" type="uri"/>
           <xs:element name="valueDate" type="date"/>
           <xs:element name="valueDateTime" type="dateTime"/>
           <xs:element name="valueCode" type="code"/>
           <xs:element name="valueAttachment" type="Attachment"/>
           <xs:element name="valueIdentifier" type="Identifier"/>
           <xs:element name="valueCodeableConcept" type="CodeableConcept"/>
           <xs:element name="valueCoding" type="Coding"/>
           <xs:element name="valueQuantity" type="Quantity"/>
           <xs:element name="valueRange" type="Range"/>
           <xs:element name="valuePeriod" type="Period"/>
           <xs:element name="valueRatio" type="Ratio"/>
           <xs:element name="valueResource" type="ResourceReference"/>
           <xs:element name="valueSampledData" type="SampledData"/>
           <xs:element name="valueHumanName" type="HumanName"/>
           <xs:element name="valueAddress" type="Address"/>
           <xs:element name="valueContact" type="Contact"/>
           <xs:element name="valueSchedule" type="Schedule"/>
          </xs:choice>
        </xs:sequence>
        <xs:attribute name="url" type="uri-primitive" use="required"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="Narrative">
    <xs:annotation>
      <xs:documentation>A human-readable formatted text, including images.</xs:documentation>
      <xs:documentation>If the element is present, it must have a value for at least one of the defined elements, an @id referenced from the Narrative, or extensions</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="Element">
        <xs:sequence>
          <xs:element name="status" type="NarrativeStatus" minOccurs="1" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>The status of the narrative - whether it's entirely generated (from just the defined data or the extensions too), or whether a human authored it and it may contain additional data.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element ref="xhtml:div" minOccurs="1" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>The actual narrative content, a stripped down version of XHTML.</xs:documentation>
            </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:simpleType name="NarrativeStatus-list">
    <xs:restriction base="xs:string">
      <xs:enumeration value="generated">
        <xs:annotation>
          <xs:documentation>The contents of the narrative are entirely generated from the structured data in the resource.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="extensions">
        <xs:annotation>
          <xs:documentation>The contents of the narrative are entirely generated from the structured data in the resource and some of the content is generated from extensions.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="additional">
        <xs:annotation>
          <xs:documentation>The contents of the narrative contain additional information not found in the structured data.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="empty">
        <xs:annotation>
          <xs:documentation>the contents of the narrative are some equivalent of &quot;No human-readable text provided for this resource&quot;.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>
  <xs:complexType name="NarrativeStatus">
    <xs:annotation>
      <xs:documentation>The status of a resource narrative</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="NarrativeStatus-list" use="optional"/>
       </xs:extension>
     </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="Period">
    <xs:annotation>
      <xs:documentation>A time period defined by a start and end date and optionally time.</xs:documentation>
      <xs:documentation>If the element is present, it must have a value for at least one of the defined elements, an @id referenced from the Narrative, or extensions</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="Element">
        <xs:sequence>
          <xs:element name="start" type="dateTime" minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>The start of the period. The boundary is inclusive.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="end" type="dateTime" minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>The end of the period. If the end of the period is missing, it means that the period is ongoing.</xs:documentation>
            </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="Coding">
    <xs:annotation>
      <xs:documentation>A reference to a code defined by a terminology system.</xs:documentation>
      <xs:documentation>If the element is present, it must have a value for at least one of the defined elements, an @id referenced from the Narrative, or extensions</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="Element">
        <xs:sequence>
          <xs:element name="system" type="uri" minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>The identification of the code system that defines the meaning of the symbol in the code.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="version" type="string" minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>The version of the code system which was used when choosing this code. Note that a well-maintained code system does not need the version reported, because the meaning of codes is consistent across versions. However this cannot consistently be assured. and When the meaning is not guaranteed to be consistent, the version SHOULD be exchanged.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="code" type="code" minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>A symbol in syntax defined by the system. The symbol may be a predefined code or an expression in a syntax defined by the coding system (e.g. post-coordination).</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="display" type="string" minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>A representation of the meaning of the code in the system, following the rules of the system.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="primary" type="boolean" minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>Indicates that this code was chosen by a user directly - i.e. off a pick list of available items (codes or displays).</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="valueSet" type="ResourceReference" minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>The set of possible coded values this coding was chosen from or constrained by.</xs:documentation>
            </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="Range">
    <xs:annotation>
      <xs:documentation>A set of ordered Quantities defined by a low and high limit.</xs:documentation>
      <xs:documentation>If the element is present, it must have a value for at least one of the defined elements, an @id referenced from the Narrative, or extensions</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="Element">
        <xs:sequence>
          <xs:element name="low" type="Quantity" minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>The low limit. The boundary is inclusive.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="high" type="Quantity" minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>The high limit. The boundary is inclusive.</xs:documentation>
            </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="Quantity">
    <xs:annotation>
      <xs:documentation>A measured amount (or an amount that can potentially be measured). Note that measured amounts include amounts that are not precisely quantified, including amounts involving arbitrary units and floating currencies.</xs:documentation>
      <xs:documentation>If the element is present, it must have a value for at least one of the defined elements, an @id referenced from the Narrative, or extensions</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="Element">
        <xs:sequence>
          <xs:element name="value" type="decimal" minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>The value of the measured amount. The value includes an implicit precision in the presentation of the value.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="comparator" type="QuantityCompararator" minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>How the value should be understood and represented - whether the actual value is greater or less than the stated value due to measurement issues. E.g. if the comparator is &quot;&lt;&quot; , then the real value is &lt; stated value.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="units" type="string" minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>A human-readable form of the units.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="system" type="uri" minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>The identification of the system that provides the coded form of the unit.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="code" type="code" minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>A computer processable form of the units in some unit representation system.</xs:documentation>
            </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:simpleType name="QuantityCompararator-list">
    <xs:restriction base="xs:string">
      <xs:enumeration value="&lt;">
        <xs:annotation>
          <xs:documentation>The actual value is less than the given value.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="&lt;=">
        <xs:annotation>
          <xs:documentation>The actual value is less than or equal to the given value.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="&gt;=">
        <xs:annotation>
          <xs:documentation>The actual value is greater than or equal to the given value.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="&gt;">
        <xs:annotation>
          <xs:documentation>The actual value is greater than the given value.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>
  <xs:complexType name="QuantityCompararator">
    <xs:annotation>
      <xs:documentation>How the Quantity should be understood and represented</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="QuantityCompararator-list" use="optional"/>
       </xs:extension>
     </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="Attachment">
    <xs:annotation>
      <xs:documentation>For referring to data content defined in other formats.</xs:documentation>
      <xs:documentation>If the element is present, it must have a value for at least one of the defined elements, an @id referenced from the Narrative, or extensions</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="Element">
        <xs:sequence>
          <xs:element name="contentType" type="code" minOccurs="1" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>Identifies the type of the data in the attachment and allows a method to be chosen to interpret or render the data. Includes mime type parameters such as charset where appropriate.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="language" type="code" minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>The human language of the content. The value can be any valid value according to BCP 47.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="data" type="base64Binary" minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>The actual data of the attachment - a sequence of bytes. In XML, represented using base64.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="url" type="uri" minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>An alternative location where the data can be accessed.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="size" type="integer" minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>The number of bytes of data that make up this attachment.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="hash" type="base64Binary" minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>The calculated hash of the data using SHA-1. Represented using base64.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="title" type="string" minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>A label or set of text to display in place of the data.</xs:documentation>
            </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="Ratio">
    <xs:annotation>
      <xs:documentation>A relationship of two Quantity values - expressed as a numerator and a denominator.</xs:documentation>
      <xs:documentation>If the element is present, it must have a value for at least one of the defined elements, an @id referenced from the Narrative, or extensions</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="Element">
        <xs:sequence>
          <xs:element name="numerator" type="Quantity" minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>The value of the numerator.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="denominator" type="Quantity" minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>The value of the denominator.</xs:documentation>
            </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="SampledData">
    <xs:annotation>
      <xs:documentation>A series of measurements taken by a device, with upper and lower limits. There may be more than one dimension in the data.</xs:documentation>
      <xs:documentation>If the element is present, it must have a value for at least one of the defined elements, an @id referenced from the Narrative, or extensions</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="Element">
        <xs:sequence>
          <xs:element name="origin" type="Quantity" minOccurs="1" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>The base quantity that a measured value of zero represents. In addition, this provides the units of the entire measurement series.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="period" type="decimal" minOccurs="1" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>The length of time between sampling times, measured in milliseconds.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="factor" type="decimal" minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>A correction factor that is applied to the sampled data points before they are added to the origin.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="lowerLimit" type="decimal" minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>The lower limit of detection of the measured points. This is needed if any of the data points have the value &quot;L&quot; (lower than detection limit).</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="upperLimit" type="decimal" minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>The upper limit of detection of the measured points. This is needed if any of the data points have the value &quot;U&quot; (higher than detection limit).</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="dimensions" type="integer" minOccurs="1" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>The number of sample points at each time point. If this value is greater than one, then the dimensions will be interlaced - all the sample points for a point in time will be recorded at once.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="data" type="SampledDataDataType" minOccurs="1" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>A series of data points which are decimal values separated by a single space (character u20). The special values &quot;E&quot; (error), &quot;L&quot; (below detection limit) and &quot;U&quot; (above detection limit) can also be used in place of a decimal value.</xs:documentation>
            </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:simpleType name="SampledDataDataType-primitive">
     <xs:restriction base="xs:string">
      <xs:pattern value="((-{0,1}\d*\.{0,1}\d+)|[EUL])( ((-{0,1}\d*\.{0,1}\d+)|[EUL]))*"/>
    </xs:restriction>
  </xs:simpleType>
    <xs:complexType name="SampledDataDataType">
      <xs:complexContent>
        <xs:extension base="Element">
          <xs:attribute name="value" type="SampledDataDataType-primitive" use="optional"/>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>

  <xs:complexType name="ResourceReference">
    <xs:annotation>
      <xs:documentation>A reference from one resource to another.</xs:documentation>
      <xs:documentation>If the element is present, it must have a value for at least one of the defined elements, an @id referenced from the Narrative, or extensions</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="Element">
        <xs:sequence>
          <xs:element name="reference" type="string" minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>A reference to a location at which the other resource is found. The reference may a relative reference, in which case it is relative to the service base URL, or an absolute URL that resolves to the location where the resource is found. The reference may be version specific or not. If the reference is not to a FHIR RESTful server, then it should be assumed to be version specific. Internal fragment references (start with '#') refer to contained resources.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="display" type="string" minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>Plain text narrative that identifies the resource in addition to the resource reference.</xs:documentation>
            </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="CodeableConcept">
    <xs:annotation>
      <xs:documentation>A concept that may be defined by a formal reference to a terminology or ontology or may be provided by text.</xs:documentation>
      <xs:documentation>If the element is present, it must have a value for at least one of the defined elements, an @id referenced from the Narrative, or extensions</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="Element">
        <xs:sequence>
          <xs:element name="coding" type="Coding" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation>A reference to a code defined by a terminology system.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="text" type="string" minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>A human language representation of the concept as seen/selected/uttered by the user who entered the data and/or which represents the intended meaning of the user.</xs:documentation>
            </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="Identifier">
    <xs:annotation>
      <xs:documentation>A technical identifier - identifies some entity uniquely and unambiguously.</xs:documentation>
      <xs:documentation>If the element is present, it must have a value for at least one of the defined elements, an @id referenced from the Narrative, or extensions</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="Element">
        <xs:sequence>
          <xs:element name="use" type="IdentifierUse" minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>The purpose of this identifier.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="label" type="string" minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>A text string for the identifier that can be displayed to a human so they can recognize the identifier.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="system" type="uri" minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>Establishes the namespace in which set of possible id values is unique.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="value" type="string" minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>The portion of the identifier typically displayed to the user and which is unique within the context of the system.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="period" type="Period" minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>Time period during which identifier is/was valid for use.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="assigner" type="ResourceReference" minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>Organization that issued/manages the identifier.</xs:documentation>
            </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:simpleType name="IdentifierUse-list">
    <xs:restriction base="xs:string">
      <xs:enumeration value="usual">
        <xs:annotation>
          <xs:documentation>the identifier recommended for display and use in real-world interactions.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="official">
        <xs:annotation>
          <xs:documentation>the identifier considered to be most trusted for the identification of this item.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="temp">
        <xs:annotation>
          <xs:documentation>A temporary identifier.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="secondary">
        <xs:annotation>
          <xs:documentation>An identifier that was assigned in secondary use - it serves to identify the object in a relative context, but cannot be consistently assigned to the same object again in a different context.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>
  <xs:complexType name="IdentifierUse">
    <xs:annotation>
      <xs:documentation>Identifies the purpose for this identifier, if known</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="IdentifierUse-list" use="optional"/>
       </xs:extension>
     </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="Age">
    <xs:complexContent>
      <xs:restriction base="Quantity">
        <xs:sequence>
          <xs:element name="value" type="decimal" minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>The value of the measured amount. The value includes an implicit precision in the presentation of the value.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="comparator" type="QuantityCompararator" minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>How the value should be understood and represented - whether the actual value is greater or less than the stated value due to measurement issues. E.g. if the comparator is &quot;&lt;&quot; , then the real value is &lt; stated value.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="units" type="string" minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>A human-readable form of the units.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="system" type="uri" minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>The identification of the system that provides the coded form of the unit.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="code" type="code" minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>A computer processable form of the units in some unit representation system.</xs:documentation>
            </xs:annotation>
          </xs:element>
        </xs:sequence>
        <xs:attribute name="id" type="id-primitive"/>
      </xs:restriction>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="Count">
    <xs:complexContent>
      <xs:restriction base="Quantity">
        <xs:sequence>
          <xs:element name="value" type="decimal" minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>The value of the measured amount. The value includes an implicit precision in the presentation of the value.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="comparator" type="QuantityCompararator" minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>How the value should be understood and represented - whether the actual value is greater or less than the stated value due to measurement issues. E.g. if the comparator is &quot;&lt;&quot; , then the real value is &lt; stated value.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="units" type="string" minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>A human-readable form of the units.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="system" type="uri" minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>The identification of the system that provides the coded form of the unit.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="code" type="code" minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>A computer processable form of the units in some unit representation system.</xs:documentation>
            </xs:annotation>
          </xs:element>
        </xs:sequence>
        <xs:attribute name="id" type="id-primitive"/>
      </xs:restriction>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="Money">
    <xs:complexContent>
      <xs:restriction base="Quantity">
        <xs:sequence>
          <xs:element name="value" type="decimal" minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>The value of the measured amount. The value includes an implicit precision in the presentation of the value.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="comparator" type="QuantityCompararator" minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>How the value should be understood and represented - whether the actual value is greater or less than the stated value due to measurement issues. E.g. if the comparator is &quot;&lt;&quot; , then the real value is &lt; stated value.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="units" type="string" minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>A human-readable form of the units.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="system" type="uri" minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>The identification of the system that provides the coded form of the unit.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="code" type="code" minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>A computer processable form of the units in some unit representation system.</xs:documentation>
            </xs:annotation>
          </xs:element>
        </xs:sequence>
        <xs:attribute name="id" type="id-primitive"/>
      </xs:restriction>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="Distance">
    <xs:complexContent>
      <xs:restriction base="Quantity">
        <xs:sequence>
          <xs:element name="value" type="decimal" minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>The value of the measured amount. The value includes an implicit precision in the presentation of the value.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="comparator" type="QuantityCompararator" minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>How the value should be understood and represented - whether the actual value is greater or less than the stated value due to measurement issues. E.g. if the comparator is &quot;&lt;&quot; , then the real value is &lt; stated value.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="units" type="string" minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>A human-readable form of the units.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="system" type="uri" minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>The identification of the system that provides the coded form of the unit.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="code" type="code" minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>A computer processable form of the units in some unit representation system.</xs:documentation>
            </xs:annotation>
          </xs:element>
        </xs:sequence>
        <xs:attribute name="id" type="id-primitive"/>
      </xs:restriction>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="Duration">
    <xs:complexContent>
      <xs:restriction base="Quantity">
        <xs:sequence>
          <xs:element name="value" type="decimal" minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>The value of the measured amount. The value includes an implicit precision in the presentation of the value.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="comparator" type="QuantityCompararator" minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>How the value should be understood and represented - whether the actual value is greater or less than the stated value due to measurement issues. E.g. if the comparator is &quot;&lt;&quot; , then the real value is &lt; stated value.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="units" type="string" minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>A human-readable form of the units.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="system" type="uri" minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>The identification of the system that provides the coded form of the unit.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="code" type="code" minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>A computer processable form of the units in some unit representation system.</xs:documentation>
            </xs:annotation>
          </xs:element>
        </xs:sequence>
        <xs:attribute name="id" type="id-primitive"/>
      </xs:restriction>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="Schedule">
    <xs:annotation>
      <xs:documentation>Specifies an event that may occur multiple times. Schedules are used for to reord when things are expected or requested to occur.</xs:documentation>
      <xs:documentation>If the element is present, it must have a value for at least one of the defined elements, an @id referenced from the Narrative, or extensions</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="Element">
        <xs:sequence>
          <xs:element name="event" type="Period" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation>Identifies specific time periods when the event should occur.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="repeat" type="Schedule.Repeat" minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>Identifies a repeating pattern to the intended time periods.</xs:documentation>
            </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="Schedule.Repeat">
    <xs:annotation>
      <xs:documentation>Specifies an event that may occur multiple times. Schedules are used for to reord when things are expected or requested to occur.</xs:documentation>
      <xs:documentation>If the element is present, it must have a value for at least one of the defined elements, an @id referenced from the Narrative, or extensions</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="Element">
        <xs:sequence>
          <xs:element name="frequency" type="integer" minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>Indicates how often the event should occur.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="when" type="EventTiming" minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>Identifies the occurrence of daily life that determines timing.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="duration" type="decimal" minOccurs="1" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>How long each repetition should last.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="units" type="UnitsOfTime" minOccurs="1" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>The units of time for the duration.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="count" type="integer" minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>A total count of the desired number of repetitions.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="end" type="dateTime" minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>When to stop repeating the schedule.</xs:documentation>
            </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:simpleType name="EventTiming-list">
    <xs:restriction base="xs:string">
      <xs:enumeration value="HS">
        <xs:annotation>
          <xs:documentation>event occurs [duration] before the hour of sleep (or trying to).</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="WAKE">
        <xs:annotation>
          <xs:documentation>event occurs [duration] after waking.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="AC">
        <xs:annotation>
          <xs:documentation>event occurs [duration] before a meal (from the Latin ante cibus).</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="ACM">
        <xs:annotation>
          <xs:documentation>event occurs [duration] before breakfast (from the Latin ante cibus matutinus).</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="ACD">
        <xs:annotation>
          <xs:documentation>event occurs [duration] before lunch (from the Latin ante cibus diurnus).</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="ACV">
        <xs:annotation>
          <xs:documentation>event occurs [duration] before dinner (from the Latin ante cibus vespertinus).</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="PC">
        <xs:annotation>
          <xs:documentation>event occurs [duration] after a meal (from the Latin post cibus).</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="PCM">
        <xs:annotation>
          <xs:documentation>event occurs [duration] after breakfast (from the Latin post cibus matutinus).</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="PCD">
        <xs:annotation>
          <xs:documentation>event occurs [duration] after lunch (from the Latin post cibus diurnus).</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="PCV">
        <xs:annotation>
          <xs:documentation>event occurs [duration] after dinner (from the Latin post cibus vespertinus).</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>
  <xs:complexType name="EventTiming">
    <xs:annotation>
      <xs:documentation>Real world event that the schedule relates to</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="EventTiming-list" use="optional"/>
       </xs:extension>
     </xs:complexContent>
  </xs:complexType>
  <xs:simpleType name="UnitsOfTime-list">
    <xs:restriction base="xs:string">
      <xs:enumeration value="s">
        <xs:annotation>
          <xs:documentation>second.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="min">
        <xs:annotation>
          <xs:documentation>minute.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="h">
        <xs:annotation>
          <xs:documentation>hour.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="d">
        <xs:annotation>
          <xs:documentation>day.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="wk">
        <xs:annotation>
          <xs:documentation>week.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="mo">
        <xs:annotation>
          <xs:documentation>month.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="a">
        <xs:annotation>
          <xs:documentation>year.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>
  <xs:complexType name="UnitsOfTime">
    <xs:annotation>
      <xs:documentation>A unit of time (units from UCUM)</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="UnitsOfTime-list" use="optional"/>
       </xs:extension>
     </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="Contact">
    <xs:annotation>
      <xs:documentation>All kinds of technology mediated contact details for a person or organization, including telephone, email, etc.</xs:documentation>
      <xs:documentation>If the element is present, it must have a value for at least one of the defined elements, an @id referenced from the Narrative, or extensions</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="Element">
        <xs:sequence>
          <xs:element name="system" type="ContactSystem" minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>Telecommunications form for contact - what communications system is required to make use of the contact.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="value" type="string" minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>The actual contact details, in a form that is meaningful to the designated communication system (i.e. phone number or email address).</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="use" type="ContactUse" minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>Identifies the purpose for the address.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="period" type="Period" minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>Time period when the contact was/is in use.</xs:documentation>
            </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:simpleType name="ContactSystem-list">
    <xs:restriction base="xs:string">
      <xs:enumeration value="phone">
        <xs:annotation>
          <xs:documentation>The value is a telephone number used for voice calls. Use of full international numbers starting with + is recommended to enable automatic dialing support but not required.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="fax">
        <xs:annotation>
          <xs:documentation>The value is a fax machine. Use of full international numbers starting with + is recommended to enable automatic dialing support but not required.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="email">
        <xs:annotation>
          <xs:documentation>The value is an email address.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="url">
        <xs:annotation>
          <xs:documentation>The value is a url. This is intended for various personal contacts including blogs, Twitter, Facebook, etc. Do not use for email addresses.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>
  <xs:complexType name="ContactSystem">
    <xs:annotation>
      <xs:documentation>Telecommunications form for contact</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="ContactSystem-list" use="optional"/>
       </xs:extension>
     </xs:complexContent>
  </xs:complexType>
  <xs:simpleType name="ContactUse-list">
    <xs:restriction base="xs:string">
      <xs:enumeration value="home">
        <xs:annotation>
          <xs:documentation>A communication contact at a home; attempted contacts for business purposes might intrude privacy and chances are one will contact family or other household members instead of the person one wishes to call. Typically used with urgent cases, or if no other contacts are available.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="work">
        <xs:annotation>
          <xs:documentation>An office contact. First choice for business related contacts during business hours.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="temp">
        <xs:annotation>
          <xs:documentation>A temporary contact. The period can provide more detailed information.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="old">
        <xs:annotation>
          <xs:documentation>This contact is no longer in use (or was never correct, but retained for records).</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="mobile">
        <xs:annotation>
          <xs:documentation>A telecommunication device that moves and stays with its owner. May have characteristics of all other use codes, suitable for urgent matters, not the first choice for routine business.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>
  <xs:complexType name="ContactUse">
    <xs:annotation>
      <xs:documentation>Location, type or status of telecommunications address indicating use</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="ContactUse-list" use="optional"/>
       </xs:extension>
     </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="Address">
    <xs:annotation>
      <xs:documentation>There is a variety of postal address formats defined around the world. This format defines a superset that is the basis for all addresses around the world.</xs:documentation>
      <xs:documentation>If the element is present, it must have a value for at least one of the defined elements, an @id referenced from the Narrative, or extensions</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="Element">
        <xs:sequence>
          <xs:element name="use" type="AddressUse" minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>The purpose of this address.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="text" type="string" minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>A full text representation of the address.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="line" type="string" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation>This component contains the house number, apartment number, street name, street direction, 
P.O. Box number, delivery hints, and similar address information.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="city" type="string" minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>The name of the city, town, village or other community or delivery center.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="state" type="string" minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>Sub-unit of a country with limited sovereignty in a federally organized country. A code may be used if codes are in common use (i.e. US 2 letter state codes).</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="zip" type="string" minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>A postal code designating a region defined by the postal service.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="country" type="string" minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>Country - a nation as commonly understood or generally accepted.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="period" type="Period" minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>Time period when address was/is in use.</xs:documentation>
            </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:simpleType name="AddressUse-list">
    <xs:restriction base="xs:string">
      <xs:enumeration value="home">
        <xs:annotation>
          <xs:documentation>A communication address at a home.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="work">
        <xs:annotation>
          <xs:documentation>An office address. First choice for business related contacts during business hours.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="temp">
        <xs:annotation>
          <xs:documentation>A temporary address. The period can provide more detailed information.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="old">
        <xs:annotation>
          <xs:documentation>This address is no longer in use (or was never correct, but retained for records).</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>
  <xs:complexType name="AddressUse">
    <xs:annotation>
      <xs:documentation>The use of an address</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="AddressUse-list" use="optional"/>
       </xs:extension>
     </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="HumanName">
    <xs:annotation>
      <xs:documentation>A human's name with the ability to identify parts and usage.</xs:documentation>
      <xs:documentation>If the element is present, it must have a value for at least one of the defined elements, an @id referenced from the Narrative, or extensions</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="Element">
        <xs:sequence>
          <xs:element name="use" type="NameUse" minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>Identifies the purpose for this name.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="text" type="string" minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>A full text representation of the name.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="family" type="string" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation>The part of a name that links to the genealogy. In some cultures (e.g. Eritrea) the family name of a son is the first name of his father.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="given" type="string" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation>Given name.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="prefix" type="string" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation>Part of the name that is acquired as a title due to academic, legal, employment or nobility status, etc. and that appears at the start of the name.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="suffix" type="string" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation>Part of the name that is acquired as a title due to academic, legal, employment or nobility status, etc. and that appears at the end of the name.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="period" type="Period" minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>Indicates the period of time when this name was valid for the named person.</xs:documentation>
            </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:simpleType name="NameUse-list">
    <xs:restriction base="xs:string">
      <xs:enumeration value="usual">
        <xs:annotation>
          <xs:documentation>Known as/conventional/the one you normally use.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="official">
        <xs:annotation>
          <xs:documentation>The formal name as registered in an official (government) registry, but which name might not be commonly used. May be called &quot;legal name&quot;.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="temp">
        <xs:annotation>
          <xs:documentation>A temporary name. Name.period can provide more detailed information. This may also be used for temporary names assigned at birth or in emergency situations.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="nickname">
        <xs:annotation>
          <xs:documentation>A name that is used to address the person in an informal manner, but is not part of their formal or usual name.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="anonymous">
        <xs:annotation>
          <xs:documentation>Anonymous assigned name, alias, or pseudonym (used to protect a person's identity for privacy reasons).</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="old">
        <xs:annotation>
          <xs:documentation>This name is no longer in use (or was never correct, but retained for records).</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="maiden">
        <xs:annotation>
          <xs:documentation>A name used prior to marriage. Marriage naming customs vary greatly around the world. This name use is for use by applications that collect and store &quot;maiden&quot; names. Though the concept of maiden name is often gender specific, the use of this term is not gender specific. The use of this term does not imply any particular history for a person's name, nor should the maiden name be determined algorithmically.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>
  <xs:complexType name="NameUse">
    <xs:annotation>
      <xs:documentation>The use of a human name</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="NameUse-list" use="optional"/>
       </xs:extension>
     </xs:complexContent>
  </xs:complexType>
  <xs:simpleType name="DocumentReferenceStatus-list">
    <xs:restriction base="xs:string">
      <xs:enumeration value="current">
        <xs:annotation>
          <xs:documentation>This is the current reference for this document.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="superceded">
        <xs:annotation>
          <xs:documentation>This reference has been superseded by another reference.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="entered in error">
        <xs:annotation>
          <xs:documentation>This reference was created in error.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>
  <xs:complexType name="DocumentReferenceStatus">
    <xs:annotation>
      <xs:documentation></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="DocumentReferenceStatus-list" use="optional"/>
       </xs:extension>
     </xs:complexContent>
  </xs:complexType>
  <xs:simpleType name="SearchParamType-list">
    <xs:restriction base="xs:string">
      <xs:enumeration value="number">
        <xs:annotation>
          <xs:documentation>Search parameter SHALL be a number (a whole number, or a decimal).</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="date">
        <xs:annotation>
          <xs:documentation>Search parameter is on a date/time. The date format is the standard XML format, though other formats may be supported.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="string">
        <xs:annotation>
          <xs:documentation>Search parameter is a simple string, like a name part. Search is case-insensitive and accent-insensitive. May match just the start of a string. String parameters may contain spaces.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="token">
        <xs:annotation>
          <xs:documentation>Search parameter on a coded element or identifier. May be used to search through the text, displayname, code and code/codesystem (for codes) and label, system and key (for identifier). Its value is either a string or a pair of namespace and value, separated by a &quot;|&quot;, depending on the modifier used.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="reference">
        <xs:annotation>
          <xs:documentation>A reference to another resource.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="composite">
        <xs:annotation>
          <xs:documentation>A composite search parameter that combines a search on two values together.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="quantity">
        <xs:annotation>
          <xs:documentation>A search parameter that searches on a quantity.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>
  <xs:complexType name="SearchParamType">
    <xs:annotation>
      <xs:documentation></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="SearchParamType-list" use="optional"/>
       </xs:extension>
     </xs:complexContent>
  </xs:complexType>
  <xs:simpleType name="ValueSetStatus-list">
    <xs:restriction base="xs:string">
      <xs:enumeration value="draft">
        <xs:annotation>
          <xs:documentation>This valueset is still under development.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="active">
        <xs:annotation>
          <xs:documentation>This valueset is ready for normal use.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="retired">
        <xs:annotation>
          <xs:documentation>This valueset has been withdrawn or superceded and should no longer be used.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>
  <xs:complexType name="ValueSetStatus">
    <xs:annotation>
      <xs:documentation></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="ValueSetStatus-list" use="optional"/>
       </xs:extension>
     </xs:complexContent>
  </xs:complexType>
  <xs:simpleType name="ResourceNamesPlusBinary">
    <xs:union memberTypes="ResourceType">
      <xs:simpleType>
      <xs:restriction base="xs:NMTOKEN">
        <xs:enumeration value="Binary"/>
      </xs:restriction>
    </xs:simpleType>
  </xs:union>
  </xs:simpleType>
  <xs:complexType name="Binary">
    <xs:simpleContent>
      <xs:extension base="xs:base64Binary">
        <xs:attribute name="contentType" type="xs:string" use="required"/>
        <xs:attribute name="id" type="id-primitive"/>
      </xs:extension>
    </xs:simpleContent>
  </xs:complexType>
  <xs:element name="Binary" type="Binary"/>
  <xs:element name="AdverseReaction" type="AdverseReaction">
    <xs:annotation>
      <xs:documentation>Records an unexpected reaction suspected to be related to the exposure of the reaction subject to a substance.</xs:documentation>
    </xs:annotation>
  </xs:element>
  <xs:complexType name="AdverseReaction">
    <xs:annotation>
      <xs:documentation>Records an unexpected reaction suspected to be related to the exposure of the reaction subject to a substance.</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>This records identifiers associated with this reaction that are defined by business processed and/ or used to refer to it when a direct URL reference to the resource itself is not appropriate (e.g. in CDA documents, or in written / printed documentation).</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="date" minOccurs="0" maxOccurs="1" type="dateTime">
            <xs:annotation>
              <xs:documentation>The date (and possibly time) when the reaction began.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="subject" minOccurs="1" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>The subject of the adverse reaction.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="didNotOccurFlag" minOccurs="1" maxOccurs="1" type="boolean">
            <xs:annotation>
              <xs:documentation>If true, indicates that no reaction occurred.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="recorder" minOccurs="0" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>Identifies the individual responsible for the information in the reaction record.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="symptom" type="AdverseReaction.Symptom" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation>The signs and symptoms that were observed as part of the reaction.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="exposure" type="AdverseReaction.Exposure" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation>An exposure to a substance that preceded a reaction occurrence.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="AdverseReaction.Symptom">
    <xs:annotation>
      <xs:documentation>Records an unexpected reaction suspected to be related to the exposure of the reaction subject to a substance.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="code" minOccurs="1" maxOccurs="1" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>Indicates the specific sign or symptom that was observed.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="severity" minOccurs="0" maxOccurs="1" type="ReactionSeverity">
            <xs:annotation>
              <xs:documentation>The severity of the sign or symptom.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="AdverseReaction.Exposure">
    <xs:annotation>
      <xs:documentation>Records an unexpected reaction suspected to be related to the exposure of the reaction subject to a substance.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="date" minOccurs="0" maxOccurs="1" type="dateTime">
            <xs:annotation>
              <xs:documentation>Identifies the initial date of the exposure that is suspected to be related to the reaction.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="type" minOccurs="0" maxOccurs="1" type="ExposureType">
            <xs:annotation>
              <xs:documentation>The type of exposure: Drug Administration, Immunization, Coincidental.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="causalityExpectation" minOccurs="0" maxOccurs="1" type="CausalityExpectation">
            <xs:annotation>
              <xs:documentation>A statement of how confident that the recorder was that this exposure caused the reaction.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="substance" minOccurs="0" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>Substance that is presumed to have caused the adverse reaction.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:simpleType name="ReactionSeverity-list">
    <xs:restriction base="xs:string">
      <xs:enumeration value="severe">
        <xs:annotation>
          <xs:documentation>Severe complications arose due to the reaction.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="serious">
        <xs:annotation>
          <xs:documentation>Serious inconvenience to the subject.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="moderate">
        <xs:annotation>
          <xs:documentation>Moderate inconvenience to the subject.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="minor">
        <xs:annotation>
          <xs:documentation>Minor inconvenience to the subject.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>
  <xs:complexType name="ReactionSeverity">
    <xs:annotation>
      <xs:documentation>The severity of an adverse reaction.</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="ReactionSeverity-list" use="optional"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:simpleType name="ExposureType-list">
    <xs:restriction base="xs:string">
      <xs:enumeration value="drugadmin">
        <xs:annotation>
          <xs:documentation>Drug Administration.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="immuniz">
        <xs:annotation>
          <xs:documentation>Immunization.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="coincidental">
        <xs:annotation>
          <xs:documentation>In the same area as the substance.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>
  <xs:complexType name="ExposureType">
    <xs:annotation>
      <xs:documentation>The type of exposure that resulted in an adverse reaction</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="ExposureType-list" use="optional"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:simpleType name="CausalityExpectation-list">
    <xs:restriction base="xs:string">
      <xs:enumeration value="likely">
        <xs:annotation>
          <xs:documentation>Likely that this specific exposure caused the reaction.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="unlikely">
        <xs:annotation>
          <xs:documentation>Unlikely that this specific exposure caused the reaction - the exposure is being linked to for information purposes.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="confirmed">
        <xs:annotation>
          <xs:documentation>It has been confirmed that this exposure was one of the causes of the reaction.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="unknown">
        <xs:annotation>
          <xs:documentation>It is unknown whether this exposure had anything to do with the reaction.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>
  <xs:complexType name="CausalityExpectation">
    <xs:annotation>
      <xs:documentation>How likely is it that the given exposure caused a reaction</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="CausalityExpectation-list" use="optional"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:element name="Alert" type="Alert">
    <xs:annotation>
      <xs:documentation>Prospective warnings of potential issues when providing care to the patient.</xs:documentation>
    </xs:annotation>
  </xs:element>
  <xs:complexType name="Alert">
    <xs:annotation>
      <xs:documentation>Prospective warnings of potential issues when providing care to the patient.</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>Identifier assigned to the alert for external use (outside the FHIR environment).</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="category" minOccurs="0" maxOccurs="1" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>Allows an alert to be divided into different categories like clinical, administrative etc.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="status" minOccurs="1" maxOccurs="1" type="AlertStatus">
            <xs:annotation>
              <xs:documentation>Supports basic workflow.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="subject" minOccurs="1" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>The person who this alert concerns.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="author" minOccurs="0" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>The person or device that created the alert.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="note" minOccurs="1" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>The textual component of the alert to display to the user.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:simpleType name="AlertStatus-list">
    <xs:restriction base="xs:string">
      <xs:enumeration value="active">
        <xs:annotation>
          <xs:documentation>A current alert that should be displayed to a user. A system may use the category to determine which roles should view the alert.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="inactive">
        <xs:annotation>
          <xs:documentation>The alert does not need to be displayed any more.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="entered in error">
        <xs:annotation>
          <xs:documentation>The alert was added in error, and should no longer be displayed.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>
  <xs:complexType name="AlertStatus">
    <xs:annotation>
      <xs:documentation>Indicates whether this alert is active and needs to be displayed to a user, or whether it is no longer needed or entered in error</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="AlertStatus-list" use="optional"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:element name="AllergyIntolerance" type="AllergyIntolerance">
    <xs:annotation>
      <xs:documentation>Indicates the patient has a susceptibility to an adverse reaction upon exposure to a specified substance.</xs:documentation>
    </xs:annotation>
  </xs:element>
  <xs:complexType name="AllergyIntolerance">
    <xs:annotation>
      <xs:documentation>Indicates the patient has a susceptibility to an adverse reaction upon exposure to a specified substance.</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>This records identifiers associated with this allergy/intolerance concern that are defined by business processed and/ or used to refer to it when a direct URL reference to the resource itself is not appropriate (e.g. in CDA documents, or in written / printed documentation).</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="criticality" minOccurs="0" maxOccurs="1" type="Criticality">
            <xs:annotation>
              <xs:documentation>Criticality of the sensitivity.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="sensitivityType" minOccurs="1" maxOccurs="1" type="SensitivityType">
            <xs:annotation>
              <xs:documentation>Type of the sensitivity.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="recordedDate" minOccurs="0" maxOccurs="1" type="dateTime">
            <xs:annotation>
              <xs:documentation>Date when the sensitivity was recorded.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="status" minOccurs="1" maxOccurs="1" type="SensitivityStatus">
            <xs:annotation>
              <xs:documentation>Status of the sensitivity.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="subject" minOccurs="1" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>The patient who has the allergy or intolerance.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="recorder" minOccurs="0" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>Indicates who has responsibility for the record.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="substance" minOccurs="1" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>The substance that causes the sensitivity.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="reaction" minOccurs="0" maxOccurs="unbounded" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>Reactions associated with the sensitivity.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="sensitivityTest" minOccurs="0" maxOccurs="unbounded" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>Observations that confirm or refute the sensitivity.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:simpleType name="SensitivityStatus-list">
    <xs:restriction base="xs:string">
      <xs:enumeration value="suspected">
        <xs:annotation>
          <xs:documentation>A suspected sensitivity to a substance.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="confirmed">
        <xs:annotation>
          <xs:documentation>The sensitivity has been confirmed and is active.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="refuted">
        <xs:annotation>
          <xs:documentation>The sensitivity has been shown to never have existed.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="resolved">
        <xs:annotation>
          <xs:documentation>The sensitivity used to exist but no longer does.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>
  <xs:complexType name="SensitivityStatus">
    <xs:annotation>
      <xs:documentation>The status of the adverse sensitivity</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="SensitivityStatus-list" use="optional"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:simpleType name="Criticality-list">
    <xs:restriction base="xs:string">
      <xs:enumeration value="fatal">
        <xs:annotation>
          <xs:documentation>Likely to result in death if re-exposed.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="high">
        <xs:annotation>
          <xs:documentation>Likely to result in reactions that will need to be treated if re-exposed.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="medium">
        <xs:annotation>
          <xs:documentation>Likely to result in reactions that will inconvenience the subject.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="low">
        <xs:annotation>
          <xs:documentation>Not likely to result in any inconveniences for the subject.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>
  <xs:complexType name="Criticality">
    <xs:annotation>
      <xs:documentation>The criticality of an adverse sensitivity</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="Criticality-list" use="optional"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:simpleType name="SensitivityType-list">
    <xs:restriction base="xs:string">
      <xs:enumeration value="allergy">
        <xs:annotation>
          <xs:documentation>Allergic Reaction.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="intolerance">
        <xs:annotation>
          <xs:documentation>Non-Allergic Reaction.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="unknown">
        <xs:annotation>
          <xs:documentation>Unknown type.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>
  <xs:complexType name="SensitivityType">
    <xs:annotation>
      <xs:documentation>The type of an adverse sensitivity</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="SensitivityType-list" use="optional"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:element name="CarePlan" type="CarePlan">
    <xs:annotation>
      <xs:documentation>Describes the intention of how one or more practitioners intend to deliver care for a particular patient for a period of time, possibly limited to care for a specific condition or set of conditions.</xs:documentation>
    </xs:annotation>
  </xs:element>
  <xs:complexType name="CarePlan">
    <xs:annotation>
      <xs:documentation>Describes the intention of how one or more practitioners intend to deliver care for a particular patient for a period of time, possibly limited to care for a specific condition or set of conditions.</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>This records identifiers associated with this care plan that are defined by business processed and/ or used to refer to it when a direct URL reference to the resource itself is not appropriate (e.g. in CDA documents, or in written / printed documentation).</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="patient" minOccurs="0" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>Identifies the patient/subject whose intended care is described by the plan.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="status" minOccurs="1" maxOccurs="1" type="CarePlanStatus">
            <xs:annotation>
              <xs:documentation>Indicates whether the plan is currently being acted upon, represents future intentions or is now just historical record.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="period" minOccurs="0" maxOccurs="1" type="Period">
            <xs:annotation>
              <xs:documentation>Indicates when the plan did (or is intended to) come into effect and end.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="modified" minOccurs="0" maxOccurs="1" type="dateTime">
            <xs:annotation>
              <xs:documentation>Identifies the most recent date on which the plan has been revised.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="concern" minOccurs="0" maxOccurs="unbounded" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>Identifies the conditions/problems/concerns/diagnoses/etc. whose management and/or mitigation are handled by this plan.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="participant" type="CarePlan.Participant" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation>Identifies all people and organizations who are expected to be involved in the care envisioned by this plan.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="goal" type="CarePlan.Goal" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation>Describes the intended objective(s) of carrying out the Care Plan.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="activity" type="CarePlan.Activity" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation>Identifies a planned action to occur as part of the plan.  For example, a medication to be used, lab tests to perform, self-monitoring, education, etc.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="notes" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>General notes about the care plan not covered elsewhere.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="CarePlan.Participant">
    <xs:annotation>
      <xs:documentation>Describes the intention of how one or more practitioners intend to deliver care for a particular patient for a period of time, possibly limited to care for a specific condition or set of conditions.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="role" minOccurs="0" maxOccurs="1" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>Indicates specific responsibility of an individual within the care plan.  E.g. &quot;Primary physician&quot;, &quot;Team coordinator&quot;, &quot;Caregiver&quot;, etc.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="member" minOccurs="1" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>The specific person or organization who is participating/expected to participate in the care plan.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="CarePlan.Goal">
    <xs:annotation>
      <xs:documentation>Describes the intention of how one or more practitioners intend to deliver care for a particular patient for a period of time, possibly limited to care for a specific condition or set of conditions.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="description" minOccurs="1" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>Human-readable description of a specific desired objective of the care plan.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="status" minOccurs="0" maxOccurs="1" type="CarePlanGoalStatus">
            <xs:annotation>
              <xs:documentation>Indicates whether the goal has been reached and is still considered relevant.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="notes" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>Any comments related to the goal.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="concern" minOccurs="0" maxOccurs="unbounded" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>The identified conditions that this goal relates to - the condition that caused it to be created, or that it is intended to address.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="CarePlan.Activity">
    <xs:annotation>
      <xs:documentation>Describes the intention of how one or more practitioners intend to deliver care for a particular patient for a period of time, possibly limited to care for a specific condition or set of conditions.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="goal" type="xmlIdRef" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation>Internal reference that identifies the goals that this activity is intended to contribute towards meeting.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="status" minOccurs="0" maxOccurs="1" type="CarePlanActivityStatus">
            <xs:annotation>
              <xs:documentation>Identifies what progress is being made for the specific activity.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="prohibited" minOccurs="1" maxOccurs="1" type="boolean">
            <xs:annotation>
              <xs:documentation>If true, indicates that the described activity is one that must NOT be engaged in when following the plan.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="actionResulting" minOccurs="0" maxOccurs="unbounded" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>Resources that describe follow-on actions resulting from the plan, such as drug prescriptions, encounter records, appointments, etc.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="notes" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>Notes about the execution of the activity.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="detail" minOccurs="0" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>The details of the proposed activity represented in a specific resource.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="simple" type="CarePlan.Simple" minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>A simple summary of details suitable for a general care plan system (e.g. form driven) that doesn't know about specific resources such as procedure etc.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="CarePlan.Simple">
    <xs:annotation>
      <xs:documentation>Describes the intention of how one or more practitioners intend to deliver care for a particular patient for a period of time, possibly limited to care for a specific condition or set of conditions.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="category" minOccurs="1" maxOccurs="1" type="CarePlanActivityCategory">
            <xs:annotation>
              <xs:documentation>High-level categorization of the type of activity in a care plan.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="code" minOccurs="0" maxOccurs="1" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>Detailed description of the type of activity.  E.g. What lab test, what procedure, what kind of encounter.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:choice minOccurs="0" maxOccurs="1" >
            <xs:annotation>
              <xs:documentation>The period, timing or frequency upon which the described activity is to occur.</xs:documentation>
            </xs:annotation>
            <xs:element name="timingSchedule" type="Schedule"/>
            <xs:element name="timingPeriod" type="Period"/>
            <xs:element name="timingString" type="string"/>
          </xs:choice>
          <xs:element name="location" minOccurs="0" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>Identifies the facility where the activity will occur.  E.g. home, hospital, specific clinic, etc.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="performer" minOccurs="0" maxOccurs="unbounded" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>Identifies who's expected to be involved in the activity.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="product" minOccurs="0" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>Identifies the food, drug or other product being consumed or supplied in the activity.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="dailyAmount" minOccurs="0" maxOccurs="1" type="Quantity">
            <xs:annotation>
              <xs:documentation>Identifies the quantity expected to be consumed in a given day.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="quantity" minOccurs="0" maxOccurs="1" type="Quantity">
            <xs:annotation>
              <xs:documentation>Identifies the quantity expected to be supplied.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="details" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>This provides a textual description of constraints on the activity occurrence, including relation to other activities.  It may also include objectives, pre-conditions and end-conditions.  Finally, it may convey specifics about the activity such as body site, method, route, etc.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:simpleType name="CarePlanStatus-list">
    <xs:restriction base="xs:string">
      <xs:enumeration value="planned">
        <xs:annotation>
          <xs:documentation>The plan is in development or awaiting use but is not yet intended to be acted upon.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="active">
        <xs:annotation>
          <xs:documentation>The plan is intended to be followed and used as part of patient care.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="completed">
        <xs:annotation>
          <xs:documentation>The plan is no longer in use and is not expected to be followed or used in patient care.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>
  <xs:complexType name="CarePlanStatus">
    <xs:annotation>
      <xs:documentation>Indicates whether the plan is currently being acted upon, represents future intentions or is now just historical record.</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="CarePlanStatus-list" use="optional"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:simpleType name="CarePlanActivityCategory-list">
    <xs:restriction base="xs:string">
      <xs:enumeration value="diet">
        <xs:annotation>
          <xs:documentation>Plan for the patient to consume food of a specified nature.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="drug">
        <xs:annotation>
          <xs:documentation>Plan for the patient to consume/receive a drug, vaccine or other product.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="encounter">
        <xs:annotation>
          <xs:documentation>Plan to meet or communicate with the patient (in-patient, out-patient, phone call, etc.).</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="observation">
        <xs:annotation>
          <xs:documentation>Plan to capture information about a patient (vitals, labs, diagnostic images, etc.).</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="procedure">
        <xs:annotation>
          <xs:documentation>Plan to modify the patient in some way (surgery, physiotherapy, education, counseling, etc.).</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="supply">
        <xs:annotation>
          <xs:documentation>Plan to provide something to the patient (medication, medical supply, etc.).</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="other">
        <xs:annotation>
          <xs:documentation>Some other form of action.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>
  <xs:complexType name="CarePlanActivityCategory">
    <xs:annotation>
      <xs:documentation>High-level categorization of the type of activity in a care plan.</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="CarePlanActivityCategory-list" use="optional"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:simpleType name="CarePlanGoalStatus-list">
    <xs:restriction base="xs:string">
      <xs:enumeration value="in progress">
        <xs:annotation>
          <xs:documentation>The goal is being sought but has not yet been reached.  (Also applies if goal was reached in the past but there has been regression and goal is being sought again).</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="achieved">
        <xs:annotation>
          <xs:documentation>The goal has been met and no further action is needed.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="sustaining">
        <xs:annotation>
          <xs:documentation>The goal has been met, but ongoing activity is needed to sustain the goal objective.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="cancelled">
        <xs:annotation>
          <xs:documentation>The goal is no longer being sought.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>
  <xs:complexType name="CarePlanGoalStatus">
    <xs:annotation>
      <xs:documentation>Indicates whether the goal has been met and is still being targeted</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="CarePlanGoalStatus-list" use="optional"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:simpleType name="CarePlanActivityStatus-list">
    <xs:restriction base="xs:string">
      <xs:enumeration value="not started">
        <xs:annotation>
          <xs:documentation>Activity is planned but no action has yet been taken.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="scheduled">
        <xs:annotation>
          <xs:documentation>Appointment or other booking has occurred but activity has not yet begun.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="in progress">
        <xs:annotation>
          <xs:documentation>Activity has been started but is not yet complete.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="on hold">
        <xs:annotation>
          <xs:documentation>Activity was started but has temporarily ceased with an expectation of resumption at a future time.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="completed">
        <xs:annotation>
          <xs:documentation>The activities have been completed (more or less) as planned.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="cancelled">
        <xs:annotation>
          <xs:documentation>The activities have been ended prior to completion (perhaps even before they were started).</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>
  <xs:complexType name="CarePlanActivityStatus">
    <xs:annotation>
      <xs:documentation>Indicates where the activity is at in its overall life cycle</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="CarePlanActivityStatus-list" use="optional"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:element name="Composition" type="Composition">
    <xs:annotation>
      <xs:documentation>A set of healthcare-related information that is assembled together into a single logical document that provides a single coherent statement of meaning, establishes its own context and that has clinical attestation with regard to who is making the statement.</xs:documentation>
    </xs:annotation>
  </xs:element>
  <xs:complexType name="Composition">
    <xs:annotation>
      <xs:documentation>A set of healthcare-related information that is assembled together into a single logical document that provides a single coherent statement of meaning, establishes its own context and that has clinical attestation with regard to who is making the statement.</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="1" type="Identifier">
            <xs:annotation>
              <xs:documentation>Logical Identifier for the composition, assigned when created. This identifier stays constant as the composition is changed over time.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="date" minOccurs="1" maxOccurs="1" type="dateTime">
            <xs:annotation>
              <xs:documentation>The composition editing time, when the composition was last logically changed by the author.</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 composition (e.g. History and Physical, Discharge Summary, Progress Note). This usually equates to the purpose of making the composition.</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 composition. This may be implied by or derived from the code specified in the Composition Type.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="title" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>Official human-readable label for the composition.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="status" minOccurs="1" maxOccurs="1" type="CompositionStatus">
            <xs:annotation>
              <xs:documentation>The workflow/clinical status of this composition. The status is a marker for the clinical standing of the document.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="confidentiality" minOccurs="1" maxOccurs="1" type="Coding">
            <xs:annotation>
              <xs:documentation>The code specifying the level of confidentiality of the Composition.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="subject" minOccurs="1" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>Who or what the composition is about. The composition 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 livestock, or a set of patients that share a common exposure).</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 the information in the composition.  (Not necessarily who typed it in.).</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="attester" type="Composition.Attester" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation>A participant who has attested to the accuracy of the composition/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 composition/document information.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="event" type="Composition.Event" minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>The main event/act/item, such as a colonoscopy or an appendectomy, being documented.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="encounter" minOccurs="0" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>Describes the clinical encounter or type of care this documentation is associated with.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="section" type="Composition.Section" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation>The root of the sections that make up the composition.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="Composition.Attester">
    <xs:annotation>
      <xs:documentation>A set of healthcare-related information that is assembled together into a single logical document that provides a single coherent statement of meaning, establishes its own context and that has clinical attestation with regard to who is making the statement.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="mode" minOccurs="1" maxOccurs="unbounded" type="CompositionAttestationMode">
            <xs:annotation>
              <xs:documentation>The type of attestation the authenticator offers.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="time" minOccurs="0" maxOccurs="1" type="dateTime">
            <xs:annotation>
              <xs:documentation>When composition was attested by the party.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="party" minOccurs="0" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>Who attested the composition in the specified way.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="Composition.Event">
    <xs:annotation>
      <xs:documentation>A set of healthcare-related information that is assembled together into a single logical document that provides a single coherent statement of meaning, establishes its own context and that has clinical attestation with regard to who is making the statement.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="code" 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 period of time covered by the documentation. There is no assertion that the documentation is a complete representation for this period, only that it documents events during this time.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="detail" minOccurs="0" maxOccurs="unbounded" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>Full details for the event(s) the composition/documentation consents.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="Composition.Section">
    <xs:annotation>
      <xs:documentation>A set of healthcare-related information that is assembled together into a single logical document that provides a single coherent statement of meaning, establishes its own context and that has clinical attestation with regard to who is making the statement.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="title" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>The heading for this particular section.  This will be part of the rendered content for the document.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="code" minOccurs="0" maxOccurs="1" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>A code identifying the kind of content contained within the section.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="subject" minOccurs="0" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>Identifies the primary subject of the section.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="content" minOccurs="0" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>Identifies the discrete data that provides the content for the section.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="section" type="Composition.Section" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation>A nested sub-section within this section.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:simpleType name="CompositionStatus-list">
    <xs:restriction base="xs:string">
      <xs:enumeration value="preliminary">
        <xs:annotation>
          <xs:documentation>This is a preliminary composition or document (also known as initial or interim). The content may be incomplete or unverified.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="final">
        <xs:annotation>
          <xs:documentation>The composition or document is complete and verified by an appropriate person, and no further work is planned.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="appended">
        <xs:annotation>
          <xs:documentation>The composition or document has been modified subsequent to being released as &quot;final&quot;, and is complete and verified by an authorized person. The modifications added new information to the composition or document, but did not revise existing content.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="amended">
        <xs:annotation>
          <xs:documentation>The composition or document has been modified subsequent to being released as &quot;final&quot;, and is complete and verified by an authorized person.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="entered in error">
        <xs:annotation>
          <xs:documentation>The composition or document was originally created/issued in error, and this is an amendment that marks that the entire series should not be considered as valid.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>
  <xs:complexType name="CompositionStatus">
    <xs:annotation>
      <xs:documentation>The workflow/clinical status of the composition</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="CompositionStatus-list" use="optional"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:simpleType name="CompositionAttestationMode-list">
    <xs:restriction base="xs:string">
      <xs:enumeration value="personal">
        <xs:annotation>
          <xs:documentation>The person authenticated the content in their personal capacity.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="professional">
        <xs:annotation>
          <xs:documentation>The person authenticated the content in their professional capacity.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="legal">
        <xs:annotation>
          <xs:documentation>The person authenticated the content and accepted legal responsibility for its content.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="official">
        <xs:annotation>
          <xs:documentation>The organization authenticated the content as consistent with their policies and procedures.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>
  <xs:complexType name="CompositionAttestationMode">
    <xs:annotation>
      <xs:documentation>The way in which a person authenticated a composition</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="CompositionAttestationMode-list" use="optional"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:element name="ConceptMap" type="ConceptMap">
    <xs:annotation>
      <xs:documentation>A statement of relationships from one set of concepts to one or more other concept systems.</xs:documentation>
    </xs:annotation>
  </xs:element>
  <xs:complexType name="ConceptMap">
    <xs:annotation>
      <xs:documentation>A statement of relationships from one set of concepts to one or more other concept systems.</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="1" type="string">
            <xs:annotation>
              <xs:documentation>The identifier that is used to identify this concept map when it is referenced in a specification, model, design or an instance (should be globally unique OID, UUID, or URI).</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="version" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>The identifier that is used to identify this version of the concept map when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the profile author manually and the value should be a timestamp.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="name" minOccurs="1" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>A free text natural language name describing the concept map.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="publisher" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>The name of the individual or organization that published the concept map.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="telecom" minOccurs="0" maxOccurs="unbounded" type="Contact">
            <xs:annotation>
              <xs:documentation>Contacts of the publisher to assist a user in finding and communicating with the publisher.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="description" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>A free text natural language description of the use of the concept map - reason for definition, conditions of use, etc.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="copyright" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>A copyright statement relating to the concept map and/or its contents.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="status" minOccurs="1" maxOccurs="1" type="ValueSetStatus">
            <xs:annotation>
              <xs:documentation>The status of the concept map.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="experimental" minOccurs="0" maxOccurs="1" type="boolean">
            <xs:annotation>
              <xs:documentation>This ConceptMap was authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="date" minOccurs="0" maxOccurs="1" type="dateTime">
            <xs:annotation>
              <xs:documentation>The date that the concept map status was last changed.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="source" minOccurs="1" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>The source value set that specifies the concepts that are being mapped.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="target" minOccurs="1" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>The target value set provides context to the mappings. Note that the mapping is made between concepts, not between value sets, but the value set provides important context about how the concept mapping choices are made.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="concept" type="ConceptMap.Concept" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation>Mappings for a concept from the source valueset.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="ConceptMap.Concept">
    <xs:annotation>
      <xs:documentation>A statement of relationships from one set of concepts to one or more other concept systems.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="system" minOccurs="1" maxOccurs="1" type="uri">
            <xs:annotation>
              <xs:documentation>System that defines the concept being mapped.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="code" minOccurs="0" maxOccurs="1" type="code">
            <xs:annotation>
              <xs:documentation>Identifies concept being mapped.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="dependsOn" type="ConceptMap.DependsOn" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation>A set of additional dependencies for this mapping to hold. This mapping is only applicable if the specified concept can be resolved, and it has the specified value.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="map" type="ConceptMap.Map" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation>A concept from the target value set that this concept maps to.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="ConceptMap.DependsOn">
    <xs:annotation>
      <xs:documentation>A statement of relationships from one set of concepts to one or more other concept systems.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="concept" minOccurs="1" maxOccurs="1" type="uri">
            <xs:annotation>
              <xs:documentation>A reference to a specific concept that holds a coded value. This can be an element in a FHIR resource, or a specific reference to a data element in a different specification (e.g. v2) or a general reference to a kind of data field, or a reference to a value set with an appropriately narrow definition.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="system" minOccurs="1" maxOccurs="1" type="uri">
            <xs:annotation>
              <xs:documentation>System for a concept in the referenced concept.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="code" minOccurs="1" maxOccurs="1" type="code">
            <xs:annotation>
              <xs:documentation>Code for a concept in the referenced concept.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="ConceptMap.Map">
    <xs:annotation>
      <xs:documentation>A statement of relationships from one set of concepts to one or more other concept systems.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="system" minOccurs="0" maxOccurs="1" type="uri">
            <xs:annotation>
              <xs:documentation>System of the target.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="code" minOccurs="0" maxOccurs="1" type="code">
            <xs:annotation>
              <xs:documentation>Code that identifies the target concept.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="equivalence" minOccurs="1" maxOccurs="1" type="ConceptMapEquivalence">
            <xs:annotation>
              <xs:documentation>equal | equivalent | wider | subsumes | narrower | specialises | inexact | unmatched | disjoint.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="comments" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>Description of status/issues in mapping.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="product" type="ConceptMap.DependsOn" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation>A set of additional outcomes from this mapping to other value sets. To properly execute this mapping, the specified value set must be mapped to some data element or source that is in context. The mapping may still be useful without a place for the additional data elements, but the equivalence cannot be relied on.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:simpleType name="ConceptMapEquivalence-list">
    <xs:restriction base="xs:string">
      <xs:enumeration value="equal">
        <xs:annotation>
          <xs:documentation>The definitions of the concepts are exactly the same (i.e. only grammatical differences) and structural implications of meaning are identifical or irrelevant (i.e. intensionally identical).</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="equivalent">
        <xs:annotation>
          <xs:documentation>The definitions of the concepts mean the same thing (including when structural implications of meaning are considered) (i.e. extensionally identical).</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="wider">
        <xs:annotation>
          <xs:documentation>The target mapping is wider in meaning than the source concept.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="subsumes">
        <xs:annotation>
          <xs:documentation>The target mapping subsumes the meaning of the source concept (e.g. the source is-a target).</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="narrower">
        <xs:annotation>
          <xs:documentation>The target mapping is narrower in meaning that the source concept. The sense in which the mapping is narrower SHALL be described in the comments in this case, and applications should be careful when atempting to use these mappings operationally.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="specialises">
        <xs:annotation>
          <xs:documentation>The target mapping specialises the meaning of the source concept (e.g. the target is-a source).</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="inexact">
        <xs:annotation>
          <xs:documentation>The target mapping overlaps with the source concept, but both source and target cover additional meaning. The sense in which the mapping is narrower SHALL be described in the comments in this case, and applications should be careful when atempting to use these mappings operationally.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="unmatched">
        <xs:annotation>
          <xs:documentation>There is no match for this concept in the destination concept system.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="disjoint">
        <xs:annotation>
          <xs:documentation>This is an explicit assertion that there is no mapping between the source and target concept.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>
  <xs:complexType name="ConceptMapEquivalence">
    <xs:annotation>
      <xs:documentation>The degree of equivalence between concepts</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="ConceptMapEquivalence-list" use="optional"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:element name="Condition" type="Condition">
    <xs:annotation>
      <xs:documentation>Use to record detailed information about conditions, problems or diagnoses recognized by a clinician. There are many uses including: recording a Diagnosis during an Encounter; populating a problem List or a Summary Statement, such as a Discharge Summary.</xs:documentation>
    </xs:annotation>
  </xs:element>
  <xs:complexType name="Condition">
    <xs:annotation>
      <xs:documentation>Use to record detailed information about conditions, problems or diagnoses recognized by a clinician. There are many uses including: recording a Diagnosis during an Encounter; populating a problem List or a Summary Statement, such as a Discharge Summary.</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>This records identifiers associated with this condition that are defined by business processed and/ or used to refer to it when a direct URL reference to the resource itself is not appropriate (e.g. in CDA documents, or in written / printed documentation).</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="subject" minOccurs="1" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>Indicates the patient who the condition record is associated with.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="encounter" minOccurs="0" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>Encounter during which the condition was first asserted.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="asserter" minOccurs="0" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>Person who takes responsibility for asserting the existence of the condition as part of the electronic record.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="dateAsserted" minOccurs="0" maxOccurs="1" type="date">
            <xs:annotation>
              <xs:documentation>Estimated or actual date the condition/problem/diagnosis was first detected/suspected.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="code" minOccurs="1" maxOccurs="1" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>Identification of the condition, problem or diagnosis.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="category" minOccurs="0" maxOccurs="1" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>A category assigned to the condition. E.g. complaint | symptom | finding | diagnosis.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="status" minOccurs="1" maxOccurs="1" type="ConditionStatus">
            <xs:annotation>
              <xs:documentation>The clinical status of the condition.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="certainty" minOccurs="0" maxOccurs="1" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>The degree of confidence that this condition is correct.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="severity" minOccurs="0" maxOccurs="1" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>A subjective assessment of the severity of the condition as evaluated by the clinician.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:choice minOccurs="0" maxOccurs="1" >
            <xs:annotation>
              <xs:documentation>Estimated or actual date the condition began, in the opinion of the clinician.</xs:documentation>
            </xs:annotation>
            <xs:element name="onsetDate" type="date"/>
            <xs:element name="onsetAge" type="Age"/>
          </xs:choice>
          <xs:choice minOccurs="0" maxOccurs="1" >
            <xs:annotation>
              <xs:documentation>The date or estimated date that the condition resolved or went into remission. This is called &quot;abatement&quot; because of the many overloaded connotations associated with &quot;remission&quot; or &quot;resolution&quot; - Conditions are never really resolved, but they can abate.</xs:documentation>
            </xs:annotation>
            <xs:element name="abatementDate" type="date"/>
            <xs:element name="abatementAge" type="Age"/>
            <xs:element name="abatementBoolean" type="boolean"/>
          </xs:choice>
          <xs:element name="stage" type="Condition.Stage" minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>Clinical stage or grade of a condition. May include formal severity assessments.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="evidence" type="Condition.Evidence" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation>Supporting Evidence / manifestations that are the basis on which this condition is suspected or confirmed.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="location" type="Condition.Location" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation>The anatomical location where this condition manifests itself.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="relatedItem" type="Condition.RelatedItem" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation>Further conditions, problems, diagnoses, procedures or events that are related in some way to this condition, or the substance that caused/triggered this Condition.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="notes" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>Additional information about the Condition. This is a general notes/comments entry  for description of the Condition, its diagnosis and prognosis.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="Condition.Stage">
    <xs:annotation>
      <xs:documentation>Use to record detailed information about conditions, problems or diagnoses recognized by a clinician. There are many uses including: recording a Diagnosis during an Encounter; populating a problem List or a Summary Statement, such as a Discharge Summary.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="summary" minOccurs="0" maxOccurs="1" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>A simple summary of the stage such as &quot;Stage 3&quot;. The determination of the stage is disease-specific.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="assessment" minOccurs="0" maxOccurs="unbounded" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>Reference to a formal record of the evidence on which the staging assessment is based.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="Condition.Evidence">
    <xs:annotation>
      <xs:documentation>Use to record detailed information about conditions, problems or diagnoses recognized by a clinician. There are many uses including: recording a Diagnosis during an Encounter; populating a problem List or a Summary Statement, such as a Discharge Summary.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="code" minOccurs="0" maxOccurs="1" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>A manifestation or symptom that led to the recording of this condition.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="detail" minOccurs="0" maxOccurs="unbounded" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>Links to other relevant information, including pathology reports.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="Condition.Location">
    <xs:annotation>
      <xs:documentation>Use to record detailed information about conditions, problems or diagnoses recognized by a clinician. There are many uses including: recording a Diagnosis during an Encounter; populating a problem List or a Summary Statement, such as a Discharge Summary.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="code" minOccurs="0" maxOccurs="1" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>Code that identifies the structural location.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="detail" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>Detailed anatomical location information.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="Condition.RelatedItem">
    <xs:annotation>
      <xs:documentation>Use to record detailed information about conditions, problems or diagnoses recognized by a clinician. There are many uses including: recording a Diagnosis during an Encounter; populating a problem List or a Summary Statement, such as a Discharge Summary.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="type" minOccurs="1" maxOccurs="1" type="ConditionRelationshipType">
            <xs:annotation>
              <xs:documentation>The type of relationship that this condition has to the related item.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="code" minOccurs="0" maxOccurs="1" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>Code that identifies the target of this relationship. The code takes the place of a detailed instance target.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="target" minOccurs="0" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>Target of the relationship.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:simpleType name="ConditionStatus-list">
    <xs:restriction base="xs:string">
      <xs:enumeration value="provisional">
        <xs:annotation>
          <xs:documentation>This is a tentative diagnosis - still a candidate that is under consideration.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="working">
        <xs:annotation>
          <xs:documentation>The patient is being treated on the basis that this is the condition, but it is still not confirmed.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="confirmed">
        <xs:annotation>
          <xs:documentation>There is sufficient diagnostic and/or clinical evidence to treat this as a confirmed condition.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="refuted">
        <xs:annotation>
          <xs:documentation>This condition has been ruled out by diagnostic and clinical evidence.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>
  <xs:complexType name="ConditionStatus">
    <xs:annotation>
      <xs:documentation>The clinical status of the Condition or diagnosis</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="ConditionStatus-list" use="optional"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:simpleType name="ConditionRelationshipType-list">
    <xs:restriction base="xs:string">
      <xs:enumeration value="due-to">
        <xs:annotation>
          <xs:documentation>this condition follows the identified condition/procedure/substance and is a consequence of it.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="following">
        <xs:annotation>
          <xs:documentation>this condition follows the identified condition/procedure/substance, but it is not known whether they are causually linked.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>
  <xs:complexType name="ConditionRelationshipType">
    <xs:annotation>
      <xs:documentation>The type of relationship between a condition and its related item</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="ConditionRelationshipType-list" use="optional"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:element name="Conformance" type="Conformance">
    <xs:annotation>
      <xs:documentation>A conformance statement is a set of requirements for a desired implementation or a description of how a target application fulfills those requirements in a particular implementation.</xs:documentation>
    </xs:annotation>
  </xs:element>
  <xs:complexType name="Conformance">
    <xs:annotation>
      <xs:documentation>A conformance statement is a set of requirements for a desired implementation or a description of how a target application fulfills those requirements in a particular implementation.</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="1" type="string">
            <xs:annotation>
              <xs:documentation>The identifier that is used to identify this conformance statement when it is referenced in a specification, model, design or an instance (should be globally unique OID, UUID, or URI).</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="version" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>The identifier that is used to identify this version of the conformance statement when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the profile author manually and the value should be a timestamp.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="name" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>A free text natural language name identifying the conformance statement.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="publisher" minOccurs="1" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>Name of Organization publishing this conformance statement.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="telecom" minOccurs="0" maxOccurs="unbounded" type="Contact">
            <xs:annotation>
              <xs:documentation>Contacts for Organization relevant to this conformance statement.  The contacts may be a website, email, phone numbers, etc.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="description" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>A free text natural language description of the conformance statement and its use. Typically, this is used when the profile describes a desired rather than an actual solution, for example as a formal expression of requirements as part of an RFP.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="status" minOccurs="0" maxOccurs="1" type="ConformanceStatementStatus">
            <xs:annotation>
              <xs:documentation>The status of this conformance statement.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="experimental" minOccurs="0" maxOccurs="1" type="boolean">
            <xs:annotation>
              <xs:documentation>A flag to indicate that this conformance statement is authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="date" minOccurs="1" maxOccurs="1" type="dateTime">
            <xs:annotation>
              <xs:documentation>The date when the conformance statement was published.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="software" type="Conformance.Software" minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>Software that is covered by this conformance statement.  It is used when the profile describes the capabilities of a particular software version, independent of an installation.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="implementation" type="Conformance.Implementation" minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>Identifies a specific implementation instance that is described by the conformance statement - i.e. a particular installation, rather than the capabilities of a software program.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="fhirVersion" minOccurs="1" maxOccurs="1" type="id">
            <xs:annotation>
              <xs:documentation>The version of the FHIR specification on which this conformance statement is based.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="acceptUnknown" minOccurs="1" maxOccurs="1" type="boolean">
            <xs:annotation>
              <xs:documentation>A flag that indicates whether the application accepts unknown elements as part of a resource.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="format" minOccurs="1" maxOccurs="unbounded" type="code">
            <xs:annotation>
              <xs:documentation>A list of the formats supported by this implementation.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="profile" minOccurs="0" maxOccurs="unbounded" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>A list of profiles supported by the system. For a server, &quot;supported by the system&quot; means the system hosts/produces a set of recourses, conformant to a particular profile, and allows its clients to search using this profile and to find appropriate data. For a client, it means the system will search by this profile and process data according to the guidance implicit in the profile.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="rest" type="Conformance.Rest" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation>A definition of the restful capabilities of the solution, if any.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="messaging" type="Conformance.Messaging" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation>A description of the messaging capabilities of the solution.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="document" type="Conformance.Document" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation>A document definition.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="Conformance.Software">
    <xs:annotation>
      <xs:documentation>A conformance statement is a set of requirements for a desired implementation or a description of how a target application fulfills those requirements in a particular implementation.</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>Name software is known by.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="version" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>The version identifier for the software covered by this statement.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="releaseDate" minOccurs="0" maxOccurs="1" type="dateTime">
            <xs:annotation>
              <xs:documentation>Date this version of the software released.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="Conformance.Implementation">
    <xs:annotation>
      <xs:documentation>A conformance statement is a set of requirements for a desired implementation or a description of how a target application fulfills those requirements in a particular implementation.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="description" minOccurs="1" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>Information about the specific installation that this conformance statement relates to.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="url" minOccurs="0" maxOccurs="1" type="uri">
            <xs:annotation>
              <xs:documentation>A base URL for the implementation.  This forms the base for REST interfaces as well as the mailbox and document interfaces.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="Conformance.Rest">
    <xs:annotation>
      <xs:documentation>A conformance statement is a set of requirements for a desired implementation or a description of how a target application fulfills those requirements in a particular implementation.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="mode" minOccurs="1" maxOccurs="1" type="RestfulConformanceMode">
            <xs:annotation>
              <xs:documentation>Identifies whether this portion of the statement is describing ability to initiate or receive restful operations.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="documentation" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>Information about the system's restful capabilities that apply across all applications, such as security.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="security" type="Conformance.Security" minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>Information about security of implementation.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="resource" type="Conformance.Resource" minOccurs="1" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation>A specification of the restful capabilities of the solution for a specific resource type.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="operation" type="Conformance.Operation1" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation>A specification of restful operations supported by the system.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="query" type="Conformance.Query" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation>Definition of a named query and its parameters and their meaning.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="documentMailbox" minOccurs="0" maxOccurs="unbounded" type="uri">
            <xs:annotation>
              <xs:documentation>A list of profiles that this server implements for accepting documents in the mailbox. If this list is empty, then documents are not accepted. The base specification has the profile identifier &quot;http://hl7.org/fhir/documents/mailbox&quot;. Other specifications can declare their own identifier for this purpose.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="Conformance.Security">
    <xs:annotation>
      <xs:documentation>A conformance statement is a set of requirements for a desired implementation or a description of how a target application fulfills those requirements in a particular implementation.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="cors" minOccurs="0" maxOccurs="1" type="boolean">
            <xs:annotation>
              <xs:documentation>Server adds CORS headers when responding to requests - this enables javascript applications to yuse the server.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="service" minOccurs="0" maxOccurs="unbounded" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>Types of security services are supported/required by the system.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="description" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>General description of how security works.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="certificate" type="Conformance.Certificate" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation>Certificates associated with security profiles.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="Conformance.Certificate">
    <xs:annotation>
      <xs:documentation>A conformance statement is a set of requirements for a desired implementation or a description of how a target application fulfills those requirements in a particular implementation.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="type" minOccurs="0" maxOccurs="1" type="code">
            <xs:annotation>
              <xs:documentation>Mime type for certificate.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="blob" minOccurs="0" maxOccurs="1" type="base64Binary">
            <xs:annotation>
              <xs:documentation>Actual certificate.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="Conformance.Resource">
    <xs:annotation>
      <xs:documentation>A conformance statement is a set of requirements for a desired implementation or a description of how a target application fulfills those requirements in a particular implementation.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="type" minOccurs="1" maxOccurs="1" type="code">
            <xs:annotation>
              <xs:documentation>A type of resource exposed via the restful interface.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="profile" minOccurs="0" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>A specification of the profile that describes the solution's support for the resource, including any constraints on cardinality, bindings, lengths or other limitations.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="operation" type="Conformance.Operation" minOccurs="1" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation>Identifies a restful operation supported by the solution.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="readHistory" minOccurs="0" maxOccurs="1" type="boolean">
            <xs:annotation>
              <xs:documentation>A flag for whether the server is able to return past versions as part of the vRead operation.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="updateCreate" minOccurs="0" maxOccurs="1" type="boolean">
            <xs:annotation>
              <xs:documentation>A flag to indicate that the server allows the client to create new identities on the server. If the update operation is used (client) or allowed (server) to a new location where a resource doesn't already exist. This means that the server allows the client to create new identities on the server.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="searchInclude" minOccurs="0" maxOccurs="unbounded" type="string">
            <xs:annotation>
              <xs:documentation>A list of _include values supported by the server.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="searchParam" type="Conformance.SearchParam" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation>Additional search parameters for implementations to support and/or make use of.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="Conformance.Operation">
    <xs:annotation>
      <xs:documentation>A conformance statement is a set of requirements for a desired implementation or a description of how a target application fulfills those requirements in a particular implementation.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="code" minOccurs="1" maxOccurs="1" type="RestfulOperationType">
            <xs:annotation>
              <xs:documentation>Coded identifier of the operation, supported by the system resource.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="documentation" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>Guidance specific to the implementation of this operation, such as 'delete is a logical delete' or 'updates are only allowed with version id' or 'creates permitted from pre-authorized certificates only'.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="Conformance.SearchParam">
    <xs:annotation>
      <xs:documentation>A conformance statement is a set of requirements for a desired implementation or a description of how a target application fulfills those requirements in a particular implementation.</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 the search parameter used in the interface.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="definition" minOccurs="0" maxOccurs="1" type="uri">
            <xs:annotation>
              <xs:documentation>A formal reference to where this parameter was first defined, so that a client can be confident of the meaning of the search parameter.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="type" minOccurs="1" maxOccurs="1" type="SearchParamType">
            <xs:annotation>
              <xs:documentation>The type of value a search parameter refers to, and how the content is interpreted.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="documentation" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>This allows documentation of any distinct behaviors about how the search parameter is used.  For example, text matching algorithms.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="target" minOccurs="0" maxOccurs="unbounded" type="code">
            <xs:annotation>
              <xs:documentation>Types of resource (if a resource is referenced).</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="chain" minOccurs="0" maxOccurs="unbounded" type="string">
            <xs:annotation>
              <xs:documentation>Chained names supported.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="Conformance.Operation1">
    <xs:annotation>
      <xs:documentation>A conformance statement is a set of requirements for a desired implementation or a description of how a target application fulfills those requirements in a particular implementation.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="code" minOccurs="1" maxOccurs="1" type="RestfulOperationSystem">
            <xs:annotation>
              <xs:documentation>A coded identifier of the operation, supported by the system.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="documentation" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>Guidance specific to the implementation of this operation, such as limitations on the kind of transactions allowed, or information about system wide search is implemented.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="Conformance.Query">
    <xs:annotation>
      <xs:documentation>A conformance statement is a set of requirements for a desired implementation or a description of how a target application fulfills those requirements in a particular implementation.</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 query, which is used in the _query parameter when the query is called.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="definition" minOccurs="1" maxOccurs="1" type="uri">
            <xs:annotation>
              <xs:documentation>Identifies the custom query, defined either in FHIR core or another profile.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="documentation" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>Additional information about how the query functions in this particular implementation.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="parameter" type="Conformance.SearchParam" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation>Identifies which of the parameters for the named query are supported.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="Conformance.Messaging">
    <xs:annotation>
      <xs:documentation>A conformance statement is a set of requirements for a desired implementation or a description of how a target application fulfills those requirements in a particular implementation.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="endpoint" minOccurs="0" maxOccurs="1" type="uri">
            <xs:annotation>
              <xs:documentation>An address to which messages and/or replies are to be sent.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="reliableCache" minOccurs="0" maxOccurs="1" type="integer">
            <xs:annotation>
              <xs:documentation>Length if the receiver's reliable messaging cache (if a receiver) or how long the cache length on the receiver should be (if a sender).</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="documentation" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>Documentation about the system's messaging capabilities for this endpoint not otherwise documented by the conformance statement.  For example, process for becoming an authorized messaging exchange partner.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="event" type="Conformance.Event" minOccurs="1" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation>A description of the solution's support for an event at this end point.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="Conformance.Event">
    <xs:annotation>
      <xs:documentation>A conformance statement is a set of requirements for a desired implementation or a description of how a target application fulfills those requirements in a particular implementation.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="code" minOccurs="1" maxOccurs="1" type="Coding">
            <xs:annotation>
              <xs:documentation>A coded identifier of a supported messaging event.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="category" minOccurs="0" maxOccurs="1" type="MessageSignificanceCategory">
            <xs:annotation>
              <xs:documentation>The impact of the content of the message.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="mode" minOccurs="1" maxOccurs="1" type="ConformanceEventMode">
            <xs:annotation>
              <xs:documentation>The mode of this event declaration - whether application is sender or receiver.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="protocol" minOccurs="0" maxOccurs="unbounded" type="Coding">
            <xs:annotation>
              <xs:documentation>A list of the messaging transport protocol(s) identifiers, supported by this endpoint.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="focus" minOccurs="1" maxOccurs="1" type="code">
            <xs:annotation>
              <xs:documentation>A resource associated with the event.  This is the resource that defines the event.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="request" minOccurs="1" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>Information about the request for this event.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="response" minOccurs="1" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>Information about the response for this event.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="documentation" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>Guidance on how this event is handled, such as internal system trigger points, business rules, etc.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="Conformance.Document">
    <xs:annotation>
      <xs:documentation>A conformance statement is a set of requirements for a desired implementation or a description of how a target application fulfills those requirements in a particular implementation.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="mode" minOccurs="1" maxOccurs="1" type="DocumentMode">
            <xs:annotation>
              <xs:documentation>Mode of this document declaration - whether application is producer or consumer.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="documentation" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>A description of how the application supports or uses the specified document profile.  For example, when are documents created, what action is taken with consumed documents, etc.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="profile" minOccurs="1" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>A constraint on a resource used in the document.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:simpleType name="DocumentMode-list">
    <xs:restriction base="xs:string">
      <xs:enumeration value="producer">
        <xs:annotation>
          <xs:documentation>The application produces documents of the specified type.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="consumer">
        <xs:annotation>
          <xs:documentation>The application consumes documents of the specified type.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>
  <xs:complexType name="DocumentMode">
    <xs:annotation>
      <xs:documentation>Whether the application produces or consumes 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="DocumentMode-list" use="optional"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:simpleType name="RestfulConformanceMode-list">
    <xs:restriction base="xs:string">
      <xs:enumeration value="client">
        <xs:annotation>
          <xs:documentation>The application acts as a server for this resource.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="server">
        <xs:annotation>
          <xs:documentation>The application acts as a client for this resource.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>
  <xs:complexType name="RestfulConformanceMode">
    <xs:annotation>
      <xs:documentation>The mode of a RESTful conformance statement</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="RestfulConformanceMode-list" use="optional"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:simpleType name="ConformanceEventMode-list">
    <xs:restriction base="xs:string">
      <xs:enumeration value="sender">
        <xs:annotation>
          <xs:documentation>The application sends requests and receives responses.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="receiver">
        <xs:annotation>
          <xs:documentation>The application receives requests and sends responses.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>
  <xs:complexType name="ConformanceEventMode">
    <xs:annotation>
      <xs:documentation>The mode of a message conformance statement</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="ConformanceEventMode-list" use="optional"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:simpleType name="MessageSignificanceCategory-list">
    <xs:restriction base="xs:string">
      <xs:enumeration value="Consequence">
        <xs:annotation>
          <xs:documentation>The message represents/requests a change that should not be processed more than once. E.g. Making a booking for an appointment.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="Currency">
        <xs:annotation>
          <xs:documentation>The message represents a response to query for current information. Retrospective processing is wrong and/or wasteful.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="Notification">
        <xs:annotation>
          <xs:documentation>The content is not necessarily intended to be current, and it can be reprocessed, though there may be version issues created by processing old notifications.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>
  <xs:complexType name="MessageSignificanceCategory">
    <xs:annotation>
      <xs:documentation>The impact of the content of a message</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="MessageSignificanceCategory-list" use="optional"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:simpleType name="RestfulOperationType-list">
    <xs:restriction base="xs:string">
      <xs:enumeration value="read">
        <xs:annotation>
          <xs:documentation></xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="vread">
        <xs:annotation>
          <xs:documentation></xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="update">
        <xs:annotation>
          <xs:documentation></xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="delete">
        <xs:annotation>
          <xs:documentation></xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="history-instance">
        <xs:annotation>
          <xs:documentation></xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="validate">
        <xs:annotation>
          <xs:documentation></xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="history-type">
        <xs:annotation>
          <xs:documentation></xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="create">
        <xs:annotation>
          <xs:documentation></xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="search-type">
        <xs:annotation>
          <xs:documentation></xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>
  <xs:complexType name="RestfulOperationType">
    <xs:annotation>
      <xs:documentation>Operations supported by REST at the type or instance level</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="RestfulOperationType-list" use="optional"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:simpleType name="ConformanceStatementStatus-list">
    <xs:restriction base="xs:string">
      <xs:enumeration value="draft">
        <xs:annotation>
          <xs:documentation>This conformance statement is still under development.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="active">
        <xs:annotation>
          <xs:documentation>This conformance statement is ready for use in production systems.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="retired">
        <xs:annotation>
          <xs:documentation>This conformance statement has been withdrawn or superceded and should no longer be used.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>
  <xs:complexType name="ConformanceStatementStatus">
    <xs:annotation>
      <xs:documentation>The status of this conformance statement</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="ConformanceStatementStatus-list" use="optional"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:simpleType name="RestfulOperationSystem-list">
    <xs:restriction base="xs:string">
      <xs:enumeration value="transaction">
        <xs:annotation>
          <xs:documentation></xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="search-system">
        <xs:annotation>
          <xs:documentation></xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="history-system">
        <xs:annotation>
          <xs:documentation></xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>
  <xs:complexType name="RestfulOperationSystem">
    <xs:annotation>
      <xs:documentation>Operations supported by REST at the system level</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="RestfulOperationSystem-list" use="optional"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:element name="Device" type="Device">
    <xs:annotation>
      <xs:documentation>This resource identifies an instance of a manufactured thing that is used in the provision of healthcare without being substantially changed through that activity. The device may be a machine, an insert, a computer, an application, etc. This includes durable (reusable) medical equipment as well as disposable equipment used for diagnostic, treatment, and research for healthcare and public health.</xs:documentation>
    </xs:annotation>
  </xs:element>
  <xs:complexType name="Device">
    <xs:annotation>
      <xs:documentation>This resource identifies an instance of a manufactured thing that is used in the provision of healthcare without being substantially changed through that activity. The device may be a machine, an insert, a computer, an application, etc. This includes durable (reusable) medical equipment as well as disposable equipment used for diagnostic, treatment, and research for healthcare and public health.</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>Identifiers assigned to this device by various organizations. The most likely organizations to assign identifiers are the manufacturer and the owner, though regulatory agencies may also assign an identifier. The identifiers identify the particular device, not the kind of device.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="type" minOccurs="1" maxOccurs="1" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>A kind of this device.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="manufacturer" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>A name of the manufacturer.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="model" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>The &quot;model&quot; - an identifier assigned by the manufacturer to identify the product by its type. This number is shared by the all devices sold as the same type.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="version" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>The version of the device, if the device has multiple releases under the same model, or if the device is software or carries firmware.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="expiry" minOccurs="0" maxOccurs="1" type="date">
            <xs:annotation>
              <xs:documentation>Date of expiry of this device (if applicable).</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="udi" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>FDA Mandated Unique Device Identifier. Use the human readable information (the content that the user sees, which is sometimes different to the exact syntax represented in the barcode)  - see http://www.fda.gov/MedicalDevices/DeviceRegulationandGuidance/UniqueDeviceIdentification/default.htm.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="lotNumber" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>Lot number assigned by the manufacturer.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="owner" minOccurs="0" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>An organization that is responsible for the provision and ongoing maintenance of the device.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="location" minOccurs="0" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>The resource may be found in a literal location (i.e. GPS coordinates), a logical place (i.e. &quot;in/with the patient&quot;), or a coded location.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="patient" minOccurs="0" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>Patient information, if the resource is affixed to a person.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="contact" minOccurs="0" maxOccurs="unbounded" type="Contact">
            <xs:annotation>
              <xs:documentation>Contact details for an organization or a particular human that is responsible for the device.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="url" minOccurs="0" maxOccurs="1" type="uri">
            <xs:annotation>
              <xs:documentation>A network address on which the device may be contacted directly.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:element name="DeviceObservationReport" type="DeviceObservationReport">
    <xs:annotation>
      <xs:documentation>Describes the data produced by a device at a point in time.</xs:documentation>
    </xs:annotation>
  </xs:element>
  <xs:complexType name="DeviceObservationReport">
    <xs:annotation>
      <xs:documentation>Describes the data produced by a device at a point in time.</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="instant" minOccurs="1" maxOccurs="1" type="instant">
            <xs:annotation>
              <xs:documentation>The point in time that the values are reported.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="identifier" minOccurs="0" maxOccurs="1" type="Identifier">
            <xs:annotation>
              <xs:documentation>An identifier assigned to this observation bu the source device that made the observation.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="source" minOccurs="1" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>Identification information for the device that is the source of the data.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="subject" minOccurs="0" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>The subject of the measurement.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="virtualDevice" type="DeviceObservationReport.VirtualDevice" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation>A medical-related subsystem of a medical device.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="DeviceObservationReport.VirtualDevice">
    <xs:annotation>
      <xs:documentation>Describes the data produced by a device at a point in time.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="code" minOccurs="0" maxOccurs="1" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>Describes the compartment.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="channel" type="DeviceObservationReport.Channel" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation>Groups together physiological measurement data and derived data.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="DeviceObservationReport.Channel">
    <xs:annotation>
      <xs:documentation>Describes the data produced by a device at a point in time.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="code" minOccurs="0" maxOccurs="1" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>Describes the channel.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="metric" type="DeviceObservationReport.Metric" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation>A piece of measured or derived data that is reported by the machine.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="DeviceObservationReport.Metric">
    <xs:annotation>
      <xs:documentation>Describes the data produced by a device at a point in time.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="observation" minOccurs="1" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>The data for the metric.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:element name="DiagnosticOrder" type="DiagnosticOrder">
    <xs:annotation>
      <xs:documentation>A request for a diagnostic investigation service to be performed.</xs:documentation>
    </xs:annotation>
  </xs:element>
  <xs:complexType name="DiagnosticOrder">
    <xs:annotation>
      <xs:documentation>A request for a diagnostic investigation service to be performed.</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="subject" minOccurs="1" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>Who or what the investigation is to be performed on. This is usually a human patient, but diagnostic tests can also be requested on animals, groups of humans or animals, devices such as dialysis machines, or even locations (typically for environmental scans).</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="orderer" minOccurs="0" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>The practitioner that holds legal responsibility for ordering the investigation.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="identifier" minOccurs="0" maxOccurs="unbounded" type="Identifier">
            <xs:annotation>
              <xs:documentation>Identifiers assigned to this order by the order or by the receiver.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="encounter" minOccurs="0" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>An encounter that provides additional informaton about the healthcare context in which this request is made.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="clinicalNotes" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>An explanation or justification for why this diagnostic investigation is being requested.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="specimen" minOccurs="0" maxOccurs="unbounded" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>One or more specimens that the diagnostic investigation is about.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="status" minOccurs="0" maxOccurs="1" type="DiagnosticOrderStatus">
            <xs:annotation>
              <xs:documentation>The status of the order.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="priority" minOccurs="0" maxOccurs="1" type="DiagnosticOrderPriority">
            <xs:annotation>
              <xs:documentation>The clinical priority associated with this order.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="event" type="DiagnosticOrder.Event" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation>A summary of the events of interest that have occurred as the request is processed. E.g. when the order was made, various processing steps (specimens received), when it was completed.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="item" type="DiagnosticOrder.Item" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation>The specific diagnostic investigations that are requested as part of this request. Sometimes, there can only be one item per request, but in most contexts, more than one investigation can be requested.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="DiagnosticOrder.Event">
    <xs:annotation>
      <xs:documentation>A request for a diagnostic investigation service to be performed.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="status" minOccurs="1" maxOccurs="1" type="DiagnosticOrderStatus">
            <xs:annotation>
              <xs:documentation>The status for the event.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="description" minOccurs="0" maxOccurs="1" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>Additional information about the event that occurred - e.g. if the status remained unchanged.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="dateTime" minOccurs="1" maxOccurs="1" type="dateTime">
            <xs:annotation>
              <xs:documentation>The date/time at which the event occurred.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="actor" minOccurs="0" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>The person who was responsible for performing or recording the action.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="DiagnosticOrder.Item">
    <xs:annotation>
      <xs:documentation>A request for a diagnostic investigation service to be performed.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="code" minOccurs="1" maxOccurs="1" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>A code that identifies a particular diagnostic investigation, or panel of investigations, that have been requested.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="specimen" minOccurs="0" maxOccurs="unbounded" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>If the item is related to a specific speciment.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="bodySite" minOccurs="0" maxOccurs="1" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>Anatomical location where the request test should be performed.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="status" minOccurs="0" maxOccurs="1" type="DiagnosticOrderStatus">
            <xs:annotation>
              <xs:documentation>The status of this individual item within the order.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="event" type="DiagnosticOrder.Event" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation>A summary of the events of interest that have occurred as this item of the request is processed.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:simpleType name="DiagnosticOrderStatus-list">
    <xs:restriction base="xs:string">
      <xs:enumeration value="requested">
        <xs:annotation>
          <xs:documentation>The request has been placed.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="received">
        <xs:annotation>
          <xs:documentation>The receiving system has received the order, but not yet decided whether it will be performed.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="accepted">
        <xs:annotation>
          <xs:documentation>The receiving system has accepted the order, but work has not yet commenced.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="in progress">
        <xs:annotation>
          <xs:documentation>The work to fulfill the order is happening.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="review">
        <xs:annotation>
          <xs:documentation>The work is complete, and the outcomes are being reviewed for approval.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="completed">
        <xs:annotation>
          <xs:documentation>The work has been complete, the report(s) released, and no further work is planned.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="suspended">
        <xs:annotation>
          <xs:documentation>The request has been held by originating system/user request.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="rejected">
        <xs:annotation>
          <xs:documentation>The receiving system has declined to fulfill the request.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="failed">
        <xs:annotation>
          <xs:documentation>The diagnostic investigation was attempted, but due to some procedural error, it could not be completed.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>
  <xs:complexType name="DiagnosticOrderStatus">
    <xs:annotation>
      <xs:documentation>The status of a diagnostic order</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="DiagnosticOrderStatus-list" use="optional"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:simpleType name="DiagnosticOrderPriority-list">
    <xs:restriction base="xs:string">
      <xs:enumeration value="routine">
        <xs:annotation>
          <xs:documentation>The order has a normal priority.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="urgent">
        <xs:annotation>
          <xs:documentation>The order should be urgently.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="stat">
        <xs:annotation>
          <xs:documentation>The order is time-critical.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="asap">
        <xs:annotation>
          <xs:documentation>The order should be acted on as soon as possible.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>
  <xs:complexType name="DiagnosticOrderPriority">
    <xs:annotation>
      <xs:documentation>The clinical priority of a diagnostic order</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="DiagnosticOrderPriority-list" use="optional"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:element name="DiagnosticReport" type="DiagnosticReport">
    <xs:annotation>
      <xs:documentation>The findings and interpretation of diagnostic  tests performed on patients, groups of patients, devices, and locations, and/or specimens derived from these. The report includes clinical context such as requesting and provider information, and some mix of atomic results, images, textual and coded interpretation, and formatted representation of diagnostic reports.</xs:documentation>
    </xs:annotation>
  </xs:element>
  <xs:complexType name="DiagnosticReport">
    <xs:annotation>
      <xs:documentation>The findings and interpretation of diagnostic  tests performed on patients, groups of patients, devices, and locations, and/or specimens derived from these. The report includes clinical context such as requesting and provider information, and some mix of atomic results, images, textual and coded interpretation, and formatted representation of diagnostic reports.</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="1" maxOccurs="1" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>A code or name that describes this diagnostic report.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="status" minOccurs="1" maxOccurs="1" type="DiagnosticReportStatus">
            <xs:annotation>
              <xs:documentation>The status of the diagnostic report as a whole.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="issued" minOccurs="1" maxOccurs="1" type="dateTime">
            <xs:annotation>
              <xs:documentation>The date and/or time that this version of the report was released from the source diagnostic service.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="subject" minOccurs="1" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>The subject of the report. Usually, but not always, this is a patient. However diagnostic services also perform analyses on specimens collected from a variety of other sources.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="performer" minOccurs="1" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>The diagnostic service that is responsible for issuing the report.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="identifier" minOccurs="0" maxOccurs="1" type="Identifier">
            <xs:annotation>
              <xs:documentation>The local ID assigned to the report by the order filler, usually by the Information System of the diagnostic service provider.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="requestDetail" minOccurs="0" maxOccurs="unbounded" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>Details concerning a test requested.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="serviceCategory" minOccurs="0" maxOccurs="1" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>The section of the diagnostic service that performs the examination e.g. biochemistry, hematology, MRI.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:choice minOccurs="1" maxOccurs="1" >
            <xs:annotation>
              <xs:documentation>The time or time-period the observed values are related to. This is usually either the time of the procedure or of specimen collection(s), but very often the source of the date/time is not known, only the date/time itself.</xs:documentation>
            </xs:annotation>
            <xs:element name="diagnosticDateTime" type="dateTime"/>
            <xs:element name="diagnosticPeriod" type="Period"/>
          </xs:choice>
          <xs:element name="specimen" minOccurs="0" maxOccurs="unbounded" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>Details about the specimens on which this Disagnostic report is based.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="result" minOccurs="0" maxOccurs="unbounded" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>Observations that are part of this diagnostic report. Observations can be simple name/value pairs (e.g. &quot;atomic&quot; results), or they can be grouping observations that include references to other members of the group (e.g. &quot;panels&quot;).</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="imagingStudy" minOccurs="0" maxOccurs="unbounded" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>One or more links to full details of any imaging performed during the diagnostic investigation. Typically, this is imaging performed by DICOM enabled modalities, but this is not required. A fully enabled PACS viewer can use this information to provide views of the source images.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="image" type="DiagnosticReport.Image" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation>A list of key images associated with this report. The images are generally created during the diagnostic process, and may be directly of the patient, or of treated specimens (i.e. slides of interest).</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="conclusion" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>Concise and clinically contextualized narrative interpretation of the diagnostic report.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="codedDiagnosis" minOccurs="0" maxOccurs="unbounded" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>Codes for the conclusion.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="presentedForm" minOccurs="0" maxOccurs="unbounded" type="Attachment">
            <xs:annotation>
              <xs:documentation>Rich text representation of the entire result as issued by the diagnostic service. Multiple formats are allowed but they SHALL be semantically equivalent.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="DiagnosticReport.Image">
    <xs:annotation>
      <xs:documentation>The findings and interpretation of diagnostic  tests performed on patients, groups of patients, devices, and locations, and/or specimens derived from these. The report includes clinical context such as requesting and provider information, and some mix of atomic results, images, textual and coded interpretation, and formatted representation of diagnostic reports.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="comment" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>A comment about the image. Typically, this is used to provide an explanation for why the image is included, or to draw the viewer's attention to important features.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="link" minOccurs="1" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>Reference to the image source.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:simpleType name="DiagnosticReportStatus-list">
    <xs:restriction base="xs:string">
      <xs:enumeration value="registered">
        <xs:annotation>
          <xs:documentation>The existence of the report is registered, but there is nothing yet available.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="partial">
        <xs:annotation>
          <xs:documentation>This is a partial (e.g. initial, interim or preliminary) report: data in the report may be incomplete or unverified.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="final">
        <xs:annotation>
          <xs:documentation>The report is complete and verified by an authorized person.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="corrected">
        <xs:annotation>
          <xs:documentation>The report has been modified subsequent to being Final, and is complete and verified by an authorized person.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="amended">
        <xs:annotation>
          <xs:documentation>The report has been modified subsequent to being Final, and is complete and verified by an authorized person, and data has been changed.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="appended">
        <xs:annotation>
          <xs:documentation>The report has been modified subsequent to being Final, and is complete and verified by an authorized person. New content has been added, but existing content hasn't changed.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="cancelled">
        <xs:annotation>
          <xs:documentation>The report is unavailable because the measurement was not started or not completed (also sometimes called &quot;aborted&quot;).</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="entered in error">
        <xs:annotation>
          <xs:documentation>The report has been withdrawn following previous Final release.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>
  <xs:complexType name="DiagnosticReportStatus">
    <xs:annotation>
      <xs:documentation>The status of the diagnostic report as a whole</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="DiagnosticReportStatus-list" use="optional"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:element name="DocumentManifest" type="DocumentManifest">
    <xs:annotation>
      <xs:documentation>A manifest that defines a set of documents.</xs:documentation>
    </xs:annotation>
  </xs:element>
  <xs:complexType name="DocumentManifest">
    <xs:annotation>
      <xs:documentation>A manifest that defines a set of 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="Resource">
        <xs:sequence>
          <xs:element name="masterIdentifier" minOccurs="1" maxOccurs="1" type="Identifier">
            <xs:annotation>
              <xs:documentation>A single identifier that uniquely identifies this manifest. Principally used to refer to the manifest in non-FHIR contexts.</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="unbounded" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>Who or what the set of documents is about. The documents 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). If the documents cross more than one subject, then more than one subject is allowed here (unusual use case).</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="recipient" minOccurs="0" maxOccurs="unbounded" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>A patient, practitioner, or organization for which this set of documents is intended.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="type" minOccurs="0" maxOccurs="1" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>Specifies the kind of this set of documents (e.g. Patient Summary, Discharge Summary, Prescription, etc.). The type of a set of documents may be the same as one of the documents in it - especially if there is only one - but it may be wider.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="author" minOccurs="0" 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="created" minOccurs="0" maxOccurs="1" type="dateTime">
            <xs:annotation>
              <xs:documentation>When the document manifest was created for submission to the server (not necessarily the same thing as the actual resource last modified time, since it may be modified, replicated etc).</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="source" minOccurs="0" maxOccurs="1" type="uri">
            <xs:annotation>
              <xs:documentation>Identifies the source system, application, or software that produced the document manifest.</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 manifest.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="supercedes" minOccurs="0" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>Whether this document manifest replaces another.</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="1" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>A code specifying the level of confidentiality of this set of Documents.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="content" minOccurs="1" maxOccurs="unbounded" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>The list of resources that describe the parts of this document reference. Usually, these would be document references, but direct references to binary attachments and images are also allowed.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <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:element name="Encounter" type="Encounter">
    <xs:annotation>
      <xs:documentation>An interaction between a patient and healthcare provider(s) for the purpose of providing healthcare service(s) or assessing the health status of a patient.</xs:documentation>
    </xs:annotation>
  </xs:element>
  <xs:complexType name="Encounter">
    <xs:annotation>
      <xs:documentation>An interaction between a patient and healthcare provider(s) for the purpose of providing healthcare service(s) or assessing the health status of a patient.</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>Identifier(s) by which this encounter is known.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="status" minOccurs="1" maxOccurs="1" type="EncounterState">
            <xs:annotation>
              <xs:documentation>planned | in progress | onleave | finished | cancelled.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="class" minOccurs="1" maxOccurs="1" type="EncounterClass">
            <xs:annotation>
              <xs:documentation>inpatient | outpatient | ambulatory | emergency +.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="type" minOccurs="0" maxOccurs="unbounded" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>Specific type of encounter (e.g. e-mail consultation, surgical day-care, skilled nursing, rehabilitation).</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="subject" minOccurs="0" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>The patient present at the encounter.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="participant" type="Encounter.Participant" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation>The main practitioner responsible for providing the service.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="period" minOccurs="0" maxOccurs="1" type="Period">
            <xs:annotation>
              <xs:documentation>The start and end time of the encounter.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="length" minOccurs="0" maxOccurs="1" type="Duration">
            <xs:annotation>
              <xs:documentation>Quantity of time the encounter lasted. This excludes the time during leaves of absence.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="reason" minOccurs="0" maxOccurs="1" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>Reason the encounter takes place, expressed as a code. For admissions, this can be used for a coded admission diagnosis.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="indication" minOccurs="0" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>Reason the encounter takes place, as specified using information from another resource. For admissions, this is the admission diagnosis.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="priority" minOccurs="0" maxOccurs="1" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>Indicates the urgency of the encounter.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="hospitalization" type="Encounter.Hospitalization" minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>Details about an admission to a clinic.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="location" type="Encounter.Location" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation>List of locations at which the patient has been.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="serviceProvider" minOccurs="0" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>Department or team providing care.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="partOf" minOccurs="0" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>Another Encounter of which this encounter is a part of (administratively or in time).</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="Encounter.Participant">
    <xs:annotation>
      <xs:documentation>An interaction between a patient and healthcare provider(s) for the purpose of providing healthcare service(s) or assessing the health status of a patient.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="type" minOccurs="0" maxOccurs="unbounded" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>Role of participant in encounter.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="individual" minOccurs="0" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>Persons involved in the encounter other than the patient.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="Encounter.Hospitalization">
    <xs:annotation>
      <xs:documentation>An interaction between a patient and healthcare provider(s) for the purpose of providing healthcare service(s) or assessing the health status of a patient.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="preAdmissionIdentifier" minOccurs="0" maxOccurs="1" type="Identifier">
            <xs:annotation>
              <xs:documentation>Pre-admission identifier.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="origin" minOccurs="0" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>The location from which the patient came before admission.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="admitSource" minOccurs="0" maxOccurs="1" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>From where patient was admitted (physician referral, transfer).</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="period" minOccurs="0" maxOccurs="1" type="Period">
            <xs:annotation>
              <xs:documentation>Period during which the patient was admitted.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="accomodation" type="Encounter.Accomodation" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation>Where the patient stays during this encounter.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="diet" minOccurs="0" maxOccurs="1" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>Dietary restrictions for the patient.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="specialCourtesy" minOccurs="0" maxOccurs="unbounded" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>Special courtesies (VIP, board member).</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="specialArrangement" minOccurs="0" maxOccurs="unbounded" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>Wheelchair, translator, stretcher, etc.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="destination" minOccurs="0" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>Location to which the patient is discharged.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="dischargeDisposition" minOccurs="0" maxOccurs="1" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>Category or kind of location after discharge.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="dischargeDiagnosis" minOccurs="0" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>The final diagnosis given a patient before release from the hospital after all testing, surgery, and workup are complete.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="reAdmission" minOccurs="0" maxOccurs="1" type="boolean">
            <xs:annotation>
              <xs:documentation>Whether this hospitalization is a readmission.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="Encounter.Accomodation">
    <xs:annotation>
      <xs:documentation>An interaction between a patient and healthcare provider(s) for the purpose of providing healthcare service(s) or assessing the health status of a patient.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="bed" minOccurs="0" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>The bed that is assigned to the patient.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="period" minOccurs="0" maxOccurs="1" type="Period">
            <xs:annotation>
              <xs:documentation>Period during which the patient was assigned the bed.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="Encounter.Location">
    <xs:annotation>
      <xs:documentation>An interaction between a patient and healthcare provider(s) for the purpose of providing healthcare service(s) or assessing the health status of a patient.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="location" minOccurs="1" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>The location where the encounter takes place.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="period" minOccurs="1" maxOccurs="1" type="Period">
            <xs:annotation>
              <xs:documentation>Time period during which the patient was present at the location.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:simpleType name="EncounterClass-list">
    <xs:restriction base="xs:string">
      <xs:enumeration value="inpatient">
        <xs:annotation>
          <xs:documentation>An encounter during which the patient is hospitalized and stays overnight.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="outpatient">
        <xs:annotation>
          <xs:documentation>An encounter during which the patient is not hospitalized overnight.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="ambulatory">
        <xs:annotation>
          <xs:documentation>An encounter where the patient visits the practitioner in his/her office, e.g. a G.P. visit.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="emergency">
        <xs:annotation>
          <xs:documentation>An encounter where the patient needs urgent care.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="home">
        <xs:annotation>
          <xs:documentation>An encounter where the practitioner visits the patient at his/her home.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="field">
        <xs:annotation>
          <xs:documentation>An encounter taking place outside the regular environment for giving care.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="daytime">
        <xs:annotation>
          <xs:documentation>An encounter where the patient needs more prolonged treatment or investigations than outpatients, but who do not need to stay in the hospital overnight.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="virtual">
        <xs:annotation>
          <xs:documentation>An encounter that takes place where the patient and practitioner do not physically meet but use electronic means for contact.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>
  <xs:complexType name="EncounterClass">
    <xs:annotation>
      <xs:documentation>Classification of the encounter</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="EncounterClass-list" use="optional"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:simpleType name="EncounterState-list">
    <xs:restriction base="xs:string">
      <xs:enumeration value="planned">
        <xs:annotation>
          <xs:documentation>The Encounter has not yet started.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="in progress">
        <xs:annotation>
          <xs:documentation>The Encounter has begun and the patient is present / the practitioner and the patient are meeting.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="onleave">
        <xs:annotation>
          <xs:documentation>The Encounter has begun, but the patient is temporarily on leave.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="finished">
        <xs:annotation>
          <xs:documentation>The Encounter has ended.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="cancelled">
        <xs:annotation>
          <xs:documentation>The Encounter has ended before it has begun.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>
  <xs:complexType name="EncounterState">
    <xs:annotation>
      <xs:documentation>Current state of the encounter</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="EncounterState-list" use="optional"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:element name="FamilyHistory" type="FamilyHistory">
    <xs:annotation>
      <xs:documentation>Significant health events and conditions for people related to the subject relevant in the context of care for the subject.</xs:documentation>
    </xs:annotation>
  </xs:element>
  <xs:complexType name="FamilyHistory">
    <xs:annotation>
      <xs:documentation>Significant health events and conditions for people related to the subject relevant in the context of care for the subject.</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>This records identifiers associated with this family history record that are defined by business processes and/ or used to refer to it when a direct URL reference to the resource itself is not appropriate (e.g. in CDA documents, or in written / printed documentation).</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="subject" minOccurs="1" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>The person who this history concerns.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="note" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>Conveys information about family history not specific to individual relations.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="relation" type="FamilyHistory.Relation" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation>The related person. Each FamilyHistory resource contains the entire family history for a single person.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="FamilyHistory.Relation">
    <xs:annotation>
      <xs:documentation>Significant health events and conditions for people related to the subject relevant in the context of care for the subject.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="name" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>This will either be a name or a description.  E.g. &quot;Aunt Susan&quot;, &quot;my cousin with the red hair&quot;.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="relationship" minOccurs="1" maxOccurs="1" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>The type of relationship this person has to the patient (father, mother, brother etc.).</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:choice minOccurs="0" maxOccurs="1" >
            <xs:annotation>
              <xs:documentation>The actual or approximate date of birth of the relative.</xs:documentation>
            </xs:annotation>
            <xs:element name="bornPeriod" type="Period"/>
            <xs:element name="bornDate" type="date"/>
            <xs:element name="bornString" type="string"/>
          </xs:choice>
          <xs:choice minOccurs="0" maxOccurs="1" >
            <xs:annotation>
              <xs:documentation>If this resource is indicating that the related person is deceased, then an indicator of whether the person is deceased (yes) or not (no) or the age or age range or description of age at death - can be indicated here. If the reason for death is known, then it can be indicated in the outcome code of the condition - in this case the deceased property should still be set.</xs:documentation>
            </xs:annotation>
            <xs:element name="deceasedBoolean" type="boolean"/>
            <xs:element name="deceasedAge" type="Age"/>
            <xs:element name="deceasedRange" type="Range"/>
            <xs:element name="deceasedDate" type="date"/>
            <xs:element name="deceasedString" type="string"/>
          </xs:choice>
          <xs:element name="note" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>This property allows a non condition-specific note to the made about the related person. Ideally, the note would be in the condition property, but this is not always possible.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="condition" type="FamilyHistory.Condition" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation>The significant Conditions (or condition) that the family member had. This is a repeating section to allow a system to represent more than one condition per resource, though there is nothing stopping multiple resources - one per condition.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="FamilyHistory.Condition">
    <xs:annotation>
      <xs:documentation>Significant health events and conditions for people related to the subject relevant in the context of care for the subject.</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 actual condition specified. Could be a coded condition (like MI or Diabetes) or a less specific string like 'cancer' depending on how much is known about the condition and the capabilities of the creating system.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="outcome" minOccurs="0" maxOccurs="1" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>Indicates what happened as a result of this condition.  If the condition resulted in death, deceased date is captured on the relation.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:choice minOccurs="0" maxOccurs="1" >
            <xs:annotation>
              <xs:documentation>Either the age of onset, range of approximate age or descriptive string can be recorded.  For conditions with multiple occurrences, this describes the first known occurrence.</xs:documentation>
            </xs:annotation>
            <xs:element name="onsetAge" type="Age"/>
            <xs:element name="onsetRange" type="Range"/>
            <xs:element name="onsetString" type="string"/>
          </xs:choice>
          <xs:element name="note" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>An area where general notes can be placed about this specific condition.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:element name="Group" type="Group">
    <xs:annotation>
      <xs:documentation>Represents a defined collection of entities that may be discussed or acted upon collectively but which are not expected to act collectively and are not formally or legally recognized.  I.e. A collection of entities that isn't an Organization.</xs:documentation>
    </xs:annotation>
  </xs:element>
  <xs:complexType name="Group">
    <xs:annotation>
      <xs:documentation>Represents a defined collection of entities that may be discussed or acted upon collectively but which are not expected to act collectively and are not formally or legally recognized.  I.e. A collection of entities that isn't an Organization.</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="1" type="Identifier">
            <xs:annotation>
              <xs:documentation>A unique business identifier for this group.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="type" minOccurs="1" maxOccurs="1" type="GroupType">
            <xs:annotation>
              <xs:documentation>Identifies the broad classification of the kind of resources the group includes.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="actual" minOccurs="1" maxOccurs="1" type="boolean">
            <xs:annotation>
              <xs:documentation>If true, indicates that the resource refers to a specific group of real individuals.  If false, the group defines a set of intended individuals.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="code" minOccurs="0" maxOccurs="1" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>Provides a specific type of resource the group includes.  E.g. &quot;cow&quot;, &quot;syringe&quot;, etc.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="name" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>A label assigned to the group for human identification and communication.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="quantity" minOccurs="0" maxOccurs="1" type="integer">
            <xs:annotation>
              <xs:documentation>A count of the number of resource instances that are part of the group.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="characteristic" type="Group.Characteristic" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation>Identifies the traits shared by members of the group.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="member" minOccurs="0" maxOccurs="unbounded" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>Identifies the resource instances that are members of the group.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="Group.Characteristic">
    <xs:annotation>
      <xs:documentation>Represents a defined collection of entities that may be discussed or acted upon collectively but which are not expected to act collectively and are not formally or legally recognized.  I.e. A collection of entities that isn't an Organization.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="code" minOccurs="1" maxOccurs="1" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>A code that identifies the kind of trait being asserted.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:choice minOccurs="1" maxOccurs="1" >
            <xs:annotation>
              <xs:documentation>The value of the trait that holds (or does not hold - see 'exclude') for members of the group.</xs:documentation>
            </xs:annotation>
            <xs:element name="valueCodeableConcept" type="CodeableConcept"/>
            <xs:element name="valueBoolean" type="boolean"/>
            <xs:element name="valueQuantity" type="Quantity"/>
            <xs:element name="valueRange" type="Range"/>
          </xs:choice>
          <xs:element name="exclude" minOccurs="1" maxOccurs="1" type="boolean">
            <xs:annotation>
              <xs:documentation>If true, indicates the characteristic is one that is NOT held by members of the group.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:simpleType name="GroupType-list">
    <xs:restriction base="xs:string">
      <xs:enumeration value="person">
        <xs:annotation>
          <xs:documentation>Group contains &quot;person&quot; Patient resources.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="animal">
        <xs:annotation>
          <xs:documentation>Group contains &quot;animal&quot; Patient resources.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="practitioner">
        <xs:annotation>
          <xs:documentation>Group contains healthcare practitioner resources.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="device">
        <xs:annotation>
          <xs:documentation>Group contains Device resources.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="medication">
        <xs:annotation>
          <xs:documentation>Group contains Medication resources.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="substance">
        <xs:annotation>
          <xs:documentation>Group contains Substance resources.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>
  <xs:complexType name="GroupType">
    <xs:annotation>
      <xs:documentation>Types of resources that are part of group</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="GroupType-list" use="optional"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:element name="ImagingStudy" type="ImagingStudy">
    <xs:annotation>
      <xs:documentation>Manifest of a set of images produced in study. The set of images may include every image in the study, or it may be an incomplete sample, such as a list of key images.</xs:documentation>
    </xs:annotation>
  </xs:element>
  <xs:complexType name="ImagingStudy">
    <xs:annotation>
      <xs:documentation>Manifest of a set of images produced in study. The set of images may include every image in the study, or it may be an incomplete sample, such as a list of key images.</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="dateTime" minOccurs="0" maxOccurs="1" type="dateTime">
            <xs:annotation>
              <xs:documentation>Date and Time the study took place.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="subject" minOccurs="1" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>Who the images are of.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="uid" minOccurs="1" maxOccurs="1" type="oid">
            <xs:annotation>
              <xs:documentation>Formal identifier for the study.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="accessionNo" minOccurs="0" maxOccurs="1" type="Identifier">
            <xs:annotation>
              <xs:documentation>Accession Number.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="identifier" minOccurs="0" maxOccurs="unbounded" type="Identifier">
            <xs:annotation>
              <xs:documentation>Other identifiers for the study.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="order" minOccurs="0" maxOccurs="unbounded" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>A list of the diagnostic orders that resulted in this imaging study being performed.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="modality" minOccurs="0" maxOccurs="unbounded" type="ImagingModality">
            <xs:annotation>
              <xs:documentation>A list of all the Series.ImageModality values that are actual acquisition modalities, i.e. those in the DICOM Context Group 29 (value set OID 1.2.840.10008.6.1.19).</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="referrer" minOccurs="0" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>The requesting/referring physician.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="availability" minOccurs="0" maxOccurs="1" type="InstanceAvailability">
            <xs:annotation>
              <xs:documentation>Availability of study (online, offline or nearline).</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="url" minOccurs="0" maxOccurs="1" type="uri">
            <xs:annotation>
              <xs:documentation>WADO-RS URI where Study is available.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="numberOfSeries" minOccurs="1" maxOccurs="1" type="integer">
            <xs:annotation>
              <xs:documentation>Number of Series in Study.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="numberOfInstances" minOccurs="1" maxOccurs="1" type="integer">
            <xs:annotation>
              <xs:documentation>Number of SOP Instances in Study.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="clinicalInformation" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>Diagnoses etc provided with request.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="procedure" minOccurs="0" maxOccurs="unbounded" type="Coding">
            <xs:annotation>
              <xs:documentation>Type of procedure performed.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="interpreter" minOccurs="0" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>Who read study and interpreted the images.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="description" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>Institution-generated description or classification of the Study (component) performed.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="series" type="ImagingStudy.Series" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation>Each study has one or more series of image instances.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="ImagingStudy.Series">
    <xs:annotation>
      <xs:documentation>Manifest of a set of images produced in study. The set of images may include every image in the study, or it may be an incomplete sample, such as a list of key images.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="number" minOccurs="0" maxOccurs="1" type="integer">
            <xs:annotation>
              <xs:documentation>The number of this series in the overall sequence.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="modality" minOccurs="1" maxOccurs="1" type="Modality">
            <xs:annotation>
              <xs:documentation>The modality of this series sequence.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="uid" minOccurs="1" maxOccurs="1" type="oid">
            <xs:annotation>
              <xs:documentation>Formal identifier for this series.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="description" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>A description of the series.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="numberOfInstances" minOccurs="1" maxOccurs="1" type="integer">
            <xs:annotation>
              <xs:documentation>Sequence that contains attributes from the.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="availability" minOccurs="0" maxOccurs="1" type="InstanceAvailability">
            <xs:annotation>
              <xs:documentation>Availability of series (online, offline or nearline).</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="url" minOccurs="0" maxOccurs="1" type="uri">
            <xs:annotation>
              <xs:documentation>WADO-RS URI where Series is available.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="bodySite" minOccurs="0" maxOccurs="1" type="Coding">
            <xs:annotation>
              <xs:documentation>Body part examined. See  DICOM Part 16 Annex L for the mapping from DICOM to Snomed.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="dateTime" minOccurs="0" maxOccurs="1" type="dateTime">
            <xs:annotation>
              <xs:documentation>When the series started.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="instance" type="ImagingStudy.Instance" minOccurs="1" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation>A single image taken from a patient.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="ImagingStudy.Instance">
    <xs:annotation>
      <xs:documentation>Manifest of a set of images produced in study. The set of images may include every image in the study, or it may be an incomplete sample, such as a list of key images.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="number" minOccurs="0" maxOccurs="1" type="integer">
            <xs:annotation>
              <xs:documentation>The number of this image in the series.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="uid" minOccurs="1" maxOccurs="1" type="oid">
            <xs:annotation>
              <xs:documentation>Formal identifier for this image.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="sopclass" minOccurs="1" maxOccurs="1" type="oid">
            <xs:annotation>
              <xs:documentation>DICOM Image type.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="type" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>Type of instance (image etc) (0004,1430).</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="title" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>Description (0070,0080 | 0040,A043 &gt; 0008,0104 | 0042,0010 | 0008,0008).</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="url" minOccurs="0" maxOccurs="1" type="uri">
            <xs:annotation>
              <xs:documentation>WADO-RS url where image is available.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="attachment" minOccurs="0" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>A FHIR resource with content for this instance.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:simpleType name="ImagingModality-list">
    <xs:restriction base="xs:string">
      <xs:enumeration value="AR">
        <xs:annotation>
          <xs:documentation></xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="BMD">
        <xs:annotation>
          <xs:documentation></xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="BDUS">
        <xs:annotation>
          <xs:documentation></xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="EPS">
        <xs:annotation>
          <xs:documentation></xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="CR">
        <xs:annotation>
          <xs:documentation></xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="CT">
        <xs:annotation>
          <xs:documentation></xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="DX">
        <xs:annotation>
          <xs:documentation></xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="ECG">
        <xs:annotation>
          <xs:documentation></xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="ES">
        <xs:annotation>
          <xs:documentation></xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="XC">
        <xs:annotation>
          <xs:documentation></xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="GM">
        <xs:annotation>
          <xs:documentation></xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="HD">
        <xs:annotation>
          <xs:documentation></xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="IO">
        <xs:annotation>
          <xs:documentation></xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="IVOCT">
        <xs:annotation>
          <xs:documentation></xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="IVUS">
        <xs:annotation>
          <xs:documentation></xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="KER">
        <xs:annotation>
          <xs:documentation></xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="LEN">
        <xs:annotation>
          <xs:documentation></xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="MR">
        <xs:annotation>
          <xs:documentation></xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="MG">
        <xs:annotation>
          <xs:documentation></xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="NM">
        <xs:annotation>
          <xs:documentation></xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="OAM">
        <xs:annotation>
          <xs:documentation></xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="OCT">
        <xs:annotation>
          <xs:documentation></xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="OPM">
        <xs:annotation>
          <xs:documentation></xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="OP">
        <xs:annotation>
          <xs:documentation></xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="OPR">
        <xs:annotation>
          <xs:documentation></xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="OPT">
        <xs:annotation>
          <xs:documentation></xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="OPV">
        <xs:annotation>
          <xs:documentation></xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="PX">
        <xs:annotation>
          <xs:documentation></xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="PT">
        <xs:annotation>
          <xs:documentation></xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="RF">
        <xs:annotation>
          <xs:documentation></xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="RG">
        <xs:annotation>
          <xs:documentation></xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="SM">
        <xs:annotation>
          <xs:documentation></xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="SRF">
        <xs:annotation>
          <xs:documentation></xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="US">
        <xs:annotation>
          <xs:documentation></xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="VA">
        <xs:annotation>
          <xs:documentation></xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="XA">
        <xs:annotation>
          <xs:documentation></xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>
  <xs:complexType name="ImagingModality">
    <xs:annotation>
      <xs:documentation>Type of acquired image data in the instance</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="ImagingModality-list" use="optional"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:simpleType name="InstanceAvailability-list">
    <xs:restriction base="xs:string">
      <xs:enumeration value="ONLINE">
        <xs:annotation>
          <xs:documentation>Resources are immediately available,.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="OFFLINE">
        <xs:annotation>
          <xs:documentation>Resources need to be retrieved by manual intervention.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="NEARLINE">
        <xs:annotation>
          <xs:documentation>Resources need to be retrieved from relatively slow media.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="UNAVAILABLE">
        <xs:annotation>
          <xs:documentation>Resources cannot be retrieved.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>
  <xs:complexType name="InstanceAvailability">
    <xs:annotation>
      <xs:documentation>Availability of the resource</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="InstanceAvailability-list" use="optional"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:simpleType name="Modality-list">
    <xs:restriction base="xs:string">
      <xs:enumeration value="AR">
        <xs:annotation>
          <xs:documentation></xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="AU">
        <xs:annotation>
          <xs:documentation></xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="BDUS">
        <xs:annotation>
          <xs:documentation></xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="BI">
        <xs:annotation>
          <xs:documentation></xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="BMD">
        <xs:annotation>
          <xs:documentation></xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="CR">
        <xs:annotation>
          <xs:documentation></xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="CT">
        <xs:annotation>
          <xs:documentation></xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="DG">
        <xs:annotation>
          <xs:documentation></xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="DX">
        <xs:annotation>
          <xs:documentation></xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="ECG">
        <xs:annotation>
          <xs:documentation></xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="EPS">
        <xs:annotation>
          <xs:documentation></xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="ES">
        <xs:annotation>
          <xs:documentation></xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="GM">
        <xs:annotation>
          <xs:documentation></xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="HC">
        <xs:annotation>
          <xs:documentation></xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="HD">
        <xs:annotation>
          <xs:documentation></xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="IO">
        <xs:annotation>
          <xs:documentation></xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="IVOCT">
        <xs:annotation>
          <xs:documentation></xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="IVUS">
        <xs:annotation>
          <xs:documentation></xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="KER">
        <xs:annotation>
          <xs:documentation></xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="KO">
        <xs:annotation>
          <xs:documentation></xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="LEN">
        <xs:annotation>
          <xs:documentation></xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="LS">
        <xs:annotation>
          <xs:documentation></xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="MG">
        <xs:annotation>
          <xs:documentation></xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="MR">
        <xs:annotation>
          <xs:documentation></xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="NM">
        <xs:annotation>
          <xs:documentation></xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="OAM">
        <xs:annotation>
          <xs:documentation></xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="OCT">
        <xs:annotation>
          <xs:documentation></xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="OP">
        <xs:annotation>
          <xs:documentation></xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="OPM">
        <xs:annotation>
          <xs:documentation></xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="OPT">
        <xs:annotation>
          <xs:documentation></xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="OPV">
        <xs:annotation>
          <xs:documentation></xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="OT">
        <xs:annotation>
          <xs:documentation></xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="PR">
        <xs:annotation>
          <xs:documentation></xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="PT">
        <xs:annotation>
          <xs:documentation></xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="PX">
        <xs:annotation>
          <xs:documentation></xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="REG">
        <xs:annotation>
          <xs:documentation></xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="RF">
        <xs:annotation>
          <xs:documentation></xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="RG">
        <xs:annotation>
          <xs:documentation></xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="RTDOSE">
        <xs:annotation>
          <xs:documentation></xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="RTIMAGE">
        <xs:annotation>
          <xs:documentation></xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="RTPLAN">
        <xs:annotation>
          <xs:documentation></xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="RTRECORD">
        <xs:annotation>
          <xs:documentation></xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="RTSTRUCT">
        <xs:annotation>
          <xs:documentation></xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="SEG">
        <xs:annotation>
          <xs:documentation></xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="SM">
        <xs:annotation>
          <xs:documentation></xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="SMR">
        <xs:annotation>
          <xs:documentation></xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="SR">
        <xs:annotation>
          <xs:documentation></xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="SRF">
        <xs:annotation>
          <xs:documentation></xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="TG">
        <xs:annotation>
          <xs:documentation></xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="US">
        <xs:annotation>
          <xs:documentation></xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="VA">
        <xs:annotation>
          <xs:documentation></xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="XA">
        <xs:annotation>
          <xs:documentation></xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="XC">
        <xs:annotation>
          <xs:documentation></xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>
  <xs:complexType name="Modality">
    <xs:annotation>
      <xs:documentation>Type of data in the instance</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="Modality-list" use="optional"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:element name="Immunization" type="Immunization">
    <xs:annotation>
      <xs:documentation>Immunization event information.</xs:documentation>
    </xs:annotation>
  </xs:element>
  <xs:complexType name="Immunization">
    <xs:annotation>
      <xs:documentation>Immunization event information.</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>A unique identifier assigned to this adverse reaction record.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="date" minOccurs="1" maxOccurs="1" type="dateTime">
            <xs:annotation>
              <xs:documentation>Date vaccine administered or was to be administered.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="vaccineType" minOccurs="1" maxOccurs="1" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>Vaccine that was administered or was to be administered.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="subject" minOccurs="1" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>The patient to whom the vaccine was to be administered.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="refusedIndicator" minOccurs="1" maxOccurs="1" type="boolean">
            <xs:annotation>
              <xs:documentation>Indicates if the vaccination was refused.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="reported" minOccurs="1" maxOccurs="1" type="boolean">
            <xs:annotation>
              <xs:documentation>True if this administration was reported rather than directly administered.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="performer" minOccurs="0" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>Clinician who administered the vaccine.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="requester" minOccurs="0" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>Clinician who ordered the vaccination.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="manufacturer" minOccurs="0" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>Name of vaccine manufacturer.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="location" minOccurs="0" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>The service delivery location where the vaccine administration occurred.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="lotNumber" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>Lot number of the  vaccine product.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="expirationDate" minOccurs="0" maxOccurs="1" type="date">
            <xs:annotation>
              <xs:documentation>Date vaccine batch expires.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="site" minOccurs="0" maxOccurs="1" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>Body site where vaccine was administered.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="route" minOccurs="0" maxOccurs="1" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>The path by which the vaccine product is taken into the body.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="doseQuantity" minOccurs="0" maxOccurs="1" type="Quantity">
            <xs:annotation>
              <xs:documentation>The quantity of vaccine product that was administered.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="explanation" type="Immunization.Explanation" minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>Reasons why a vaccine was administered or refused.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="reaction" type="Immunization.Reaction" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation>Categorical data indicating that an adverse event is associated in time to an immunization.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="vaccinationProtocol" type="Immunization.VaccinationProtocol" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation>Contains information about the protocol(s) under which the vaccine was administered.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="Immunization.Explanation">
    <xs:annotation>
      <xs:documentation>Immunization event information.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="reason" minOccurs="0" maxOccurs="unbounded" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>Reasons why a vaccine was administered.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="refusalReason" minOccurs="0" maxOccurs="unbounded" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>Refusal or exemption reasons.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="Immunization.Reaction">
    <xs:annotation>
      <xs:documentation>Immunization event information.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="date" minOccurs="0" maxOccurs="1" type="dateTime">
            <xs:annotation>
              <xs:documentation>Date of reaction to the immunization.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="detail" minOccurs="0" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>Details of the reaction.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="reported" minOccurs="0" maxOccurs="1" type="boolean">
            <xs:annotation>
              <xs:documentation>Self-reported indicator.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="Immunization.VaccinationProtocol">
    <xs:annotation>
      <xs:documentation>Immunization event information.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="doseSequence" minOccurs="1" maxOccurs="1" type="integer">
            <xs:annotation>
              <xs:documentation>Nominal position in a series.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="description" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>Contains the description about the protocol under which the vaccine was administered.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="authority" minOccurs="0" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>Indicates the authority who published the protocol?  E.g. ACIP.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="series" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>One possible path to achieve presumed immunity against a disease - within the context of an authority.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="seriesDoses" minOccurs="0" maxOccurs="1" type="integer">
            <xs:annotation>
              <xs:documentation>The recommended number of doses to achieve immunity.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="doseTarget" minOccurs="1" maxOccurs="1" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>The targeted disease.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="doseStatus" minOccurs="1" maxOccurs="1" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>Indicates if the immunization event should &quot;count&quot; against  the protocol.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="doseStatusReason" minOccurs="0" maxOccurs="1" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>Provides an explanation as to why a immunization event should or should not count against the protocol.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:element name="ImmunizationRecommendation" type="ImmunizationRecommendation">
    <xs:annotation>
      <xs:documentation>A patient's point-of-time immunization status and recommendation with optional supporting justification.</xs:documentation>
    </xs:annotation>
  </xs:element>
  <xs:complexType name="ImmunizationRecommendation">
    <xs:annotation>
      <xs:documentation>A patient's point-of-time immunization status and recommendation with optional supporting justification.</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>A unique identifier assigned to this particular recommendation record.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="subject" minOccurs="1" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>The patient who is the subject of the profile.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="recommendation" type="ImmunizationRecommendation.Recommendation" minOccurs="1" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation>Vaccine administration recommendations.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="ImmunizationRecommendation.Recommendation">
    <xs:annotation>
      <xs:documentation>A patient's point-of-time immunization status and recommendation with optional supporting justification.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="date" minOccurs="1" maxOccurs="1" type="dateTime">
            <xs:annotation>
              <xs:documentation>The date the immunization recommendation was created.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="vaccineType" minOccurs="1" maxOccurs="1" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>Vaccine that pertains to the recommendation.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="doseNumber" minOccurs="0" maxOccurs="1" type="integer">
            <xs:annotation>
              <xs:documentation>This indicates the next recommended dose number (e.g. dose 2 is the next recommended dose).</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="forecastStatus" minOccurs="1" maxOccurs="1" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>Vaccine administration status.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="dateCriterion" type="ImmunizationRecommendation.DateCriterion" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation>Vaccine date recommendations - e.g. earliest date to administer, latest date to administer, etc.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="protocol" type="ImmunizationRecommendation.Protocol" minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>Contains information about the protocol under which the vaccine was administered.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="supportingImmunization" minOccurs="0" maxOccurs="unbounded" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>Immunization event history that supports the status and recommendation.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="supportingPatientInformation" minOccurs="0" maxOccurs="unbounded" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>Patient Information that supports the status and recommendation.  This includes patient observations, adverse reactions and allergy/intolerance information.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="ImmunizationRecommendation.DateCriterion">
    <xs:annotation>
      <xs:documentation>A patient's point-of-time immunization status and recommendation with optional supporting justification.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="code" minOccurs="1" maxOccurs="1" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>Date classification of recommendation - e.g. earliest date to give, latest date to give, etc.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="value" minOccurs="1" maxOccurs="1" type="dateTime">
            <xs:annotation>
              <xs:documentation>Date recommendation.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="ImmunizationRecommendation.Protocol">
    <xs:annotation>
      <xs:documentation>A patient's point-of-time immunization status and recommendation with optional supporting justification.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="doseSequence" minOccurs="0" maxOccurs="1" type="integer">
            <xs:annotation>
              <xs:documentation>Indicates the nominal position in a series of the next dose.  This is the recommended dose number as per a specified protocol.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="description" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>Contains the description about the protocol under which the vaccine was administered.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="authority" minOccurs="0" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>Indicates the authority who published the protocol?  E.g. ACIP.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="series" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>One possible path to achieve presumed immunity against a disease - within the context of an authority.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:element name="List" type="List">
    <xs:annotation>
      <xs:documentation>A set of information summarized from a list of other resources.</xs:documentation>
    </xs:annotation>
  </xs:element>
  <xs:complexType name="List">
    <xs:annotation>
      <xs:documentation>A set of information summarized from a list of other resources.</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>Identifier for the List assigned for business purposes outside the context of FHIR.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="code" minOccurs="0" maxOccurs="1" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>This code defines the purpose of the list - why it was created.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="subject" minOccurs="0" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>The common subject (or patient) of the resources that are in the list, if there is one.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="source" minOccurs="0" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>The entity responsible for deciding what the contents of the list were.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="date" minOccurs="0" maxOccurs="1" type="dateTime">
            <xs:annotation>
              <xs:documentation>The date that the list was prepared.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="ordered" minOccurs="0" maxOccurs="1" type="boolean">
            <xs:annotation>
              <xs:documentation>Whether items in the list have a meaningful order.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="mode" minOccurs="1" maxOccurs="1" type="ListMode">
            <xs:annotation>
              <xs:documentation>How this list was prepared - whether it is a working list that is suitable for being maintained on an ongoing basis, or if it represents a snapshot of a list of items from another source, or whether it is a prepared list where items may be marked as added, modified or deleted.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="entry" type="List.Entry" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation>Entries in this list.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="emptyReason" minOccurs="0" maxOccurs="1" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>If the list is empty, why the list is empty.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="List.Entry">
    <xs:annotation>
      <xs:documentation>A set of information summarized from a list of other resources.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="flag" minOccurs="0" maxOccurs="unbounded" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>The flag allows the system constructing the list to make one or more statements about the role and significance of the item in the list.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="deleted" minOccurs="0" maxOccurs="1" type="boolean">
            <xs:annotation>
              <xs:documentation>True if this item is marked as deleted in the list.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="date" minOccurs="0" maxOccurs="1" type="dateTime">
            <xs:annotation>
              <xs:documentation>When this item was added to the list.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="item" minOccurs="1" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>A reference to the actual resource from which data was derived.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:simpleType name="ListMode-list">
    <xs:restriction base="xs:string">
      <xs:enumeration value="working">
        <xs:annotation>
          <xs:documentation>This list is the master list, maintained in an ongoing fashion with regular updates as the real world list it is tracking changes.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="snapshot">
        <xs:annotation>
          <xs:documentation>This list was prepared as a snapshot. It should not be assumed to be current.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="changes">
        <xs:annotation>
          <xs:documentation>The list is prepared as a statement of changes that have been made or recommended.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>
  <xs:complexType name="ListMode">
    <xs:annotation>
      <xs:documentation>The processing mode that applies to this list</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="ListMode-list" use="optional"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:element name="Location" type="Location">
    <xs:annotation>
      <xs:documentation>Details and position information for a physical place where services are provided  and resources and participants may be stored, found, contained or accommodated.</xs:documentation>
    </xs:annotation>
  </xs:element>
  <xs:complexType name="Location">
    <xs:annotation>
      <xs:documentation>Details and position information for a physical place where services are provided  and resources and participants may be stored, found, contained or accommodated.</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="1" type="Identifier">
            <xs:annotation>
              <xs:documentation>Unique code or number identifying the location to its users.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="name" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>Name of the location as used by humans. Does not need to be unique.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="description" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>Description of the Location, which helps in finding or referencing the place.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="type" minOccurs="0" maxOccurs="1" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>Indicates the type of function performed at the location.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="telecom" minOccurs="0" maxOccurs="unbounded" type="Contact">
            <xs:annotation>
              <xs:documentation>The contact details of communication devices available at the location. This can include phone numbers, fax numbers, mobile numbers, email addresses and web sites.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="address" minOccurs="0" maxOccurs="1" type="Address">
            <xs:annotation>
              <xs:documentation>Physical location.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="physicalType" minOccurs="0" maxOccurs="1" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>Physical form of the location, e.g. building, room, vehicle, road.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="position" type="Location.Position" minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>The absolute geographic location of the Location, expressed in a KML compatible manner (see notes below for KML).</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="managingOrganization" minOccurs="0" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>The organization that is responsible for the provisioning and upkeep of the location.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="status" minOccurs="0" maxOccurs="1" type="LocationStatus">
            <xs:annotation>
              <xs:documentation>active | suspended | inactive.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="partOf" minOccurs="0" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>Another Location which this Location is physically part of.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="mode" minOccurs="0" maxOccurs="1" type="LocationMode">
            <xs:annotation>
              <xs:documentation>Indicates whether a resource instance represents a specific location or a class of locations.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="Location.Position">
    <xs:annotation>
      <xs:documentation>Details and position information for a physical place where services are provided  and resources and participants may be stored, found, contained or accommodated.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="longitude" minOccurs="1" maxOccurs="1" type="decimal">
            <xs:annotation>
              <xs:documentation>Longitude. The value domain and the interpretation are the same as for the text of the longitude element in KML (see notes below).</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="latitude" minOccurs="1" maxOccurs="1" type="decimal">
            <xs:annotation>
              <xs:documentation>Latitude. The value domain and the interpretation are the same as for the text of the latitude element in KML (see notes below).</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="altitude" minOccurs="0" maxOccurs="1" type="decimal">
            <xs:annotation>
              <xs:documentation>Altitude. The value domain and the interpretation are the same as for the text of the altitude element in KML (see notes below).</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:simpleType name="LocationStatus-list">
    <xs:restriction base="xs:string">
      <xs:enumeration value="active">
        <xs:annotation>
          <xs:documentation>The location is operational.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="suspended">
        <xs:annotation>
          <xs:documentation>The location is temporarily closed.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="inactive">
        <xs:annotation>
          <xs:documentation>The location is no longer used.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>
  <xs:complexType name="LocationStatus">
    <xs:annotation>
      <xs:documentation>Indicates whether the location is still in use</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="LocationStatus-list" use="optional"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:simpleType name="LocationMode-list">
    <xs:restriction base="xs:string">
      <xs:enumeration value="instance">
        <xs:annotation>
          <xs:documentation>The Location resource represents a specific instance of a Location.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="kind">
        <xs:annotation>
          <xs:documentation>The Location represents a class of Locations.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>
  <xs:complexType name="LocationMode">
    <xs:annotation>
      <xs:documentation>Indicates whether a resource instance represents a specific location or a class of locations</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="LocationMode-list" use="optional"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:element name="Media" type="Media">
    <xs:annotation>
      <xs:documentation>A photo, video, or audio recording acquired or used in healthcare. The actual content may be inline or provided by direct reference.</xs:documentation>
    </xs:annotation>
  </xs:element>
  <xs:complexType name="Media">
    <xs:annotation>
      <xs:documentation>A photo, video, or audio recording acquired or used in healthcare. The actual content may be inline or provided by direct reference.</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="type" minOccurs="1" maxOccurs="1" type="MediaType">
            <xs:annotation>
              <xs:documentation>Whether the media is a photo (still image), an audio recording, or a video recording.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="subtype" minOccurs="0" maxOccurs="1" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>Details of the type of the media - usually, how it was acquired (what type of device). If images sourced from a DICOM system, are wrapped in a Media resource, then this is the modality.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="identifier" minOccurs="0" maxOccurs="unbounded" type="Identifier">
            <xs:annotation>
              <xs:documentation>Identifiers associated with the image - these may include identifiers for the image itself, identifiers for the context of its collection (e.g. series ids) and context ids such as accession numbers or other workflow identifiers.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="dateTime" minOccurs="0" maxOccurs="1" type="dateTime">
            <xs:annotation>
              <xs:documentation>When the media was originally recorded. For video and audio, if the length of the recording is not insignificant, this is the end of the recording.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="subject" minOccurs="0" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>Who/What this Media is a record of.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="operator" minOccurs="0" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>The person who administered the collection of the image.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="view" minOccurs="0" maxOccurs="1" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>The name of the imaging view e.g Lateral or Antero-posterior (AP).</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="deviceName" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>The name of the device / manufacturer of the device  that was used to make the recording.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="height" minOccurs="0" maxOccurs="1" type="integer">
            <xs:annotation>
              <xs:documentation>Height of the image in pixels(photo/video).</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="width" minOccurs="0" maxOccurs="1" type="integer">
            <xs:annotation>
              <xs:documentation>Width of the image in pixels (photo/video).</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="frames" minOccurs="0" maxOccurs="1" type="integer">
            <xs:annotation>
              <xs:documentation>The number of frames in a photo. This is used with a multi-page fax, or an imaging acquisition context that takes multiple slices in a single image, or an animated gif. If there is more than one frame, this SHALL have a value in order to alert interface software that a multi-frame capable rendering widget is required.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="length" minOccurs="0" maxOccurs="1" type="integer">
            <xs:annotation>
              <xs:documentation>The length of the recording in seconds - for audio and video.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="content" minOccurs="1" maxOccurs="1" type="Attachment">
            <xs:annotation>
              <xs:documentation>The actual content of the media - inline or by direct reference to the media source file.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:simpleType name="MediaType-list">
    <xs:restriction base="xs:string">
      <xs:enumeration value="photo">
        <xs:annotation>
          <xs:documentation>The media consists of one or more unmoving images, including photographs, computer-generated graphs and charts, and scanned documents.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="video">
        <xs:annotation>
          <xs:documentation>The media consists of a series of frames that capture a moving image.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="audio">
        <xs:annotation>
          <xs:documentation>The media consists of a sound recording.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>
  <xs:complexType name="MediaType">
    <xs:annotation>
      <xs:documentation>Whether the Media is a photo, video, or audio</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="MediaType-list" use="optional"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <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:element name="MedicationAdministration" type="MedicationAdministration">
    <xs:annotation>
      <xs:documentation>Describes the event of a patient being given a dose of a medication.  This may be as simple as swallowing a tablet or it may be a long running infusion.

Related resources tie this event to the authorizing prescription, and the specific encounter between patient and health care practitioner.</xs:documentation>
    </xs:annotation>
  </xs:element>
  <xs:complexType name="MedicationAdministration">
    <xs:annotation>
      <xs:documentation>Describes the event of a patient being given a dose of a medication.  This may be as simple as swallowing a tablet or it may be a long running infusion.

Related resources tie this event to the authorizing prescription, and the specific encounter between patient and health care practitioner.</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>External identifier - FHIR will generate its own internal IDs (probably URLs) which do not need to be explicitly managed by the resource.  The identifier here is one that would be used by another non-FHIR system - for example an automated medication pump would provide a record each time it operated; an administration while the patient was off the ward might be made with a different system and entered after the event.  Particularly important if these records have to be updated.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="status" minOccurs="1" maxOccurs="1" type="MedicationAdministrationStatus">
            <xs:annotation>
              <xs:documentation>Will generally be set to show that the administration has been completed.  For some long running administrations such as infusions it is possible for an administration to be started but not completed or it may be paused while some other process is under way.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="patient" minOccurs="1" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>The person or animal to whom the medication was given.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="practitioner" minOccurs="1" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>The individual who was responsible for giving the medication to the patient.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="encounter" minOccurs="0" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>The visit or admission the or other contact between patient and health care provider the medication administration was performed as part of.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="prescription" minOccurs="1" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>The original request, instruction or authority to perform the administration.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="wasNotGiven" minOccurs="0" maxOccurs="1" type="boolean">
            <xs:annotation>
              <xs:documentation>Set this to true if the record is saying that the medication was NOT administered.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="reasonNotGiven" minOccurs="0" maxOccurs="unbounded" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>A code indicating why the administration was not performed.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="whenGiven" minOccurs="1" maxOccurs="1" type="Period">
            <xs:annotation>
              <xs:documentation>An interval of time during which the administration took place.  For many administrations, such as swallowing a tablet the lower and upper values of the interval will be the same.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="medication" minOccurs="0" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>Identifies the medication that was administered. This is either a link to a resource representing the details of the medication or a simple attribute carrying a code that identifies the medication from a known list of medications.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="device" minOccurs="0" maxOccurs="unbounded" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>The device used in administering the medication to the patient.  E.g. a particular infusion pump.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="dosage" type="MedicationAdministration.Dosage" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation>Provides details of how much of the medication was administered.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="MedicationAdministration.Dosage">
    <xs:annotation>
      <xs:documentation>Describes the event of a patient being given a dose of a medication.  This may be as simple as swallowing a tablet or it may be a long running infusion.

Related resources tie this event to the authorizing prescription, and the specific encounter between patient and health care practitioner.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:choice minOccurs="0" maxOccurs="1" >
            <xs:annotation>
              <xs:documentation>The timing schedule for giving the medication to the patient.  This may be a single time point (using dateTime) or it may be a start and end dateTime (Period).</xs:documentation>
            </xs:annotation>
            <xs:element name="timingDateTime" type="dateTime"/>
            <xs:element name="timingPeriod" type="Period"/>
          </xs:choice>
          <xs:choice minOccurs="0" maxOccurs="1" >
            <xs:annotation>
              <xs:documentation>If set to true or if specified as a CodeableConcept, indicates that the medication is only taken when needed within the specified schedule rather than at every scheduled dose.  If a CodeableConcept is present, it indicates the pre-condition for taking the Medication.</xs:documentation>
            </xs:annotation>
            <xs:element name="asNeededBoolean" type="boolean"/>
            <xs:element name="asNeededCodeableConcept" type="CodeableConcept"/>
          </xs:choice>
          <xs:element name="site" minOccurs="0" maxOccurs="1" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>A coded specification of the anatomic site where the medication first entered the body.  E.g. &quot;left arm&quot;.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="route" minOccurs="0" maxOccurs="1" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>A code specifying the route or physiological path of administration of a therapeutic agent into or onto the patient.   E.g. topical, intravenous, etc.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="method" minOccurs="0" maxOccurs="1" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>A coded value indicating the method by which the medication was introduced into or onto the body. Most commonly used for injections.  Examples:  Slow Push; Deep IV.

Terminologies used often pre-coordinate this term with the route and or form of administration.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="quantity" minOccurs="0" maxOccurs="1" type="Quantity">
            <xs:annotation>
              <xs:documentation>The amount of the medication given at one administration event.   Use this value when the administration is essentially an instantaneous event such as a swallowing a tablet or giving an injection.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="rate" minOccurs="0" maxOccurs="1" type="Ratio">
            <xs:annotation>
              <xs:documentation>Identifies the speed with which the medication was introduced into the patient. Typically the rate for an infusion e.g. 200ml in 2 hours.  May also expressed as a rate per unit of time such as 100ml per hour - the duration is then not specified, or is specified in the quantity.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="maxDosePerPeriod" minOccurs="0" maxOccurs="1" type="Ratio">
            <xs:annotation>
              <xs:documentation>The maximum total quantity of a therapeutic substance that was administered to the patient over the specified period of time. E.g. 1000mg in 24 hours.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:simpleType name="MedicationAdministrationStatus-list">
    <xs:restriction base="xs:string">
      <xs:enumeration value="in progress">
        <xs:annotation>
          <xs:documentation>The administration has started but has not yet completed.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="on hold">
        <xs:annotation>
          <xs:documentation>Actions implied by the administration have been temporarily halted, but are expected to continue later. May also be called &quot;suspended&quot;.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="completed">
        <xs:annotation>
          <xs:documentation>All actions that are implied by the administration have occurred.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="entered in error">
        <xs:annotation>
          <xs:documentation>The administration was entered in error and therefore nullified.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="stopped">
        <xs:annotation>
          <xs:documentation>Actions implied by the administration have been permanently halted, before all of them occurred.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>
  <xs:complexType name="MedicationAdministrationStatus">
    <xs:annotation>
      <xs:documentation>A set of codes indicating the current status of a MedicationAdministration</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="MedicationAdministrationStatus-list" use="optional"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:element name="MedicationDispense" type="MedicationDispense">
    <xs:annotation>
      <xs:documentation>Dispensing a medication to a named patient.  This includes a description of the supply provided and the instructions for administering the medication.</xs:documentation>
    </xs:annotation>
  </xs:element>
  <xs:complexType name="MedicationDispense">
    <xs:annotation>
      <xs:documentation>Dispensing a medication to a named patient.  This includes a description of the supply provided and the instructions for administering the medication.</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="1" type="Identifier">
            <xs:annotation>
              <xs:documentation>Identifier assigned by the dispensing facility - this is an identifier assigned outside FHIR.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="status" minOccurs="0" maxOccurs="1" type="MedicationDispenseStatus">
            <xs:annotation>
              <xs:documentation>A code specifying the state of the set of dispense events.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="patient" minOccurs="0" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>A link to a resource representing the person to whom the medication will be given.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="dispenser" minOccurs="0" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>The individual responsible for dispensing the medication.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="authorizingPrescription" minOccurs="0" maxOccurs="unbounded" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>Indicates the medication order that is being dispensed against.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="dispense" type="MedicationDispense.Dispense" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation>Indicates the details of the dispense event such as the days supply and quantity of medication dispensed.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="substitution" type="MedicationDispense.Substitution" minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>Indicates whether or not substitution was made as part of the dispense.  In some cases substitution will be expected but doesn't happen, in other cases substitution is not expected but does happen.  This block explains what substitition did or did not happen and why.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="MedicationDispense.Dispense">
    <xs:annotation>
      <xs:documentation>Dispensing a medication to a named patient.  This includes a description of the supply provided and the instructions for administering the medication.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="identifier" minOccurs="0" maxOccurs="1" type="Identifier">
            <xs:annotation>
              <xs:documentation>Identifier assigned by the dispensing facility.   This is an identifier assigned outside FHIR.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="status" minOccurs="0" maxOccurs="1" type="MedicationDispenseStatus">
            <xs:annotation>
              <xs:documentation>A code specifying the state of the dispense event.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="type" minOccurs="0" maxOccurs="1" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>Indicates the type of dispensing event that is performed. Examples include: Trial Fill, Completion of Trial, Partial Fill, Emergency Fill, Samples, etc.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="quantity" minOccurs="0" maxOccurs="1" type="Quantity">
            <xs:annotation>
              <xs:documentation>The amount of medication that has been dispensed. Includes unit of measure.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="medication" minOccurs="0" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>Identifies the medication being administered. This is either a link to a resource representing the details of the medication or a simple attribute carrying a code that identifies the medication from a known list of medications.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="whenPrepared" minOccurs="0" maxOccurs="1" type="dateTime">
            <xs:annotation>
              <xs:documentation>The time when the dispensed product was packaged and reviewed.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="whenHandedOver" minOccurs="0" maxOccurs="1" type="dateTime">
            <xs:annotation>
              <xs:documentation>The time the dispensed product was provided to the patient or their representative.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="destination" minOccurs="0" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>Identification of the facility/location where the medication was shipped to, as part of the dispense event.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="receiver" minOccurs="0" maxOccurs="unbounded" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>Identifies the person who picked up the medication.  This will usually be a patient or their carer, but some cases exist where it can be a healthcare professional.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="dosage" type="MedicationDispense.Dosage" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation>Indicates how the medication is to be used by the patient.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="MedicationDispense.Dosage">
    <xs:annotation>
      <xs:documentation>Dispensing a medication to a named patient.  This includes a description of the supply provided and the instructions for administering the medication.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="additionalInstructions" minOccurs="0" maxOccurs="1" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>Additional instructions such as &quot;Swallow with plenty of water&quot; which may or may not be coded.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:choice minOccurs="0" maxOccurs="1" >
            <xs:annotation>
              <xs:documentation>The timing schedule for giving the medication to the patient.  The Schedule data type allows many different expressions, for example.  &quot;Every  8 hours&quot;; &quot;Three times a day&quot;; &quot;1/2 an hour before breakfast for 10 days from 23-Dec 2011:&quot;;  &quot;15 Oct 2013, 17 Oct 2013 and 1 Nov 2013&quot;.</xs:documentation>
            </xs:annotation>
            <xs:element name="timingDateTime" type="dateTime"/>
            <xs:element name="timingPeriod" type="Period"/>
            <xs:element name="timingSchedule" type="Schedule"/>
          </xs:choice>
          <xs:choice minOccurs="0" maxOccurs="1" >
            <xs:annotation>
              <xs:documentation>If set to true or if specified as a CodeableConcept, indicates that the medication is only taken when needed within the specified schedule rather than at every scheduled dose.  If a CodeableConcept is present, it indicates the pre-condition for taking the Medication.</xs:documentation>
            </xs:annotation>
            <xs:element name="asNeededBoolean" type="boolean"/>
            <xs:element name="asNeededCodeableConcept" type="CodeableConcept"/>
          </xs:choice>
          <xs:element name="site" minOccurs="0" maxOccurs="1" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>A coded specification of the anatomic site where the medication first enters the body.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="route" minOccurs="0" maxOccurs="1" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>A code specifying the route or physiological path of administration of a therapeutic agent into or onto a subject.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="method" minOccurs="0" maxOccurs="1" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>A coded value indicating the method by which the medication is introduced into or onto the body. Most commonly used for injections.  Examples:  Slow Push; Deep IV.

Terminologies used often pre-coordinate this term with the route and or form of administration.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="quantity" minOccurs="0" maxOccurs="1" type="Quantity">
            <xs:annotation>
              <xs:documentation>The amount of therapeutic or other substance given at one administration event.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="rate" minOccurs="0" maxOccurs="1" type="Ratio">
            <xs:annotation>
              <xs:documentation>Identifies the speed with which the substance is introduced into the subject. Typically the rate for an infusion. 200ml in 2 hours.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="maxDosePerPeriod" minOccurs="0" maxOccurs="1" type="Ratio">
            <xs:annotation>
              <xs:documentation>The maximum total quantity of a therapeutic substance that may be administered to a subject over the period of time,  e.g. 1000mg in 24 hours.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="MedicationDispense.Substitution">
    <xs:annotation>
      <xs:documentation>Dispensing a medication to a named patient.  This includes a description of the supply provided and the instructions for administering the medication.</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>A code signifying whether a different drug was dispensed from what was prescribed.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="reason" minOccurs="0" maxOccurs="unbounded" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>Indicates the reason for the substitution of (or lack of substitution) from what was prescribed.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="responsibleParty" minOccurs="0" maxOccurs="unbounded" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>The person or organization that has primary responsibility for the substitution.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:simpleType name="MedicationDispenseStatus-list">
    <xs:restriction base="xs:string">
      <xs:enumeration value="in progress">
        <xs:annotation>
          <xs:documentation>The dispense has started but has not yet completed.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="on hold">
        <xs:annotation>
          <xs:documentation>Actions implied by the administration have been temporarily halted, but are expected to continue later. May also be called &quot;suspended&quot;.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="completed">
        <xs:annotation>
          <xs:documentation>All actions that are implied by the dispense have occurred.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="entered in error">
        <xs:annotation>
          <xs:documentation>The dispense was entered in error and therefore nullified.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="stopped">
        <xs:annotation>
          <xs:documentation>Actions implied by the dispense have been permanently halted, before all of them occurred.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>
  <xs:complexType name="MedicationDispenseStatus">
    <xs:annotation>
      <xs:documentation>A code specifying the state of the dispense event.</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="MedicationDispenseStatus-list" use="optional"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:element name="MedicationPrescription" type="MedicationPrescription">
    <xs:annotation>
      <xs:documentation>An order for both supply of the medication and the instructions for administration of the medicine to a patient.</xs:documentation>
    </xs:annotation>
  </xs:element>
  <xs:complexType name="MedicationPrescription">
    <xs:annotation>
      <xs:documentation>An order for both supply of the medication and the instructions for administration of the medicine to a patient.</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>External identifier - one that would be used by another non-FHIR system - for example a re-imbursement system might issue its own id for each prescription that is created.  This is particularly important where FHIR only provides part of an erntire workflow process where records have to be tracked through an entire system.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="dateWritten" minOccurs="0" maxOccurs="1" type="dateTime">
            <xs:annotation>
              <xs:documentation>The date (and perhaps time) when the prescription was written.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="status" minOccurs="0" maxOccurs="1" type="MedicationPrescriptionStatus">
            <xs:annotation>
              <xs:documentation>A code specifying the state of the order.  Generally this will be active or completed state.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="patient" minOccurs="0" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>A link to a resource representing the person to whom the medication will be given.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="prescriber" minOccurs="0" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>The healthcare professional responsible for authorizing the prescription.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="encounter" minOccurs="0" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>A link to a resource that identifies the particular occurrence of contact between patient and health care provider.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:choice minOccurs="0" maxOccurs="1" >
            <xs:annotation>
              <xs:documentation>Can be the reason or the indication for writing the prescription.</xs:documentation>
            </xs:annotation>
            <xs:element name="reasonCodeableConcept" type="CodeableConcept"/>
            <xs:element name="reasonResource" type="ResourceReference"/>
          </xs:choice>
          <xs:element name="medication" minOccurs="0" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>Identifies the medication being administered. This is either a link to a resource representing the details of the medication or a simple attribute carrying a code that identifies the medication from a known list of medications.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="dosageInstruction" type="MedicationPrescription.DosageInstruction" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation>Indicates how the medication is to be used by the patient.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="dispense" type="MedicationPrescription.Dispense" minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>Deals with details of the dispense part of the order.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="substitution" type="MedicationPrescription.Substitution" minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>Indicates whether or not substitution can or should be part of the dispense. In some cases substitution must happen, in other cases substitution must not happen, and in others it does not matter. This block explains the prescriber's intent. If nothing is specified substitution may be done.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="MedicationPrescription.DosageInstruction">
    <xs:annotation>
      <xs:documentation>An order for both supply of the medication and the instructions for administration of the medicine to a patient.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="text" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>Free text dosage instructions for cases where the instructions are too complex to code.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="additionalInstructions" minOccurs="0" maxOccurs="1" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>Additional instructions such as &quot;Swallow with plenty of water&quot; which may or may not be coded.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:choice minOccurs="0" maxOccurs="1" >
            <xs:annotation>
              <xs:documentation>The timing schedule for giving the medication to the patient.  The Schedule data type allows many different expressions, for example.  &quot;Every  8 hours&quot;; &quot;Three times a day&quot;; &quot;1/2 an hour before breakfast for 10 days from 23-Dec 2011:&quot;;  &quot;15 Oct 2013, 17 Oct 2013 and 1 Nov 2013&quot;.</xs:documentation>
            </xs:annotation>
            <xs:element name="timingDateTime" type="dateTime"/>
            <xs:element name="timingPeriod" type="Period"/>
            <xs:element name="timingSchedule" type="Schedule"/>
          </xs:choice>
          <xs:choice minOccurs="0" maxOccurs="1" >
            <xs:annotation>
              <xs:documentation>If set to true or if specified as a CodeableConcept, indicates that the medication is only taken when needed within the specified schedule rather than at every scheduled dose.  If a CodeableConcept is present, it indicates the pre-condition for taking the Medication.</xs:documentation>
            </xs:annotation>
            <xs:element name="asNeededBoolean" type="boolean"/>
            <xs:element name="asNeededCodeableConcept" type="CodeableConcept"/>
          </xs:choice>
          <xs:element name="site" minOccurs="0" maxOccurs="1" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>A coded specification of the anatomic site where the medication first enters the body.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="route" minOccurs="0" maxOccurs="1" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>A code specifying the route or physiological path of administration of a therapeutic agent into or onto a patient.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="method" minOccurs="0" maxOccurs="1" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>A coded value indicating the method by which the medication is introduced into or onto the body. Most commonly used for injections.  Examples:  Slow Push; Deep IV.

Terminologies used often pre-coordinate this term with the route and or form of administration.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="doseQuantity" minOccurs="0" maxOccurs="1" type="Quantity">
            <xs:annotation>
              <xs:documentation>The amount of therapeutic or other substance given at one administration event.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="rate" minOccurs="0" maxOccurs="1" type="Ratio">
            <xs:annotation>
              <xs:documentation>Identifies the speed with which the substance is introduced into the subject. Typically the rate for an infusion. 200ml in 2 hours.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="maxDosePerPeriod" minOccurs="0" maxOccurs="1" type="Ratio">
            <xs:annotation>
              <xs:documentation>The maximum total quantity of a therapeutic substance that may be administered to a subject over the period of time. E.g. 1000mg in 24 hours.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="MedicationPrescription.Dispense">
    <xs:annotation>
      <xs:documentation>An order for both supply of the medication and the instructions for administration of the medicine to a patient.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="medication" minOccurs="0" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>Identifies the medication that is to be dispensed.  This may be a more specifically defined than the medicationPrescription.medication . This is either a link to a resource representing the details of the medication or a simple attribute carrying a code that identifies the medication from a known list of medications.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="validityPeriod" minOccurs="0" maxOccurs="1" type="Period">
            <xs:annotation>
              <xs:documentation>Design Comments: This indicates the validity period of a prescription (stale dating the Prescription) 
It reflects the prescriber perspective for the validity of the prescription. Dispenses must not be made against the prescription outside of this period. The lower-bound of the Dispensing Window signifies the earliest date that the prescription can be filled for the first time. If an upper-bound is not specified then the Prescription is open-ended or will default to a stale-date based on regulations. 
Rationale: Indicates when the Prescription becomes valid, and when it ceases to be a dispensable Prescription.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="numberOfRepeatsAllowed" minOccurs="0" maxOccurs="1" type="integer">
            <xs:annotation>
              <xs:documentation>An integer indicating the number of repeats of the Dispense. 
UsageNotes: For example, the number of times the prescribed quantity is to be supplied including the initial standard fill.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="quantity" minOccurs="0" maxOccurs="1" type="Quantity">
            <xs:annotation>
              <xs:documentation>The amount that is to be dispensed.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="expectedSupplyDuration" minOccurs="0" maxOccurs="1" type="Duration">
            <xs:annotation>
              <xs:documentation>Identifies the period time over which the supplied product is expected to be used, or the length of time the dispense is expected to last. 
In some situations, this attribute may be used instead of quantity to identify the amount supplied by how long it is expected to last, rather than the physical quantity issued, e.g. 90 days supply of medication (based on an ordered dosage) When possible, it is always better to specify quantity, as this tends to be more precise. expectedSupplyDuration will always be an estimate that can be influenced by external factors.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="MedicationPrescription.Substitution">
    <xs:annotation>
      <xs:documentation>An order for both supply of the medication and the instructions for administration of the medicine to a patient.</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>A code signifying whether a different drug should be dispensed from what was prescribed.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="reason" minOccurs="0" maxOccurs="1" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>Indicates the reason for the substitution, or why substitution must or must not be performed.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:simpleType name="MedicationPrescriptionStatus-list">
    <xs:restriction base="xs:string">
      <xs:enumeration value="active">
        <xs:annotation>
          <xs:documentation>The prescription is 'actionable', but not all actions that are implied by it have occurred yet.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="on hold">
        <xs:annotation>
          <xs:documentation>Actions implied by the prescription have been temporarily halted, but are expected to continue later.  May also be called &quot;suspended&quot;.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="completed">
        <xs:annotation>
          <xs:documentation>All actions that are implied by the prescription have occurred (this will rarely be made explicit).</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="entered in error">
        <xs:annotation>
          <xs:documentation>The prescription was entered in error and therefore nullified.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="stopped">
        <xs:annotation>
          <xs:documentation>Actions implied by the prescription have been permanently halted, before all of them occurred.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="superceded">
        <xs:annotation>
          <xs:documentation>The prescription was replaced by a newer one, which encompasses all the information in the previous one.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>
  <xs:complexType name="MedicationPrescriptionStatus">
    <xs:annotation>
      <xs:documentation>A code specifying the state of the prescribing event. Describes the lifecycle of the prescription.</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="MedicationPrescriptionStatus-list" use="optional"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:element name="MedicationStatement" type="MedicationStatement">
    <xs:annotation>
      <xs:documentation>A record of medication being taken by a patient, or that the medication has been given to a patient where the record is the result of a report from the patient or another clinician.</xs:documentation>
    </xs:annotation>
  </xs:element>
  <xs:complexType name="MedicationStatement">
    <xs:annotation>
      <xs:documentation>A record of medication being taken by a patient, or that the medication has been given to a patient where the record is the result of a report from the patient or another clinician.</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>External identifier - FHIR will generate its own internal IDs (probably URLs) which do not need to be explicitly managed by the resource.  The identifier here is one that would be used by another non-FHIR system - for example an automated medication pump would provide a record each time it operated; an administration while the patient was off the ward might be made with a different system and entered after the event.  Particularly important if these records have to be updated.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="patient" minOccurs="0" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>The person or animal who is /was taking the medication.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="wasNotGiven" minOccurs="0" maxOccurs="1" type="boolean">
            <xs:annotation>
              <xs:documentation>Set this to true if the record is saying that the medication was NOT taken.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="reasonNotGiven" minOccurs="0" maxOccurs="unbounded" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>A code indicating why the medication was not taken.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="whenGiven" minOccurs="0" maxOccurs="1" type="Period">
            <xs:annotation>
              <xs:documentation>The interval of time during which it is being asserted that the patient was taking the medication.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="medication" minOccurs="0" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>Identifies the medication being administered. This is either a link to a resource representing the details of the medication or a simple attribute carrying a code that identifies the medication from a known list of medications.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="device" minOccurs="0" maxOccurs="unbounded" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>An identifier or a link to a resource that identifies a device used in administering the medication to the patient.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="dosage" type="MedicationStatement.Dosage" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation>Indicates how the medication is/was used by the patient.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="MedicationStatement.Dosage">
    <xs:annotation>
      <xs:documentation>A record of medication being taken by a patient, or that the medication has been given to a patient where the record is the result of a report from the patient or another clinician.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="timing" minOccurs="0" maxOccurs="1" type="Schedule">
            <xs:annotation>
              <xs:documentation>The timing schedule for giving the medication to the patient.  The Schedule data type allows many different expressions, for example.  &quot;Every  8 hours&quot;; &quot;Three times a day&quot;; &quot;1/2 an hour before breakfast for 10 days from 23-Dec 2011:&quot;;  &quot;15 Oct 2013, 17 Oct 2013 and 1 Nov 2013&quot;.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:choice minOccurs="0" maxOccurs="1" >
            <xs:annotation>
              <xs:documentation>If set to true or if specified as a CodeableConcept, indicates that the medication is only taken when needed within the specified schedule rather than at every scheduled dose.  If a CodeableConcept is present, it indicates the pre-condition for taking the Medication.</xs:documentation>
            </xs:annotation>
            <xs:element name="asNeededBoolean" type="boolean"/>
            <xs:element name="asNeededCodeableConcept" type="CodeableConcept"/>
          </xs:choice>
          <xs:element name="site" minOccurs="0" maxOccurs="1" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>A coded specification of the anatomic site where the medication first enters the body.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="route" minOccurs="0" maxOccurs="1" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>A code specifying the route or physiological path of administration of a therapeutic agent into or onto a subject.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="method" minOccurs="0" maxOccurs="1" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>A coded value indicating the method by which the medication is introduced into or onto the body. Most commonly used for injections.  Examples:  Slow Push; Deep IV.

Terminologies used often pre-coordinate this term with the route and or form of administration.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="quantity" minOccurs="0" maxOccurs="1" type="Quantity">
            <xs:annotation>
              <xs:documentation>The amount of therapeutic or other substance given at one administration event.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="rate" minOccurs="0" maxOccurs="1" type="Ratio">
            <xs:annotation>
              <xs:documentation>Identifies the speed with which the substance is introduced into the subject. Typically the rate for an infusion. 200ml in 2 hours.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="maxDosePerPeriod" minOccurs="0" maxOccurs="1" type="Ratio">
            <xs:annotation>
              <xs:documentation>The maximum total quantity of a therapeutic substance that may be administered to a subject over the period of time. E.g. 1000mg in 24 hours.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:element name="MessageHeader" type="MessageHeader">
    <xs:annotation>
      <xs:documentation>The header for a message exchange that is either requesting or responding to an action.  The resource(s) that are the subject of the action as well as other Information related to the action are typically transmitted in a bundle in which the MessageHeader resource instance is the first resource in the bundle.</xs:documentation>
    </xs:annotation>
  </xs:element>
  <xs:complexType name="MessageHeader">
    <xs:annotation>
      <xs:documentation>The header for a message exchange that is either requesting or responding to an action.  The resource(s) that are the subject of the action as well as other Information related to the action are typically transmitted in a bundle in which the MessageHeader resource instance is the first resource in the bundle.</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="1" maxOccurs="1" type="id">
            <xs:annotation>
              <xs:documentation>The identifier of this message.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="timestamp" minOccurs="1" maxOccurs="1" type="instant">
            <xs:annotation>
              <xs:documentation>The time that the message was sent.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="event" minOccurs="1" maxOccurs="1" type="Coding">
            <xs:annotation>
              <xs:documentation>Code that identifies the event this message represents and connects it with it's definition. Events defined as part of the FHIR specification have the system value &quot;http://hl7.org/fhir/message-type&quot;.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="response" type="MessageHeader.Response" minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>Information about the message that this message is a response to.  Only present if this message is a response.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="source" type="MessageHeader.Source" minOccurs="1" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>The source application from which this message originated.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="destination" type="MessageHeader.Destination" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation>The destination application which the message is intended for.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="enterer" minOccurs="0" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>The person or device that performed the data entry leading to this message. Where there is more than one candidate, pick the most proximal to the message. Can provide other enterers in extensions.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="author" minOccurs="0" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>The logical author of the message - the person or device that decided the described event should happen. Where there is more than one candidate, pick the most proximal to the MessageHeader. Can provide other authors in extensions.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="receiver" minOccurs="0" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>Allows data conveyed by a message to be addressed to a particular person or department when routing to a specific application isn't sufficient.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="responsible" minOccurs="0" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>The person or organization that accepts overall responsibility for the contents of the message. The implication is that the message event happened under the policies of the responsible party.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="reason" minOccurs="0" maxOccurs="1" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>Coded indication of the cause for the event - indicates  a reason for the occurance of the event that is a focus of this message.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="data" minOccurs="0" maxOccurs="unbounded" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>The actual data of the message - a reference to the root/focus class of the event.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="MessageHeader.Response">
    <xs:annotation>
      <xs:documentation>The header for a message exchange that is either requesting or responding to an action.  The resource(s) that are the subject of the action as well as other Information related to the action are typically transmitted in a bundle in which the MessageHeader resource instance is the first resource in the bundle.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="identifier" minOccurs="1" maxOccurs="1" type="id">
            <xs:annotation>
              <xs:documentation>The id of the message that this message is a response to.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="code" minOccurs="1" maxOccurs="1" type="ResponseType">
            <xs:annotation>
              <xs:documentation>Code that identifies the type of response to the message - whether it was successful or not, and whether it should be resent or not.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="details" minOccurs="0" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>Full details of any issues found in the message.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="MessageHeader.Source">
    <xs:annotation>
      <xs:documentation>The header for a message exchange that is either requesting or responding to an action.  The resource(s) that are the subject of the action as well as other Information related to the action are typically transmitted in a bundle in which the MessageHeader resource instance is the first resource in the bundle.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="name" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>Human-readable name for the target system.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="software" minOccurs="1" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>May include configuration or other information useful in debugging.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="version" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>Can convey versions of multiple systems in situations where a message passes through multiple hands.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="contact" minOccurs="0" maxOccurs="1" type="Contact">
            <xs:annotation>
              <xs:documentation>An e-mail, phone, website or other contact point to use to resolve issues with message communications.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="endpoint" minOccurs="1" maxOccurs="1" type="uri">
            <xs:annotation>
              <xs:documentation>Identifies the routing target to send acknowledgements to.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="MessageHeader.Destination">
    <xs:annotation>
      <xs:documentation>The header for a message exchange that is either requesting or responding to an action.  The resource(s) that are the subject of the action as well as other Information related to the action are typically transmitted in a bundle in which the MessageHeader resource instance is the first resource in the bundle.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="name" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>Human-readable name for the source system.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="target" minOccurs="0" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>Identifies the target end system in situations where the initial message transmission is to an intermediary system.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="endpoint" minOccurs="1" maxOccurs="1" type="uri">
            <xs:annotation>
              <xs:documentation>Indicates where the message should be routed to.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:simpleType name="ResponseType-list">
    <xs:restriction base="xs:string">
      <xs:enumeration value="ok">
        <xs:annotation>
          <xs:documentation>The message was accepted and processed without error.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="transient-error">
        <xs:annotation>
          <xs:documentation>Some internal unexpected error occurred - wait and try again. Note - this is usually used for things like database unavailable, which may be expected to resolve, though human intervention may be required.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="fatal-error">
        <xs:annotation>
          <xs:documentation>The message was rejected because of some content in it. There is no point in re-sending without change. The response narrative SHALL describe what the issue is.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>
  <xs:complexType name="ResponseType">
    <xs:annotation>
      <xs:documentation>The kind of response to a message</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="ResponseType-list" use="optional"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:element name="Observation" type="Observation">
    <xs:annotation>
      <xs:documentation>Measurements and simple assertions made about a patient, device or other subject.</xs:documentation>
    </xs:annotation>
  </xs:element>
  <xs:complexType name="Observation">
    <xs:annotation>
      <xs:documentation>Measurements and simple assertions made about a patient, device or other subject.</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="1" maxOccurs="1" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>Describes what was observed. Sometimes this is called the observation &quot;code&quot;.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:choice minOccurs="0" maxOccurs="1" >
            <xs:annotation>
              <xs:documentation>The information determined as a result of making the observation, if the information has a simple value.</xs:documentation>
            </xs:annotation>
            <xs:element name="valueQuantity" type="Quantity"/>
            <xs:element name="valueCodeableConcept" type="CodeableConcept"/>
            <xs:element name="valueAttachment" type="Attachment"/>
            <xs:element name="valueRatio" type="Ratio"/>
            <xs:element name="valuePeriod" type="Period"/>
            <xs:element name="valueSampledData" type="SampledData"/>
            <xs:element name="valueString" type="string"/>
          </xs:choice>
          <xs:element name="interpretation" minOccurs="0" maxOccurs="1" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>The assessment made based on the result of the observation.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="comments" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>May include statements about significant, unexpected or unreliable values, or information about the source of the value where this may be relevant to the interpretation of the result.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:choice minOccurs="0" maxOccurs="1" >
            <xs:annotation>
              <xs:documentation>The time or time-period the observed value is asserted as being true. For biological subjects - e.g. human patients - this is usually called the &quot;physiologically relevant time&quot;. This is usually either the time of the procedure or of specimen collection, but very often the source of the date/time is not known, only the date/time itself.</xs:documentation>
            </xs:annotation>
            <xs:element name="appliesDateTime" type="dateTime"/>
            <xs:element name="appliesPeriod" type="Period"/>
          </xs:choice>
          <xs:element name="issued" minOccurs="0" maxOccurs="1" type="instant">
            <xs:annotation>
              <xs:documentation>Date/Time this was made available.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="status" minOccurs="1" maxOccurs="1" type="ObservationStatus">
            <xs:annotation>
              <xs:documentation>The status of the result value.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="reliability" minOccurs="1" maxOccurs="1" type="ObservationReliability">
            <xs:annotation>
              <xs:documentation>An estimate of the degree to which quality issues have impacted on the value reported.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="bodySite" minOccurs="0" maxOccurs="1" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>Indicates where on the subject's body the observation was made.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="method" minOccurs="0" maxOccurs="1" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>Indicates the mechanism used to perform the observation.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="identifier" minOccurs="0" maxOccurs="1" type="Identifier">
            <xs:annotation>
              <xs:documentation>A unique identifier for the simple observation.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="subject" minOccurs="0" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>The thing the observation is being made about.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="specimen" minOccurs="0" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>The specimen that was used when this observation was made.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="performer" minOccurs="0" maxOccurs="unbounded" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>Who was responsible for asserting the observed value as &quot;true&quot;.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="referenceRange" type="Observation.ReferenceRange" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation>Guidance on how to interpret the value by comparison to a normal or recommended range.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="related" type="Observation.Related" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation>Related observations - either components, or previous observations, or statements of derivation.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="Observation.ReferenceRange">
    <xs:annotation>
      <xs:documentation>Measurements and simple assertions made about a patient, device or other subject.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="low" minOccurs="0" maxOccurs="1" type="Quantity">
            <xs:annotation>
              <xs:documentation>The value of the low bound of the reference range. If this is omitted, the low bound of the reference range is assumed to be meaningless. E.g. &lt;2.3.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="high" minOccurs="0" maxOccurs="1" type="Quantity">
            <xs:annotation>
              <xs:documentation>The value of the high bound of the reference range. If this is omitted, the high bound of the reference range is assumed to be meaningless. E.g. &gt;5.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="meaning" minOccurs="0" maxOccurs="1" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>Code for the meaning of the reference range.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="age" minOccurs="0" maxOccurs="1" type="Range">
            <xs:annotation>
              <xs:documentation>The age at which this reference range is applicable. This is a neonatal age (e.g. number of weeks at term) if the meaning says so.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="Observation.Related">
    <xs:annotation>
      <xs:documentation>Measurements and simple assertions made about a patient, device or other subject.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="type" minOccurs="0" maxOccurs="1" type="ObservationRelationshipType">
            <xs:annotation>
              <xs:documentation>A code specifying the kind of relationship that exists with the target observation.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="target" minOccurs="1" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>A reference to the observation that is related to this observation.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:simpleType name="ObservationReliability-list">
    <xs:restriction base="xs:string">
      <xs:enumeration value="ok">
        <xs:annotation>
          <xs:documentation>The result has no reliability concerns.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="ongoing">
        <xs:annotation>
          <xs:documentation>An early estimate of value; measurement is still occurring.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="early">
        <xs:annotation>
          <xs:documentation>An early estimate of value; processing is still occurring.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="questionable">
        <xs:annotation>
          <xs:documentation>The observation value should be treated with care.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="calibrating">
        <xs:annotation>
          <xs:documentation>The result has been generated while calibration is occurring.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="error">
        <xs:annotation>
          <xs:documentation>The observation could not be completed because of an error.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="unknown">
        <xs:annotation>
          <xs:documentation>No observation value was available.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>
  <xs:complexType name="ObservationReliability">
    <xs:annotation>
      <xs:documentation>Codes that provide an estimate of the degree to which quality issues have impacted on the value of an observation</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="ObservationReliability-list" use="optional"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:simpleType name="ObservationStatus-list">
    <xs:restriction base="xs:string">
      <xs:enumeration value="registered">
        <xs:annotation>
          <xs:documentation>The existence of the observation is registered, but there is no result yet available.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="preliminary">
        <xs:annotation>
          <xs:documentation>This is an initial or interim observation: data may be incomplete or unverified.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="final">
        <xs:annotation>
          <xs:documentation>The observation is complete and verified by an authorized person.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="amended">
        <xs:annotation>
          <xs:documentation>The observation has been modified subsequent to being Final, and is complete and verified by an authorized person.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="cancelled">
        <xs:annotation>
          <xs:documentation>The observation is unavailable because the measurement was not started or not completed (also sometimes called &quot;aborted&quot;).</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="entered in error">
        <xs:annotation>
          <xs:documentation>The observation has been withdrawn following previous Final release.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>
  <xs:complexType name="ObservationStatus">
    <xs:annotation>
      <xs:documentation>Codes providing the status of an observation</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="ObservationStatus-list" use="optional"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:simpleType name="ObservationRelationshipType-list">
    <xs:restriction base="xs:string">
      <xs:enumeration value="has-component">
        <xs:annotation>
          <xs:documentation>The target observation is a component of this observation (e.g. Systolic and Diastolic Blood Pressure).</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="has-member">
        <xs:annotation>
          <xs:documentation>This observation is a group observation (e.g. a battery, a panel of tests, a set of vital sign measurements) that includes the target as a member of the group.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="derived-from">
        <xs:annotation>
          <xs:documentation>The target observation is part of the information from which this observation value is derived (e.g. calculated anion gap, Apgar score).</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="sequel-to">
        <xs:annotation>
          <xs:documentation>This observation follows the target observation (e.g. timed tests such as Glucose Tolerance Test).</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="replaces">
        <xs:annotation>
          <xs:documentation>This observation replaces a previous observation (i.e. a revised value). The target observation is now obsolete.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="qualified-by">
        <xs:annotation>
          <xs:documentation>The value of the target observation qualifies (refines) the semantics of the source observation (e.g. a lipaemia measure target from a plasma measure).</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="interfered-by">
        <xs:annotation>
          <xs:documentation>The value of the target observation interferes (degardes quality, or prevents valid observation) with the semantics of the source observation (e.g. a hemolysis measure target from a plasma potassium measure which has no value).</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>
  <xs:complexType name="ObservationRelationshipType">
    <xs:annotation>
      <xs:documentation>Codes specifying how two observations are related</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="ObservationRelationshipType-list" use="optional"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:element name="OperationOutcome" type="OperationOutcome">
    <xs:annotation>
      <xs:documentation>A collection of error, warning or information messages that result from a system action.</xs:documentation>
    </xs:annotation>
  </xs:element>
  <xs:complexType name="OperationOutcome">
    <xs:annotation>
      <xs:documentation>A collection of error, warning or information messages that result from a system action.</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="issue" type="OperationOutcome.Issue" minOccurs="1" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation>An error, warning or information message that results from a system action.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="OperationOutcome.Issue">
    <xs:annotation>
      <xs:documentation>A collection of error, warning or information messages that result from a system action.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="severity" minOccurs="1" maxOccurs="1" type="IssueSeverity">
            <xs:annotation>
              <xs:documentation>Indicates whether the issue indicates a variation from successful processing.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="type" minOccurs="0" maxOccurs="1" type="Coding">
            <xs:annotation>
              <xs:documentation>A code indicating the type of error, warning or information message.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="details" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>Additional description of the issue.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="location" minOccurs="0" maxOccurs="unbounded" type="string">
            <xs:annotation>
              <xs:documentation>A simple XPath limited to element names, repetition indicators and the default child access that identifies one of the elements in the resource that caused this issue to be raised.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:simpleType name="IssueSeverity-list">
    <xs:restriction base="xs:string">
      <xs:enumeration value="fatal">
        <xs:annotation>
          <xs:documentation>The issue caused the action to fail, and no further checking could be performed.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="error">
        <xs:annotation>
          <xs:documentation>The issue is sufficiently important to cause the action to fail.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="warning">
        <xs:annotation>
          <xs:documentation>The issue is not important enough to cause the action to fail, but may cause it to be performed suboptimally or in a way that is not as desired.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="information">
        <xs:annotation>
          <xs:documentation>The issue has no relation to the degree of success of the action.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>
  <xs:complexType name="IssueSeverity">
    <xs:annotation>
      <xs:documentation>How the issue affects the success of the action</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="IssueSeverity-list" use="optional"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:element name="Order" type="Order">
    <xs:annotation>
      <xs:documentation>A request to perform an action.</xs:documentation>
    </xs:annotation>
  </xs:element>
  <xs:complexType name="Order">
    <xs:annotation>
      <xs:documentation>A request to perform an action.</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>Identifiers assigned to this order by the orderer or by the receiver.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="date" minOccurs="0" maxOccurs="1" type="dateTime">
            <xs:annotation>
              <xs:documentation>When the order was made.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="subject" minOccurs="0" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>Patient this order is about.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="source" minOccurs="0" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>Who initiated the order.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="target" minOccurs="0" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>Who is intended to fulfill the order.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:choice minOccurs="0" maxOccurs="1" >
            <xs:annotation>
              <xs:documentation>Text - why the order was made.</xs:documentation>
            </xs:annotation>
            <xs:element name="reasonCodeableConcept" type="CodeableConcept"/>
            <xs:element name="reasonResource" type="ResourceReference"/>
          </xs:choice>
          <xs:element name="authority" minOccurs="0" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>If required by policy.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="when" type="Order.When" minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>When order should be fulfilled.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="detail" minOccurs="1" maxOccurs="unbounded" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>What action is being ordered.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="Order.When">
    <xs:annotation>
      <xs:documentation>A request to perform an action.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="code" minOccurs="0" maxOccurs="1" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>Code specifies when request should be done. The code may simply be a priority code.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="schedule" minOccurs="0" maxOccurs="1" type="Schedule">
            <xs:annotation>
              <xs:documentation>A formal schedule.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:element name="OrderResponse" type="OrderResponse">
    <xs:annotation>
      <xs:documentation>A response to an order.</xs:documentation>
    </xs:annotation>
  </xs:element>
  <xs:complexType name="OrderResponse">
    <xs:annotation>
      <xs:documentation>A response to an order.</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>Identifiers assigned to this order. The identifiers are usually assigned by the system responding to the order, but they may be provided or added to by other systems.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="request" minOccurs="1" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>A reference to the order that this is in response to.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="date" minOccurs="0" maxOccurs="1" type="dateTime">
            <xs:annotation>
              <xs:documentation>The date and time at which this order response was made (created/posted).</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="who" minOccurs="0" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>The person, organization, or device credited with making the response.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:choice minOccurs="0" maxOccurs="1" >
            <xs:annotation>
              <xs:documentation>A reference to an authority policy that is the reason for the response. Usually this is used when the order is rejected, to provide a reason for rejection.</xs:documentation>
            </xs:annotation>
            <xs:element name="authorityCodeableConcept" type="CodeableConcept"/>
            <xs:element name="authorityResource" type="ResourceReference"/>
          </xs:choice>
          <xs:element name="code" minOccurs="1" maxOccurs="1" type="OrderOutcomeStatus">
            <xs:annotation>
              <xs:documentation>What this response says about the status of the original order.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="description" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>Additional description about the response - e.g. a text description provided by a human user when making decisions about the order.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="fulfillment" minOccurs="0" maxOccurs="unbounded" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>Links to resources that provide details of the outcome of performing the order. E.g. Diagnostic Reports in a response that is made to an order that referenced a diagnostic order.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:simpleType name="OrderOutcomeStatus-list">
    <xs:restriction base="xs:string">
      <xs:enumeration value="pending">
        <xs:annotation>
          <xs:documentation>The order is known, but no processing has occurred at this time.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="review">
        <xs:annotation>
          <xs:documentation>The order is undergoing initial processing to determine whether it will be accepted (usually this involves human review).</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="rejected">
        <xs:annotation>
          <xs:documentation>The order was rejected because of a workflow/business logic reason.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="error">
        <xs:annotation>
          <xs:documentation>The order was unable to be processed because of a technical error (i.e. unexpected error).</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="accepted">
        <xs:annotation>
          <xs:documentation>The order has been accepted, and work is in progress.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="cancelled">
        <xs:annotation>
          <xs:documentation>Processing the order was halted at the initiators request.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="replaced">
        <xs:annotation>
          <xs:documentation>The order has been cancelled and replaced by another.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="aborted">
        <xs:annotation>
          <xs:documentation>Processing the order was stopped because of some workflow/business logic reason.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="complete">
        <xs:annotation>
          <xs:documentation>The order has been completed.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>
  <xs:complexType name="OrderOutcomeStatus">
    <xs:annotation>
      <xs:documentation>The status of the response to an order</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="OrderOutcomeStatus-list" use="optional"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:element name="Organization" type="Organization">
    <xs:annotation>
      <xs:documentation>A formally or informally recognized grouping of people or organizations formed for the purpose of achieving some form of collective action.  Includes companies, institutions, corporations, departments, community groups, healthcare practice groups, etc.</xs:documentation>
    </xs:annotation>
  </xs:element>
  <xs:complexType name="Organization">
    <xs:annotation>
      <xs:documentation>A formally or informally recognized grouping of people or organizations formed for the purpose of achieving some form of collective action.  Includes companies, institutions, corporations, departments, community groups, healthcare practice groups, etc.</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>Identifier for the organization that is used to identify the organization across multiple disparate systems.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="name" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>A name associated with the organization.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="type" minOccurs="0" maxOccurs="1" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>The kind of organization that this is.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="telecom" minOccurs="0" maxOccurs="unbounded" type="Contact">
            <xs:annotation>
              <xs:documentation>A contact detail for the organization.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="address" minOccurs="0" maxOccurs="unbounded" type="Address">
            <xs:annotation>
              <xs:documentation>An address for the organization.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="partOf" minOccurs="0" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>The organization of which this organization forms a part.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="contact" type="Organization.Contact" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation>Contact for the organization for a certain purpose.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="location" minOccurs="0" maxOccurs="unbounded" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>Location(s) the organization uses to provide services.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="active" minOccurs="0" maxOccurs="1" type="boolean">
            <xs:annotation>
              <xs:documentation>Whether the organization's record is still in active use.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="Organization.Contact">
    <xs:annotation>
      <xs:documentation>A formally or informally recognized grouping of people or organizations formed for the purpose of achieving some form of collective action.  Includes companies, institutions, corporations, departments, community groups, healthcare practice groups, etc.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="purpose" minOccurs="0" maxOccurs="1" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>Indicates a purpose for which the contact can be reached.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="name" minOccurs="0" maxOccurs="1" type="HumanName">
            <xs:annotation>
              <xs:documentation>A name associated with the contact.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="telecom" minOccurs="0" maxOccurs="unbounded" type="Contact">
            <xs:annotation>
              <xs:documentation>A contact detail (e.g. a telephone number or an email address) by which the party may be contacted.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="address" minOccurs="0" maxOccurs="1" type="Address">
            <xs:annotation>
              <xs:documentation>Visiting or postal addresses for the contact.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="gender" minOccurs="0" maxOccurs="1" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>Administrative Gender - the gender that the person is considered to have for administration and record keeping purposes.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:element name="Other" type="Other">
    <xs:annotation>
      <xs:documentation>Other is a conformant for handling resource concepts not yet defined for FHIR or outside HL7's scope of interest.</xs:documentation>
    </xs:annotation>
  </xs:element>
  <xs:complexType name="Other">
    <xs:annotation>
      <xs:documentation>Other is a conformant for handling resource concepts not yet defined for FHIR or outside HL7's scope of interest.</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>Identifier assigned to the resource for business purposes, outside the context of FHIR.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="code" minOccurs="1" maxOccurs="1" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>Identifies the 'type' of resource - equivalent to the resource name for other resources.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="subject" minOccurs="0" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>Identifies the patient, practitioner, device or any other resource that is the &quot;focus&quot; of this resoruce.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="author" minOccurs="0" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>Indicates who was responsible for creating the resource instance.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="created" minOccurs="0" maxOccurs="1" type="date">
            <xs:annotation>
              <xs:documentation>Identifies when the resource was first created.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:element name="Patient" type="Patient">
    <xs:annotation>
      <xs:documentation>Demographics and other administrative information about a person or animal receiving care or other health-related services.</xs:documentation>
    </xs:annotation>
  </xs:element>
  <xs:complexType name="Patient">
    <xs:annotation>
      <xs:documentation>Demographics and other administrative information about a person or animal receiving care or other health-related services.</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>An identifier that applies to this person as a patient.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="name" minOccurs="0" maxOccurs="unbounded" type="HumanName">
            <xs:annotation>
              <xs:documentation>A name associated with the individual.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="telecom" minOccurs="0" maxOccurs="unbounded" type="Contact">
            <xs:annotation>
              <xs:documentation>A contact detail (e.g. a telephone number or an email address) by which the individual may be contacted.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="gender" minOccurs="0" maxOccurs="1" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>Administrative Gender - the gender that the patient is considered to have for administration and record keeping purposes.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="birthDate" minOccurs="0" maxOccurs="1" type="dateTime">
            <xs:annotation>
              <xs:documentation>The date and time of birth for the individual.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:choice minOccurs="0" maxOccurs="1" >
            <xs:annotation>
              <xs:documentation>Indicates if the individual is deceased or not.</xs:documentation>
            </xs:annotation>
            <xs:element name="deceasedBoolean" type="boolean"/>
            <xs:element name="deceasedDateTime" type="dateTime"/>
          </xs:choice>
          <xs:element name="address" minOccurs="0" maxOccurs="unbounded" type="Address">
            <xs:annotation>
              <xs:documentation>Addresses for the individual.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="maritalStatus" minOccurs="0" maxOccurs="1" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>This field contains a patient's most recent marital (civil) status.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:choice minOccurs="0" maxOccurs="1" >
            <xs:annotation>
              <xs:documentation>Indicates whether the patient is part of a multiple or indicates the actual birth order.</xs:documentation>
            </xs:annotation>
            <xs:element name="multipleBirthBoolean" type="boolean"/>
            <xs:element name="multipleBirthInteger" type="integer"/>
          </xs:choice>
          <xs:element name="photo" minOccurs="0" maxOccurs="unbounded" type="Attachment">
            <xs:annotation>
              <xs:documentation>Image of the person.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="contact" type="Patient.Contact" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation>A contact party (e.g. guardian, partner, friend) for the patient.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="animal" type="Patient.Animal" minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>This element has a value if the patient is an animal.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="communication" minOccurs="0" maxOccurs="unbounded" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>Languages which may be used to communicate with the patient about his or her health.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="careProvider" minOccurs="0" maxOccurs="unbounded" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>Patient's nominated care provider.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="managingOrganization" minOccurs="0" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>Organization that is the custodian of the patient record.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="link" type="Patient.Link" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation>Link to another patient resource that concerns the same actual person.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="active" minOccurs="0" maxOccurs="1" type="boolean">
            <xs:annotation>
              <xs:documentation>Whether this patient record is in active use.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="Patient.Contact">
    <xs:annotation>
      <xs:documentation>Demographics and other administrative information about a person or animal receiving care or other health-related services.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="relationship" minOccurs="0" maxOccurs="unbounded" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>The nature of the relationship between the patient and the contact person.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="name" minOccurs="0" maxOccurs="1" type="HumanName">
            <xs:annotation>
              <xs:documentation>A name associated with the person.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="telecom" minOccurs="0" maxOccurs="unbounded" type="Contact">
            <xs:annotation>
              <xs:documentation>A contact detail for the person, e.g. a telephone number or an email address.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="address" minOccurs="0" maxOccurs="1" type="Address">
            <xs:annotation>
              <xs:documentation>Address for the contact person.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="gender" minOccurs="0" maxOccurs="1" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>Administrative Gender - the gender that the person is considered to have for administration and record keeping purposes.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="organization" minOccurs="0" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>Organization on behalf of which the contact is acting or for which the contact is working.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="Patient.Animal">
    <xs:annotation>
      <xs:documentation>Demographics and other administrative information about a person or animal receiving care or other health-related services.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="species" minOccurs="1" maxOccurs="1" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>Identifies the high level categorization of the kind of animal.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="breed" minOccurs="0" maxOccurs="1" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>Identifies the detailed categorization of the kind of animal.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="genderStatus" minOccurs="0" maxOccurs="1" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>Indicates the current state of the animal's reproductive organs.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="Patient.Link">
    <xs:annotation>
      <xs:documentation>Demographics and other administrative information about a person or animal receiving care or other health-related services.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="other" minOccurs="1" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>The other patient resource that the link refers to.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="type" minOccurs="1" maxOccurs="1" type="LinkType">
            <xs:annotation>
              <xs:documentation>The type of link between this patient resource and another patient resource.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:simpleType name="LinkType-list">
    <xs:restriction base="xs:string">
      <xs:enumeration value="replace">
        <xs:annotation>
          <xs:documentation>The patient resource containing this link must no longer be used. The link points forward to another patient resource that must be used in lieu of the patient resource that contains the link.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="refer">
        <xs:annotation>
          <xs:documentation>The patient resource containing this link is in use and valid but not considered the main source of information about a patient. The link points forward to another patient resource that should be consulted to retrieve additional patient information.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="seealso">
        <xs:annotation>
          <xs:documentation>The patient resource containing this link is in use and valid, but points to another patient resource that is known to contain data about the same person. Data in this resource might overlap or contradict information found in the other patient resource. This link does not indicate any relative importance of the resources concerned, and both should be regarded as equally valid.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>
  <xs:complexType name="LinkType">
    <xs:annotation>
      <xs:documentation>The type of link between this patient resource and another patient resource.</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="LinkType-list" use="optional"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:element name="Practitioner" type="Practitioner">
    <xs:annotation>
      <xs:documentation>A person who is directly or indirectly involved in the provisioning of healthcare.</xs:documentation>
    </xs:annotation>
  </xs:element>
  <xs:complexType name="Practitioner">
    <xs:annotation>
      <xs:documentation>A person who is directly or indirectly involved in the provisioning of healthcare.</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>An identifier that applies to this person in this role.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="name" minOccurs="0" maxOccurs="1" type="HumanName">
            <xs:annotation>
              <xs:documentation>A name associated with the person.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="telecom" minOccurs="0" maxOccurs="unbounded" type="Contact">
            <xs:annotation>
              <xs:documentation>A contact detail for the practitioner, e.g. a telephone number or an email address.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="address" minOccurs="0" maxOccurs="1" type="Address">
            <xs:annotation>
              <xs:documentation>The postal address where the practitioner can be found or visited or to which mail can be delivered.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="gender" minOccurs="0" maxOccurs="1" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>Administrative Gender - the gender that the person is considered to have for administration and record keeping purposes.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="birthDate" minOccurs="0" maxOccurs="1" type="dateTime">
            <xs:annotation>
              <xs:documentation>The date and time of birth for the practitioner.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="photo" minOccurs="0" maxOccurs="unbounded" type="Attachment">
            <xs:annotation>
              <xs:documentation>Image of the person.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="organization" minOccurs="0" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>The organization that the practitioner represents.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="role" minOccurs="0" maxOccurs="unbounded" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>Roles which this practitioner is authorized to perform for the organization.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="specialty" minOccurs="0" maxOccurs="unbounded" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>Specific specialty of the practitioner.</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 person is authorized to act as a practitioner in these role(s) for the organization.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="location" minOccurs="0" maxOccurs="unbounded" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>The location(s) at which this practitioner provides care.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="qualification" type="Practitioner.Qualification" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation>Qualifications obtained by training and certification.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="communication" minOccurs="0" maxOccurs="unbounded" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>A language the practitioner is able to use in patient communication.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="Practitioner.Qualification">
    <xs:annotation>
      <xs:documentation>A person who is directly or indirectly involved in the provisioning of healthcare.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="code" minOccurs="1" maxOccurs="1" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>Coded representation of the qualification.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="period" minOccurs="0" maxOccurs="1" type="Period">
            <xs:annotation>
              <xs:documentation>Period during which the qualification is valid.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="issuer" minOccurs="0" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>Organization that regulates and issues the qualification.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:element name="Procedure" type="Procedure">
    <xs:annotation>
      <xs:documentation>An action that is performed on a patient. This can be a physical 'thing' like an operation, or less invasive like counseling or hypnotherapy.</xs:documentation>
    </xs:annotation>
  </xs:element>
  <xs:complexType name="Procedure">
    <xs:annotation>
      <xs:documentation>An action that is performed on a patient. This can be a physical 'thing' like an operation, or less invasive like counseling or hypnotherapy.</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>This records identifiers associated with this procedure that are defined by business processed and/ or used to refer to it when a direct URL reference to the resource itself is not appropriate (e.g. in CDA documents, or in written / printed documentation).</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="subject" minOccurs="1" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>The person on whom the procedure was performed.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="type" minOccurs="1" maxOccurs="1" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>The specific procedure that is performed. Use text if the exact nature of the procedure can't be coded.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="bodySite" minOccurs="0" maxOccurs="unbounded" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>Detailed and structured anatomical location information. Multiple locations are allowed - e.g. multiple punch biopsies of a lesion.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="indication" minOccurs="0" maxOccurs="unbounded" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>The reason why the procedure was performed. This may be due to a Condition, may be coded entity of some type, or may simply be present as text.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="performer" type="Procedure.Performer" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation>Limited to 'real' people rather than equipment.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="date" minOccurs="0" maxOccurs="1" type="Period">
            <xs:annotation>
              <xs:documentation>The dates over which the procedure was performed. Allows a period to support complex procedures that span more that one date, and also allows for the length of the procedure to be captured.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="encounter" minOccurs="0" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>The encounter during which the procedure was performed.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="outcome" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>What was the outcome of the procedure - did it resolve reasons why the procedure was performed?.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="report" minOccurs="0" maxOccurs="unbounded" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>This could be a histology result. There could potentially be multiple reports - e.g. if this was a procedure that made multiple biopsies.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="complication" minOccurs="0" maxOccurs="unbounded" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>Any complications that occurred during the procedure, or in the immediate post-operative period. These are generally tracked separately from the notes, which typically will describe the procedure itself rather than any 'post procedure' issues.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="followUp" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>If the procedure required specific follow up - e.g. removal of sutures. The followup may be represented as a simple note, or potentially could be more complex in which case the CarePlan resource can be used.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="relatedItem" type="Procedure.RelatedItem" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation>Procedures may be related to other items such as procedures or medications. For example treating wound dehiscence following a previous procedure.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="notes" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>Any other notes about the procedure - e.g. the operative notes.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="Procedure.Performer">
    <xs:annotation>
      <xs:documentation>An action that is performed on a patient. This can be a physical 'thing' like an operation, or less invasive like counseling or hypnotherapy.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="person" minOccurs="0" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>The practitioner who was involved in the procedure.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="role" minOccurs="0" maxOccurs="1" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>E.g. surgeon, anaethetist, endoscopist.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="Procedure.RelatedItem">
    <xs:annotation>
      <xs:documentation>An action that is performed on a patient. This can be a physical 'thing' like an operation, or less invasive like counseling or hypnotherapy.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="type" minOccurs="0" maxOccurs="1" type="ProcedureRelationshipType">
            <xs:annotation>
              <xs:documentation>The nature of the relationship.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="target" minOccurs="0" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>The related item - e.g. a procedure.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:simpleType name="ProcedureRelationshipType-list">
    <xs:restriction base="xs:string">
      <xs:enumeration value="caused-by">
        <xs:annotation>
          <xs:documentation>This procedure had to be performed because of the related one.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="because-of">
        <xs:annotation>
          <xs:documentation>This procedure caused the related one to be performed.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>
  <xs:complexType name="ProcedureRelationshipType">
    <xs:annotation>
      <xs:documentation>The nature of the relationship with this procedure</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="ProcedureRelationshipType-list" use="optional"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:element name="Profile" type="Profile">
    <xs:annotation>
      <xs:documentation>A Resource Profile - a statement of use of one or more FHIR Resources.  It may include constraints on Resources and Data Types, Terminology Binding Statements and Extension Definitions.</xs:documentation>
    </xs:annotation>
  </xs:element>
  <xs:complexType name="Profile">
    <xs:annotation>
      <xs:documentation>A Resource Profile - a statement of use of one or more FHIR Resources.  It may include constraints on Resources and Data Types, Terminology Binding Statements and Extension Definitions.</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="1" type="string">
            <xs:annotation>
              <xs:documentation>The identifier that is used to identify this profile when it is referenced in a specification, model, design or an instance  (should be globally unique OID, UUID, or URI).</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="version" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>The identifier that is used to identify this version of the profile when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the profile author manually and the value should be a timestamp.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="name" minOccurs="1" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>A free text natural language name identifying the Profile.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="publisher" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>Details of the individual or organization who accepts responsibility for publishing the profile.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="telecom" minOccurs="0" maxOccurs="unbounded" type="Contact">
            <xs:annotation>
              <xs:documentation>Contact details to assist a user in finding and communicating with the publisher.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="description" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>A free text natural language description of the profile and its use.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="code" minOccurs="0" maxOccurs="unbounded" type="Coding">
            <xs:annotation>
              <xs:documentation>A set of terms from external terminologies that may be used to assist with indexing and searching of templates.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="status" minOccurs="1" maxOccurs="1" type="ResourceProfileStatus">
            <xs:annotation>
              <xs:documentation>The status of the profile.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="experimental" minOccurs="0" maxOccurs="1" type="boolean">
            <xs:annotation>
              <xs:documentation>This profile was authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="date" minOccurs="0" maxOccurs="1" type="dateTime">
            <xs:annotation>
              <xs:documentation>The date that this version of the profile was published.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="requirements" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>The Scope and Usage that this profile was created to meet.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="fhirVersion" minOccurs="0" maxOccurs="1" type="id">
            <xs:annotation>
              <xs:documentation>The version of the FHIR specification on which this profile is based.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="mapping" type="Profile.Mapping" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation>An external specification that the content is mapped to.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="structure" type="Profile.Structure" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation>A constraint statement about what contents a resource or data type may have.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="extensionDefn" type="Profile.ExtensionDefn" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation>An extension defined as part of the profile.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="query" type="Profile.Query" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation>Definition of a named query and its parameters and their meaning.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="Profile.Mapping">
    <xs:annotation>
      <xs:documentation>A Resource Profile - a statement of use of one or more FHIR Resources.  It may include constraints on Resources and Data Types, Terminology Binding Statements and Extension Definitions.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="identity" minOccurs="1" maxOccurs="1" type="id">
            <xs:annotation>
              <xs:documentation>An Internal id that is used to identify this mapping set when specific mappings are made.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="uri" minOccurs="0" maxOccurs="1" type="uri">
            <xs:annotation>
              <xs:documentation>A URI that identifies the specification that this mapping is expressed to.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="name" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>A name for the specification that is being mapped to.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="comments" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>Comments about this mapping, including version notes, issues, scope limitations, and other important notes for usage.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="Profile.Structure">
    <xs:annotation>
      <xs:documentation>A Resource Profile - a statement of use of one or more FHIR Resources.  It may include constraints on Resources and Data Types, Terminology Binding Statements and Extension Definitions.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="type" minOccurs="1" maxOccurs="1" type="code">
            <xs:annotation>
              <xs:documentation>The Resource or Data type being described.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="name" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>The name of this resource constraint statement (to refer to it from other resource constraints - from Profile.structure.element.definition.type.profile).</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="publish" minOccurs="0" maxOccurs="1" type="boolean">
            <xs:annotation>
              <xs:documentation>This definition of a profile on a structure is published as a formal statement. Some structural definitions might be defined purely for internal use within the profile, and not intended to be used outside that context.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="purpose" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>Human summary: why describe this resource?.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="element" type="Profile.Element" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation>Captures constraints on each element within the resource.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="searchParam" type="Profile.SearchParam" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation>Additional search parameters for implementations to support and/or make use of.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="Profile.Element">
    <xs:annotation>
      <xs:documentation>A Resource Profile - a statement of use of one or more FHIR Resources.  It may include constraints on Resources and Data Types, Terminology Binding Statements and Extension Definitions.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="path" minOccurs="1" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>The path identifies the element and is expressed as a &quot;.&quot;-separated list of ancestor elements, beginning with the name of the resource.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="representation" minOccurs="0" maxOccurs="unbounded" type="PropertyRepresentation">
            <xs:annotation>
              <xs:documentation>Codes that define how this element is represented in instances, when the deviation varies from the normal case.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="name" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>The name of this element definition (to refer to it from other element definitions using Profile.structure.element.definition.nameReference). This is a unique name referring to a specific set of constraints applied to this element. One use of this is to provide a name to different slices of the same element.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="slicing" type="Profile.Slicing" minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>Indicates that the element is sliced into a set of alternative definitions (there are multiple definitions on a single element in the base resource). The set of slices is any elements that come after this in the element sequence that have the same path, until a shorter path occurs (the shorter path terminates the set).</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="definition" type="Profile.Definition" minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>Definition of the content of the element to provide a more specific definition than that contained for the element in the base resource.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="Profile.Slicing">
    <xs:annotation>
      <xs:documentation>A Resource Profile - a statement of use of one or more FHIR Resources.  It may include constraints on Resources and Data Types, Terminology Binding Statements and Extension Definitions.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="discriminator" minOccurs="1" maxOccurs="1" type="id">
            <xs:annotation>
              <xs:documentation>Designates which child element is used to discriminate between the slices when processing an instance. The value of the child element in the instance SHALL completely distinguish which slice the element in the resource matches based on the allowed values for that element in each of the slices.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="ordered" minOccurs="1" maxOccurs="1" type="boolean">
            <xs:annotation>
              <xs:documentation>If the matching elements have to occur in the same order as defined in the profile.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="rules" minOccurs="1" maxOccurs="1" type="SlicingRules">
            <xs:annotation>
              <xs:documentation>Whether additional slices are allowed or not. When the slices are ordered, profile authors can also say that additional slices are only allowed at the end.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="Profile.Definition">
    <xs:annotation>
      <xs:documentation>A Resource Profile - a statement of use of one or more FHIR Resources.  It may include constraints on Resources and Data Types, Terminology Binding Statements and Extension Definitions.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="short" minOccurs="1" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>A concise definition that  is shown in the generated XML format that summarizes profiles (used throughout the specification).</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="formal" minOccurs="1" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>The definition SHALL be consistent with the base definition, but convey the meaning of the element in the particular context of use of the resource.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="comments" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>Comments about the use of the element, including notes about how to use the data properly, exceptions to proper use, etc.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="requirements" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>Explains why this element is needed and why it's been constrained as it has.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="synonym" minOccurs="0" maxOccurs="unbounded" type="string">
            <xs:annotation>
              <xs:documentation>Identifies additional names by which this element might also be known.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="min" minOccurs="1" maxOccurs="1" type="integer">
            <xs:annotation>
              <xs:documentation>The minimum number of times this element SHALL appear in the instance.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="max" minOccurs="1" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>The maximum number of times this element is permitted to appear in the instance.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="type" type="Profile.Type" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation>The data type or resource that the value of this element is permitted to be.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="nameReference" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>Identifies the name of a slice defined elsewhere in the profile whose constraints should be applied to the current element.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:choice minOccurs="0" maxOccurs="1" >
            <xs:annotation>
              <xs:documentation>Specifies a primitive value that SHALL hold for this element in the instance.</xs:documentation>
            </xs:annotation>
            <xs:element name="valueBoolean" type="boolean"/>
            <xs:element name="valueInteger" type="integer"/>
            <xs:element name="valueDecimal" type="decimal"/>
            <xs:element name="valueBase64Binary" type="base64Binary"/>
            <xs:element name="valueInstant" type="instant"/>
            <xs:element name="valueString" type="string"/>
            <xs:element name="valueUri" type="uri"/>
            <xs:element name="valueDate" type="date"/>
            <xs:element name="valueDateTime" type="dateTime"/>
            <xs:element name="valueCode" type="code"/>
            <xs:element name="valueOid" type="oid"/>
            <xs:element name="valueUuid" type="uuid"/>
            <xs:element name="valueId" type="id"/>
            <xs:element name="valueAttachment" type="Attachment"/>
            <xs:element name="valueIdentifier" type="Identifier"/>
            <xs:element name="valueCodeableConcept" type="CodeableConcept"/>
            <xs:element name="valueCoding" type="Coding"/>
            <xs:element name="valueQuantity" type="Quantity"/>
            <xs:element name="valueRange" type="Range"/>
            <xs:element name="valuePeriod" type="Period"/>
            <xs:element name="valueRatio" type="Ratio"/>
            <xs:element name="valueResource" type="ResourceReference"/>
            <xs:element name="valueSampledData" type="SampledData"/>
            <xs:element name="valueHumanName" type="HumanName"/>
            <xs:element name="valueAddress" type="Address"/>
            <xs:element name="valueContact" type="Contact"/>
            <xs:element name="valueSchedule" type="Schedule"/>
          </xs:choice>
          <xs:choice minOccurs="0" maxOccurs="1" >
            <xs:annotation>
              <xs:documentation>An example value for this element.</xs:documentation>
            </xs:annotation>
            <xs:element name="exampleBoolean" type="boolean"/>
            <xs:element name="exampleInteger" type="integer"/>
            <xs:element name="exampleDecimal" type="decimal"/>
            <xs:element name="exampleBase64Binary" type="base64Binary"/>
            <xs:element name="exampleInstant" type="instant"/>
            <xs:element name="exampleString" type="string"/>
            <xs:element name="exampleUri" type="uri"/>
            <xs:element name="exampleDate" type="date"/>
            <xs:element name="exampleDateTime" type="dateTime"/>
            <xs:element name="exampleCode" type="code"/>
            <xs:element name="exampleOid" type="oid"/>
            <xs:element name="exampleUuid" type="uuid"/>
            <xs:element name="exampleId" type="id"/>
            <xs:element name="exampleAttachment" type="Attachment"/>
            <xs:element name="exampleIdentifier" type="Identifier"/>
            <xs:element name="exampleCodeableConcept" type="CodeableConcept"/>
            <xs:element name="exampleCoding" type="Coding"/>
            <xs:element name="exampleQuantity" type="Quantity"/>
            <xs:element name="exampleRange" type="Range"/>
            <xs:element name="examplePeriod" type="Period"/>
            <xs:element name="exampleRatio" type="Ratio"/>
            <xs:element name="exampleResource" type="ResourceReference"/>
            <xs:element name="exampleSampledData" type="SampledData"/>
            <xs:element name="exampleHumanName" type="HumanName"/>
            <xs:element name="exampleAddress" type="Address"/>
            <xs:element name="exampleContact" type="Contact"/>
            <xs:element name="exampleSchedule" type="Schedule"/>
          </xs:choice>
          <xs:element name="maxLength" minOccurs="0" maxOccurs="1" type="integer">
            <xs:annotation>
              <xs:documentation>Indicates the shortest length that SHALL be supported by conformant instances without truncation.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="condition" minOccurs="0" maxOccurs="unbounded" type="id">
            <xs:annotation>
              <xs:documentation>A reference to an invariant that may make additional statements about the cardinality or value in the instance.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="constraint" type="Profile.Constraint" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation>Formal constraints such as co-occurrence and other constraints that can be computationally evaluated within the context of the instance.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="mustSupport" minOccurs="0" maxOccurs="1" type="boolean">
            <xs:annotation>
              <xs:documentation>If true, conformant resource authors SHALL be capable of providing a value for the element and resource consumers SHALL be capable of extracting and doing something useful with the data element.  If false, the element may be ignored and not supported.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="isModifier" minOccurs="1" maxOccurs="1" type="boolean">
            <xs:annotation>
              <xs:documentation>If true, the value of this element affects the interpretation of the element or resource that contains it, and the value of the element cannot be ignored. Typically, this is used for status, negation and qualification codes. The effect of this is that the element cannot be ignored by systems: they SHALL either recognize the element and process it, and/or a pre-determination has been made that it is not relevant to their particular system.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="binding" type="Profile.Binding" minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>Binds to a value set if this element is coded (code, Coding, CodeableConcept).</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="mapping" type="Profile.Mapping1" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation>Identifies a concept from an external specification that roughly corresponds to this element.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="Profile.Type">
    <xs:annotation>
      <xs:documentation>A Resource Profile - a statement of use of one or more FHIR Resources.  It may include constraints on Resources and Data Types, Terminology Binding Statements and Extension Definitions.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="code" minOccurs="1" maxOccurs="1" type="code">
            <xs:annotation>
              <xs:documentation>Name of Data type or Resource.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="profile" minOccurs="0" maxOccurs="1" type="uri">
            <xs:annotation>
              <xs:documentation>Identifies a profile that SHALL hold for resources or datatypes referenced as the type of this element. Can be a local reference - to another structure in this profile, or a reference to a structure in another profile.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="aggregation" minOccurs="0" maxOccurs="unbounded" type="AggregationMode">
            <xs:annotation>
              <xs:documentation>If the type is a reference to another resource, how the resource is or can be aggreated - is it a contained resource, or a reference, and if the context is a bundle, is it included in the bundle.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="Profile.Constraint">
    <xs:annotation>
      <xs:documentation>A Resource Profile - a statement of use of one or more FHIR Resources.  It may include constraints on Resources and Data Types, Terminology Binding Statements and Extension Definitions.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="key" minOccurs="1" maxOccurs="1" type="id">
            <xs:annotation>
              <xs:documentation>Allows identification of which elements have their cardinalities impacted by the constraint.  Will not be referenced for constraints that do not affect cardinality.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="name" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>Used to label the constraint in OCL or in short displays incapable of displaying the full human description.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="severity" minOccurs="1" maxOccurs="1" type="ConstraintSeverity">
            <xs:annotation>
              <xs:documentation>Identifies the impact constraint violation has on the conformance of the instance.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="human" minOccurs="1" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>Text that can be used to describe the constraint in messages identifying that the constraint has been violated.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="xpath" minOccurs="1" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>XPath expression of constraint.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="Profile.Binding">
    <xs:annotation>
      <xs:documentation>A Resource Profile - a statement of use of one or more FHIR Resources.  It may include constraints on Resources and Data Types, Terminology Binding Statements and Extension Definitions.</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>A descriptive name for this - can be useful for generating implementation artifacts.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="isExtensible" minOccurs="1" maxOccurs="1" type="boolean">
            <xs:annotation>
              <xs:documentation>If true, then conformant systems may use additional codes or (where the data type permits) text alone to convey concepts not covered by the set of codes identified in the binding.  If false, then conformant systems are constrained to the provided codes alone.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="conformance" minOccurs="0" maxOccurs="1" type="BindingConformance">
            <xs:annotation>
              <xs:documentation>Indicates the degree of conformance expectations associated with this binding.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="description" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>Describes the intended use of this particular set of codes.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:choice minOccurs="0" maxOccurs="1" >
            <xs:annotation>
              <xs:documentation>Points to the value set or external definition that identifies the set of codes to be used.</xs:documentation>
            </xs:annotation>
            <xs:element name="referenceUri" type="uri"/>
            <xs:element name="referenceValueSet" type="ResourceReference"/>
          </xs:choice>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="Profile.Mapping1">
    <xs:annotation>
      <xs:documentation>A Resource Profile - a statement of use of one or more FHIR Resources.  It may include constraints on Resources and Data Types, Terminology Binding Statements and Extension Definitions.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="identity" minOccurs="1" maxOccurs="1" type="id">
            <xs:annotation>
              <xs:documentation>An internal reference to the definition of a mapping.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="map" minOccurs="1" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>Expresses what part of the target specification corresponds to this element.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="Profile.SearchParam">
    <xs:annotation>
      <xs:documentation>A Resource Profile - a statement of use of one or more FHIR Resources.  It may include constraints on Resources and Data Types, Terminology Binding Statements and Extension Definitions.</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 the standard or custom search parameter.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="type" minOccurs="1" maxOccurs="1" type="SearchParamType">
            <xs:annotation>
              <xs:documentation>The type of value a search parameter refers to, and how the content is interpreted.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="documentation" minOccurs="1" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>A specification for search parameters. For standard parameters, provides additional information on how the parameter is used in this solution.  For custom parameters, provides a description of what the parameter does.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="xpath" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>An XPath expression that returns a set of elements for the search parameter.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="target" minOccurs="0" maxOccurs="unbounded" type="code">
            <xs:annotation>
              <xs:documentation>Types of resource (if a resource is referenced).</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="Profile.ExtensionDefn">
    <xs:annotation>
      <xs:documentation>A Resource Profile - a statement of use of one or more FHIR Resources.  It may include constraints on Resources and Data Types, Terminology Binding Statements and Extension Definitions.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="code" minOccurs="1" maxOccurs="1" type="code">
            <xs:annotation>
              <xs:documentation>A unique code (within the profile) used to identify the extension.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="display" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>Defined so that applications can use this name when displaying the value of the extension to the user.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="contextType" minOccurs="1" maxOccurs="1" type="ExtensionContext">
            <xs:annotation>
              <xs:documentation>Identifies the type of context to which the extension applies.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="context" minOccurs="1" maxOccurs="unbounded" type="string">
            <xs:annotation>
              <xs:documentation>Identifies the types of resource or data type elements to which the extension can be applied.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="definition" type="Profile.Definition" minOccurs="1" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>Definition of the extension and its content.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="Profile.Query">
    <xs:annotation>
      <xs:documentation>A Resource Profile - a statement of use of one or more FHIR Resources.  It may include constraints on Resources and Data Types, Terminology Binding Statements and Extension Definitions.</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 query, which is used in the URI from Conformance statements declaring use of the query.  Typically this will also be the name for the _query parameter when the query is called, though in some cases it may be aliased by a server to avoid collisions.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="documentation" minOccurs="1" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>Description of the query - the functionality it offers, and considerations about how it functions and to use it.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="parameter" type="Profile.SearchParam" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation>A parameter of a named query.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:simpleType name="BindingConformance-list">
    <xs:restriction base="xs:string">
      <xs:enumeration value="required">
        <xs:annotation>
          <xs:documentation>Only codes in the specified set are allowed.  If the binding is extensible, other codes may be used for concepts not covered by the bound set of codes.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="preferred">
        <xs:annotation>
          <xs:documentation>For greater interoperability, implementers are strongly encouraged to use the bound set of codes, however alternate codes may be used in derived profiles and implementations if necessary without being considered non-conformant.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="example">
        <xs:annotation>
          <xs:documentation>The codes in the set are an example to illustrate the meaning of the field. There is no particular preference for its use nor any assertion that the provided values are sufficient to meet implementation needs.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>
  <xs:complexType name="BindingConformance">
    <xs:annotation>
      <xs:documentation>Binding conformance for applications</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="BindingConformance-list" use="optional"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:simpleType name="ConstraintSeverity-list">
    <xs:restriction base="xs:string">
      <xs:enumeration value="error">
        <xs:annotation>
          <xs:documentation>If the constraint is violated, the resource is not conformant.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="warning">
        <xs:annotation>
          <xs:documentation>If the constraint is violated, the resource is conformant, but it is not necessarily following best practice.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>
  <xs:complexType name="ConstraintSeverity">
    <xs:annotation>
      <xs:documentation>SHALL applications comply with this constraint?</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="ConstraintSeverity-list" use="optional"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:simpleType name="ResourceProfileStatus-list">
    <xs:restriction base="xs:string">
      <xs:enumeration value="draft">
        <xs:annotation>
          <xs:documentation>This profile is still under development.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="active">
        <xs:annotation>
          <xs:documentation>This profile is ready for normal use.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="retired">
        <xs:annotation>
          <xs:documentation>This profile has been deprecated, withdrawn or superseded and should no longer be used.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>
  <xs:complexType name="ResourceProfileStatus">
    <xs:annotation>
      <xs:documentation>The lifecycle status of a Resource Profile</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="ResourceProfileStatus-list" use="optional"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:simpleType name="PropertyRepresentation-list">
    <xs:restriction base="xs:string">
      <xs:enumeration value="xmlAttr">
        <xs:annotation>
          <xs:documentation>In XML, this property is represented as an attribute not an element.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>
  <xs:complexType name="PropertyRepresentation">
    <xs:annotation>
      <xs:documentation>How a property is represented on the wire</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="PropertyRepresentation-list" use="optional"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:simpleType name="AggregationMode-list">
    <xs:restriction base="xs:string">
      <xs:enumeration value="contained">
        <xs:annotation>
          <xs:documentation>The reference is a local reference to a contained resource.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="referenced">
        <xs:annotation>
          <xs:documentation>The reference to to a resource that has to be resolved externally to the resource that includes the reference.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="bundled">
        <xs:annotation>
          <xs:documentation>The resource the reference points to will be found in the same bundle as the resource that includes the reference.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>
  <xs:complexType name="AggregationMode">
    <xs:annotation>
      <xs:documentation>How resource references can be aggregated</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="AggregationMode-list" use="optional"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:simpleType name="ExtensionContext-list">
    <xs:restriction base="xs:string">
      <xs:enumeration value="resource">
        <xs:annotation>
          <xs:documentation>The context is all elements matching a particular resource element path.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="datatype">
        <xs:annotation>
          <xs:documentation>The context is all nodes matching a particular data type element path (root or repeating element) or all elements referencing a particular primitive data type (expressed as the datatype name).</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="mapping">
        <xs:annotation>
          <xs:documentation>The context is all nodes whose mapping to a specified reference model corresponds to a particular mapping structure.  The context identifies the mapping target. The mapping should clearly identify where such an extension could be used.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="extension">
        <xs:annotation>
          <xs:documentation>The context is a particular extension from a particular profile.  Expressed as uri#name, where uri identifies the profile and #name identifies the extension code.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>
  <xs:complexType name="ExtensionContext">
    <xs:annotation>
      <xs:documentation>How an extension context is interpreted</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="ExtensionContext-list" use="optional"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:simpleType name="SlicingRules-list">
    <xs:restriction base="xs:string">
      <xs:enumeration value="closed">
        <xs:annotation>
          <xs:documentation>No additional content is allowed other than that described by the slices in this profile.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="open">
        <xs:annotation>
          <xs:documentation>Additional content is allowed anywhere in the list.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="openAtEnd">
        <xs:annotation>
          <xs:documentation>Additional content is allowed, but only at the end of the list.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>
  <xs:complexType name="SlicingRules">
    <xs:annotation>
      <xs:documentation>How slices are interpreted when evaluating an instance</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="SlicingRules-list" use="optional"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <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:element name="Query" type="Query">
    <xs:annotation>
      <xs:documentation>A description of a query with a set of parameters.</xs:documentation>
    </xs:annotation>
  </xs:element>
  <xs:complexType name="Query">
    <xs:annotation>
      <xs:documentation>A description of a query with a set of parameters.</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="1" maxOccurs="1" type="uri">
            <xs:annotation>
              <xs:documentation>Links query and its response(s).</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="parameter" minOccurs="1" maxOccurs="unbounded" type="Extension">
            <xs:annotation>
              <xs:documentation>Set of query parameters with values.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="response" type="Query.Response" minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>If this is a response to a query.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="Query.Response">
    <xs:annotation>
      <xs:documentation>A description of a query with a set of parameters.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="identifier" minOccurs="1" maxOccurs="1" type="uri">
            <xs:annotation>
              <xs:documentation>Links response to source query.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="outcome" minOccurs="1" maxOccurs="1" type="QueryOutcome">
            <xs:annotation>
              <xs:documentation>Outcome of processing the query.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="total" minOccurs="0" maxOccurs="1" type="integer">
            <xs:annotation>
              <xs:documentation>Total number of matching records.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="parameter" minOccurs="0" maxOccurs="unbounded" type="Extension">
            <xs:annotation>
              <xs:documentation>Parameters server used.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="first" minOccurs="0" maxOccurs="unbounded" type="Extension">
            <xs:annotation>
              <xs:documentation>To get first page (if paged).</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="previous" minOccurs="0" maxOccurs="unbounded" type="Extension">
            <xs:annotation>
              <xs:documentation>To get previous page (if paged).</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="next" minOccurs="0" maxOccurs="unbounded" type="Extension">
            <xs:annotation>
              <xs:documentation>To get next page (if paged).</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="last" minOccurs="0" maxOccurs="unbounded" type="Extension">
            <xs:annotation>
              <xs:documentation>To get last page (if paged).</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="reference" minOccurs="0" maxOccurs="unbounded" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>Resources that are the results of the search.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:simpleType name="QueryOutcome-list">
    <xs:restriction base="xs:string">
      <xs:enumeration value="ok">
        <xs:annotation>
          <xs:documentation>The query was processed successfully.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="limited">
        <xs:annotation>
          <xs:documentation>The query was processed successfully, but some additional limitations were added.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="refused">
        <xs:annotation>
          <xs:documentation>The server refused to process the query.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="error">
        <xs:annotation>
          <xs:documentation>The server tried to process the query, but some error occurred.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>
  <xs:complexType name="QueryOutcome">
    <xs:annotation>
      <xs:documentation>The outcome of processing a query request</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="QueryOutcome-list" use="optional"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:element name="Questionnaire" type="Questionnaire">
    <xs:annotation>
      <xs:documentation>A structured set of questions and their answers. The Questionnaire may contain questions, answers or both. The questions are ordered and grouped into coherent subsets, corresponding to the structure of the grouping of the underlying questions.</xs:documentation>
    </xs:annotation>
  </xs:element>
  <xs:complexType name="Questionnaire">
    <xs:annotation>
      <xs:documentation>A structured set of questions and their answers. The Questionnaire may contain questions, answers or both. The questions are ordered and grouped into coherent subsets, corresponding to the structure of the grouping of the underlying questions.</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="status" minOccurs="1" maxOccurs="1" type="QuestionnaireStatus">
            <xs:annotation>
              <xs:documentation>The lifecycle status of the questionnaire as a whole.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="authored" minOccurs="1" maxOccurs="1" type="dateTime">
            <xs:annotation>
              <xs:documentation>The date and/or time that this version of the questionnaire was authored.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="subject" minOccurs="0" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>The subject of the questionnaires: this is the patient that the answers apply to, but this person is not necessarily the source of information.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="author" minOccurs="0" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>Person who received the answers to the questions in the Questionnaire and recorded them in the system.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="source" minOccurs="0" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>The person who answered the questions about the subject. Only used when this is not the subject him/herself.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="name" minOccurs="0" maxOccurs="1" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>Structured name for a predefined list of questions this questionnaire is responding to.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="identifier" minOccurs="0" maxOccurs="unbounded" type="Identifier">
            <xs:annotation>
              <xs:documentation>This records identifiers associated with this question/answer set that are defined by business processed and/ or used to refer to it when a direct URL reference to the resource itself is not appropriate (e.g. in CDA documents, or in written / printed documentation).</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="encounter" minOccurs="0" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>Encounter during which this questionnaire answers were collected. When there were multiple encounters, this is the one considered most relevant to the context of the answers.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="group" type="Questionnaire.Group" minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>A group of questions to a possibly similarly grouped set of questions in the questionnaire.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="Questionnaire.Group">
    <xs:annotation>
      <xs:documentation>A structured set of questions and their answers. The Questionnaire may contain questions, answers or both. The questions are ordered and grouped into coherent subsets, corresponding to the structure of the grouping of the underlying questions.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="name" minOccurs="0" maxOccurs="1" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>Structured name for a section of a predefined list of questions this questionnaire is responding to.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="header" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>Text that is displayed above the contents of the group.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="text" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>Additional text for the group, used for display purposes.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="subject" minOccurs="0" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>More specific subject this section's answers are about, details the subject given in Questionnaire.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="group" type="Questionnaire.Group" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation>A sub-group within a group. The ordering of groups within this group is relevant.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="question" type="Questionnaire.Question" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation>Set of questions within this group. The order of questions within the group is relevant.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="Questionnaire.Question">
    <xs:annotation>
      <xs:documentation>A structured set of questions and their answers. The Questionnaire may contain questions, answers or both. The questions are ordered and grouped into coherent subsets, corresponding to the structure of the grouping of the underlying questions.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="name" minOccurs="0" maxOccurs="1" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>Structured name for the question that identifies this question within the Questionnaire or Group.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="text" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>Text of the question as it is shown to the user.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:choice minOccurs="0" maxOccurs="1" >
            <xs:annotation>
              <xs:documentation>Single-valued answer to the question.</xs:documentation>
            </xs:annotation>
            <xs:element name="answerDecimal" type="decimal"/>
            <xs:element name="answerInteger" type="integer"/>
            <xs:element name="answerBoolean" type="boolean"/>
            <xs:element name="answerDate" type="date"/>
            <xs:element name="answerString" type="string"/>
            <xs:element name="answerDateTime" type="dateTime"/>
            <xs:element name="answerInstant" type="instant"/>
          </xs:choice>
          <xs:element name="choice" minOccurs="0" maxOccurs="unbounded" type="Coding">
            <xs:annotation>
              <xs:documentation>Selections made by the user from the list of options.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="options" minOccurs="0" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>Reference to a valueset containing the possible options.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:choice minOccurs="0" maxOccurs="1" >
            <xs:annotation>
              <xs:documentation>Structured answer in the form of a FHIR Resource or datatype.</xs:documentation>
            </xs:annotation>
            <xs:element name="dataBoolean" type="boolean"/>
            <xs:element name="dataInteger" type="integer"/>
            <xs:element name="dataDecimal" type="decimal"/>
            <xs:element name="dataBase64Binary" type="base64Binary"/>
            <xs:element name="dataInstant" type="instant"/>
            <xs:element name="dataString" type="string"/>
            <xs:element name="dataUri" type="uri"/>
            <xs:element name="dataDate" type="date"/>
            <xs:element name="dataDateTime" type="dateTime"/>
            <xs:element name="dataCode" type="code"/>
            <xs:element name="dataOid" type="oid"/>
            <xs:element name="dataUuid" type="uuid"/>
            <xs:element name="dataId" type="id"/>
            <xs:element name="dataAttachment" type="Attachment"/>
            <xs:element name="dataIdentifier" type="Identifier"/>
            <xs:element name="dataCodeableConcept" type="CodeableConcept"/>
            <xs:element name="dataCoding" type="Coding"/>
            <xs:element name="dataQuantity" type="Quantity"/>
            <xs:element name="dataRange" type="Range"/>
            <xs:element name="dataPeriod" type="Period"/>
            <xs:element name="dataRatio" type="Ratio"/>
            <xs:element name="dataResource" type="ResourceReference"/>
            <xs:element name="dataSampledData" type="SampledData"/>
            <xs:element name="dataHumanName" type="HumanName"/>
            <xs:element name="dataAddress" type="Address"/>
            <xs:element name="dataContact" type="Contact"/>
            <xs:element name="dataSchedule" type="Schedule"/>
          </xs:choice>
          <xs:element name="remarks" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>The remark contains information about the answer given. This is additional information about the answer the author wishes to convey, but should not be used to contain information that is part of the answer itself.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="group" type="Questionnaire.Group" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation>Nested group, containing nested question for this question. The order of groups within the question is relevant.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:simpleType name="QuestionnaireStatus-list">
    <xs:restriction base="xs:string">
      <xs:enumeration value="draft">
        <xs:annotation>
          <xs:documentation>This Questionnaire is used as a template but the template is not ready for use or publication.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="published">
        <xs:annotation>
          <xs:documentation>This Questionnaire is used as a template, is published and ready for use.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="retired">
        <xs:annotation>
          <xs:documentation>This Questionnaire is used as a template but should no longer be used for new Questionnaires.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="in progress">
        <xs:annotation>
          <xs:documentation>This Questionnaire has been filled out with answers, but changes or additions are still expected to be made to it.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="completed">
        <xs:annotation>
          <xs:documentation>This Questionnaire has been filled out with answers, and the current content is regarded as definitive.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="amended">
        <xs:annotation>
          <xs:documentation>This Questionnaire has been filled out with answers, then marked as complete, yet changes or additions have been made to it afterwards.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>
  <xs:complexType name="QuestionnaireStatus">
    <xs:annotation>
      <xs:documentation>Lifecycle status of the questionnaire</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="QuestionnaireStatus-list" use="optional"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:element name="RelatedPerson" type="RelatedPerson">
    <xs:annotation>
      <xs:documentation>Information about a person that is involved in the care for a patient, but who is not the target of healthcare, nor has a formal responsibility in the care process.</xs:documentation>
    </xs:annotation>
  </xs:element>
  <xs:complexType name="RelatedPerson">
    <xs:annotation>
      <xs:documentation>Information about a person that is involved in the care for a patient, but who is not the target of healthcare, nor has a formal responsibility in the care process.</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>Identifier for a person within a particular scope.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="patient" minOccurs="1" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>The patient this person is related to.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="relationship" minOccurs="0" maxOccurs="1" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>The nature of the relationship between a patient and the related person.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="name" minOccurs="0" maxOccurs="1" type="HumanName">
            <xs:annotation>
              <xs:documentation>A name associated with the person.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="telecom" minOccurs="0" maxOccurs="unbounded" type="Contact">
            <xs:annotation>
              <xs:documentation>A contact detail for the person, e.g. a telephone number or an email address.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="gender" minOccurs="0" maxOccurs="1" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>Administrative Gender - the gender that the person is considered to have for administration and record keeping purposes.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="address" minOccurs="0" maxOccurs="1" type="Address">
            <xs:annotation>
              <xs:documentation>Address where the related person can be contacted or visited.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="photo" minOccurs="0" maxOccurs="unbounded" type="Attachment">
            <xs:annotation>
              <xs:documentation>Image of the person.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:element name="SecurityEvent" type="SecurityEvent">
    <xs:annotation>
      <xs:documentation>A record of an event made for purposes of maintaining a security log. Typical uses include detection of intrusion attempts and monitoring for inappropriate usage.</xs:documentation>
    </xs:annotation>
  </xs:element>
  <xs:complexType name="SecurityEvent">
    <xs:annotation>
      <xs:documentation>A record of an event made for purposes of maintaining a security log. Typical uses include detection of intrusion attempts and monitoring for inappropriate usage.</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="event" type="SecurityEvent.Event" minOccurs="1" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>Identifies the name, action type, time, and disposition of the audited event.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="participant" type="SecurityEvent.Participant" minOccurs="1" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation>A person, a hardware device or software process.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="source" type="SecurityEvent.Source" minOccurs="1" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>Application systems and processes.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="object" type="SecurityEvent.Object" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation>Specific instances of data or objects that have been accessed.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="SecurityEvent.Event">
    <xs:annotation>
      <xs:documentation>A record of an event made for purposes of maintaining a security log. Typical uses include detection of intrusion attempts and monitoring for inappropriate usage.</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>Identifier for a family of the event.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="subtype" minOccurs="0" maxOccurs="unbounded" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>Identifier for the category of event.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="action" minOccurs="0" maxOccurs="1" type="SecurityEventAction">
            <xs:annotation>
              <xs:documentation>Indicator for type of action performed during the event that generated the audit.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="dateTime" minOccurs="1" maxOccurs="1" type="instant">
            <xs:annotation>
              <xs:documentation>The time when the event occurred on the source.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="outcome" minOccurs="0" maxOccurs="1" type="SecurityEventOutcome">
            <xs:annotation>
              <xs:documentation>Indicates whether the event succeeded or failed.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="outcomeDesc" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>A free text description of the outcome of the event.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="SecurityEvent.Participant">
    <xs:annotation>
      <xs:documentation>A record of an event made for purposes of maintaining a security log. Typical uses include detection of intrusion attempts and monitoring for inappropriate usage.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="role" minOccurs="0" maxOccurs="unbounded" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>Specification of the role(s) the user plays when performing the event. Usually the codes used in this element are local codes defined by the role-based access control security system used in the local context.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="reference" minOccurs="0" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>Direct reference to a resource that identifies the participant.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="userId" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>Unique identifier for the user actively participating in the event.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="altId" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>Alternative Participant Identifier. For a human, this should be a user identifier text string from authentication system. This identifier would be one known to a common authentication system (e.g., single sign-on), if available.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="name" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>Human-meaningful name for the user.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="requestor" minOccurs="1" maxOccurs="1" type="boolean">
            <xs:annotation>
              <xs:documentation>Indicator that the user is or is not the requestor, or initiator, for the event being audited.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="media" minOccurs="0" maxOccurs="1" type="Coding">
            <xs:annotation>
              <xs:documentation>Type of media involved. Used when the event is about exporting/importing onto media.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="network" type="SecurityEvent.Network" minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>Logical network location for application activity, if the activity has a network location.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="SecurityEvent.Network">
    <xs:annotation>
      <xs:documentation>A record of an event made for purposes of maintaining a security log. Typical uses include detection of intrusion attempts and monitoring for inappropriate usage.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="identifier" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>An identifier for the network access point of the user device for the audit event.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="type" minOccurs="0" maxOccurs="1" type="SecurityEventParticipantNetworkType">
            <xs:annotation>
              <xs:documentation>An identifier for the type of network access point that originated the audit event.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="SecurityEvent.Source">
    <xs:annotation>
      <xs:documentation>A record of an event made for purposes of maintaining a security log. Typical uses include detection of intrusion attempts and monitoring for inappropriate usage.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="site" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>Logical source location within the healthcare enterprise network.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="identifier" minOccurs="1" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>Identifier of the source where the event originated.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="type" minOccurs="0" maxOccurs="unbounded" type="Coding">
            <xs:annotation>
              <xs:documentation>Code specifying the type of source where event originated.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="SecurityEvent.Object">
    <xs:annotation>
      <xs:documentation>A record of an event made for purposes of maintaining a security log. Typical uses include detection of intrusion attempts and monitoring for inappropriate usage.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="identifier" minOccurs="0" maxOccurs="1" type="Identifier">
            <xs:annotation>
              <xs:documentation>Identifies a specific instance of the participant object. The reference should always be version specific.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="reference" minOccurs="0" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>Identifies a specific instance of the participant object. The reference should always be version specific.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="type" minOccurs="0" maxOccurs="1" type="SecurityEventObjectType">
            <xs:annotation>
              <xs:documentation>Object type being audited.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="role" minOccurs="0" maxOccurs="1" type="SecurityEventObjectRole">
            <xs:annotation>
              <xs:documentation>Code representing the functional application role of Participant Object being audited.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="lifecycle" minOccurs="0" maxOccurs="1" type="SecurityEventObjectLifecycle">
            <xs:annotation>
              <xs:documentation>Identifier for the data life-cycle stage for the participant object.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="sensitivity" minOccurs="0" maxOccurs="1" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>Denotes policy-defined sensitivity for the Participant Object ID such as VIP, HIV status, mental health status or similar topics.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="name" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>An instance-specific descriptor of the Participant Object ID audited, such as a person's name.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="description" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>Text that describes the object in more detail.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="query" minOccurs="0" maxOccurs="1" type="base64Binary">
            <xs:annotation>
              <xs:documentation>The actual query for a query-type participant object.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="detail" type="SecurityEvent.Detail" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation>Additional Information about the Object.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="SecurityEvent.Detail">
    <xs:annotation>
      <xs:documentation>A record of an event made for purposes of maintaining a security log. Typical uses include detection of intrusion attempts and monitoring for inappropriate usage.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="type" minOccurs="1" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>Name of the property.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="value" minOccurs="1" maxOccurs="1" type="base64Binary">
            <xs:annotation>
              <xs:documentation>Property value.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:simpleType name="SecurityEventObjectRole-list">
    <xs:restriction base="xs:string">
      <xs:enumeration value="1">
        <xs:annotation>
          <xs:documentation>This object is the patient that is the subject of care related to this event.  It is identifiable by patient ID or equivalent.  The patient may be either human or animal.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="2">
        <xs:annotation>
          <xs:documentation>This is a location identified as related to the event.  This is usually the location where the event took place.  Note that for shipping, the usual events are arrival at a location or departure from a location.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="3">
        <xs:annotation>
          <xs:documentation>This object is any kind of persistent document created as a result of the event.  This could be a paper report, film, electronic report, DICOM Study, etc.  Issues related to medical records life cycle management are conveyed elsewhere.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="4">
        <xs:annotation>
          <xs:documentation>A logical object related to the event.  (Deprecated).</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="5">
        <xs:annotation>
          <xs:documentation>This is any configurable file used to control creation of documents.  Examples include the objects maintained by the HL7 Master File transactions, Value Sets, etc.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="6">
        <xs:annotation>
          <xs:documentation>A human participant not otherwise identified by some other category.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="7">
        <xs:annotation>
          <xs:documentation>(deprecated).</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="8">
        <xs:annotation>
          <xs:documentation>Typically a licensed person who is providing or performing care related to the event, generally a physician.   The key distinction between doctor and practitioner is with regards to their role, not the licensing.  The doctor is the human who actually performed the work.  The practitioner is the human or organization that is responsible for the work.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="9">
        <xs:annotation>
          <xs:documentation>A person or system that is being notified as part of the event.  This is relevant in situations where automated systems provide notifications to other parties when an event took place.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="10">
        <xs:annotation>
          <xs:documentation>Insurance company, or any other organization who accepts responsibility for paying for the healthcare event.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="11">
        <xs:annotation>
          <xs:documentation>A person or active system object involved in the event with a security role.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="12">
        <xs:annotation>
          <xs:documentation>A person or system object involved in the event with the authority to modify security roles of other objects.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="13">
        <xs:annotation>
          <xs:documentation>A passive object, such as a role table, that is relevant to the event.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="14">
        <xs:annotation>
          <xs:documentation>(deprecated)  Relevant to certain RBAC security methodologies.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="15">
        <xs:annotation>
          <xs:documentation>Any person or organization responsible for providing care.  This encompasses all forms of care, licensed or otherwise, and all sorts of teams and care groups. Note, the distinction between practitioners and the doctor that actually provided the care to the patient.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="16">
        <xs:annotation>
          <xs:documentation>The source or destination for data transfer, when it does not match some other role.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="17">
        <xs:annotation>
          <xs:documentation>A source or destination for data transfer, that acts as an archive, database, or similar role.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="18">
        <xs:annotation>
          <xs:documentation>An object that holds schedule information.  This could be an appointment book, availability information, etc.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="19">
        <xs:annotation>
          <xs:documentation>An organization or person that is the recipient of services.  This could be an organization that is buying services for a patient, or a person that is buying services for an animal.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="20">
        <xs:annotation>
          <xs:documentation>An order, task, work item, procedure step, or other description of work to be performed.  E.g., a particular instance of an MPPS.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="21">
        <xs:annotation>
          <xs:documentation>A list of jobs or a system that provides lists of jobs.  E.g., an MWL SCP.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="22">
        <xs:annotation>
          <xs:documentation>(Deprecated).</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="23">
        <xs:annotation>
          <xs:documentation>An object that specifies or controls the routing or delivery of items.  For example, a distribution list is the routing criteria for mail.  The items delivered may be documents, jobs, or other objects.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="24">
        <xs:annotation>
          <xs:documentation>The contents of a query.  This is used to capture the contents of any kind of query.  For security surveillance purposes knowing the queries being made is very important.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>
  <xs:complexType name="SecurityEventObjectRole">
    <xs:annotation>
      <xs:documentation>Code representing the functional application role of Participant Object being audited</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="SecurityEventObjectRole-list" use="optional"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:simpleType name="SecurityEventObjectType-list">
    <xs:restriction base="xs:string">
      <xs:enumeration value="1">
        <xs:annotation>
          <xs:documentation>Person.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="2">
        <xs:annotation>
          <xs:documentation>System Object.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="3">
        <xs:annotation>
          <xs:documentation>Organization.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="4">
        <xs:annotation>
          <xs:documentation>Other.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>
  <xs:complexType name="SecurityEventObjectType">
    <xs:annotation>
      <xs:documentation>Code for the participant object type being audited</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="SecurityEventObjectType-list" use="optional"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:simpleType name="SecurityEventAction-list">
    <xs:restriction base="xs:string">
      <xs:enumeration value="C">
        <xs:annotation>
          <xs:documentation>Create a new database object, such as Placing an Order.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="R">
        <xs:annotation>
          <xs:documentation>Display or print data, such as a Doctor Census.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="U">
        <xs:annotation>
          <xs:documentation>Update data, such as Revise Patient Information.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="D">
        <xs:annotation>
          <xs:documentation>Delete items, such as a doctor master file record.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="E">
        <xs:annotation>
          <xs:documentation>Perform a system or application function such as log-on, program execution or use of an object's method, or perform a query/search operation.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>
  <xs:complexType name="SecurityEventAction">
    <xs:annotation>
      <xs:documentation>Indicator for type of action performed during the event that generated the audit.</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="SecurityEventAction-list" use="optional"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:simpleType name="SecurityEventObjectLifecycle-list">
    <xs:restriction base="xs:string">
      <xs:enumeration value="1">
        <xs:annotation>
          <xs:documentation>Origination / Creation.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="2">
        <xs:annotation>
          <xs:documentation>Import / Copy from original.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="3">
        <xs:annotation>
          <xs:documentation>Amendment.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="4">
        <xs:annotation>
          <xs:documentation>Verification.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="5">
        <xs:annotation>
          <xs:documentation>Translation.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="6">
        <xs:annotation>
          <xs:documentation>Access / Use.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="7">
        <xs:annotation>
          <xs:documentation>De-identification.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="8">
        <xs:annotation>
          <xs:documentation>Aggregation, summarization, derivation.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="9">
        <xs:annotation>
          <xs:documentation>Report.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="10">
        <xs:annotation>
          <xs:documentation>Export / Copy to target.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="11">
        <xs:annotation>
          <xs:documentation>Disclosure.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="12">
        <xs:annotation>
          <xs:documentation>Receipt of disclosure.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="13">
        <xs:annotation>
          <xs:documentation>Archiving.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="14">
        <xs:annotation>
          <xs:documentation>Logical deletion.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="15">
        <xs:annotation>
          <xs:documentation>Permanent erasure / Physical destruction.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>
  <xs:complexType name="SecurityEventObjectLifecycle">
    <xs:annotation>
      <xs:documentation>Identifier for the data life-cycle stage for the participant object</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="SecurityEventObjectLifecycle-list" use="optional"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:simpleType name="SecurityEventParticipantNetworkType-list">
    <xs:restriction base="xs:string">
      <xs:enumeration value="1">
        <xs:annotation>
          <xs:documentation>Machine Name, including DNS name.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="2">
        <xs:annotation>
          <xs:documentation>IP Address.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="3">
        <xs:annotation>
          <xs:documentation>Telephone Number.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="4">
        <xs:annotation>
          <xs:documentation>Email address.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="5">
        <xs:annotation>
          <xs:documentation>URI (User directory, HTTP-PUT, ftp, etc.).</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>
  <xs:complexType name="SecurityEventParticipantNetworkType">
    <xs:annotation>
      <xs:documentation>The type of network access point that originated the audit event</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="SecurityEventParticipantNetworkType-list" use="optional"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:simpleType name="SecurityEventOutcome-list">
    <xs:restriction base="xs:string">
      <xs:enumeration value="0">
        <xs:annotation>
          <xs:documentation>The operation completed successfully (whether with warnings or not).</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="4">
        <xs:annotation>
          <xs:documentation>The action was not successful due to some kind of catered for error (often equivalent to an HTTP 400 response).</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="8">
        <xs:annotation>
          <xs:documentation>The action was not successful due to some kind of unexpected error (often equivalent to an HTTP 500 response).</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="12">
        <xs:annotation>
          <xs:documentation>An error of such magnitude occurred that the system is not longer available for use (i.e. the system died).</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>
  <xs:complexType name="SecurityEventOutcome">
    <xs:annotation>
      <xs:documentation>Indicates whether the event succeeded or failed</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="SecurityEventOutcome-list" use="optional"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <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:element name="Substance" type="Substance">
    <xs:annotation>
      <xs:documentation>A homogeneous material with a definite composition.</xs:documentation>
    </xs:annotation>
  </xs:element>
  <xs:complexType name="Substance">
    <xs:annotation>
      <xs:documentation>A homogeneous material with a definite composition.</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="type" minOccurs="1" maxOccurs="1" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>A code (or set of codes) that identify this substance.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="description" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>A description of the substance - its appearance, handling requirements, and other usage notes.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="instance" type="Substance.Instance" minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>Substance may be used to describe a kind of substance, or a specific package/container of the substance: an instance.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="ingredient" type="Substance.Ingredient" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation>A substance can be composed of other substances.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="Substance.Instance">
    <xs:annotation>
      <xs:documentation>A homogeneous material with a definite composition.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="identifier" minOccurs="0" maxOccurs="1" type="Identifier">
            <xs:annotation>
              <xs:documentation>Identifier associated with the package/container (usually a label affixed directly).</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="expiry" minOccurs="0" maxOccurs="1" type="dateTime">
            <xs:annotation>
              <xs:documentation>When the substance is no longer valid to use. For some substances, a single arbitrary date is used for expiry.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="quantity" minOccurs="0" maxOccurs="1" type="Quantity">
            <xs:annotation>
              <xs:documentation>The amount of the substance.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="Substance.Ingredient">
    <xs:annotation>
      <xs:documentation>A homogeneous material with a definite composition.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="quantity" minOccurs="0" maxOccurs="1" type="Ratio">
            <xs:annotation>
              <xs:documentation>The amount of the ingredient in the substance - a concentration ratio.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="substance" minOccurs="1" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>Another substance that is a component of this substance.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:element name="Supply" type="Supply">
    <xs:annotation>
      <xs:documentation>A supply - a  request for something, and provision of what is supplied.</xs:documentation>
    </xs:annotation>
  </xs:element>
  <xs:complexType name="Supply">
    <xs:annotation>
      <xs:documentation>A supply - a  request for something, and provision of what is supplied.</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="kind" minOccurs="0" maxOccurs="1" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>Category of supply, e.g.  central, non-stock, etc. This is used to support work flows associated with the supply process.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="identifier" minOccurs="0" maxOccurs="1" type="Identifier">
            <xs:annotation>
              <xs:documentation>Unique identifier for this supply request.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="status" minOccurs="0" maxOccurs="1" type="SupplyStatus">
            <xs:annotation>
              <xs:documentation>Status of the supply request.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="orderedItem" minOccurs="0" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>The item that is requested to be supplied.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="patient" minOccurs="0" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>A link to a resource representing the person whom the ordered item is for.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="dispense" type="Supply.Dispense" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation>Indicates the details of the dispense event such as the days supply and quantity of a supply dispensed.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="Supply.Dispense">
    <xs:annotation>
      <xs:documentation>A supply - a  request for something, and provision of what is supplied.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="identifier" minOccurs="0" maxOccurs="1" type="Identifier">
            <xs:annotation>
              <xs:documentation>Identifier assigned by the dispensing facility when the dispense occurs.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="status" minOccurs="0" maxOccurs="1" type="SupplyDispenseStatus">
            <xs:annotation>
              <xs:documentation>A code specifying the state of the dispense event.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="type" minOccurs="0" maxOccurs="1" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>Indicates the type of dispensing event that is performed. Examples include: Trial Fill, Completion of Trial, Partial Fill, Emergency Fill, Samples, etc.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="quantity" minOccurs="0" maxOccurs="1" type="Quantity">
            <xs:annotation>
              <xs:documentation>The amount of supply that has been dispensed. Includes unit of measure.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="suppliedItem" minOccurs="0" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>Identifies the medication or substance being dispensed. This is either a link to a resource representing the details of the medication or substance or a simple attribute carrying a code that identifies the medication from a known list of medications.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="supplier" minOccurs="0" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>The individual responsible for dispensing the medication.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="whenPrepared" minOccurs="0" maxOccurs="1" type="Period">
            <xs:annotation>
              <xs:documentation>The time the dispense event occurred.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="whenHandedOver" minOccurs="0" maxOccurs="1" type="Period">
            <xs:annotation>
              <xs:documentation>The time the dispensed item was sent or handed to the patient (or agent).</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="destination" minOccurs="0" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>Identification of the facility/location where the Supply was shipped to, as part of the dispense event.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="receiver" minOccurs="0" maxOccurs="unbounded" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>Identifies the person who picked up the Supply.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:simpleType name="SupplyDispenseStatus-list">
    <xs:restriction base="xs:string">
      <xs:enumeration value="in progress">
        <xs:annotation>
          <xs:documentation>Supply has been requested, but not dispensed.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="dispensed">
        <xs:annotation>
          <xs:documentation>Supply is part of a pharmacy order and has been dispensed.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="abandoned">
        <xs:annotation>
          <xs:documentation>Dispensing was not completed.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>
  <xs:complexType name="SupplyDispenseStatus">
    <xs:annotation>
      <xs:documentation>Status of the dispense</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="SupplyDispenseStatus-list" use="optional"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:simpleType name="SupplyStatus-list">
    <xs:restriction base="xs:string">
      <xs:enumeration value="requested">
        <xs:annotation>
          <xs:documentation>Supply has been requested, but not dispensed.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="dispensed">
        <xs:annotation>
          <xs:documentation>Supply is part of a pharmacy order and has been dispensed.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="received">
        <xs:annotation>
          <xs:documentation>Supply has been received by the requestor.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="failed">
        <xs:annotation>
          <xs:documentation>The supply will not be completed because the supplier was unable or unwilling to supply the item.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="cancelled">
        <xs:annotation>
          <xs:documentation>The orderer of the supply cancelled the request.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>
  <xs:complexType name="SupplyStatus">
    <xs:annotation>
      <xs:documentation>Status of the supply</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="SupplyStatus-list" use="optional"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:element name="ValueSet" type="ValueSet">
    <xs:annotation>
      <xs:documentation>A value set specifies a set of codes drawn from one or more code systems.</xs:documentation>
    </xs:annotation>
  </xs:element>
  <xs:complexType name="ValueSet">
    <xs:annotation>
      <xs:documentation>A value set specifies a set of codes drawn from one or more code systems.</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="1" type="string">
            <xs:annotation>
              <xs:documentation>The identifier that is used to identify this value set when it is referenced in a specification, model, design or an instance (should be globally unique OID, UUID, or URI).</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="version" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>The identifier that is used to identify this version of the value set when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the profile author manually and the value should be a timestamp.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="name" minOccurs="1" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>A free text natural language name describing the value set.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="publisher" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>The name of the individual or organization that published the value set.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="telecom" minOccurs="0" maxOccurs="unbounded" type="Contact">
            <xs:annotation>
              <xs:documentation>Contacts of the publisher to assist a user in finding and communicating with the publisher.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="description" minOccurs="1" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>A free text natural language description of the use of the value set - reason for definition, conditions of use, etc.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="copyright" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>A copyright statement relating to the value set and/or its contents.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="status" minOccurs="1" maxOccurs="1" type="ValueSetStatus">
            <xs:annotation>
              <xs:documentation>The status of the value set.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="experimental" minOccurs="0" maxOccurs="1" type="boolean">
            <xs:annotation>
              <xs:documentation>This valueset was authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="extensible" minOccurs="0" maxOccurs="1" type="boolean">
            <xs:annotation>
              <xs:documentation>Whether this is intended to be used with an extensible binding or not.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="date" minOccurs="0" maxOccurs="1" type="dateTime">
            <xs:annotation>
              <xs:documentation>The date that the value set status was last changed.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="define" type="ValueSet.Define" minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>When value set defines its own codes.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="compose" type="ValueSet.Compose" minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>When value set includes codes from elsewhere.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="expansion" type="ValueSet.Expansion" minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>When value set is an expansion.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="ValueSet.Define">
    <xs:annotation>
      <xs:documentation>A value set specifies a set of codes drawn from one or more code systems.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="system" minOccurs="1" maxOccurs="1" type="uri">
            <xs:annotation>
              <xs:documentation>URI to identify the code system.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="version" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>The version of this code system that defines the codes. Note that the version is optional because a well maintained code system does not suffer from versioning, and therefore the version does not need to be maintained. However many code systems are not well maintained, and the version needs to be defined and tracked.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="caseSensitive" minOccurs="0" maxOccurs="1" type="boolean">
            <xs:annotation>
              <xs:documentation>If code comparison is case sensitive when codes within this system are compared to each other.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="concept" type="ValueSet.Concept" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation>Concepts in the code system.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="ValueSet.Concept">
    <xs:annotation>
      <xs:documentation>A value set specifies a set of codes drawn from one or more code systems.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="code" minOccurs="1" maxOccurs="1" type="code">
            <xs:annotation>
              <xs:documentation>Code that identifies concept.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="abstract" minOccurs="0" maxOccurs="1" type="boolean">
            <xs:annotation>
              <xs:documentation>If this code is not for use as a real concept.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="display" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>Text to Display to the user.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="definition" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>The formal definition of the concept. Formal definitions are not required, because of the prevalence of legacy systems without them, but they are highly recommended, as without them there is no formal meaning associated with the concept.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="concept" type="ValueSet.Concept" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation>Child Concepts (is-a / contains).</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="ValueSet.Compose">
    <xs:annotation>
      <xs:documentation>A value set specifies a set of codes drawn from one or more code systems.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="import" minOccurs="0" maxOccurs="unbounded" type="uri">
            <xs:annotation>
              <xs:documentation>Includes the contents of the referenced value set as a part of the contents of this value set.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="include" type="ValueSet.Include" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation>Include one or more codes from a code system.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="exclude" type="ValueSet.Include" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation>Exclude one or more codes from the value set.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="ValueSet.Include">
    <xs:annotation>
      <xs:documentation>A value set specifies a set of codes drawn from one or more code systems.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="system" minOccurs="1" maxOccurs="1" type="uri">
            <xs:annotation>
              <xs:documentation>The code system from which the selected codes come from.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="version" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>The version of the code system that the codes are selected from.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="code" minOccurs="0" maxOccurs="unbounded" type="code">
            <xs:annotation>
              <xs:documentation>Specifies a code or concept to be included or excluded. The list of codes is considered ordered, though the order may not have any particular significance.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="filter" type="ValueSet.Filter" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation>Select concepts by specify a matching criteria based on the properties (including relationships) defined by the system. If multiple filters are specified, they SHALL all be true.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="ValueSet.Filter">
    <xs:annotation>
      <xs:documentation>A value set specifies a set of codes drawn from one or more code systems.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="property" minOccurs="1" maxOccurs="1" type="code">
            <xs:annotation>
              <xs:documentation>A code that identifies a property defined in the code system.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="op" minOccurs="1" maxOccurs="1" type="FilterOperator">
            <xs:annotation>
              <xs:documentation>The kind of operation to perform as a part of the filter criteria.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="value" minOccurs="1" maxOccurs="1" type="code">
            <xs:annotation>
              <xs:documentation>The match value may be either a code defined by the system, or a string value which is used a regex match on the literal string of the property value.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="ValueSet.Expansion">
    <xs:annotation>
      <xs:documentation>A value set specifies a set of codes drawn from one or more code systems.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="identifier" minOccurs="0" maxOccurs="1" type="Identifier">
            <xs:annotation>
              <xs:documentation>An identifier that uniquely identifies this expansion of the valueset. Systems may re-use the same identifier as long as the expansion and the definition remain the same, but are not required to do so.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="timestamp" minOccurs="1" maxOccurs="1" type="instant">
            <xs:annotation>
              <xs:documentation>Time valueset expansion happened.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="contains" type="ValueSet.Contains" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation>Codes in the value set.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="ValueSet.Contains">
    <xs:annotation>
      <xs:documentation>A value set specifies a set of codes drawn from one or more code systems.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="system" minOccurs="0" maxOccurs="1" type="uri">
            <xs:annotation>
              <xs:documentation>System value for the code.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="code" minOccurs="0" maxOccurs="1" type="code">
            <xs:annotation>
              <xs:documentation>Code - if blank, this is not a choosable code.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="display" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>User display for the concept.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="contains" type="ValueSet.Contains" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation>Codes contained in this concept.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:simpleType name="FilterOperator-list">
    <xs:restriction base="xs:string">
      <xs:enumeration value="=">
        <xs:annotation>
          <xs:documentation>The property value has the concept specified by the value.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="is-a">
        <xs:annotation>
          <xs:documentation>The property value has a concept that has an is-a relationship with the value.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="is-not-a">
        <xs:annotation>
          <xs:documentation>The property value has a concept that does not have an is-a relationship with the value.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="regex">
        <xs:annotation>
          <xs:documentation>The property value representation matches the regex specified in the value.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="in">
        <xs:annotation>
          <xs:documentation>The property value is in the set of codes or concepts identified by the value.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="not in">
        <xs:annotation>
          <xs:documentation>The property value is not in the set of codes or concepts identified by the value.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>
  <xs:complexType name="FilterOperator">
    <xs:annotation>
      <xs:documentation>The kind of operation to perform as a part of a property based filter</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="FilterOperator-list" use="optional"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
</xs:schema>
