{
  "resourceType": "StructureDefinition",
  "id": "diaryentry-v1-profile",
  "url": "http://fhir.xt.dev/StructureDefinition/DiaryEntryV1",
  "version": "0.0.2",
  "name": "DiaryEntryV1",
  "status": "draft",
  "date": "2026-04-17T11:55:00+00:00",
  "publisher": "x-tention Informationstechnologie GmbH",
  "contact": [
    {
      "telecom": [
        {
          "system": "email",
          "value": "fhir.profiling@x-tention.com",
          "use": "work"
        }
      ]
    }
  ],
  "description": "A single entry in an electronic patient diary. This could e.g. be used for tracking pain levels during treatment. Each Observation is a statement by a patient (or representative) concerning their current mental or physical state.",
  "copyright": "x-tention Informationstechnologie GmbH",
  "fhirVersion": "4.0.1",
  "kind": "resource",
  "abstract": false,
  "type": "Observation",
  "baseDefinition": "http://hl7.org/fhir/StructureDefinition/Observation",
  "derivation": "constraint",
  "differential": {
    "element": [
      {
        "id": "Observation.text",
        "path": "Observation.text",
        "slicing": {
          "discriminator": [
            {
              "type": "value",
              "path": "status"
            }
          ],
          "rules": "open"
        },
        "short": "Formatted diary entry content",
        "definition": "The content of the diary entry must be stored as the narrative"
      },
      {
        "id": "Observation.text:formattedContent",
        "path": "Observation.text",
        "sliceName": "formattedContent"
      },
      {
        "id": "Observation.text:formattedContent.status",
        "path": "Observation.text.status",
        "fixedCode": "additional"
      },
      {
        "id": "Observation.text:formattedContent.div",
        "path": "Observation.text.div",
        "short": "Formatted Content",
        "definition": "The actual narrative content of the DiaryEntry, using a stripped down version of XHTML. This must always be wrapped in a div element."
      },
      {
        "id": "Observation.status",
        "path": "Observation.status",
        "short": "preliminary | final"
      },
      {
        "id": "Observation.category",
        "path": "Observation.category",
        "slicing": {
          "discriminator": [
            {
              "type": "value",
              "path": "coding.system"
            },
            {
              "type": "value",
              "path": "coding.code"
            }
          ],
          "rules": "open"
        }
      },
      {
        "id": "Observation.category:simpleHealthStatus",
        "path": "Observation.category",
        "sliceName": "simpleHealthStatus"
      },
      {
        "id": "Observation.category:simpleHealthStatus.coding",
        "path": "Observation.category.coding",
        "min": 1,
        "max": "1"
      },
      {
        "id": "Observation.category:simpleHealthStatus.coding.system",
        "path": "Observation.category.coding.system",
        "min": 1,
        "fixedUri": "http://fhir.xt.dev/CodeSystem/SimpleHealthStatus\","
      },
      {
        "id": "Observation.category:simpleHealthStatus.coding.code",
        "path": "Observation.category.coding.code",
        "min": 1
      },
      {
        "id": "Observation.code.coding",
        "path": "Observation.code.coding",
        "min": 1,
        "max": "1"
      },
      {
        "id": "Observation.code.coding.system",
        "path": "Observation.code.coding.system",
        "min": 1,
        "fixedUri": "http://loinc.org"
      },
      {
        "id": "Observation.code.coding.version",
        "path": "Observation.code.coding.version",
        "max": "0"
      },
      {
        "id": "Observation.code.coding.code",
        "path": "Observation.code.coding.code",
        "min": 1,
        "fixedCode": "66318-7"
      },
      {
        "id": "Observation.code.coding.display",
        "path": "Observation.code.coding.display",
        "fixedString": "Diary completed"
      },
      {
        "id": "Observation.code.coding.userSelected",
        "path": "Observation.code.coding.userSelected",
        "max": "0"
      },
      {
        "id": "Observation.code.text",
        "path": "Observation.code.text",
        "max": "0"
      },
      {
        "id": "Observation.subject",
        "path": "Observation.subject",
        "min": 1,
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "http://hl7.org/fhir/StructureDefinition/Patient"
            ]
          }
        ]
      },
      {
        "id": "Observation.subject.reference",
        "path": "Observation.subject.reference",
        "min": 1
      },
      {
        "id": "Observation.effective[x]",
        "path": "Observation.effective[x]",
        "min": 1,
        "type": [
          {
            "code": "dateTime"
          }
        ]
      },
      {
        "id": "Observation.issued",
        "path": "Observation.issued",
        "min": 1
      },
      {
        "id": "Observation.performer",
        "path": "Observation.performer",
        "min": 1,
        "max": "1",
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "http://hl7.org/fhir/StructureDefinition/Patient",
              "http://hl7.org/fhir/StructureDefinition/RelatedPerson"
            ],
            "aggregation": [
              "referenced"
            ]
          }
        ]
      },
      {
        "id": "Observation.performer.reference",
        "path": "Observation.performer.reference",
        "min": 1
      },
      {
        "id": "Observation.value[x]",
        "path": "Observation.value[x]",
        "min": 1,
        "type": [
          {
            "code": "string"
          }
        ]
      },
      {
        "id": "Observation.note",
        "path": "Observation.note",
        "min": 1,
        "max": "1"
      },
      {
        "id": "Observation.note.author[x]",
        "path": "Observation.note.author[x]",
        "max": "0"
      },
      {
        "id": "Observation.note.time",
        "path": "Observation.note.time",
        "max": "0"
      },
      {
        "id": "Observation.note.text",
        "path": "Observation.note.text",
        "short": "Plain text entry title",
        "definition": "Must not use any formatting, despite the markdown data type."
      }
    ]
  }
}