<StructureDefinition xmlns="http://hl7.org/fhir">
  <id value="ca-on-pubsub-group" />
  <url value="http://ontariohealth.ca/fhir/ehr/StructureDefinition/profile-PubSubGroup" />
  <version value="1.0.3" />
  <name value="OntarioPubSubGroup" />
  <title value="Ontario Health Publish-Subscribe Group Profile" />
  <status value="draft" />
  <publisher value="Ontario Health" />
  <contact>
    <name value="Ontario Health" />
    <telecom>
      <system value="url" />
      <value value="https://www.ontariohealth.ca" />
    </telecom>
  </contact>
  <description value="A profile of the Group resource for publish-subscribe mechanisms within Ontario Health. It requires at least one member and constrains members to be references to CA Core Patient or CA Core Practitioner profiles." />
  <fhirVersion value="4.0.1" />
  <kind value="resource" />
  <abstract value="false" />
  <type value="Group" />
  <baseDefinition value="http://hl7.org/fhir/StructureDefinition/Group" />
  <derivation value="constraint" />
  <differential>
    <element id="Group.identifier">
      <path value="Group.identifier" />
      <short value="Mandatory, globally unique business identifier for the group (Must Support)" />
      <definition value="A mandatory, globally unique business identifier for this group (e.g., a patient list), assigned by the EMR instance. The EMR Instance SHALL ensure this identifier is globally unique across all groups it manages and SHALL use the same Group.identifier for subsequent updates of the same conceptual list to ensure stability. This element is marked as Must Support, meaning systems SHALL be capable of populating and processing it." />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="Group.type">
      <path value="Group.type" />
      <short value="Type of group: person or practitioner (Must Support)" />
      <definition value="Declares the type of resources that are members of this group. This profile mandates that the type must be either 'person' (if members are Patients) or 'practitioner' (if members are Practitioners). This element is marked as Must Support. The cardinality of Group.type is 1..1 (inherited from base)." />
      <constraint>
        <key value="pubsub-group-type-person-practitioner" />
        <severity value="error" />
        <human value="Group.type must be 'person' or 'practitioner'." />
        <expression value="type = 'person' or type = 'practitioner'" />
        <source value="http://ontariohealth.ca/fhir/StructureDefinition/ca-on-pubsub-group" />
      </constraint>
      <mustSupport value="true" />
      <binding>
        <strength value="required" />
        <description value="The type of group members, constrained to person or practitioner by this profile." />
        <valueSet value="http://hl7.org/fhir/ValueSet/group-type" />
      </binding>
    </element>
    <element id="Group.member">
      <path value="Group.member" />
      <short value="Identifies the resource instances that are members of the group." />
      <definition value="Identifies the resource instances that are members of the group. This profile requires at least one member." />
      <min value="1" />
    </element>
    <element id="Group.member.entity">
      <path value="Group.member.entity" />
      <short value="A reference to the CA Core Patient or CA Core Practitioner that is a member of this group" />
      <definition value="A reference to a resource conforming to the CA Core Patient profile or CA Core Practitioner profile that is a member of this group." />
      <type>
        <code value="Reference" />
        <targetProfile value="http://fhir.infoway-inforoute.ca/cacore/StructureDefinition/patient-ca-core" />
        <targetProfile value="http://fhir.infoway-inforoute.ca/cacore/StructureDefinition/practitioner-ca-core" />
      </type>
    </element>
  </differential>
</StructureDefinition>