<StructureDefinition xmlns="http://hl7.org/fhir">
  <id value="biobankcy-sd-visit" />
  <url value="http://ig.biobank.cy/fhir/StructureDefinition/biobankcy-sd-visit" />
  <name value="BIOBANKCYSDVisit" />
  <title value="Profile: Visit (biobank.cy)" />
  <status value="draft" />
  <publisher value="biobank.cy" />
  <contact>
    <name value="Molecular Medicine Research Center (MMRC)" />
    <telecom>
      <system value="email" />
      <value value="biobank@ucy.ac.cy" />
      <use value="work" />
    </telecom>
  </contact>
  <description value="Represents the visit between a patient (donor or citizen) and a practitioner of the biobank.cy (nurse or researcher). The input of a new entry or the update of an existing entry in the biobank.cy Data Warehouse shall be done only in the context of a visit. Therefore, all the data of a patient resource in the data warehosue shall reference a specific visit in which they were first created or updated." />
  <fhirVersion value="4.0.1" />
  <kind value="resource" />
  <abstract value="false" />
  <type value="Encounter" />
  <baseDefinition value="http://hl7.org/fhir/StructureDefinition/Encounter" />
  <derivation value="constraint" />
  <differential>
    <element id="Encounter.identifier">
      <path value="Encounter.identifier" />
      <min value="1" />
      <max value="1" />
    </element>
    <element id="Encounter.identifier.type">
      <path value="Encounter.identifier.type" />
      <min value="1" />
      <type>
        <code value="CodeableConcept" />
        <profile value="http://hl7.org/fhir/uv/ips/StructureDefinition/CodeableConcept-uv-ips" />
      </type>
      <patternCodeableConcept>
        <coding>
          <system value="http://terminology.hl7.org/CodeSystem/v2-0203" />
          <code value="VN" />
          <display value="Visit number" />
        </coding>
      </patternCodeableConcept>
    </element>
    <element id="Encounter.identifier.type.coding.system">
      <path value="Encounter.identifier.type.coding.system" />
      <min value="1" />
    </element>
    <element id="Encounter.identifier.type.coding.code">
      <path value="Encounter.identifier.type.coding.code" />
      <min value="1" />
    </element>
    <element id="Encounter.identifier.type.coding.display">
      <path value="Encounter.identifier.type.coding.display" />
      <min value="1" />
    </element>
    <element id="Encounter.identifier.value">
      <path value="Encounter.identifier.value" />
      <min value="1" />
    </element>
    <element id="Encounter.status">
      <path value="Encounter.status" />
      <comment value="Note that internal business rules will determine the appropriate transitions that may occur between statuses (and also classes).&#xD;&#xA;&#xD;&#xA; biobank.cy: Use only | finished |" />
      <fixedCode value="finished" />
    </element>
    <element id="Encounter.statusHistory">
      <path value="Encounter.statusHistory" />
      <comment value="The current status is always found in the current version of the resource, not the status history.&#xD;&#xA;&#xD;&#xA;Not to be used for biobank.cy" />
    </element>
    <element id="Encounter.class">
      <path value="Encounter.class" />
      <patternCoding>
        <system value="http://terminology.hl7.org/CodeSystem/v3-ActCode" />
        <code value="AMB" />
      </patternCoding>
    </element>
    <element id="Encounter.class.system">
      <path value="Encounter.class.system" />
      <min value="1" />
    </element>
    <element id="Encounter.class.code">
      <path value="Encounter.class.code" />
      <min value="1" />
    </element>
    <element id="Encounter.class.display">
      <path value="Encounter.class.display" />
      <min value="1" />
    </element>
    <element id="Encounter.classHistory">
      <path value="Encounter.classHistory" />
      <comment value="Not to be used for biobank.cy" />
    </element>
    <element id="Encounter.type">
      <path value="Encounter.type" />
      <comment value="Since there are many ways to further classify encounters, this element is 0..*.&#xD;&#xA;&#xD;&#xA;Not to be used for biobank.cy" />
    </element>
    <element id="Encounter.serviceType">
      <path value="Encounter.serviceType" />
      <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;Not to be used for biobank.cy" />
    </element>
    <element id="Encounter.priority">
      <path value="Encounter.priority" />
      <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;Not to be used for biobank.cy" />
    </element>
    <element id="Encounter.subject">
      <path value="Encounter.subject" />
      <min value="1" />
      <type>
        <code value="Reference" />
        <targetProfile value="http://hl7.org/fhir/StructureDefinition/Patient" />
        <targetProfile value="http://hl7.org/fhir/StructureDefinition/Group" />
        <targetProfile value="http://ig.biobank.cy/fhir/StructureDefinition/biobankcy-sd-donor" />
        <targetProfile value="http://ig.biobank.cy/fhir/StructureDefinition/biobankcy-sd-citizen" />
      </type>
      <mustSupport value="true" />
    </element>
    <element id="Encounter.subject.reference">
      <path value="Encounter.subject.reference" />
      <min value="1" />
    </element>
    <element id="Encounter.subject.identifier.type">
      <path value="Encounter.subject.identifier.type" />
      <type>
        <code value="CodeableConcept" />
        <profile value="http://hl7.org/fhir/uv/ips/StructureDefinition/CodeableConcept-uv-ips" />
      </type>
    </element>
    <element id="Encounter.subject.identifier.type.coding.system">
      <path value="Encounter.subject.identifier.type.coding.system" />
      <min value="1" />
    </element>
    <element id="Encounter.subject.identifier.type.coding.code">
      <path value="Encounter.subject.identifier.type.coding.code" />
      <min value="1" />
    </element>
    <element id="Encounter.subject.identifier.type.coding.display">
      <path value="Encounter.subject.identifier.type.coding.display" />
      <min value="1" />
    </element>
    <element id="Encounter.episodeOfCare">
      <path value="Encounter.episodeOfCare" />
      <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;Not to be used for biobank.cy" />
    </element>
    <element id="Encounter.basedOn">
      <path value="Encounter.basedOn" />
      <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;&#xD;&#xA;Not to be used for biobank.cy" />
    </element>
    <element id="Encounter.participant">
      <path value="Encounter.participant" />
      <comment value="biobank.cy: Use individual element --&gt; practitioner role (see comment on individual element)." />
      <mustSupport value="true" />
    </element>
    <element id="Encounter.participant.type">
      <path value="Encounter.participant.type" />
      <type>
        <code value="CodeableConcept" />
        <profile value="http://hl7.org/fhir/uv/ips/StructureDefinition/CodeableConcept-uv-ips" />
      </type>
    </element>
    <element id="Encounter.participant.type.coding.system">
      <path value="Encounter.participant.type.coding.system" />
      <min value="1" />
    </element>
    <element id="Encounter.participant.type.coding.code">
      <path value="Encounter.participant.type.coding.code" />
      <min value="1" />
    </element>
    <element id="Encounter.participant.type.coding.display">
      <path value="Encounter.participant.type.coding.display" />
      <min value="1" />
    </element>
    <element id="Encounter.participant.individual">
      <path value="Encounter.participant.individual" />
      <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;&#xD;&#xA;biobank.cy use &quot;primary performer&quot;." />
      <min value="1" />
      <type>
        <code value="Reference" />
        <targetProfile value="http://hl7.org/fhir/StructureDefinition/Practitioner" />
        <targetProfile value="http://hl7.org/fhir/StructureDefinition/PractitionerRole" />
        <targetProfile value="http://ig.biobank.cy/fhir/StructureDefinition/biobankcy-sd-practitioner" />
      </type>
    </element>
    <element id="Encounter.participant.individual.reference">
      <path value="Encounter.participant.individual.reference" />
      <min value="1" />
    </element>
    <element id="Encounter.participant.individual.identifier.type">
      <path value="Encounter.participant.individual.identifier.type" />
      <type>
        <code value="CodeableConcept" />
        <profile value="http://hl7.org/fhir/uv/ips/StructureDefinition/CodeableConcept-uv-ips" />
      </type>
    </element>
    <element id="Encounter.participant.individual.identifier.type.coding.system">
      <path value="Encounter.participant.individual.identifier.type.coding.system" />
      <min value="1" />
    </element>
    <element id="Encounter.participant.individual.identifier.type.coding.code">
      <path value="Encounter.participant.individual.identifier.type.coding.code" />
      <min value="1" />
    </element>
    <element id="Encounter.participant.individual.identifier.type.coding.display">
      <path value="Encounter.participant.individual.identifier.type.coding.display" />
      <min value="1" />
    </element>
    <element id="Encounter.appointment">
      <path value="Encounter.appointment" />
      <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;&#xD;&#xA;Not to be used for biobank.cy" />
    </element>
    <element id="Encounter.period">
      <path value="Encounter.period" />
      <mustSupport value="true" />
    </element>
    <element id="Encounter.length">
      <path value="Encounter.length" />
      <comment value="May differ from the time the Encounter.period lasted because of leave of absence.&#xD;&#xA;&#xD;&#xA;Not to be used for biobank.cy" />
    </element>
    <element id="Encounter.reasonCode">
      <path value="Encounter.reasonCode" />
      <comment value="For systems that need to know which was the primary diagnosis, these will be marked with the standard extension primaryDiagnosis (which is a sequence value rather than a flag, 1 = primary diagnosis).&#xD;&#xA;&#xD;&#xA;&#xD;&#xA;Not to be used for biobank.cy" />
    </element>
    <element id="Encounter.reasonReference">
      <path value="Encounter.reasonReference" />
      <comment value="For systems that need to know which was the primary diagnosis, these will be marked with the standard extension primaryDiagnosis (which is a sequence value rather than a flag, 1 = primary diagnosis).&#xD;&#xA;&#xD;&#xA;Not to be used for biobank.cy" />
    </element>
    <element id="Encounter.diagnosis">
      <path value="Encounter.diagnosis" />
      <comment value="Not to be used for biobank.cy" />
    </element>
    <element id="Encounter.diagnosis.rank">
      <path value="Encounter.diagnosis.rank" />
      <comment value="32 bit number; for values larger than this, use decimal&#xD;&#xA;&#xD;&#xA;Not to be used for biobank.cy" />
    </element>
    <element id="Encounter.account">
      <path value="Encounter.account" />
      <comment value="The billing system may choose to allocate billable items associated with the Encounter to different referenced Accounts based on internal business rules.&#xD;&#xA;&#xD;&#xA;Not to be used for biobank.cy" />
    </element>
    <element id="Encounter.hospitalization">
      <path value="Encounter.hospitalization" />
      <comment value="An Encounter may cover more than just the inpatient stay. Contexts such as outpatients, community clinics, and aged care facilities are also included.&#xD;&#xD;The duration recorded in the period of this encounter covers the entire scope of this hospitalization record.&#xD;&#xA;&#xD;&#xA;Not to be used for biobank.cy" />
    </element>
    <element id="Encounter.location">
      <path value="Encounter.location" />
      <mustSupport value="true" />
    </element>
    <element id="Encounter.location.location">
      <path value="Encounter.location.location" />
      <type>
        <code value="Reference" />
        <targetProfile value="http://hl7.org/fhir/StructureDefinition/Location" />
        <targetProfile value="http://ig.biobank.cy/fhir/StructureDefinition/biobankcy-sd-location" />
      </type>
    </element>
    <element id="Encounter.location.location.reference">
      <path value="Encounter.location.location.reference" />
      <min value="1" />
    </element>
    <element id="Encounter.location.location.identifier.type">
      <path value="Encounter.location.location.identifier.type" />
      <type>
        <code value="CodeableConcept" />
        <profile value="http://hl7.org/fhir/uv/ips/StructureDefinition/CodeableConcept-uv-ips" />
      </type>
    </element>
    <element id="Encounter.location.location.identifier.type.coding.system">
      <path value="Encounter.location.location.identifier.type.coding.system" />
      <min value="1" />
    </element>
    <element id="Encounter.location.location.identifier.type.coding.code">
      <path value="Encounter.location.location.identifier.type.coding.code" />
      <min value="1" />
    </element>
    <element id="Encounter.location.location.identifier.type.coding.display">
      <path value="Encounter.location.location.identifier.type.coding.display" />
      <min value="1" />
    </element>
    <element id="Encounter.location.status">
      <path value="Encounter.location.status" />
      <comment value="When the patient is no longer active at a location, then the period end date is entered, and the status may be changed to completed.&#xD;&#xA;&#xD;&#xA;Not to be used for biobank.cy" />
    </element>
    <element id="Encounter.location.physicalType">
      <path value="Encounter.location.physicalType" />
      <comment value="This information is de-normalized from the Location resource to support the easier understanding of the encounter resource and processing in messaging or query.&#xA;&#xA;There may be many levels in the hierachy, and this may only pic specific levels that are required for a specific usage scenario.&#xD;&#xA;&#xD;&#xA;Not to be used for biobank.cy" />
    </element>
    <element id="Encounter.location.period">
      <path value="Encounter.location.period" />
      <comment value="A Period specifies a range of time; the context of use will specify whether the entire range applies (e.g. &quot;the patient was an inpatient of the hospital for this time range&quot;) or one value from the range applies (e.g. &quot;give to the patient between these two times&quot;).&#xA;&#xA;Period is not used for a duration (a measure of elapsed time). See [Duration](datatypes.html#Duration).&#xD;&#xA;&#xD;&#xA;Not to be used for biobank.cy" />
    </element>
    <element id="Encounter.serviceProvider">
      <path value="Encounter.serviceProvider" />
      <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;Not to be used for biobank.cy" />
    </element>
    <element id="Encounter.partOf">
      <path value="Encounter.partOf" />
      <comment value="This is also used for associating a child's encounter back to the mother's encounter.&#xD;&#xD;Refer to the Notes section in the Patient resource for further details.&#xD;&#xA;&#xD;&#xA;Not to be used for biobank.cy" />
    </element>
  </differential>
</StructureDefinition>