<StructureDefinition xmlns="http://hl7.org/fhir">
  <id value="cyehrsd-sd-provenance" />
  <url value="http://ig.ehealth4u.eu/fhir/StructureDefinition/cyehrsd-sd-provenance" />
  <name value="CYEHRSDProvenance" />
  <title value="Cyprus EHR Provenance profile" />
  <status value="draft" />
  <publisher value="eHealth4U" />
  <contact>
    <name value="eHealth Lab (University of Cyprus)" />
    <telecom>
      <system value="email" />
      <value value="ehealthl@ucy.ac.cy" />
      <use value="work" />
    </telecom>
  </contact>
  <description value="Represents the usage of the Provenance resource for the needs of eHealth4U to document how particular FHIR resources are created or modified. Note: Currently the Provenance resource is used to keep a record of importing a patient's resources based on a document (e.g. IPS document, EU PS document) to show provenance from resources back to the IPS source document (eHealth4U IPS module). In the future it is expected that this profile will be used for other use cases as well." />
  <fhirVersion value="4.0.1" />
  <kind value="resource" />
  <abstract value="false" />
  <type value="Provenance" />
  <baseDefinition value="http://hl7.org/fhir/StructureDefinition/Provenance" />
  <derivation value="constraint" />
  <differential>
    <element id="Provenance.meta">
      <path value="Provenance.meta" />
    </element>
    <element id="Provenance.meta.profile">
      <path value="Provenance.meta.profile" />
      <slicing>
        <discriminator>
          <type value="value" />
          <path value="$this" />
        </discriminator>
        <rules value="open" />
      </slicing>
      <min value="1" />
    </element>
    <element id="Provenance.meta.profile:CyprusEHRProfile">
      <path value="Provenance.meta.profile" />
      <sliceName value="CyprusEHRProfile" />
      <min value="1" />
      <max value="1" />
      <fixedCanonical value="http://ig.ehealth4u.eu/fhir/StructureDefinition/cyehrsd-sd-provenance" />
    </element>
    <element id="Provenance.target.reference">
      <path value="Provenance.target.reference" />
      <comment value="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.&#xD;&#xA;&#xD;&#xA;CyprusEHR: Reference all the resources that were created/imported by a document" />
      <min value="1" />
    </element>
    <element id="Provenance.occurred[x]">
      <path value="Provenance.occurred[x]" />
      <comment value="The period can be a little arbitrary; where possible, the time should correspond to human assessment of the activity time.&#xD;&#xA;&#xD;&#xA;CyprusEHR: Not to be used in the context of Cyprus EHR." />
    </element>
    <element id="Provenance.recorded">
      <path value="Provenance.recorded" />
      <comment value="This can be a little different from the time stamp on the resource if there is a delay between recording the event and updating the provenance and target resource.&#xD;&#xA;&#xD;&#xA;CyprusEHR: The instant of time that the creation of the resources based on the document occured." />
    </element>
    <element id="Provenance.policy">
      <path value="Provenance.policy" />
      <comment value="For example: Where an OAuth token authorizes, the unique identifier from the OAuth token is placed into the policy element Where a policy engine (e.g. XACML) holds policy logic, the unique policy identifier is placed into the policy element.&#xD;&#xA;&#xD;&#xA;CyprusEHR: Not to be used in the context of Cyprus EHR." />
    </element>
    <element id="Provenance.location">
      <path value="Provenance.location" />
      <comment value="References SHALL be a reference to an actual FHIR resource, and SHALL be resolveable (allowing for access control, temporary unavailability, etc.). Resolution can be either by retrieval from the URL, or, where applicable by resource type, by treating an absolute reference as a canonical URL and looking it up in a local registry/repository.&#xD;&#xA;&#xD;&#xA;CyprusEHR: Not to be used in the context of Cyprus EHR." />
    </element>
    <element id="Provenance.reason">
      <path value="Provenance.reason" />
      <comment value="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.&#xD;&#xA;&#xD;&#xA;CyprusEHR: Not to be used in the context of Cyprus EHR." />
    </element>
    <element id="Provenance.activity">
      <path value="Provenance.activity" />
      <type>
        <code value="CodeableConcept" />
        <profile value="http://hl7.org/fhir/uv/ips/StructureDefinition/CodeableConcept-uv-ips" />
      </type>
      <mustSupport value="true" />
    </element>
    <element id="Provenance.activity.coding">
      <path value="Provenance.activity.coding" />
      <slicing>
        <discriminator>
          <type value="pattern" />
          <path value="$this" />
        </discriminator>
        <rules value="open" />
      </slicing>
    </element>
    <element id="Provenance.activity.coding:resourceDerivation">
      <path value="Provenance.activity.coding" />
      <sliceName value="resourceDerivation" />
      <patternCoding>
        <system value="http://hl7.org/fhir/w3c-provenance-activity-type" />
        <code value="Derivation" />
        <display value="wasDerivedFrom" />
      </patternCoding>
    </element>
    <element id="Provenance.activity.coding:resourceDerivation.system">
      <path value="Provenance.activity.coding.system" />
      <min value="1" />
    </element>
    <element id="Provenance.activity.coding:resourceDerivation.code">
      <path value="Provenance.activity.coding.code" />
      <min value="1" />
    </element>
    <element id="Provenance.activity.coding:resourceDerivation.display">
      <path value="Provenance.activity.coding.display" />
      <min value="1" />
    </element>
    <element id="Provenance.agent">
      <path value="Provenance.agent" />
      <slicing>
        <discriminator>
          <type value="pattern" />
          <path value="type" />
        </discriminator>
        <rules value="open" />
      </slicing>
    </element>
    <element id="Provenance.agent.type">
      <path value="Provenance.agent.type" />
      <type>
        <code value="CodeableConcept" />
        <profile value="http://hl7.org/fhir/uv/ips/StructureDefinition/CodeableConcept-uv-ips" />
      </type>
    </element>
    <element id="Provenance.agent:assembler">
      <path value="Provenance.agent" />
      <sliceName value="assembler" />
    </element>
    <element id="Provenance.agent:assembler.type">
      <path value="Provenance.agent.type" />
      <min value="1" />
      <patternCodeableConcept>
        <coding>
          <system value="http://terminology.hl7.org/CodeSystem/provenance-participant-type" />
          <code value="assembler" />
          <display value="Assembler" />
        </coding>
      </patternCodeableConcept>
    </element>
    <element id="Provenance.entity">
      <path value="Provenance.entity" />
      <slicing>
        <discriminator>
          <type value="value" />
          <path value="role" />
        </discriminator>
        <rules value="open" />
      </slicing>
      <comment value="CyprusEHR: For the case of the creation of resources impoted by a received IPS document" />
      <mustSupport value="true" />
    </element>
    <element id="Provenance.entity:Source">
      <path value="Provenance.entity" />
      <sliceName value="Source" />
    </element>
    <element id="Provenance.entity:Source.role">
      <path value="Provenance.entity.role" />
      <fixedCode value="source" />
    </element>
    <element id="Provenance.entity:Source.what">
      <path value="Provenance.entity.what" />
      <comment value="whatIdentity should be used for entities that are not a Resource type.&#xD;&#xA;&#xD;&#xA;CyprusEHR: Reference the source resource that the targeted resources were created upon (e.g. in the case of a received IPS document, the received IPS Bundle would be reference)." />
    </element>
    <element id="Provenance.entity:Source.what.reference">
      <path value="Provenance.entity.what.reference" />
      <min value="1" />
    </element>
  </differential>
</StructureDefinition>