{
  "resourceType": "StructureDefinition",
  "id": "appointmenttriggeredcommunicationtemplate-profile",
  "url": "http://fhir.xt.dev/StructureDefinition/AppointmentTriggeredCommunicationTemplate",
  "version": "2.1.2",
  "name": "AppointmentTriggeredCommunicationTemplate",
  "status": "active",
  "experimental": false,
  "date": "2026-05-20T11:53:26.2350821+00:00",
  "publisher": "x-tention Informationstechnologie GmbH",
  "contact": [
    {
      "telecom": [
        {
          "system": "email",
          "value": "fhir.profiling@x-tention.com",
          "use": "work"
        }
      ]
    }
  ],
  "description": "The template 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. This type of communication template is triggered by an Appointment.",
  "copyright": "x-tention Informationstechnologie GmbH",
  "fhirVersion": "4.0.1",
  "kind": "resource",
  "abstract": false,
  "type": "CommunicationRequest",
  "baseDefinition": "http://fhir.xt.dev/StructureDefinition/BaseCommunicationTemplate",
  "derivation": "constraint",
  "differential": {
    "element": [
      {
        "id": "CommunicationRequest.basedOn",
        "path": "CommunicationRequest.basedOn",
        "slicing": {
          "discriminator": [
            {
              "type": "value",
              "path": "type"
            },
            {
              "type": "value",
              "path": "identifier.type.coding.system"
            },
            {
              "type": "value",
              "path": "identifier.type.coding.code"
            }
          ],
          "rules": "closed"
        },
        "min": 1,
        "type": [
          {
            "code": "Reference",
            "aggregation": [
              "referenced"
            ]
          }
        ]
      },
      {
        "id": "CommunicationRequest.basedOn:bookableHealthcareService",
        "path": "CommunicationRequest.basedOn",
        "sliceName": "bookableHealthcareService",
        "sliceIsConstraining": false,
        "short": "Reference to specific HealthcareService",
        "definition": "Filters which kind of Appointments trigger the communication."
      },
      {
        "id": "CommunicationRequest.basedOn:bookableHealthcareService.type",
        "path": "CommunicationRequest.basedOn.type",
        "min": 1,
        "fixedUri": "HealthcareService"
      },
      {
        "id": "CommunicationRequest.basedOn:bookableHealthcareService.identifier",
        "path": "CommunicationRequest.basedOn.identifier",
        "min": 1
      },
      {
        "id": "CommunicationRequest.basedOn:bookableHealthcareService.identifier.type",
        "path": "CommunicationRequest.basedOn.identifier.type",
        "min": 1
      },
      {
        "id": "CommunicationRequest.basedOn:bookableHealthcareService.identifier.type.coding",
        "path": "CommunicationRequest.basedOn.identifier.type.coding",
        "min": 1,
        "max": "1"
      },
      {
        "id": "CommunicationRequest.basedOn:bookableHealthcareService.identifier.type.coding.system",
        "path": "CommunicationRequest.basedOn.identifier.type.coding.system",
        "min": 1,
        "fixedUri": "http://fhir.xt.dev/CodeSystem/IdentifierType"
      },
      {
        "id": "CommunicationRequest.basedOn:bookableHealthcareService.identifier.type.coding.version",
        "path": "CommunicationRequest.basedOn.identifier.type.coding.version",
        "max": "0"
      },
      {
        "id": "CommunicationRequest.basedOn:bookableHealthcareService.identifier.type.coding.code",
        "path": "CommunicationRequest.basedOn.identifier.type.coding.code",
        "min": 1,
        "fixedCode": "BHSI"
      },
      {
        "id": "CommunicationRequest.basedOn:bookableHealthcareService.identifier.type.coding.userSelected",
        "path": "CommunicationRequest.basedOn.identifier.type.coding.userSelected",
        "max": "0"
      },
      {
        "id": "CommunicationRequest.basedOn:bookableHealthcareService.identifier.system",
        "path": "CommunicationRequest.basedOn.identifier.system",
        "min": 1
      },
      {
        "id": "CommunicationRequest.basedOn:bookableHealthcareService.identifier.value",
        "path": "CommunicationRequest.basedOn.identifier.value",
        "min": 1
      },
      {
        "id": "CommunicationRequest.basedOn:bookableHealthcareService.identifier.period",
        "path": "CommunicationRequest.basedOn.identifier.period",
        "max": "0"
      },
      {
        "id": "CommunicationRequest.basedOn:searchableHealthcareService",
        "path": "CommunicationRequest.basedOn",
        "sliceName": "searchableHealthcareService",
        "sliceIsConstraining": false,
        "short": "Reference to general HealthcareService",
        "definition": "Filters which kind of Appointments trigger the communication."
      },
      {
        "id": "CommunicationRequest.basedOn:searchableHealthcareService.type",
        "path": "CommunicationRequest.basedOn.type",
        "min": 1,
        "fixedUri": "HealthcareService"
      },
      {
        "id": "CommunicationRequest.basedOn:searchableHealthcareService.identifier",
        "path": "CommunicationRequest.basedOn.identifier",
        "min": 1
      },
      {
        "id": "CommunicationRequest.basedOn:searchableHealthcareService.identifier.type",
        "path": "CommunicationRequest.basedOn.identifier.type",
        "min": 1
      },
      {
        "id": "CommunicationRequest.basedOn:searchableHealthcareService.identifier.type.coding",
        "path": "CommunicationRequest.basedOn.identifier.type.coding",
        "min": 1,
        "max": "1"
      },
      {
        "id": "CommunicationRequest.basedOn:searchableHealthcareService.identifier.type.coding.system",
        "path": "CommunicationRequest.basedOn.identifier.type.coding.system",
        "min": 1,
        "fixedUri": "http://fhir.xt.dev/CodeSystem/IdentifierType"
      },
      {
        "id": "CommunicationRequest.basedOn:searchableHealthcareService.identifier.type.coding.version",
        "path": "CommunicationRequest.basedOn.identifier.type.coding.version",
        "max": "0"
      },
      {
        "id": "CommunicationRequest.basedOn:searchableHealthcareService.identifier.type.coding.code",
        "path": "CommunicationRequest.basedOn.identifier.type.coding.code",
        "min": 1,
        "fixedCode": "SHSI"
      },
      {
        "id": "CommunicationRequest.basedOn:searchableHealthcareService.identifier.type.coding.userSelected",
        "path": "CommunicationRequest.basedOn.identifier.type.coding.userSelected",
        "max": "0"
      },
      {
        "id": "CommunicationRequest.basedOn:searchableHealthcareService.identifier.system",
        "path": "CommunicationRequest.basedOn.identifier.system",
        "min": 1
      },
      {
        "id": "CommunicationRequest.basedOn:searchableHealthcareService.identifier.value",
        "path": "CommunicationRequest.basedOn.identifier.value",
        "min": 1
      },
      {
        "id": "CommunicationRequest.basedOn:searchableHealthcareService.identifier.period",
        "path": "CommunicationRequest.basedOn.identifier.period",
        "max": "0"
      },
      {
        "id": "CommunicationRequest.category.coding.system",
        "path": "CommunicationRequest.category.coding.system",
        "fixedUri": "http://fhir.xt.dev/CodeSystem/CommunicationTemplateCategory"
      },
      {
        "id": "CommunicationRequest.category.coding.code",
        "path": "CommunicationRequest.category.coding.code",
        "short": "AppointmentBooking Type",
        "definition": "PortalAppointmentBooking or HospitalAppointmentBooking, verified by constraint",
        "constraint": [
          {
            "key": "at-commtemplate-2",
            "severity": "error",
            "human": "The category must be one of the supported appointment types",
            "expression": "$this.exists() and ($this = 'PortalAppointmentBooking' or $this = 'HospitalAppointmentBooking')"
          }
        ]
      }
    ]
  }
}