<StructureDefinition xmlns="http://hl7.org/fhir">
  <id value="cyehr-sd-practitionerrole-r4" />
  <url value="http://ig.ehealth4u.eu/fhir/StructureDefinition/cyehr-sd-practitionerrole-r4" />
  <name value="CYEHRSDPractitionerRole" />
  <title value="Cyprus EHR Practitioner Role profile" />
  <status value="draft" />
  <publisher value="eHealth4U" />
  <contact>
    <name value="ehealth Lab" />
    <telecom>
      <system value="email" />
      <value value="ehealthl@ucy.ac.cy" />
      <use value="work" />
    </telecom>
  </contact>
  <description value="The main use-case of this profile is to represent the role that a Practitioner has within a team of healthcare professionals or an organization and the locations where he/she provides services." />
  <fhirVersion value="4.0.1" />
  <kind value="resource" />
  <abstract value="false" />
  <type value="PractitionerRole" />
  <baseDefinition value="http://hl7.org/fhir/StructureDefinition/PractitionerRole" />
  <derivation value="constraint" />
  <differential>
    <element id="PractitionerRole">
      <path value="PractitionerRole" />
      <comment value="CyprusEHR: Practitioner Role is used to present the role of a practitioner in a specific medical team or organization, specifying the location  he/she provides. Furthermore, CYEHRSDConsent resources are created referencing a particular CYEHRSDPractitionerRole of a Practitioner, indicating that the Practitioner is granted access to the patient's data with the referenced practitioner's role within the particular medical team / organization." />
      <constraint>
        <key value="cyehr-practitionerrole-1" />
        <severity value="error" />
        <human value="If the practitioner role is created based on the practitioner's medical license the code and the specialty must be the same as recorded in the medical license." />
        <expression value="extension('http://ig.ehealth4u.eu/fhir/StructureDefinition/cyehr-ext-partofpractitionerrole').exists() implies (code.coding.where(system = 'urn:oid:2.16.840.1.113883.2.9.6.2.7').code = extension('http://ig.ehealth4u.eu/fhir/StructureDefinition/cyehr-ext-partofpractitionerrole').valueReference.resolve().coding.where(system = 'urn:oid:2.16.840.1.113883.2.9.6.2.7').code and specialty.coding.code = extension('http://ig.ehealth4u.eu/fhir/StructureDefinition/cyehr-ext-partofpractitionerrole').valueReference.resolve().specialty.coding.code)" />
        <source value="http://ig.ehealth4u.eu/fhir/StructureDefinition/cyehr-sd-practitionerrole-r4" />
      </constraint>
    </element>
    <element id="PractitionerRole.meta">
      <path value="PractitionerRole.meta" />
    </element>
    <element id="PractitionerRole.meta.profile">
      <path value="PractitionerRole.meta.profile" />
      <slicing>
        <discriminator>
          <type value="value" />
          <path value="$this" />
        </discriminator>
        <rules value="open" />
      </slicing>
      <min value="1" />
    </element>
    <element id="PractitionerRole.meta.profile:CyprusEHRProfile">
      <path value="PractitionerRole.meta.profile" />
      <sliceName value="CyprusEHRProfile" />
      <min value="1" />
      <max value="1" />
      <fixedCanonical value="http://ig.ehealth4u.eu/fhir/StructureDefinition/cyehr-sd-practitionerrole-r4" />
    </element>
    <element id="PractitionerRole.extension">
      <path value="PractitionerRole.extension" />
      <slicing>
        <discriminator>
          <type value="value" />
          <path value="url" />
        </discriminator>
        <rules value="open" />
      </slicing>
      <min value="0" />
    </element>
    <element id="PractitionerRole.extension:practitionerLicense">
      <path value="PractitionerRole.extension" />
      <sliceName value="practitionerLicense" />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="Extension" />
        <profile value="http://ig.ehealth4u.eu/fhir/StructureDefinition/cyehr-ext-partofpractitionerrole" />
      </type>
      <mustSupport value="true" />
    </element>
    <element id="PractitionerRole.extension:practitionerLicense.value[x]">
      <path value="PractitionerRole.extension.value[x]" />
      <min value="1" />
      <type>
        <code value="Reference" />
        <targetProfile value="http://ig.ehealth4u.eu/fhir/StructureDefinition/cyehr-sd-practitionerlicense-r4" />
      </type>
    </element>
    <element id="PractitionerRole.extension:practitionerLicense.value[x].reference">
      <path value="PractitionerRole.extension.value[x].reference" />
      <min value="1" />
    </element>
    <element id="PractitionerRole.identifier">
      <path value="PractitionerRole.identifier" />
      <mustSupport value="false" />
    </element>
    <element id="PractitionerRole.identifier.system">
      <path value="PractitionerRole.identifier.system" />
      <mustSupport value="true" />
    </element>
    <element id="PractitionerRole.identifier.value">
      <path value="PractitionerRole.identifier.value" />
      <mustSupport value="true" />
    </element>
    <element id="PractitionerRole.active">
      <path value="PractitionerRole.active" />
      <mustSupport value="false" />
    </element>
    <element id="PractitionerRole.practitioner">
      <path value="PractitionerRole.practitioner" />
      <type>
        <code value="Reference" />
        <targetProfile value="http://hl7.org/fhir/StructureDefinition/Practitioner" />
        <targetProfile value="http://ig.ehealth4u.eu/fhir/StructureDefinition/cyehr-sd-practitioner-r4" />
      </type>
      <mustSupport value="true" />
    </element>
    <element id="PractitionerRole.practitioner.reference">
      <path value="PractitionerRole.practitioner.reference" />
      <min value="1" />
    </element>
    <element id="PractitionerRole.organization">
      <path value="PractitionerRole.organization" />
      <type>
        <code value="Reference" />
        <targetProfile value="http://hl7.org/fhir/StructureDefinition/Organization" />
        <targetProfile value="http://ig.ehealth4u.eu/fhir/StructureDefinition/cyehr-sd-organization-r4" />
        <targetProfile value="http://ig.ehealth4u.eu/fhir/StructureDefinition/cyehr-sd-medicalteam-r4" />
      </type>
      <mustSupport value="true" />
    </element>
    <element id="PractitionerRole.organization.reference">
      <path value="PractitionerRole.organization.reference" />
      <min value="1" />
    </element>
    <element id="PractitionerRole.code">
      <path value="PractitionerRole.code" />
      <type>
        <code value="CodeableConcept" />
        <profile value="http://hl7.org/fhir/uv/ips/StructureDefinition/CodeableConcept-uv-ips" />
      </type>
    </element>
    <element id="PractitionerRole.code.coding">
      <path value="PractitionerRole.code.coding" />
      <slicing>
        <discriminator>
          <type value="pattern" />
          <path value="$this" />
        </discriminator>
        <rules value="open" />
      </slicing>
    </element>
    <element id="PractitionerRole.code.coding.system">
      <path value="PractitionerRole.code.coding.system" />
      <min value="1" />
    </element>
    <element id="PractitionerRole.code.coding.code">
      <path value="PractitionerRole.code.coding.code" />
      <min value="1" />
    </element>
    <element id="PractitionerRole.code.coding.display">
      <path value="PractitionerRole.code.coding.display" />
      <min value="1" />
    </element>
    <element id="PractitionerRole.code.coding:iscoCode">
      <path value="PractitionerRole.code.coding" />
      <sliceName value="iscoCode" />
      <short value="Code as defined by the eHDSIHealthcareProfessionalRole" />
      <definition value="A reference to a code defined by a terminology system.&#xD;&#xA;&#xD;&#xA;CyprusEHR: The code of the practitioner role as defined by the eHDSIHealthcareProfessionalRole value set which is published by the eHDSI and uses the International Standard Classification of Occupations as code system." />
      <max value="1" />
      <patternCoding>
        <system value="urn:oid:2.16.840.1.113883.2.9.6.2.7" />
      </patternCoding>
      <binding>
        <strength value="required" />
        <valueSet value="http://ig.ehealth4u.eu/fhir/ValueSe/cyehr-vs-ehdsihealthcareprofessionalrole" />
      </binding>
    </element>
    <element id="PractitionerRole.code.coding:iscoCode.system">
      <path value="PractitionerRole.code.coding.system" />
      <min value="1" />
    </element>
    <element id="PractitionerRole.code.coding:iscoCode.code">
      <path value="PractitionerRole.code.coding.code" />
      <min value="1" />
    </element>
    <element id="PractitionerRole.code.coding:iscoCode.display">
      <path value="PractitionerRole.code.coding.display" />
      <min value="1" />
    </element>
    <element id="PractitionerRole.specialty">
      <path value="PractitionerRole.specialty" />
      <slicing>
        <discriminator>
          <type value="value" />
          <path value="coding" />
        </discriminator>
        <rules value="open" />
      </slicing>
      <type>
        <code value="CodeableConcept" />
        <profile value="http://hl7.org/fhir/uv/ips/StructureDefinition/CodeableConcept-uv-ips" />
      </type>
    </element>
    <element id="PractitionerRole.specialty.coding.system">
      <path value="PractitionerRole.specialty.coding.system" />
      <min value="1" />
    </element>
    <element id="PractitionerRole.specialty.coding.code">
      <path value="PractitionerRole.specialty.coding.code" />
      <min value="1" />
    </element>
    <element id="PractitionerRole.specialty.coding.display">
      <path value="PractitionerRole.specialty.coding.display" />
      <min value="1" />
    </element>
    <element id="PractitionerRole.specialty:medicalSpecialty">
      <path value="PractitionerRole.specialty" />
      <sliceName value="medicalSpecialty" />
      <short value="The licensed specialties and sub-specialties of the practitioner" />
      <definition value="Specific specialty of the practitioner.&#xD;&#xA;&#xD;&#xA;CyprusEHR: The specialties and the sub-specialties that are included in the practicing license of a medical doctor. The doctor is allowed to practice only these specialties and sub-specialties in the Republic of Cyprus." />
      <binding>
        <strength value="required" />
      </binding>
    </element>
    <element id="PractitionerRole.specialty:medicalSpecialty.coding">
      <path value="PractitionerRole.specialty.coding" />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="PractitionerRole.specialty:medicalSpecialty.coding.system">
      <path value="PractitionerRole.specialty.coding.system" />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="PractitionerRole.specialty:medicalSpecialty.coding.code">
      <path value="PractitionerRole.specialty.coding.code" />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="PractitionerRole.specialty:medicalSpecialty.coding.display">
      <path value="PractitionerRole.specialty.coding.display" />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="PractitionerRole.specialty:nurseSpecialty">
      <path value="PractitionerRole.specialty" />
      <sliceName value="nurseSpecialty" />
      <short value="The licensed nursing categories of the practitioner" />
      <definition value="Specific specialty of the practitioner.&#xD;&#xA;&#xD;&#xA;CyprusEHR: The specialties and the sub-specialties that are included in the practicing license of a nurse. The nurse is allowed to practice only these specialties in the Republic of Cyprus." />
      <max value="3" />
      <binding>
        <strength value="required" />
        <description value="The categories of the nurses in the Republic of Cyprus" />
        <valueSet value="http://ig.ehealth4u.eu/fhir/ValueSet/cyehr-vs-nursingcategories" />
      </binding>
    </element>
    <element id="PractitionerRole.specialty:nurseSpecialty.coding">
      <path value="PractitionerRole.specialty.coding" />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="PractitionerRole.specialty:nurseSpecialty.coding.system">
      <path value="PractitionerRole.specialty.coding.system" />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="PractitionerRole.specialty:nurseSpecialty.coding.code">
      <path value="PractitionerRole.specialty.coding.code" />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="PractitionerRole.specialty:nurseSpecialty.coding.display">
      <path value="PractitionerRole.specialty.coding.display" />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="PractitionerRole.location">
      <path value="PractitionerRole.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="PractitionerRole.location.reference">
      <path value="PractitionerRole.location.reference" />
      <min value="1" />
    </element>
    <element id="PractitionerRole.healthcareService.reference">
      <path value="PractitionerRole.healthcareService.reference" />
      <min value="1" />
    </element>
    <element id="PractitionerRole.telecom.system">
      <path value="PractitionerRole.telecom.system" />
      <mustSupport value="true" />
    </element>
    <element id="PractitionerRole.telecom.value">
      <path value="PractitionerRole.telecom.value" />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="PractitionerRole.telecom.use">
      <path value="PractitionerRole.telecom.use" />
      <mustSupport value="true" />
    </element>
    <element id="PractitionerRole.endpoint.reference">
      <path value="PractitionerRole.endpoint.reference" />
      <min value="1" />
    </element>
  </differential>
</StructureDefinition>