<StructureDefinition xmlns="http://hl7.org/fhir">
  <url value="http://telus.com/fhir/patientChart/StructureDefinition/profile-export-provenance" />
  <name value="ExportProvenance" />
  <status value="draft" />
  <fhirVersion value="4.0.1" />
  <mapping>
    <identity value="workflow" />
    <uri value="http://hl7.org/fhir/workflow" />
    <name value="Workflow Pattern" />
  </mapping>
  <mapping>
    <identity value="rim" />
    <uri value="http://hl7.org/v3" />
    <name value="RIM Mapping" />
  </mapping>
  <mapping>
    <identity value="w3c.prov" />
    <uri value="http://www.w3.org/ns/prov" />
    <name value="W3C PROV" />
  </mapping>
  <mapping>
    <identity value="w5" />
    <uri value="http://hl7.org/fhir/fivews" />
    <name value="FiveWs Pattern Mapping" />
  </mapping>
  <mapping>
    <identity value="fhirauditevent" />
    <uri value="http://hl7.org/fhir/auditevent" />
    <name value="FHIR AuditEvent Mapping" />
  </mapping>
  <kind value="resource" />
  <abstract value="false" />
  <type value="Provenance" />
  <baseDefinition value="http://hl7.org/fhir/StructureDefinition/Provenance" />
  <derivation value="constraint" />
  <differential>
    <element id="Provenance">
      <path value="Provenance" />
      <mustSupport value="true" />
    </element>
    <element id="Provenance.id">
      <path value="Provenance.id" />
      <comment value="Usage Note:   This will usually be a GUID that is assigned by the sending application.&#xD;&#xA;&#xD;&#xA;The only time that a resource does not have an id is when it is being submitted to the server using a create operation." />
      <mustSupport value="true" />
    </element>
    <element id="Provenance.meta">
      <path value="Provenance.meta" />
      <mustSupport value="true" />
    </element>
    <element id="Provenance.meta.lastUpdated">
      <path value="Provenance.meta.lastUpdated" />
      <mustSupport value="true" />
    </element>
    <element id="Provenance.meta.source">
      <path value="Provenance.meta.source" />
      <mustSupport value="true" />
    </element>
    <element id="Provenance.meta.profile">
      <path value="Provenance.meta.profile" />
      <mustSupport value="true" />
    </element>
    <element id="Provenance.text">
      <path value="Provenance.text" />
      <mustSupport value="true" />
    </element>
    <element id="Provenance.target">
      <path value="Provenance.target" />
      <comment value="Conformance Rule:   This will reference the bundle&#xD;&#xA;&#xD;&#xA;Target references are usually version specific, but might not be, if a version has not been assigned or if the provenance information is part of the set of resources being maintained (i.e. a document). When using the RESTful API, the identity of the resource might not be known (especially not the version specific one); the client may either submit the resource first, and then the provenance, or it may submit both using a single transaction. See the notes on transaction for further discussion." />
      <mustSupport value="true" />
    </element>
    <element id="Provenance.target.reference">
      <path value="Provenance.target.reference" />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="Provenance.target.display">
      <path value="Provenance.target.display" />
      <mustSupport value="true" />
    </element>
    <element id="Provenance.occurred[x]">
      <path value="Provenance.occurred[x]" />
      <comment value="Usage Note:   This is often the same as the recorded date in the case of an Export.&#xD;&#xA;&#xD;&#xA;The period can be a little arbitrary; where possible, the time should correspond to human assessment of the activity time." />
      <mustSupport value="true" />
    </element>
    <element id="Provenance.recorded">
      <path value="Provenance.recorded" />
      <mustSupport value="true" />
    </element>
    <element id="Provenance.reason">
      <path value="Provenance.reason" />
      <max value="1" />
      <mustSupport value="true" />
    </element>
    <element id="Provenance.reason.coding">
      <path value="Provenance.reason.coding" />
      <min value="1" />
      <max value="1" />
      <mustSupport value="true" />
    </element>
    <element id="Provenance.reason.coding.system">
      <path value="Provenance.reason.coding.system" />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="Provenance.reason.coding.code">
      <path value="Provenance.reason.coding.code" />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="Provenance.activity">
      <path value="Provenance.activity" />
      <comment value="***This will likely be a fixed value of &quot;EXPORT&quot;&#xD;&#xA;&#xD;&#xA;Not all terminology uses fit this general pattern. In some cases, models should not use CodeableConcept and use Coding directly and provide their own structure for managing text, codings, translations and the relationship between elements and pre- and post-coordination." />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="Provenance.activity.coding">
      <path value="Provenance.activity.coding" />
      <mustSupport value="true" />
    </element>
    <element id="Provenance.activity.coding.system">
      <path value="Provenance.activity.coding.system" />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="Provenance.activity.coding.code">
      <path value="Provenance.activity.coding.code" />
      <min value="1" />
      <fixedCode value="EXPORT" />
      <mustSupport value="true" />
    </element>
    <element id="Provenance.activity.text">
      <path value="Provenance.activity.text" />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="Provenance.agent">
      <path value="Provenance.agent" />
      <comment value="Conformance Rule:    There will be two agents specified in WHO.   The first is a reference to exporting device, where the EMR application instance identifier must be specified (PSS1234, MA6777, etc).   Example:   urn:telus:emr:pss:1234.   The name of the EMR software (PSSuite, MedAccess, etc)  will also be specified in device.     The second agent is a reference to the practitioner who carried out the action; this must be included if known&#xD;&#xA;&#xD;&#xA;Conformance Rule:      The name of the organization (eg Clinic ABC)  will be conveyed in the onBehalfOf.display when the agent.who is the device.&#xD;&#xA;&#xD;&#xA;Conformance Rule:   The onBehalfOf may be present when the agent.who is the User (clinical or non-clinical)  who is acting on behalf of another Practitioner (note:  FHIR uses either Practitioner or Practitioner Role resource).     Example:   A student who is acting in a clinical role will be acting on behalf of a responsible practitioner.   Example 2:   An MOA will be acting on behalf of the responsible physician.&#xD;&#xA;&#xD;&#xA;Several agents may be associated (i.e. has some responsibility for an activity) with an activity and vice-versa." />
      <mustSupport value="true" />
    </element>
    <element id="Provenance.agent.role">
      <path value="Provenance.agent.role" />
      <max value="1" />
      <mustSupport value="true" />
    </element>
    <element id="Provenance.agent.role.coding">
      <path value="Provenance.agent.role.coding" />
      <mustSupport value="true" />
    </element>
    <element id="Provenance.agent.role.coding.system">
      <path value="Provenance.agent.role.coding.system" />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="Provenance.agent.role.coding.code">
      <path value="Provenance.agent.role.coding.code" />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="Provenance.agent.role.text">
      <path value="Provenance.agent.role.text" />
      <mustSupport value="true" />
    </element>
    <element id="Provenance.agent.who">
      <path value="Provenance.agent.who" />
      <comment value="Conformance Rule:   A reference to device must be specified and a reference to either Practitioner (Profile choice of Practitioner or MOA/User)  must be specified&#xD;&#xA;&#xD;&#xA;whoIdentity should be used when the agent is not a Resource type." />
      <type>
        <code value="Reference" />
        <aggregation value="bundled" />
      </type>
      <mustSupport value="true" />
    </element>
    <element id="Provenance.agent.who.reference">
      <path value="Provenance.agent.who.reference" />
      <comment value="Conformance Rule:   A reference must be specified for device&#xD;&#xA;&#xD;&#xA;Using absolute URLs provides a stable scalable approach suitable for a cloud/web context, while using relative/logical references provides a flexible approach suitable for use when trading across closed eco-system boundaries.   Absolute URLs do not need to point to a FHIR RESTful server, though this is the preferred approach. If the URL conforms to the structure &quot;/[type]/[id]&quot; then it should be assumed that the reference is to a FHIR RESTful server." />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="Provenance.agent.who.display">
      <path value="Provenance.agent.who.display" />
      <mustSupport value="true" />
    </element>
    <element id="Provenance.agent.onBehalfOf">
      <path value="Provenance.agent.onBehalfOf" />
      <comment value="Conformance Rule:   This is specified when the agent/user is acting on behalf of Practitioner&#xD;&#xA;&#xD;&#xA;Conformance Rule:   The PractitonerRole must always be used as this is the means for specifying the role and specialty of the practitioner.   If the practitioner role is not known, the Practitioner resource may be used.  &#xD;&#xA;&#xD;&#xA;onBehalfOfIdentity should be used when the agent is not a Resource type." />
      <type>
        <code value="Reference" />
        <targetProfile value="http://hl7.org/fhir/StructureDefinition/PractitionerRole" />
        <aggregation value="bundled" />
      </type>
      <mustSupport value="true" />
    </element>
    <element id="Provenance.agent.onBehalfOf.reference">
      <path value="Provenance.agent.onBehalfOf.reference" />
      <comment value="Conformance Rule:   This will be a reference to the practitioner role or practitioner &#xD;&#xA;&#xD;&#xA;Using absolute URLs provides a stable scalable approach suitable for a cloud/web context, while using relative/logical references provides a flexible approach suitable for use when trading across closed eco-system boundaries.   Absolute URLs do not need to point to a FHIR RESTful server, though this is the preferred approach. If the URL conforms to the structure &quot;/[type]/[id]&quot; then it should be assumed that the reference is to a FHIR RESTful server." />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="Provenance.agent.onBehalfOf.display">
      <path value="Provenance.agent.onBehalfOf.display" />
      <comment value="Conformance Rule:   This will be the name of the practitioner or organization who is exporting the data.&#xD;&#xA;&#xD;&#xA;This is generally not the same as the Resource.text of the referenced resource.  The purpose is to identify what's being referenced, not to fully describe it." />
      <mustSupport value="true" />
    </element>
  </differential>
</StructureDefinition>