{
  "resourceType": "StructureDefinition",
  "id": "patientexercise-profile",
  "url": "http://fhir.xt.dev/StructureDefinition/PatientExercise",
  "version": "0.0.2",
  "name": "PatientExercise",
  "status": "draft",
  "date": "2026-07-20T16:14:48+00:00",
  "publisher": "x-tention Informationstechnologie GmbH",
  "contact": [
    {
      "telecom": [
        {
          "system": "email",
          "value": "fhir.profiling@x-tention.com",
          "use": "work"
        }
      ]
    }
  ],
  "description": "This procedure is the documentation of a patient performing an exercise (or planning to). The exercise may be physical (e.g. push-ups) or mental (e.g. meditation).",
  "copyright": "x-tention Informationstechnologie GmbH",
  "fhirVersion": "4.0.1",
  "kind": "resource",
  "abstract": false,
  "type": "Procedure",
  "baseDefinition": "http://hl7.org/fhir/StructureDefinition/Procedure",
  "derivation": "constraint",
  "differential": {
    "element": [
      {
        "id": "Procedure.meta",
        "path": "Procedure.meta"
      },
      {
        "id": "Procedure.meta.tag",
        "path": "Procedure.meta.tag",
        "definition": "Tags applied to this resource. May e.g. be used to identify the emotional context of the exercise (Zuordnung zu \"Gefühle\")."
      },
      {
        "id": "Procedure.instantiatesUri",
        "path": "Procedure.instantiatesUri",
        "definition": "The URL pointing to the details in the CMS describing how to perform the exercise.",
        "max": "1"
      },
      {
        "id": "Procedure.partOf",
        "path": "Procedure.partOf",
        "max": "0"
      },
      {
        "id": "Procedure.status",
        "path": "Procedure.status",
        "short": "preparation | completed",
        "definition": "A code specifying the state of the procedure. For a patient exercise, only \"preparation\" and \"completed\" are supported.",
        "constraint": [
          {
            "key": "perpatex-1",
            "severity": "error",
            "human": "The status must be one of preparation, completed",
            "expression": "$this.exists() and ($this = 'preparation' or $this = 'completed')"
          }
        ]
      },
      {
        "id": "Procedure.category",
        "path": "Procedure.category",
        "min": 1
      },
      {
        "id": "Procedure.category.coding",
        "path": "Procedure.category.coding",
        "min": 1,
        "max": "1"
      },
      {
        "id": "Procedure.category.coding.system",
        "path": "Procedure.category.coding.system",
        "min": 1,
        "fixedUri": "http://fhir.xt.dev/CodeSystem/TaskTypes"
      },
      {
        "id": "Procedure.category.coding.version",
        "path": "Procedure.category.coding.version",
        "max": "0"
      },
      {
        "id": "Procedure.category.coding.code",
        "path": "Procedure.category.coding.code",
        "min": 1,
        "fixedCode": "patexercise"
      },
      {
        "id": "Procedure.category.coding.userSelected",
        "path": "Procedure.category.coding.userSelected",
        "max": "0"
      },
      {
        "id": "Procedure.category.text",
        "path": "Procedure.category.text",
        "max": "0"
      },
      {
        "id": "Procedure.code",
        "path": "Procedure.code",
        "short": "Exercise Topic",
        "definition": "A code identifying the topic of the patient exercise that was performed (\"Themenbereich\").",
        "min": 1
      },
      {
        "id": "Procedure.code.coding",
        "path": "Procedure.code.coding",
        "min": 1,
        "max": "1"
      },
      {
        "id": "Procedure.code.coding.system",
        "path": "Procedure.code.coding.system",
        "min": 1
      },
      {
        "id": "Procedure.code.coding.code",
        "path": "Procedure.code.coding.code",
        "min": 1
      },
      {
        "id": "Procedure.subject",
        "path": "Procedure.subject",
        "definition": "Literal reference (Patient/abcdef) pointing to the patient resource.",
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "http://hl7.org/fhir/StructureDefinition/Patient"
            ],
            "aggregation": [
              "referenced"
            ]
          }
        ]
      },
      {
        "id": "Procedure.subject.reference",
        "path": "Procedure.subject.reference",
        "min": 1
      },
      {
        "id": "Procedure.subject.type",
        "path": "Procedure.subject.type",
        "fixedUri": "Patient"
      },
      {
        "id": "Procedure.performed[x]",
        "path": "Procedure.performed[x]",
        "definition": "Date and time when the excerise was completed.",
        "type": [
          {
            "code": "dateTime"
          }
        ]
      },
      {
        "id": "Procedure.recorder",
        "path": "Procedure.recorder",
        "definition": "Individual who recorded the record and takes responsibility for its content. May be used in future to allow professionals or representatives to document the patient's exercise for them."
      },
      {
        "id": "Procedure.asserter",
        "path": "Procedure.asserter",
        "max": "0"
      },
      {
        "id": "Procedure.performer",
        "path": "Procedure.performer",
        "min": 1,
        "max": "1"
      },
      {
        "id": "Procedure.performer.function",
        "path": "Procedure.performer.function",
        "max": "0"
      },
      {
        "id": "Procedure.performer.actor",
        "path": "Procedure.performer.actor",
        "short": "The reference to the performing patient",
        "definition": "Literal reference (Patient/abcdef) pointing to the patient resource. A PatientExercise is always performed by the patient themself.",
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "http://hl7.org/fhir/StructureDefinition/Patient"
            ],
            "aggregation": [
              "referenced"
            ]
          }
        ]
      },
      {
        "id": "Procedure.performer.actor.reference",
        "path": "Procedure.performer.actor.reference",
        "min": 1
      },
      {
        "id": "Procedure.performer.actor.type",
        "path": "Procedure.performer.actor.type",
        "fixedUri": "Patient"
      },
      {
        "id": "Procedure.bodySite",
        "path": "Procedure.bodySite",
        "max": "0"
      },
      {
        "id": "Procedure.outcome",
        "path": "Procedure.outcome",
        "definition": "Was the exercise performed succesfully? Must be documented if the status is completed.",
        "binding": {
          "strength": "required"
        }
      },
      {
        "id": "Procedure.outcome.coding",
        "path": "Procedure.outcome.coding",
        "definition": "For succesful execution, use \"385669000\". If execution was attempted, but could not be performed, use \"385671000\". If parts of the exercise were performed succesfully, use \"385670004\".",
        "min": 1,
        "max": "1"
      },
      {
        "id": "Procedure.outcome.text",
        "path": "Procedure.outcome.text",
        "short": "User Explanation of Outcome",
        "definition": "Free text explanation by the patient how the exercise outcome can be interpreted. For a partial success, e.g. how many of the prescribed repetitions were executed.\r\nNote that complications that lead to a limited execution should be documented as complications instead."
      },
      {
        "id": "Procedure.complication",
        "path": "Procedure.complication",
        "short": "Complications when performing exercise",
        "definition": "Any complications that occurred when performing the exercise."
      },
      {
        "id": "Procedure.complication.coding",
        "path": "Procedure.complication.coding",
        "max": "1"
      },
      {
        "id": "Procedure.followUp",
        "path": "Procedure.followUp",
        "max": "0"
      },
      {
        "id": "Procedure.focalDevice",
        "path": "Procedure.focalDevice",
        "max": "0"
      },
      {
        "id": "Procedure.usedReference",
        "path": "Procedure.usedReference",
        "max": "0"
      },
      {
        "id": "Procedure.usedCode",
        "path": "Procedure.usedCode",
        "max": "0"
      }
    ]
  }
}