{
  "resourceType": "StructureDefinition",
  "id": "basecommunicationtemplate-profile",
  "url": "http://fhir.xt.dev/StructureDefinition/BaseCommunicationTemplate",
  "version": "2.3.1",
  "name": "BaseCommunicationTemplate",
  "status": "active",
  "experimental": false,
  "date": "2026-07-02T14:03:22+00:00",
  "publisher": "x-tention Informationstechnologie GmbH",
  "contact": [
    {
      "telecom": [
        {
          "system": "email",
          "value": "fhir.profiling@x-tention.com",
          "use": "work"
        }
      ]
    }
  ],
  "description": "The abstract base profile for all templates for a planned communication, automatically triggered by changes in data. The communication is usually a structured interaction modeled as a Task, but might also be a more conventional message.",
  "copyright": "x-tention Informationstechnologie GmbH",
  "fhirVersion": "4.0.1",
  "kind": "resource",
  "abstract": true,
  "type": "CommunicationRequest",
  "baseDefinition": "http://hl7.org/fhir/StructureDefinition/CommunicationRequest",
  "derivation": "constraint",
  "differential": {
    "element": [
      {
        "id": "CommunicationRequest.identifier",
        "path": "CommunicationRequest.identifier",
        "slicing": {
          "discriminator": [
            {
              "type": "value",
              "path": "type.coding.system"
            },
            {
              "type": "value",
              "path": "type.coding.code"
            }
          ],
          "rules": "open"
        }
      },
      {
        "id": "CommunicationRequest.identifier:workflowUri",
        "path": "CommunicationRequest.identifier",
        "sliceName": "workflowUri",
        "short": "Workflow URI",
        "max": "1"
      },
      {
        "id": "CommunicationRequest.identifier:workflowUri.type",
        "path": "CommunicationRequest.identifier.type",
        "min": 1
      },
      {
        "id": "CommunicationRequest.identifier:workflowUri.type.coding",
        "path": "CommunicationRequest.identifier.type.coding",
        "min": 1,
        "max": "1"
      },
      {
        "id": "CommunicationRequest.identifier:workflowUri.type.coding.system",
        "path": "CommunicationRequest.identifier.type.coding.system",
        "min": 1,
        "fixedUri": "http://fhir.xt.dev/CodeSystem/IdentifierType"
      },
      {
        "id": "CommunicationRequest.identifier:workflowUri.type.coding.version",
        "path": "CommunicationRequest.identifier.type.coding.version",
        "max": "0"
      },
      {
        "id": "CommunicationRequest.identifier:workflowUri.type.coding.code",
        "path": "CommunicationRequest.identifier.type.coding.code",
        "min": 1,
        "fixedCode": "WRKU"
      },
      {
        "id": "CommunicationRequest.identifier:workflowUri.type.coding.userSelected",
        "path": "CommunicationRequest.identifier.type.coding.userSelected",
        "max": "0"
      },
      {
        "id": "CommunicationRequest.identifier:workflowUri.system",
        "path": "CommunicationRequest.identifier.system",
        "min": 1,
        "fixedUri": "urn:ietf:rfc:3986"
      },
      {
        "id": "CommunicationRequest.identifier:workflowUri.value",
        "path": "CommunicationRequest.identifier.value",
        "short": "Workflow URI",
        "definition": "Identifier of the workflow. This will be associated with the generated tasks through the Task.instantiatesUri, allowing e.g. automatic follow-up tasks. All valid URIs are accepted, URLs and URNs are preferred.",
        "min": 1
      },
      {
        "id": "CommunicationRequest.identifier:workflowUri.period",
        "path": "CommunicationRequest.identifier.period",
        "max": "0"
      },
      {
        "id": "CommunicationRequest.basedOn",
        "path": "CommunicationRequest.basedOn",
        "short": "Filter for triggers"
      },
      {
        "id": "CommunicationRequest.groupIdentifier",
        "path": "CommunicationRequest.groupIdentifier",
        "short": "Engagement Plan Identifier",
        "definition": "A shared identifier common to all CommunicationTemplates that belong to the same Engagement Plan.",
        "min": 1
      },
      {
        "id": "CommunicationRequest.groupIdentifier.system",
        "path": "CommunicationRequest.groupIdentifier.system",
        "min": 1,
        "fixedUri": "urn:ietf:rfc:3986"
      },
      {
        "id": "CommunicationRequest.groupIdentifier.value",
        "path": "CommunicationRequest.groupIdentifier.value",
        "min": 1
      },
      {
        "id": "CommunicationRequest.status",
        "path": "CommunicationRequest.status",
        "short": "active | on-hold | revoked",
        "definition": "The status of this automatization. May be active, on-hold or revoked. Only active resources trigger communications.",
        "constraint": [
          {
            "key": "inv-status-1",
            "severity": "error",
            "human": "The status must be one of revoked, active or on-hold",
            "expression": "$this.exists() and ($this = 'active' or $this = 'revoked' or $this = 'on-hold')"
          }
        ]
      },
      {
        "id": "CommunicationRequest.category",
        "path": "CommunicationRequest.category",
        "short": "Category based on triggering event",
        "min": 1,
        "binding": {
          "strength": "required",
          "valueSet": "http://fhir.xt.dev/ValueSet/CommunicationTemplateCategory"
        }
      },
      {
        "id": "CommunicationRequest.category.coding",
        "path": "CommunicationRequest.category.coding",
        "min": 1,
        "max": "1"
      },
      {
        "id": "CommunicationRequest.category.coding.system",
        "path": "CommunicationRequest.category.coding.system",
        "min": 1
      },
      {
        "id": "CommunicationRequest.category.coding.code",
        "path": "CommunicationRequest.category.coding.code",
        "min": 1
      },
      {
        "id": "CommunicationRequest.medium",
        "path": "CommunicationRequest.medium",
        "short": "Task type or communication protocol",
        "definition": "Different task types, like Consent Tasks, are considered communication mediums just like matrix chats, email or in-app notifications.",
        "min": 1,
        "max": "1"
      },
      {
        "id": "CommunicationRequest.medium.coding",
        "path": "CommunicationRequest.medium.coding",
        "slicing": {
          "discriminator": [
            {
              "type": "value",
              "path": "system"
            }
          ],
          "rules": "open"
        },
        "min": 1
      },
      {
        "id": "CommunicationRequest.medium.coding:taskType",
        "path": "CommunicationRequest.medium.coding",
        "sliceName": "taskType",
        "min": 1,
        "max": "1",
        "binding": {
          "strength": "required",
          "description": "Task Type",
          "valueSet": "http://fhir.xt.dev/ValueSet/PlannedCommunicationMedium"
        }
      },
      {
        "id": "CommunicationRequest.medium.coding:taskType.system",
        "path": "CommunicationRequest.medium.coding.system",
        "min": 1,
        "fixedUri": "http://fhir.xt.dev/CodeSystem/TaskTypes"
      },
      {
        "id": "CommunicationRequest.medium.coding:taskType.code",
        "path": "CommunicationRequest.medium.coding.code",
        "min": 1
      },
      {
        "id": "CommunicationRequest.subject",
        "path": "CommunicationRequest.subject",
        "short": "Group this template applies to",
        "definition": "The group that is the focus of this communication request. The group is identified by a URN identifier. Groups in this context define a potential set of patients that may change at any moment and could e.g. encompass all patients with a user account. If no Group is named, the template applies to all Patients. If a Group is named, the template only applies to patient records that fit the Group definition.",
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "http://hl7.org/fhir/StructureDefinition/Group"
            ]
          }
        ]
      },
      {
        "id": "CommunicationRequest.subject.type",
        "path": "CommunicationRequest.subject.type",
        "min": 1,
        "fixedUri": "Group"
      },
      {
        "id": "CommunicationRequest.subject.identifier",
        "path": "CommunicationRequest.subject.identifier",
        "short": "Reference to a predefined Group URN",
        "min": 1
      },
      {
        "id": "CommunicationRequest.subject.identifier.use",
        "path": "CommunicationRequest.subject.identifier.use",
        "max": "0"
      },
      {
        "id": "CommunicationRequest.subject.identifier.system",
        "path": "CommunicationRequest.subject.identifier.system",
        "min": 1,
        "fixedUri": "urn:ietf:rfc:3986"
      },
      {
        "id": "CommunicationRequest.subject.identifier.value",
        "path": "CommunicationRequest.subject.identifier.value",
        "short": "Predefined Group URN",
        "definition": "Must be one of 'urn:xt:2025:fhir:group:all-patients' or 'urn:xt:2025:fhir:group:patients-with-user-account' or 'urn:xt:2026:fhir:group:patients-with-verified-user-account' or 'urn:xt:2026:fhir:group:patients-with-unverified-user-account'",
        "min": 1,
        "constraint": [
          {
            "key": "commtemplate-1",
            "severity": "error",
            "human": "The group identifier must be on the list of pre-defined group URNs",
            "expression": "$this.exists() and ($this = 'urn:xt:2025:fhir:group:all-patients' or $this = 'urn:xt:2025:fhir:group:patients-with-user-account' or $this = 'urn:xt:2026:fhir:group:patients-with-verified-user-account' or $this = 'urn:xt:2026:fhir:group:patients-with-unverified-user-account')"
          }
        ]
      },
      {
        "id": "CommunicationRequest.subject.identifier.period",
        "path": "CommunicationRequest.subject.identifier.period",
        "max": "0"
      },
      {
        "id": "CommunicationRequest.subject.identifier.assigner",
        "path": "CommunicationRequest.subject.identifier.assigner",
        "max": "0"
      },
      {
        "id": "CommunicationRequest.encounter",
        "path": "CommunicationRequest.encounter",
        "max": "0"
      },
      {
        "id": "CommunicationRequest.payload",
        "path": "CommunicationRequest.payload",
        "slicing": {
          "discriminator": [
            {
              "type": "type",
              "path": "content"
            }
          ],
          "rules": "open"
        }
      },
      {
        "id": "CommunicationRequest.payload:questionnairePayload",
        "path": "CommunicationRequest.payload",
        "sliceName": "questionnairePayload",
        "short": "Questionnaire for Questionnaire Task",
        "max": "1"
      },
      {
        "id": "CommunicationRequest.payload:questionnairePayload.content[x]",
        "path": "CommunicationRequest.payload.content[x]",
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "http://hl7.org/fhir/StructureDefinition/Questionnaire"
            ],
            "aggregation": [
              "referenced"
            ]
          }
        ]
      },
      {
        "id": "CommunicationRequest.payload:questionnairePayload.content[x].identifier",
        "path": "CommunicationRequest.payload.content[x].identifier",
        "max": "0"
      },
      {
        "id": "CommunicationRequest.payload:messageBodyPayload",
        "path": "CommunicationRequest.payload",
        "sliceName": "messageBodyPayload",
        "short": "Task description",
        "min": 1,
        "max": "1"
      },
      {
        "id": "CommunicationRequest.payload:messageBodyPayload.content[x]",
        "path": "CommunicationRequest.payload.content[x]",
        "short": "Message Text",
        "definition": "Text to be used as Task description or Notification body. Plain text using the system's primary language.",
        "type": [
          {
            "code": "string"
          }
        ]
      },
      {
        "id": "CommunicationRequest.payload:informationLinkPayload",
        "path": "CommunicationRequest.payload",
        "sliceName": "informationLinkPayload",
        "short": "Links for Information Tasks"
      },
      {
        "id": "CommunicationRequest.payload:informationLinkPayload.content[x]",
        "path": "CommunicationRequest.payload.content[x]",
        "type": [
          {
            "code": "Attachment"
          }
        ]
      },
      {
        "id": "CommunicationRequest.payload:informationLinkPayload.content[x].contentType",
        "path": "CommunicationRequest.payload.content[x].contentType",
        "max": "0"
      },
      {
        "id": "CommunicationRequest.payload:informationLinkPayload.content[x].data",
        "path": "CommunicationRequest.payload.content[x].data",
        "max": "0"
      },
      {
        "id": "CommunicationRequest.payload:informationLinkPayload.content[x].url",
        "path": "CommunicationRequest.payload.content[x].url",
        "min": 1
      },
      {
        "id": "CommunicationRequest.payload:informationLinkPayload.content[x].size",
        "path": "CommunicationRequest.payload.content[x].size",
        "max": "0"
      },
      {
        "id": "CommunicationRequest.payload:informationLinkPayload.content[x].hash",
        "path": "CommunicationRequest.payload.content[x].hash",
        "max": "0"
      },
      {
        "id": "CommunicationRequest.payload:informationLinkPayload.content[x].title",
        "path": "CommunicationRequest.payload.content[x].title",
        "min": 1
      },
      {
        "id": "CommunicationRequest.payload:informationLinkPayload.content[x].creation",
        "path": "CommunicationRequest.payload.content[x].creation",
        "max": "0"
      },
      {
        "id": "CommunicationRequest.occurrence[x]",
        "path": "CommunicationRequest.occurrence[x]",
        "min": 1,
        "type": [
          {
            "code": "Period"
          }
        ]
      },
      {
        "id": "CommunicationRequest.occurrence[x].extension:startTiming",
        "path": "CommunicationRequest.occurrence[x].extension",
        "sliceName": "startTiming",
        "short": "Communication start",
        "definition": "This describes when when the communication should start, e.g. as Task.restriction.period.start.",
        "max": "1",
        "type": [
          {
            "code": "Extension",
            "profile": [
              "http://fhir.xt.dev/StructureDefinition/StartTiming"
            ]
          }
        ],
        "isModifier": false
      },
      {
        "id": "CommunicationRequest.occurrence[x].extension:dueDateTiming",
        "path": "CommunicationRequest.occurrence[x].extension",
        "sliceName": "dueDateTiming",
        "definition": "This describes when when the communication should be completed by, e.g. as Task.restriction.period.start.",
        "max": "1",
        "type": [
          {
            "code": "Extension",
            "profile": [
              "http://fhir.xt.dev/StructureDefinition/DueDateTiming"
            ]
          }
        ],
        "isModifier": false
      },
      {
        "id": "CommunicationRequest.occurrence[x].start",
        "path": "CommunicationRequest.occurrence[x].start",
        "short": "Applicability Start Date",
        "definition": "Date before which the system shall not create new Communications based on this CommunicationRequest",
        "min": 1
      },
      {
        "id": "CommunicationRequest.occurrence[x].end",
        "path": "CommunicationRequest.occurrence[x].end",
        "short": "Applicability End Date",
        "definition": "Date after which the system shall not create new Communications based on this CommunicationRequest"
      },
      {
        "id": "CommunicationRequest.requester",
        "path": "CommunicationRequest.requester",
        "short": "Requesting Organization",
        "definition": "This will be used as Task.requester for Tasks.",
        "min": 1,
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "http://hl7.org/fhir/StructureDefinition/Organization"
            ],
            "aggregation": [
              "referenced"
            ]
          }
        ]
      },
      {
        "id": "CommunicationRequest.requester.reference",
        "path": "CommunicationRequest.requester.reference",
        "short": "Organization Reference",
        "definition": "Literal reference to the organization"
      },
      {
        "id": "CommunicationRequest.requester.type",
        "path": "CommunicationRequest.requester.type",
        "fixedUri": "Organization"
      },
      {
        "id": "CommunicationRequest.requester.identifier.system",
        "path": "CommunicationRequest.requester.identifier.system",
        "min": 1,
        "fixedUri": "urn:ietf:rfc:3986"
      },
      {
        "id": "CommunicationRequest.requester.identifier.value",
        "path": "CommunicationRequest.requester.identifier.value",
        "short": "Primary Org ID",
        "definition": "URN-encoded primary organization identifier",
        "min": 1
      },
      {
        "id": "CommunicationRequest.requester.identifier.period",
        "path": "CommunicationRequest.requester.identifier.period",
        "max": "0"
      },
      {
        "id": "CommunicationRequest.requester.identifier.assigner",
        "path": "CommunicationRequest.requester.identifier.assigner",
        "max": "0"
      },
      {
        "id": "CommunicationRequest.recipient",
        "path": "CommunicationRequest.recipient",
        "slicing": {
          "discriminator": [
            {
              "type": "value",
              "path": "type"
            }
          ],
          "rules": "closed"
        },
        "short": "Communication target",
        "definition": "The entity (e.g. person, organization, clinical information system, device, group, or care team) which is the intended target of the communication. For Emails and NotificationMessages, this is the recipient, for Tasks the owner and (potentially the performer). Groups act as placeholder for the specific patient. The different patient groups only exist as identifiers (URNs).",
        "max": "1"
      },
      {
        "id": "CommunicationRequest.recipient:targetOrganization",
        "path": "CommunicationRequest.recipient",
        "sliceName": "targetOrganization",
        "max": "1",
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "http://hl7.org/fhir/StructureDefinition/Organization"
            ],
            "aggregation": [
              "referenced"
            ]
          }
        ]
      },
      {
        "id": "CommunicationRequest.recipient:targetOrganization.reference",
        "path": "CommunicationRequest.recipient.reference",
        "short": "Organization Reference",
        "definition": "Literal reference to the organization"
      },
      {
        "id": "CommunicationRequest.recipient:targetOrganization.type",
        "path": "CommunicationRequest.recipient.type",
        "min": 1,
        "fixedUri": "Organization"
      },
      {
        "id": "CommunicationRequest.recipient:targetOrganization.identifier",
        "path": "CommunicationRequest.recipient.identifier",
        "short": "Organization Identifier"
      },
      {
        "id": "CommunicationRequest.recipient:targetOrganization.identifier.system",
        "path": "CommunicationRequest.recipient.identifier.system",
        "min": 1,
        "fixedUri": "urn:ietf:rfc:3986"
      },
      {
        "id": "CommunicationRequest.recipient:targetOrganization.identifier.value",
        "path": "CommunicationRequest.recipient.identifier.value",
        "short": "Primary Org ID",
        "definition": "URN-encoded primary organization identifier",
        "min": 1
      },
      {
        "id": "CommunicationRequest.recipient:targetOrganization.identifier.period",
        "path": "CommunicationRequest.recipient.identifier.period",
        "max": "0"
      },
      {
        "id": "CommunicationRequest.recipient:targetOrganization.identifier.assigner",
        "path": "CommunicationRequest.recipient.identifier.assigner",
        "max": "0"
      },
      {
        "id": "CommunicationRequest.recipient:patientsWithUserAccount",
        "path": "CommunicationRequest.recipient",
        "sliceName": "patientsWithUserAccount",
        "definition": "Patients with a user account include all patients with a verified user account and all patients with a unverified user account.",
        "max": "1",
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "http://hl7.org/fhir/StructureDefinition/Group"
            ]
          }
        ]
      },
      {
        "id": "CommunicationRequest.recipient:patientsWithUserAccount.type",
        "path": "CommunicationRequest.recipient.type",
        "min": 1,
        "fixedUri": "Group"
      },
      {
        "id": "CommunicationRequest.recipient:patientsWithUserAccount.identifier",
        "path": "CommunicationRequest.recipient.identifier",
        "min": 1
      },
      {
        "id": "CommunicationRequest.recipient:patientsWithUserAccount.identifier.system",
        "path": "CommunicationRequest.recipient.identifier.system",
        "min": 1,
        "fixedUri": "urn:ietf:rfc:3986"
      },
      {
        "id": "CommunicationRequest.recipient:patientsWithUserAccount.identifier.value",
        "path": "CommunicationRequest.recipient.identifier.value",
        "short": "Patients with User Account",
        "min": 1,
        "fixedString": "urn:xt:2025:fhir:group:patients-with-user-account"
      },
      {
        "id": "CommunicationRequest.recipient:patientsWithUserAccount.identifier.period",
        "path": "CommunicationRequest.recipient.identifier.period",
        "max": "0"
      },
      {
        "id": "CommunicationRequest.recipient:patientsWithUserAccount.identifier.assigner",
        "path": "CommunicationRequest.recipient.identifier.assigner",
        "max": "0"
      }
    ]
  }
}