<StructureDefinition xmlns="http://hl7.org/fhir">
  <id value="cyehr-sd-encounter-r4" />
  <url value="http://ig.ehealth4u.eu/fhir/StructureDefinition/cyehr-sd-encounter-r4" />
  <name value="CYEHRSDEncounter" />
  <title value="Cyprus EHR Encounter 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="This profile represents the outpatient visit based on the requirements of the national EHR system of Cyprus. The input of a new entry or the update of an existing entry shall be done only in the context of an encounter. Therefore, all EHR data shall reference a specific encounter 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.meta">
      <path value="Encounter.meta" />
    </element>
    <element id="Encounter.meta.profile">
      <path value="Encounter.meta.profile" />
      <slicing>
        <discriminator>
          <type value="value" />
          <path value="$this" />
        </discriminator>
        <rules value="open" />
      </slicing>
      <min value="1" />
    </element>
    <element id="Encounter.meta.profile:CyprusEHRProfile">
      <path value="Encounter.meta.profile" />
      <sliceName value="CyprusEHRProfile" />
      <min value="1" />
      <max value="1" />
      <fixedCanonical value="http://ig.ehealth4u.eu/fhir/StructureDefinition/cyehr-sd-encounter-r4" />
    </element>
    <element id="Encounter.identifier.type">
      <path value="Encounter.identifier.type" />
      <type>
        <code value="CodeableConcept" />
        <profile value="http://hl7.org/fhir/uv/ips/StructureDefinition/CodeableConcept-uv-ips" />
      </type>
    </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.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; CyprusEHR: Use only | in-progress | finished | entered-in-error" />
    </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;CyprusEHR: Not to be used in the context of Cyprus EHR." />
    </element>
    <element id="Encounter.class">
      <path value="Encounter.class" />
      <comment value="Codes may be defined very casually in enumerations or code lists, up to very formal definitions such as SNOMED CT - see the HL7 v3 Core Principles for more information.&#xD;&#xA;&#xD;&#xA;&#xD;&#xA;CyprusEHR: For eHealth4U we will only use &quot;ambulatory&quot; (i.e. outpatient)." />
      <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="CyprusEHR: Not to be used in the context of Cyprus EHR." />
    </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;&#xD;&#xA;CyprusEHR: Not to be used in the context of Cyprus EHR." />
    </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;&#xD;&#xA;CyprusEHR: Not to be used in the context of Cyprus EHR." />
    </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;CyprusEHR: Not to be used in the context of Cyprus EHR." />
    </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.ehealth4u.eu/fhir/StructureDefinition/cyehr-sd-patient" />
      </type>
      <mustSupport value="true" />
    </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" />
      <min value="1" />
      <max value="1" />
      <mustSupport value="true" />
    </element>
    <element id="Encounter.episodeOfCare.identifier.type">
      <path value="Encounter.episodeOfCare.identifier.type" />
      <type>
        <code value="CodeableConcept" />
        <profile value="http://hl7.org/fhir/uv/ips/StructureDefinition/CodeableConcept-uv-ips" />
      </type>
    </element>
    <element id="Encounter.episodeOfCare.identifier.type.coding.system">
      <path value="Encounter.episodeOfCare.identifier.type.coding.system" />
      <min value="1" />
    </element>
    <element id="Encounter.episodeOfCare.identifier.type.coding.code">
      <path value="Encounter.episodeOfCare.identifier.type.coding.code" />
      <min value="1" />
    </element>
    <element id="Encounter.episodeOfCare.identifier.type.coding.display">
      <path value="Encounter.episodeOfCare.identifier.type.coding.display" />
      <min value="1" />
    </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;CyprusEHR: Will be needed when the encounter is created based on a referral." />
    </element>
    <element id="Encounter.basedOn.identifier.type">
      <path value="Encounter.basedOn.identifier.type" />
      <type>
        <code value="CodeableConcept" />
        <profile value="http://hl7.org/fhir/uv/ips/StructureDefinition/CodeableConcept-uv-ips" />
      </type>
    </element>
    <element id="Encounter.basedOn.identifier.type.coding.system">
      <path value="Encounter.basedOn.identifier.type.coding.system" />
      <min value="1" />
    </element>
    <element id="Encounter.basedOn.identifier.type.coding.code">
      <path value="Encounter.basedOn.identifier.type.coding.code" />
      <min value="1" />
    </element>
    <element id="Encounter.basedOn.identifier.type.coding.display">
      <path value="Encounter.basedOn.identifier.type.coding.display" />
      <min value="1" />
    </element>
    <element id="Encounter.participant">
      <path value="Encounter.participant" />
      <comment value="CyprusEHR: 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;CyprusEHR: For eHealth4U use &quot;primary performer&quot;." />
    </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;CyprusEHR: Not to be used in the context of Cyprus EHR." />
    </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;CyprusEHR: Not to be used in the context of Cyprus EHR." />
    </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;CyprusEHR: Not to be used in the context of Cyprus EHR." />
    </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;&#xD;&#xA;CyprusEHR: Admission cause:&#xD;&#xA;&#xD;&#xA;- The doctor will be able to choose an existing procedure or observation result or a problem from the respective profiles.&#xD;&#xA;- The doctor will be able to create a new problem using the value sets from code element.&#xD;&#xA;- Any additional note (free text) will be added to the respective profile.note." />
      <type>
        <code value="Reference" />
        <targetProfile value="http://hl7.org/fhir/StructureDefinition/Condition" />
        <targetProfile value="http://hl7.org/fhir/StructureDefinition/Procedure" />
        <targetProfile value="http://hl7.org/fhir/StructureDefinition/Observation" />
        <targetProfile value="http://hl7.org/fhir/StructureDefinition/ImmunizationRecommendation" />
        <targetProfile value="http://ig.ehealth4u.eu/fhir/StructureDefinition/cyehr-sd-problem-r4" />
        <targetProfile value="http://ig.ehealth4u.eu/fhir/StructureDefinition/cyehr-sd-procedure-r4" />
        <targetProfile value="http://ig.ehealth4u.eu/fhir/StructureDefinition/cyehr-sd-observationresults" />
      </type>
      <mustSupport value="true" />
    </element>
    <element id="Encounter.reasonReference.reference">
      <path value="Encounter.reasonReference.reference" />
      <min value="1" />
    </element>
    <element id="Encounter.reasonReference.identifier.type">
      <path value="Encounter.reasonReference.identifier.type" />
      <type>
        <code value="CodeableConcept" />
        <profile value="http://hl7.org/fhir/uv/ips/StructureDefinition/CodeableConcept-uv-ips" />
      </type>
    </element>
    <element id="Encounter.reasonReference.identifier.type.coding.system">
      <path value="Encounter.reasonReference.identifier.type.coding.system" />
      <min value="1" />
    </element>
    <element id="Encounter.reasonReference.identifier.type.coding.code">
      <path value="Encounter.reasonReference.identifier.type.coding.code" />
      <min value="1" />
    </element>
    <element id="Encounter.reasonReference.identifier.type.coding.display">
      <path value="Encounter.reasonReference.identifier.type.coding.display" />
      <min value="1" />
    </element>
    <element id="Encounter.diagnosis">
      <path value="Encounter.diagnosis" />
      <slicing>
        <discriminator>
          <type value="pattern" />
          <path value="use" />
        </discriminator>
        <rules value="open" />
      </slicing>
      <mustSupport value="true" />
    </element>
    <element id="Encounter.diagnosis.condition">
      <path value="Encounter.diagnosis.condition" />
      <type>
        <code value="Reference" />
        <targetProfile value="http://hl7.org/fhir/StructureDefinition/Condition" />
        <targetProfile value="http://hl7.org/fhir/StructureDefinition/Procedure" />
        <targetProfile value="http://ig.ehealth4u.eu/fhir/StructureDefinition/cyehr-sd-diagnosis-r4" />
      </type>
    </element>
    <element id="Encounter.diagnosis.condition.reference">
      <path value="Encounter.diagnosis.condition.reference" />
      <min value="1" />
    </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;CyprusEHR: Not to be used in the context of Cyprus EHR." />
    </element>
    <element id="Encounter.diagnosis:diagnosedProblem">
      <path value="Encounter.diagnosis" />
      <sliceName value="diagnosedProblem" />
      <mustSupport value="true" />
    </element>
    <element id="Encounter.diagnosis:diagnosedProblem.use">
      <path value="Encounter.diagnosis.use" />
      <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: An official diagnosis that is created in the context of an encounter as part of the &quot;First Impression&quot; section." />
      <min value="1" />
      <patternCodeableConcept>
        <coding>
          <system value="http://terminology.hl7.org/CodeSystem/diagnosis-role" />
          <code value="DD" />
        </coding>
      </patternCodeableConcept>
    </element>
    <element id="Encounter.diagnosis:differentialDiagnosis">
      <path value="Encounter.diagnosis" />
      <sliceName value="differentialDiagnosis" />
      <mustSupport value="true" />
    </element>
    <element id="Encounter.diagnosis:differentialDiagnosis.use">
      <path value="Encounter.diagnosis.use" />
      <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: Use this role when recoring differential diagnosis as part of an encounter as recorded in the &quot;First Impression&quot; section." />
      <min value="1" />
      <patternCodeableConcept>
        <coding>
          <system value="http://terminology.hl7.org/CodeSystem/ex-diagnosistype" />
          <code value="differential" />
        </coding>
      </patternCodeableConcept>
    </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;CyprusEHR: Not to be used in the context of Cyprus EHR." />
    </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;&#xD;&#xA;CyprusEHR: Not to be used in the context of Cyprus EHR." />
    </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.ehealth4u.eu/fhir/StructureDefinition/cyehr-sd-location-r4" />
      </type>
    </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;CyprusEHR: Not to be used in the context of Cyprus EHR." />
    </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;CyprusEHR: Not to be used in the context of Cyprus EHR." />
    </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;&#xD;&#xA;CyprusEHR: Not to be used in the context of Cyprus EHR." />
    </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;CyprusEHR: Not to be used in the context of Cyprus EHR." />
    </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;CyprusEHR: Not to be used in the context of Cyprus EHR." />
    </element>
  </differential>
</StructureDefinition>