<StructureDefinition xmlns="http://hl7.org/fhir">
  <id value="matrixconversation-profile" />
  <url value="http://fhir.xt.dev/StructureDefinition/MatrixConversation" />
  <version value="1.0.1" />
  <name value="MatrixConversation" />
  <status value="draft" />
  <date value="2024-10-10T07:29:31.6535318+00:00" />
  <publisher value="x-tention Informationstechnologie GmbH" />
  <contact>
    <telecom>
      <system value="email" />
      <value value="fhir.profiling@x-tention.com" />
      <use value="work" />
    </telecom>
  </contact>
  <description value="A record of a chat conversation using the Matrix protocol between two or more participants." />
  <copyright value="x-tention Informationstechnologie GmbH" />
  <fhirVersion value="4.0.1" />
  <kind value="resource" />
  <abstract value="false" />
  <type value="Communication" />
  <baseDefinition value="http://hl7.org/fhir/StructureDefinition/Communication" />
  <derivation value="constraint" />
  <differential>
    <element id="Communication.identifier">
      <path value="Communication.identifier" />
      <slicing>
        <discriminator>
          <type value="value" />
          <path value="type.coding.system" />
        </discriminator>
        <discriminator>
          <type value="value" />
          <path value="type.coding.code" />
        </discriminator>
        <rules value="open" />
      </slicing>
    </element>
    <element id="Communication.identifier:roomId">
      <path value="Communication.identifier" />
      <sliceName value="roomId" />
      <short value="Matrix Chat Room Identifier" />
      <max value="1" />
    </element>
    <element id="Communication.identifier:roomId.type">
      <path value="Communication.identifier.type" />
      <min value="1" />
    </element>
    <element id="Communication.identifier:roomId.type.coding">
      <path value="Communication.identifier.type.coding" />
      <min value="1" />
      <max value="1" />
    </element>
    <element id="Communication.identifier:roomId.type.coding.system">
      <path value="Communication.identifier.type.coding.system" />
      <min value="1" />
      <fixedUri value="http://fhir.xt.dev/CodeSystem/IdentifierType" />
    </element>
    <element id="Communication.identifier:roomId.type.coding.code">
      <path value="Communication.identifier.type.coding.code" />
      <min value="1" />
      <fixedCode value="MXRM" />
    </element>
    <element id="Communication.identifier:roomId.system">
      <path value="Communication.identifier.system" />
      <min value="1" />
      <fixedUri value="urn:ietf:rfc:3986" />
    </element>
    <element id="Communication.identifier:roomId.value">
      <path value="Communication.identifier.value" />
      <short value="roomID as a matrix URI" />
      <definition value="The roomId in the matrix URI format, starting with &quot;matrix:roomid/&quot; followed by the roomID, then a colon and then the server name. A room with roomID 12345 at server &quot;matrix.example.org&quot; would result in &quot;matrix:roomid/12345:matrix.example.org&quot;." />
      <min value="1" />
    </element>
    <element id="Communication.basedOn">
      <path value="Communication.basedOn" />
      <min value="1" />
      <max value="1" />
      <type>
        <code value="Reference" />
        <targetProfile value="http://hl7.org/fhir/StructureDefinition/Task" />
        <aggregation value="referenced" />
      </type>
    </element>
    <element id="Communication.basedOn.reference">
      <path value="Communication.basedOn.reference" />
      <min value="1" />
    </element>
    <element id="Communication.category.coding">
      <path value="Communication.category.coding" />
      <slicing>
        <discriminator>
          <type value="value" />
          <path value="system" />
        </discriminator>
        <discriminator>
          <type value="value" />
          <path value="code" />
        </discriminator>
        <rules value="open" />
      </slicing>
    </element>
    <element id="Communication.category.coding:systemCommunicationCategory">
      <path value="Communication.category.coding" />
      <sliceName value="systemCommunicationCategory" />
      <min value="1" />
      <max value="1" />
    </element>
    <element id="Communication.category.coding:systemCommunicationCategory.system">
      <path value="Communication.category.coding.system" />
      <min value="1" />
      <fixedUri value="http://fhir.xt.dev/CodeSystem/SystemCommunicationCategories" />
    </element>
    <element id="Communication.category.coding:systemCommunicationCategory.code">
      <path value="Communication.category.coding.code" />
      <min value="1" />
      <fixedCode value="facilitated-matrix" />
    </element>
    <element id="Communication.medium">
      <path value="Communication.medium" />
      <min value="1" />
      <max value="1" />
    </element>
    <element id="Communication.medium.coding">
      <path value="Communication.medium.coding" />
      <min value="1" />
      <max value="1" />
    </element>
    <element id="Communication.medium.coding.system">
      <path value="Communication.medium.coding.system" />
      <min value="1" />
      <fixedUri value="http://fhir.xt.dev/CodeSystem/ConnectionTypes" />
    </element>
    <element id="Communication.medium.coding.code">
      <path value="Communication.medium.coding.code" />
      <min value="1" />
      <fixedCode value="matrix" />
    </element>
    <element id="Communication.subject">
      <path value="Communication.subject" />
      <min value="1" />
      <type>
        <code value="Reference" />
        <targetProfile value="http://hl7.org/fhir/StructureDefinition/Patient" />
        <aggregation value="referenced" />
      </type>
    </element>
    <element id="Communication.subject.reference">
      <path value="Communication.subject.reference" />
      <min value="1" />
    </element>
    <element id="Communication.topic">
      <path value="Communication.topic" />
      <min value="1" />
    </element>
    <element id="Communication.topic.text">
      <path value="Communication.topic.text" />
      <min value="1" />
    </element>
    <element id="Communication.about">
      <path value="Communication.about" />
      <short value="Focus of the conversation" />
      <max value="1" />
      <type>
        <code value="Reference" />
        <targetProfile value="http://hl7.org/fhir/StructureDefinition/Appointment" />
        <aggregation value="referenced" />
      </type>
    </element>
    <element id="Communication.about.reference">
      <path value="Communication.about.reference" />
      <min value="1" />
    </element>
    <element id="Communication.recipient">
      <path value="Communication.recipient" />
      <short value="Chat Room Participants" />
      <min value="1" />
    </element>
  </differential>
</StructureDefinition>