<StructureDefinition xmlns="http://hl7.org/fhir">
  <id value="ca-on-pubsub-group" />
  <url value="http://ontariohealth.ca/fhir/pubsub/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.extension">
      <path value="Group.extension" />
      <slicing>
        <discriminator>
          <type value="value" />
          <path value="url" />
        </discriminator>
        <ordered value="false" />
        <rules value="open" />
      </slicing>
    </element>
    <element id="Group.extension:managingEntity">
      <path value="Group.extension" />
      <sliceName value="managingEntity" />
      <short value="Entity managing the subscription" />
      <definition value="The entity responsible for managing the subscription, represented as a Device." />
      <min value="1" />
      <max value="1" />
      <type>
        <code value="Extension" />
        <profile value="http://ontariohealth.ca/fhir/pubsub/StructureDefinition/ext-subscriptionManagingEntity" />
      </type>
      <mustSupport value="true" />
    </element>
    <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 managing 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)." />
      <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://ontariohealth.ca/fhir/pubsub/ValueSet/group-type" />
      </binding>
    </element>
    <element id="Group.name">
      <path value="Group.name" />
      <short value="Mandatory human-readable name for this group (Must Support)" />
      <definition value="A human-readable name for this group, for display purposes. This element is mandatory and must be supported." />
      <min value="1" />
      <max value="1" />
      <mustSupport value="true" />
    </element>
    <element id="Group.managingEntity">
      <path value="Group.managingEntity" />
      <short value="Do not use for Device reference" />
      <definition value="The standard managingEntity element is optional in this profile. If referencing a system use the 'managingEntity' extension instead." />
    </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>