PackagesCanonicalsLogsProblems
    Packages
    de.fhir.medication@2.0.0-ballot
    http://ig.fhir.de/igs/medication/StructureDefinition/TimingDgMP
{
  "description": "Beschreibt ein Ereignis, das mehrfach auftreten kann. Zeitpläne werden verwendet, um festzuhalten, wann etwas geplant, erwartet oder angefordert ist. Die häufigste Anwendung ist in Dosierungsanweisungen für Medikamente. Sie werden aber auch für die Planung verschiedener Versorgungsleistungen genutzt und können zur Dokumentation von bereits erfolgten oder laufenden Aktivitäten verwendet werden.",
  "_filename": "StructureDefinition-TimingDgMP.json",
  "package_name": "de.fhir.medication",
  "date": "2026-08-30T11:32:01+02:00",
  "derivation": "constraint",
  "publisher": "HL7 Deutschland e.V.",
  "fhirVersion": "4.0.1",
  "name": "TimingDgMP",
  "mapping": [ {
    "uri": "http://hl7.org/v2",
    "name": "HL7 v2 Mapping",
    "identity": "v2"
  }, {
    "uri": "http://hl7.org/v3",
    "name": "RIM Mapping",
    "identity": "rim"
  } ],
  "abstract": false,
  "type": "Timing",
  "experimental": null,
  "resourceType": "StructureDefinition",
  "title": "Timing dgMP",
  "package_version": "2.0.0-ballot",
  "snapshot": {
    "element": [ {
      "constraint": [ {
        "key": "ele-1",
        "human": "All FHIR elements must have a @value or children",
        "xpath": "@value|f:*|h:div",
        "source": "http://hl7.org/fhir/StructureDefinition/Element",
        "severity": "error",
        "expression": "hasValue() or (children().count() > id.count())"
      }, {
        "key": "TimingOnlyOnePeriodForDayOfWeek",
        "human": "In a schema that combines dayOfWeek with either timeOfDay or when, each combination of weekday and time must be unique across all Dosage elements of a resource.",
        "source": "http://ig.fhir.de/igs/medication/StructureDefinition/TimingDgMP",
        "severity": "error",
        "expression": "( /* Detect DayOfWeek and Time/4-Schema */\n  %resource.ofType(MedicationRequest).dosageInstruction\n  | %resource.ofType(MedicationDispense).dosageInstruction\n  | %resource.ofType(MedicationStatement).dosage\n).all(\n  (\n    timing.repeat.dayOfWeek.exists() and\n      (\n        (timing.repeat.timeOfDay.exists() and timing.repeat.when.empty()) or\n        (timing.repeat.when.exists() and timing.repeat.timeOfDay.empty())\n      )\n  )\n  implies\n  (\n    (\n      (%resource.ofType(MedicationRequest).exists() or %resource.ofType(MedicationDispense).exists())\n      implies\n      (\n        /* For each day of week */\n        /* if Mon occurs multiple times */\n        ((%resource.dosageInstruction.timing.repeat.dayOfWeek.where($this = 'mon').count() > 1) implies \n        (\n          (%resource.dosageInstruction.timing.repeat.where('mon' in dayOfWeek).when.distinct().count() = %resource.dosageInstruction.timing.repeat.where('mon' in dayOfWeek).when.count()) and\n          (%resource.dosageInstruction.timing.repeat.where('mon' in dayOfWeek).timeOfDay.distinct().count() = %resource.dosageInstruction.timing.repeat.where('mon' in dayOfWeek).timeOfDay.count())\n        )) and\n        \n        /* if tue occurs multiple times */\n        ((%resource.dosageInstruction.timing.repeat.dayOfWeek.where($this = 'tue').count() > 1) implies \n        (\n          (%resource.dosageInstruction.timing.repeat.where('tue' in dayOfWeek).when.distinct().count() = %resource.dosageInstruction.timing.repeat.where('tue' in dayOfWeek).when.count()) and\n          (%resource.dosageInstruction.timing.repeat.where('tue' in dayOfWeek).timeOfDay.distinct().count() = %resource.dosageInstruction.timing.repeat.where('tue' in dayOfWeek).timeOfDay.count())\n        )) and\n        /* if wed occurs multiple times */\n        ((%resource.dosageInstruction.timing.repeat.dayOfWeek.where($this = 'wed').count() > 1) implies \n        (\n          (%resource.dosageInstruction.timing.repeat.where('wed' in dayOfWeek).when.distinct().count() = %resource.dosageInstruction.timing.repeat.where('wed' in dayOfWeek).when.count()) and\n          (%resource.dosageInstruction.timing.repeat.where('wed' in dayOfWeek).timeOfDay.distinct().count() = %resource.dosageInstruction.timing.repeat.where('wed' in dayOfWeek).timeOfDay.count())\n        )) and\n        /* if thu occurs multiple times */\n        ((%resource.dosageInstruction.timing.repeat.dayOfWeek.where($this = 'thu').count() > 1) implies \n        (\n          (%resource.dosageInstruction.timing.repeat.where('thu' in dayOfWeek).when.distinct().count() = %resource.dosageInstruction.timing.repeat.where('thu' in dayOfWeek).when.count()) and\n          (%resource.dosageInstruction.timing.repeat.where('thu' in dayOfWeek).timeOfDay.distinct().count() = %resource.dosageInstruction.timing.repeat.where('thu' in dayOfWeek).timeOfDay.count())\n        )) and\n        /* if fri occurs multiple times */\n        ((%resource.dosageInstruction.timing.repeat.dayOfWeek.where($this = 'fri').count() > 1) implies \n        (\n          (%resource.dosageInstruction.timing.repeat.where('fri' in dayOfWeek).when.distinct().count() = %resource.dosageInstruction.timing.repeat.where('fri' in dayOfWeek).when.count()) and\n          (%resource.dosageInstruction.timing.repeat.where('fri' in dayOfWeek).timeOfDay.distinct().count() = %resource.dosageInstruction.timing.repeat.where('fri' in dayOfWeek).timeOfDay.count())\n        )) and\n        /* if sat occurs multiple times */\n        ((%resource.dosageInstruction.timing.repeat.dayOfWeek.where($this = 'sat').count() > 1) implies \n        (\n          (%resource.dosageInstruction.timing.repeat.where('sat' in dayOfWeek).when.distinct().count() = %resource.dosageInstruction.timing.repeat.where('sat' in dayOfWeek).when.count()) and\n          (%resource.dosageInstruction.timing.repeat.where('sat' in dayOfWeek).timeOfDay.distinct().count() = %resource.dosageInstruction.timing.repeat.where('sat' in dayOfWeek).timeOfDay.count())\n        )) and\n        \n        /* if sun occurs multiple times */\n        ((%resource.dosageInstruction.timing.repeat.dayOfWeek.where($this = 'sun').count() > 1) implies \n        (\n          (%resource.dosageInstruction.timing.repeat.where('sun' in dayOfWeek).when.distinct().count() = %resource.dosageInstruction.timing.repeat.where('sun' in dayOfWeek).when.count()) and\n          (%resource.dosageInstruction.timing.repeat.where('sun' in dayOfWeek).timeOfDay.distinct().count() = %resource.dosageInstruction.timing.repeat.where('sun' in dayOfWeek).timeOfDay.count())\n        ))\n      )\n    )\n    and\n    (\n      %resource.ofType(MedicationStatement).exists()\n      implies\n      (\n        /* For each day of week */\n        /* if Mon occurs multiple times */\n        ((%resource.dosage.timing.repeat.dayOfWeek.where($this = 'mon').count() > 1) implies \n        (\n          (%resource.dosage.timing.repeat.where('mon' in dayOfWeek).when.distinct().count() = %resource.dosage.timing.repeat.where('mon' in dayOfWeek).when.count()) and\n          (%resource.dosage.timing.repeat.where('mon' in dayOfWeek).timeOfDay.distinct().count() = %resource.dosage.timing.repeat.where('mon' in dayOfWeek).timeOfDay.count())\n        )) and\n        \n        /* if tue occurs multiple times */\n        ((%resource.dosage.timing.repeat.dayOfWeek.where($this = 'tue').count() > 1) implies \n        (\n          (%resource.dosage.timing.repeat.where('tue' in dayOfWeek).when.distinct().count() = %resource.dosage.timing.repeat.where('tue' in dayOfWeek).when.count()) and\n          (%resource.dosage.timing.repeat.where('tue' in dayOfWeek).timeOfDay.distinct().count() = %resource.dosage.timing.repeat.where('tue' in dayOfWeek).timeOfDay.count())\n        )) and\n        /* if wed occurs multiple times */\n        ((%resource.dosage.timing.repeat.dayOfWeek.where($this = 'wed').count() > 1) implies \n        (\n          (%resource.dosage.timing.repeat.where('wed' in dayOfWeek).when.distinct().count() = %resource.dosage.timing.repeat.where('wed' in dayOfWeek).when.count()) and\n          (%resource.dosage.timing.repeat.where('wed' in dayOfWeek).timeOfDay.distinct().count() = %resource.dosage.timing.repeat.where('wed' in dayOfWeek).timeOfDay.count())\n        )) and\n        /* if thu occurs multiple times */\n        ((%resource.dosage.timing.repeat.dayOfWeek.where($this = 'thu').count() > 1) implies \n        (\n          (%resource.dosage.timing.repeat.where('thu' in dayOfWeek).when.distinct().count() = %resource.dosage.timing.repeat.where('thu' in dayOfWeek).when.count()) and\n          (%resource.dosage.timing.repeat.where('thu' in dayOfWeek).timeOfDay.distinct().count() = %resource.dosage.timing.repeat.where('thu' in dayOfWeek).timeOfDay.count())\n        )) and\n        /* if fri occurs multiple times */\n        ((%resource.dosage.timing.repeat.dayOfWeek.where($this = 'fri').count() > 1) implies \n        (\n          (%resource.dosage.timing.repeat.where('fri' in dayOfWeek).when.distinct().count() = %resource.dosage.timing.repeat.where('fri' in dayOfWeek).when.count()) and\n          (%resource.dosage.timing.repeat.where('fri' in dayOfWeek).timeOfDay.distinct().count() = %resource.dosage.timing.repeat.where('fri' in dayOfWeek).timeOfDay.count())\n        )) and\n        /* if sat occurs multiple times */\n        ((%resource.dosage.timing.repeat.dayOfWeek.where($this = 'sat').count() > 1) implies \n        (\n          (%resource.dosage.timing.repeat.where('sat' in dayOfWeek).when.distinct().count() = %resource.dosage.timing.repeat.where('sat' in dayOfWeek).when.count()) and\n          (%resource.dosage.timing.repeat.where('sat' in dayOfWeek).timeOfDay.distinct().count() = %resource.dosage.timing.repeat.where('sat' in dayOfWeek).timeOfDay.count())\n        )) and\n        \n        /* if sun occurs multiple times */\n        ((%resource.dosage.timing.repeat.dayOfWeek.where($this = 'sun').count() > 1) implies \n        (\n          (%resource.dosage.timing.repeat.where('sun' in dayOfWeek).when.distinct().count() = %resource.dosage.timing.repeat.where('sun' in dayOfWeek).when.count()) and\n          (%resource.dosage.timing.repeat.where('sun' in dayOfWeek).timeOfDay.distinct().count() = %resource.dosage.timing.repeat.where('sun' in dayOfWeek).timeOfDay.count())\n        ))\n      )\n    )\n  )\n)"
      } ],
      "path": "Timing",
      "min": 0,
      "definition": "Specifies an event that may occur multiple times. Timing schedules are used to record when things are planned, expected or requested to occur. The most common usage is in dosage instructions for medications. They are also used when planning care of various kinds, and may be used for reporting the schedule to which past regular activities were carried out.",
      "isModifier": false,
      "short": "A timing schedule that specifies an event that may occur multiple times",
      "mapping": [ {
        "map": "n/a",
        "identity": "rim"
      }, {
        "map": "N/A",
        "identity": "v2"
      }, {
        "map": "QSET (GTS)",
        "identity": "rim"
      } ],
      "max": "*",
      "id": "Timing",
      "comment": "Describes the occurrence of an event that may occur multiple times. Timing schedules are used for specifying when events are expected or requested to occur, and may also be used to represent the summary of a past or ongoing event.  For simplicity, the definitions of Timing components are expressed as 'future' events, but such components can also be used to describe historic or ongoing events.\n\nA Timing schedule can be a list of events and/or criteria for when the event happens, which can be expressed in a structured form and/or as a code. When both event and a repeating specification are provided, the list of events should be understood as an interpretation of the information in the repeat structure.",
      "base": {
        "max": "*",
        "min": 0,
        "path": "Timing"
      }
    }, {
      "path": "Timing.id",
      "min": 0,
      "definition": "Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.",
      "isModifier": false,
      "short": "Unique id for inter-element referencing",
      "mapping": [ {
        "map": "n/a",
        "identity": "rim"
      } ],
      "type": [ {
        "code": "http://hl7.org/fhirpath/System.String",
        "extension": [ {
          "url": "http://hl7.org/fhir/StructureDefinition/structuredefinition-fhir-type",
          "valueUrl": "string"
        } ]
      } ],
      "representation": [ "xmlAttr" ],
      "max": "1",
      "id": "Timing.id",
      "base": {
        "max": "1",
        "min": 0,
        "path": "Element.id"
      },
      "isSummary": false
    }, {
      "constraint": [ {
        "key": "ele-1",
        "human": "All FHIR elements must have a @value or children",
        "xpath": "@value|f:*|h:div",
        "source": "http://hl7.org/fhir/StructureDefinition/Element",
        "severity": "error",
        "expression": "hasValue() or (children().count() > id.count())"
      }, {
        "key": "ext-1",
        "human": "Must have either extensions or value[x], not both",
        "xpath": "exists(f:extension)!=exists(f:*[starts-with(local-name(.), \"value\")])",
        "source": "http://hl7.org/fhir/StructureDefinition/Extension",
        "severity": "error",
        "expression": "extension.exists() != value.exists()"
      } ],
      "path": "Timing.extension",
      "min": 0,
      "definition": "May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.",
      "isModifier": false,
      "short": "Additional content defined by implementations",
      "mapping": [ {
        "map": "n/a",
        "identity": "rim"
      } ],
      "slicing": {
        "rules": "open",
        "description": "Extensions are always sliced by (at least) url",
        "discriminator": [ {
          "path": "url",
          "type": "value"
        } ]
      },
      "type": [ {
        "code": "Extension"
      } ],
      "alias": [ "extensions", "user content" ],
      "max": "*",
      "id": "Timing.extension",
      "comment": "There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone.",
      "base": {
        "max": "*",
        "min": 0,
        "path": "Element.extension"
      },
      "isSummary": false
    }, {
      "constraint": [ {
        "key": "ele-1",
        "human": "All FHIR elements must have a @value or children",
        "xpath": "@value|f:*|h:div",
        "source": "http://hl7.org/fhir/StructureDefinition/Element",
        "severity": "error",
        "expression": "hasValue() or (children().count() > id.count())"
      }, {
        "key": "ext-1",
        "human": "Must have either extensions or value[x], not both",
        "xpath": "exists(f:extension)!=exists(f:*[starts-with(local-name(.), \"value\")])",
        "source": "http://hl7.org/fhir/StructureDefinition/Extension",
        "severity": "error",
        "expression": "extension.exists() != value.exists()"
      } ],
      "path": "Timing.modifierExtension",
      "requirements": "Modifier extensions allow for extensions that *cannot* be safely ignored to be clearly distinguished from the vast majority of extensions which can be safely ignored.  This promotes interoperability by eliminating the need for implementers to prohibit the presence of extensions. For further information, see the [definition of modifier extensions](http://hl7.org/fhir/R4/extensibility.html#modifierExtension).",
      "min": 0,
      "definition": "May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.\n\nModifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).",
      "isModifier": true,
      "short": "Extensions that cannot be ignored even if unrecognized",
      "mapping": [ {
        "map": "N/A",
        "identity": "rim"
      } ],
      "type": [ {
        "code": "Extension"
      } ],
      "alias": [ "extensions", "user content", "modifiers" ],
      "max": "*",
      "id": "Timing.modifierExtension",
      "comment": "There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone.",
      "base": {
        "max": "*",
        "min": 0,
        "path": "BackboneElement.modifierExtension"
      },
      "isModifierReason": "Modifier extensions are expected to modify the meaning or interpretation of the element that contains them",
      "isSummary": true
    }, {
      "constraint": [ {
        "key": "ele-1",
        "human": "All FHIR elements must have a @value or children",
        "xpath": "@value|f:*|h:div",
        "source": "http://hl7.org/fhir/StructureDefinition/Element",
        "severity": "error",
        "expression": "hasValue() or (children().count() > id.count())"
      } ],
      "path": "Timing.event",
      "requirements": "In a Medication Administration Record, for instance, you need to take a general specification, and turn it into a precise specification.",
      "min": 0,
      "definition": "Identifies specific times when the event occurs.",
      "isModifier": false,
      "short": "When the event occurs",
      "mapping": [ {
        "map": "QLIST",
        "identity": "rim"
      } ],
      "type": [ {
        "code": "dateTime"
      } ],
      "max": "0",
      "id": "Timing.event",
      "comment": "Begründung Einschränkung Kardinalität: Der Zeitpunkt des Ereignisses ist in der ersten Ausbaustufe des dgMP nicht vorgesehen, um die Komplexität zu reduzieren und die Übersichtlichkeit zu erhöhen.",
      "base": {
        "max": "*",
        "min": 0,
        "path": "Timing.event"
      },
      "isSummary": true
    }, {
      "constraint": [ {
        "key": "ele-1",
        "human": "All FHIR elements must have a @value or children",
        "xpath": "@value|f:*|h:div",
        "source": "http://hl7.org/fhir/StructureDefinition/Element",
        "severity": "error",
        "expression": "hasValue() or (children().count() > id.count())"
      }, {
        "key": "tim-1",
        "human": "if there's a duration, there needs to be duration units",
        "xpath": "not(exists(f:duration)) or exists(f:durationUnit)",
        "source": "http://hl7.org/fhir/StructureDefinition/Timing",
        "severity": "error",
        "expression": "duration.empty() or durationUnit.exists()"
      }, {
        "key": "tim-2",
        "human": "if there's a period, there needs to be period units",
        "xpath": "not(exists(f:period)) or exists(f:periodUnit)",
        "source": "http://hl7.org/fhir/StructureDefinition/Timing",
        "severity": "error",
        "expression": "period.empty() or periodUnit.exists()"
      }, {
        "key": "tim-4",
        "human": "duration SHALL be a non-negative value",
        "xpath": "f:duration/@value >= 0 or not(f:duration/@value)",
        "source": "http://hl7.org/fhir/StructureDefinition/Timing",
        "severity": "error",
        "expression": "duration.exists() implies duration >= 0"
      }, {
        "key": "tim-5",
        "human": "period SHALL be a non-negative value",
        "xpath": "f:period/@value >= 0 or not(f:period/@value)",
        "source": "http://hl7.org/fhir/StructureDefinition/Timing",
        "severity": "error",
        "expression": "period.exists() implies period >= 0"
      }, {
        "key": "tim-6",
        "human": "If there's a periodMax, there must be a period",
        "xpath": "not(exists(f:periodMax)) or exists(f:period)",
        "source": "http://hl7.org/fhir/StructureDefinition/Timing",
        "severity": "error",
        "expression": "periodMax.empty() or period.exists()"
      }, {
        "key": "tim-7",
        "human": "If there's a durationMax, there must be a duration",
        "xpath": "not(exists(f:durationMax)) or exists(f:duration)",
        "source": "http://hl7.org/fhir/StructureDefinition/Timing",
        "severity": "error",
        "expression": "durationMax.empty() or duration.exists()"
      }, {
        "key": "tim-8",
        "human": "If there's a countMax, there must be a count",
        "xpath": "not(exists(f:countMax)) or exists(f:count)",
        "source": "http://hl7.org/fhir/StructureDefinition/Timing",
        "severity": "error",
        "expression": "countMax.empty() or count.exists()"
      }, {
        "key": "tim-9",
        "human": "If there's an offset, there must be a when (and not C, CM, CD, CV)",
        "xpath": "not(exists(f:offset)) or exists(f:when)",
        "source": "http://hl7.org/fhir/StructureDefinition/Timing",
        "severity": "error",
        "expression": "offset.empty() or (when.exists() and ((when in ('C' | 'CM' | 'CD' | 'CV')).not()))"
      }, {
        "key": "tim-10",
        "human": "If there's a timeOfDay, there cannot be a when, or vice versa",
        "xpath": "not(exists(f:timeOfDay)) or not(exists(f:when))",
        "source": "http://hl7.org/fhir/StructureDefinition/Timing",
        "severity": "error",
        "expression": "timeOfDay.empty() or when.empty()"
      }, {
        "key": "TimingSingleDosageForTimeOfDayWarning",
        "human": "If only timeOfDay is used and dosing is daily, the times must be modelled in a single Dosage element. Multiple Dosage elements are only allowed if every element carries a distinct dose, including its data type.",
        "source": "http://ig.fhir.de/igs/medication/StructureDefinition/TimingDE",
        "severity": "warning",
        "expression": "(\n  %resource.ofType(MedicationRequest).dosageInstruction\n  | %resource.ofType(MedicationDispense).dosageInstruction\n  | %resource.ofType(MedicationStatement).dosage\n).all(\n  (\n    timing.repeat.dayOfWeek.empty() and\n    timing.repeat.timeOfDay.exists() and\n    timing.repeat.when.empty()\n  )\n  implies\n  (\n    (\n      (\n        %resource.ofType(MedicationRequest).dosageInstruction\n        | %resource.ofType(MedicationDispense).dosageInstruction\n        | %resource.ofType(MedicationStatement).dosage\n      ).where(\n        timing.repeat.dayOfWeek.empty() and timing.repeat.timeOfDay.exists() and timing.repeat.when.empty()\n      ).count() = 1\n    )\n    or\n    (\n      (\n        %resource.ofType(MedicationRequest).dosageInstruction\n        | %resource.ofType(MedicationDispense).dosageInstruction\n        | %resource.ofType(MedicationStatement).dosage\n      ).where(\n        timing.repeat.dayOfWeek.empty() and timing.repeat.timeOfDay.exists() and timing.repeat.when.empty()\n      ).doseAndRate.dose.distinct().count()\n      =\n      (\n        %resource.ofType(MedicationRequest).dosageInstruction\n        | %resource.ofType(MedicationDispense).dosageInstruction\n        | %resource.ofType(MedicationStatement).dosage\n      ).where(\n        timing.repeat.dayOfWeek.empty() and timing.repeat.timeOfDay.exists() and timing.repeat.when.empty()\n      ).count()\n    )\n  )\n)"
      }, {
        "key": "TimingSingleDosageForWhenWarning",
        "human": "If only when is used and dosing is daily, the times of day must be modelled in a single Dosage element. Multiple Dosage elements are only allowed if every element carries a distinct dose, including its data type.",
        "source": "http://ig.fhir.de/igs/medication/StructureDefinition/TimingDE",
        "severity": "warning",
        "expression": "(\n  %resource.ofType(MedicationRequest).dosageInstruction\n  | %resource.ofType(MedicationDispense).dosageInstruction\n  | %resource.ofType(MedicationStatement).dosage\n).all(\n  (\n    timing.repeat.dayOfWeek.empty() and\n    timing.repeat.when.exists() and\n    timing.repeat.timeOfDay.empty()\n  )\n  implies\n  (\n    (\n      (\n        %resource.ofType(MedicationRequest).dosageInstruction\n        | %resource.ofType(MedicationDispense).dosageInstruction\n        | %resource.ofType(MedicationStatement).dosage\n      ).where(\n        timing.repeat.dayOfWeek.empty() and timing.repeat.when.exists() and timing.repeat.timeOfDay.empty()\n      ).count() = 1\n    )\n    or\n    (\n      (\n        %resource.ofType(MedicationRequest).dosageInstruction\n        | %resource.ofType(MedicationDispense).dosageInstruction\n        | %resource.ofType(MedicationStatement).dosage\n      ).where(\n        timing.repeat.dayOfWeek.empty() and timing.repeat.when.exists() and timing.repeat.timeOfDay.empty()\n      ).doseAndRate.dose.distinct().count()\n      =\n      (\n        %resource.ofType(MedicationRequest).dosageInstruction\n        | %resource.ofType(MedicationDispense).dosageInstruction\n        | %resource.ofType(MedicationStatement).dosage\n      ).where(\n        timing.repeat.dayOfWeek.empty() and timing.repeat.when.exists() and timing.repeat.timeOfDay.empty()\n      ).count()\n    )\n  )\n)"
      }, {
        "key": "TimingBoundsUnitMatchesCodeWarning",
        "human": "boundsDuration.unit must match the UCUM boundsDuration.code (e.g. 'Woche(n)' only with code='wk').",
        "source": "http://ig.fhir.de/igs/medication/StructureDefinition/TimingDE",
        "severity": "warning",
        "expression": "bounds.ofType(Duration).exists().not() or (\n  (\n    bounds.ofType(Duration).code = 'd'\n    implies \n    (\n      bounds.ofType(Duration).unit = 'Tag(e)' or\n      bounds.ofType(Duration).unit = 'Tag' or\n      bounds.ofType(Duration).unit = 'Tage'\n    )\n  ) and (\n    bounds.ofType(Duration).code = 'wk'\n    implies \n    (\n      bounds.ofType(Duration).unit = 'Woche(n)' or\n      bounds.ofType(Duration).unit = 'Woche' or\n      bounds.ofType(Duration).unit = 'Wochen'\n    )\n  ) and (\n    bounds.ofType(Duration).code = 'mo'\n    implies \n    (\n      bounds.ofType(Duration).unit = 'Monat(e)' or\n      bounds.ofType(Duration).unit = 'Monat' or\n      bounds.ofType(Duration).unit = 'Monate'\n    )\n  ) and (\n    bounds.ofType(Duration).code = 'a'\n    implies \n    (\n      bounds.ofType(Duration).unit = 'Jahr(e)' or\n      bounds.ofType(Duration).unit = 'Jahr' or\n      bounds.ofType(Duration).unit = 'Jahre'\n    )\n  )\n)"
      }, {
        "key": "TimingFreqOrPeriodGtOneWarning",
        "human": "If frequency and period are given together, only one of them may exceed 1 - either the frequency including frequencyMax or the period including periodMax. A statement in which both exceed 1, such as 'six times within three hours', is hard to express in language and is not needed: the same meaning can be conveyed by adapting the period, e.g. 'every 30 minutes'.",
        "source": "http://ig.fhir.de/igs/medication/StructureDefinition/TimingDE",
        "severity": "warning",
        "expression": "/* Detect Interval only */\n(\n  timeOfDay.empty() and\n  when.empty() and\n  dayOfWeek.empty() and\n  frequency.exists() and\n  period.exists()\n) implies\n(\n  (\n    (frequency > 1 or (frequencyMax.exists() and frequencyMax > 1))\n    implies\n    (\n      period = 1 and\n      (periodMax.empty() or periodMax = 1)\n    )\n  )\n  and\n  (\n    (period > 1 or (periodMax.exists() and periodMax > 1))\n    implies\n    (\n      frequency = 1 and\n      (frequencyMax.empty() or frequencyMax = 1)\n    )\n  )\n)"
      }, {
        "key": "TimingOnlyOneType",
        "human": "Exactly one of the supported timing schemas is allowed. With dayOfWeek, frequency and the pair period = 1 and periodUnit = wk are optional redundant legacy statements; they do not constitute an interval schema. With when or timeOfDay, frequency is optional; a non-daily period distinguishes the daily schema from a time interval combined with a time-of-day or clock-time reference. A variable frequency (frequencyMax) is reserved for the pure interval, because concrete times or weekdays already determine the number of administrations.",
        "source": "http://ig.fhir.de/igs/medication/StructureDefinition/TimingDgMP",
        "severity": "error",
        "expression": "/* DayOfWeek only; legacy frequency and the exact 1 wk pair are optional */\n(\n  %resource.ofType(MedicationRequest).dosageInstruction |\n  %resource.ofType(MedicationDispense).dosageInstruction |\n  %resource.ofType(MedicationStatement).dosage\n).all(\n  timing.repeat.dayOfWeek.exists() and\n  timing.repeat.when.empty() and\n  timing.repeat.timeOfDay.empty() and\n  timing.repeat.frequencyMax.empty() and\n  timing.repeat.periodMax.empty() and\n  (\n    (timing.repeat.period.empty() and timing.repeat.periodUnit.empty()) or\n    (timing.repeat.period = 1 and timing.repeat.periodUnit = 'wk')\n  )\n) or\n\n/* Interval only (frequency + period + periodUnit, no when/timeOfDay/dayOfWeek) */\n(\n  %resource.ofType(MedicationRequest).dosageInstruction |\n  %resource.ofType(MedicationDispense).dosageInstruction |\n  %resource.ofType(MedicationStatement).dosage\n).all(\n  timing.repeat.frequency.exists() and\n  timing.repeat.period.exists() and\n  timing.repeat.periodUnit.exists() and\n  timing.repeat.when.empty() and\n  timing.repeat.timeOfDay.empty() and\n  timing.repeat.dayOfWeek.empty()\n) or\n\n/* DayOfWeek and Time/4-Schema; legacy frequency and the exact 1 wk pair are optional */\n(\n  %resource.ofType(MedicationRequest).dosageInstruction | \n  %resource.ofType(MedicationDispense).dosageInstruction | \n  %resource.ofType(MedicationStatement).dosage\n).all(\n  timing.repeat.dayOfWeek.exists() and\n  (\n    (timing.repeat.timeOfDay.exists() and timing.repeat.when.empty()) or\n    (timing.repeat.when.exists() and timing.repeat.timeOfDay.empty())\n  ) and\n  timing.repeat.frequencyMax.empty() and\n  timing.repeat.periodMax.empty() and\n  (\n    (timing.repeat.period.empty() and timing.repeat.periodUnit.empty()) or\n    (timing.repeat.period = 1 and timing.repeat.periodUnit = 'wk')\n  )\n) or\n\n/* Daily When or TimeOfDay; frequency is optional, a variable frequency is not */\n(\n  %resource.ofType(MedicationRequest).dosageInstruction |\n  %resource.ofType(MedicationDispense).dosageInstruction |\n  %resource.ofType(MedicationStatement).dosage\n).all(\n  timing.repeat.dayOfWeek.empty() and\n  (\n    (timing.repeat.timeOfDay.exists() and timing.repeat.when.empty()) or\n    (timing.repeat.when.exists() and timing.repeat.timeOfDay.empty())\n  ) and\n  timing.repeat.frequencyMax.empty() and\n  timing.repeat.periodMax.empty() and\n  (\n    (timing.repeat.period.empty() and timing.repeat.periodUnit.empty()) or\n    (timing.repeat.period = 1 and timing.repeat.periodUnit = 'd')\n  )\n) or\n\n/* Non-daily interval combined with When or TimeOfDay; frequency is optional, a\n   variable frequency is not */\n(\n  %resource.ofType(MedicationRequest).dosageInstruction |\n  %resource.ofType(MedicationDispense).dosageInstruction |\n  %resource.ofType(MedicationStatement).dosage\n).all(\n  timing.repeat.dayOfWeek.empty() and\n  (\n    (timing.repeat.timeOfDay.exists() and timing.repeat.when.empty()) or\n    (timing.repeat.when.exists() and timing.repeat.timeOfDay.empty())\n  ) and\n  timing.repeat.frequencyMax.empty() and\n  timing.repeat.period.exists() and\n  timing.repeat.periodUnit.exists() and\n  (timing.repeat.periodUnit = 'd' or timing.repeat.periodUnit = 'wk' or timing.repeat.periodUnit = 'mo') and\n  (\n    timing.repeat.periodUnit != 'd' or\n    timing.repeat.period != 1 or\n    timing.repeat.periodMax.exists()\n  )\n)"
      }, {
        "key": "TimingIntervalOnlyOneFrequency",
        "human": "If a dosage is defined by a pure interval, only one Dosage element is allowed in the resource.",
        "source": "http://ig.fhir.de/igs/medication/StructureDefinition/TimingDgMP",
        "severity": "error",
        "expression": "( /* Detect Interval */\n  %resource.ofType(MedicationRequest).dosageInstruction\n  | %resource.ofType(MedicationDispense).dosageInstruction\n  | %resource.ofType(MedicationStatement).dosage\n)\n.all(\n  (\n    timing.repeat.frequency.exists()\n    and timing.repeat.period.exists()\n    and timing.repeat.periodUnit.exists()\n    and timing.repeat.when.empty()\n    and timing.repeat.timeOfDay.empty()\n    and timing.repeat.dayOfWeek.empty()\n  )\n  /* Only One Dosage allowed for Interval */\n  implies\n  (\n    (\n      (\n        %resource.ofType(MedicationRequest).exists()\n        or %resource.ofType(MedicationDispense).exists()\n      )\n      implies (\n        %resource.dosageInstruction.count() = 1\n      )\n    )\n    and\n    (\n      %resource.ofType(MedicationStatement).exists()\n      implies\n      %resource.dosage.count() = 1\n    )\n  )\n)"
      }, {
        "key": "TimingOnlyOneWhen",
        "human": "In a schema that uses only when, no part of the day may occur in more than one Dosage element of a resource.",
        "source": "http://ig.fhir.de/igs/medication/StructureDefinition/TimingDgMP",
        "severity": "error",
        "expression": "( /* Detect when-based schema */\n  %resource.ofType(MedicationRequest).dosageInstruction\n  | %resource.ofType(MedicationDispense).dosageInstruction\n  | %resource.ofType(MedicationStatement).dosage\n).all(\n    timing.repeat.dayOfWeek.empty() and\n    timing.repeat.when.exists() and\n    timing.repeat.timeOfDay.empty()\n  implies\n  (\n    (\n      (%resource.ofType(MedicationRequest).exists() or %resource.ofType(MedicationDispense).exists())\n      implies\n      (%resource.dosageInstruction.timing.repeat.when.distinct().count() = %resource.dosageInstruction.timing.repeat.when.count())\n    )\n    and\n    (\n      %resource.ofType(MedicationStatement).exists()\n      implies\n      (%resource.dosage.timing.repeat.when.distinct().count() = %resource.dosage.timing.repeat.when.count())\n    )\n  )\n)"
      }, {
        "key": "TimingOnlyWhenOrTimeOfDay",
        "human": "The Dosage elements of a resource must not mix a time of day (timeOfDay) and a part of the day (when).",
        "source": "http://ig.fhir.de/igs/medication/StructureDefinition/TimingDgMP",
        "severity": "error",
        "expression": "(\n  %resource.ofType(MedicationRequest).dosageInstruction\n  | %resource.ofType(MedicationDispense).dosageInstruction\n  | %resource.ofType(MedicationStatement).dosage\n).all(\n    (timing.repeat.when.exists() or \n    timing.repeat.timeOfDay.exists())\n  implies\n  (\n    (\n      (%resource.ofType(MedicationRequest).exists() or %resource.ofType(MedicationDispense).exists())\n      implies\n      (%resource.dosageInstruction.timing.repeat.when.exists() xor %resource.dosageInstruction.timing.repeat.timeOfDay.exists())\n    )\n    and\n    (\n      %resource.ofType(MedicationStatement).exists()\n      implies\n      (%resource.dosage.timing.repeat.when.exists() xor %resource.dosage.timing.repeat.timeOfDay.exists())\n    )\n  )\n)"
      }, {
        "key": "TimingOnlyOneTimeOfDay",
        "human": "In a schema that uses only timeOfDay, no time of day may occur in more than one Dosage element of a resource.",
        "source": "http://ig.fhir.de/igs/medication/StructureDefinition/TimingDgMP",
        "severity": "error",
        "expression": "( /* Detect TimeOfDay */\n  %resource.ofType(MedicationRequest).dosageInstruction\n  | %resource.ofType(MedicationDispense).dosageInstruction\n  | %resource.ofType(MedicationStatement).dosage\n).all(\n  (\n    timing.repeat.dayOfWeek.empty() and\n    timing.repeat.timeOfDay.exists() and\n    timing.repeat.when.empty() \n  )\n  implies\n  (\n    (\n      (%resource.ofType(MedicationRequest).exists() or %resource.ofType(MedicationDispense).exists())\n      implies\n      (%resource.dosageInstruction.timing.repeat.timeOfDay.distinct().count() = %resource.dosageInstruction.timing.repeat.timeOfDay.count())\n    )\n    and\n    (\n      %resource.ofType(MedicationStatement).exists()\n      implies\n      (%resource.dosage.timing.repeat.timeOfDay.distinct().count() = %resource.dosage.timing.repeat.timeOfDay.count())\n    )\n  )\n)"
      }, {
        "key": "TimingOnlyOneDayOfWeek",
        "human": "In a schema that uses only dayOfWeek, no weekday may occur in more than one Dosage element of a resource.",
        "source": "http://ig.fhir.de/igs/medication/StructureDefinition/TimingDgMP",
        "severity": "error",
        "expression": "( /* Detect DayOfWeek */\n  %resource.ofType(MedicationRequest).dosageInstruction\n  | %resource.ofType(MedicationDispense).dosageInstruction\n  | %resource.ofType(MedicationStatement).dosage\n).all(\n  (\n    timing.repeat.dayOfWeek.exists() and\n    timing.repeat.when.empty() and \n    timing.repeat.timeOfDay.empty()\n  )\n  implies\n  (\n    (\n      (%resource.ofType(MedicationRequest).exists() or %resource.ofType(MedicationDispense).exists())\n      implies\n      (%resource.dosageInstruction.timing.repeat.dayOfWeek.distinct().count() = %resource.dosageInstruction.timing.repeat.dayOfWeek.count())\n    )\n    and\n    (\n      %resource.ofType(MedicationStatement).exists()\n      implies\n      (%resource.dosage.timing.repeat.dayOfWeek.distinct().count() = %resource.dosage.timing.repeat.dayOfWeek.count())\n    )\n  )\n)"
      }, {
        "key": "TimingOnlyOneTimeForInterval",
        "human": "In a schema that combines an interval with timeOfDay or when, all Dosage elements of a resource must use the same period and periodUnit, and each timeOfDay or when value must be unique across them.",
        "source": "http://ig.fhir.de/igs/medication/StructureDefinition/TimingDgMP",
        "severity": "error",
        "expression": "/* Detect Interval and Time/4-Schema */\n(\n  %resource.ofType(MedicationRequest).dosageInstruction\n  | %resource.ofType(MedicationDispense).dosageInstruction\n  | %resource.ofType(MedicationStatement).dosage\n)\n.all(\n  (\n    timing.repeat.period.exists() and\n    timing.repeat.periodUnit.exists() and\n    timing.repeat.dayOfWeek.empty() and\n    (\n      (timing.repeat.timeOfDay.exists() and timing.repeat.when.empty()) or\n      (timing.repeat.when.exists() and timing.repeat.timeOfDay.empty())\n    )\n  )\n  implies\n  (\n    (\n      %resource.ofType(MedicationRequest).exists()\n      or %resource.ofType(MedicationDispense).exists()\n    )\n    implies\n    (\n      %resource.dosageInstruction.timing.repeat.period.distinct().count() = 1\n      and %resource.dosageInstruction.timing.repeat.periodUnit.distinct().count() = 1\n    )\n    and\n    (\n      (%resource.dosageInstruction.timing.repeat.timeOfDay.distinct().count() = %resource.dosageInstruction.timing.repeat.timeOfDay.count())\n      and\n      (%resource.dosageInstruction.timing.repeat.when.distinct().count() = %resource.dosageInstruction.timing.repeat.when.count())\n    )\n  )\n  and\n  (\n    %resource.ofType(MedicationStatement).exists()\n    implies\n    (\n      (\n        %resource.dosage.timing.repeat.period.distinct().count() = 1\n        and %resource.dosage.timing.repeat.periodUnit.distinct().count() = 1\n      )\n      and\n      (\n        (%resource.dosage.timing.repeat.timeOfDay.distinct().count() = %resource.dosage.timing.repeat.timeOfDay.count())\n        and\n        (%resource.dosage.timing.repeat.when.distinct().count() = %resource.dosage.timing.repeat.when.count())\n      )\n    )\n  )\n)"
      }, {
        "key": "TimingOnlyOneBounds",
        "human": "All Dosage elements of a resource must state the same bounds (Duration or Period), and either all of them carry a bounds or none.",
        "source": "http://ig.fhir.de/igs/medication/StructureDefinition/TimingDgMP",
        "severity": "error",
        "expression": "(\n  %resource.ofType(MedicationRequest).dosageInstruction\n  | %resource.ofType(MedicationDispense).dosageInstruction\n  | %resource.ofType(MedicationStatement).dosage\n).all(\n  (\n    ( /* only one different value and code are allowed*/\n      (%resource.ofType(MedicationRequest).exists() or %resource.ofType(MedicationDispense).exists())\n      implies\n      %resource.dosageInstruction.timing.repeat.bounds.ofType(Duration).exists().not() or\n      (\n        (%resource.dosageInstruction.timing.repeat.bounds.ofType(Duration).value.distinct().count() = 1)\n        and\n        (%resource.dosageInstruction.timing.repeat.bounds.ofType(Duration).code.distinct().count() = 1)\n      )\n    )\n    and\n    (\n      %resource.ofType(MedicationStatement).exists()\n      implies\n      %resource.dosage.timing.repeat.bounds.ofType(Duration).exists().not() or\n      (\n        (%resource.dosage.timing.repeat.bounds.ofType(Duration).value.distinct().count() = 1)\n        and\n        (%resource.dosage.timing.repeat.bounds.ofType(Duration).code.distinct().count() = 1)\n      )\n    )\n    and\n    ( /* boundsPeriod: Start und Ende müssen ebenfalls über alle Dosierungen gleich sein.\n         Die Textgenerierung liest den Zeitrahmen nur aus dem ersten Dosage-Element. */\n      (%resource.ofType(MedicationRequest).exists() or %resource.ofType(MedicationDispense).exists())\n      implies\n      %resource.dosageInstruction.timing.repeat.bounds.ofType(Period).exists().not() or\n      (\n        (%resource.dosageInstruction.timing.repeat.bounds.ofType(Period).start.distinct().count() <= 1)\n        and\n        (%resource.dosageInstruction.timing.repeat.bounds.ofType(Period).end.distinct().count() <= 1)\n      )\n    )\n    and\n    (\n      %resource.ofType(MedicationStatement).exists()\n      implies\n      %resource.dosage.timing.repeat.bounds.ofType(Period).exists().not() or\n      (\n        (%resource.dosage.timing.repeat.bounds.ofType(Period).start.distinct().count() <= 1)\n        and\n        (%resource.dosage.timing.repeat.bounds.ofType(Period).end.distinct().count() <= 1)\n      )\n    )\n  )\n  and\n  ( /* Entweder alle Dosage-Elemente tragen einen Zeitrahmen oder keines. Die\n       Textgenerierung liest ihn nur aus dem ersten Element; ein Element ohne\n       Zeitrahmen wuerde sonst stillschweigend als begrenzt dargestellt. */\n    (\n      (\n        %resource.ofType(MedicationRequest).dosageInstruction |\n        %resource.ofType(MedicationDispense).dosageInstruction |\n        %resource.ofType(MedicationStatement).dosage\n      ).timing.repeat.bounds.exists()\n    )\n    implies\n    (\n      (\n        %resource.ofType(MedicationRequest).dosageInstruction |\n        %resource.ofType(MedicationDispense).dosageInstruction |\n        %resource.ofType(MedicationStatement).dosage\n      ).all(timing.repeat.bounds.exists())\n    )\n  )\n)"
      }, {
        "key": "TimingFrequencyCount",
        "human": "If frequency is given together with when, timeOfDay or dayOfWeek, its value must match the number of concrete administrations.",
        "source": "http://ig.fhir.de/igs/medication/StructureDefinition/TimingDgMP",
        "severity": "error",
        "expression": "(when.exists() and dayOfWeek.empty() and frequency.exists() implies when.count() = frequency)\nand\n(when.exists() and dayOfWeek.exists() and frequency.exists() implies (when.count() * dayOfWeek.count()) = frequency)\nand\n(timeOfDay.exists() and dayOfWeek.empty() and frequency.exists() implies timeOfDay.count() = frequency)\nand\n(timeOfDay.exists() and dayOfWeek.exists() and frequency.exists() implies (timeOfDay.count() * dayOfWeek.count()) = frequency)\nand\n(dayOfWeek.exists() and timeOfDay.empty() and when.empty() and frequency.exists() implies dayOfWeek.count() = frequency)"
      }, {
        "key": "TimingPeriodUnit",
        "human": "periodUnit may only be given together with period. With dayOfWeek, only the redundant weekly statement is allowed; with when or timeOfDay without dayOfWeek, days, weeks or months are allowed.",
        "source": "http://ig.fhir.de/igs/medication/StructureDefinition/TimingDgMP",
        "severity": "error",
        "expression": "periodUnit.empty() or (\n  period.exists() and\n  (\n    (dayOfWeek.exists() and periodUnit = 'wk') or\n    (\n      dayOfWeek.empty() and\n      (\n        (when.empty() and timeOfDay.empty()) or\n        periodUnit = 'd' or\n        periodUnit = 'wk' or\n        periodUnit = 'mo'\n      )\n    )\n  )\n)"
      }, {
        "key": "TimingPeriodOnlyWholeNumber",
        "human": "period and periodMax must be whole numbers; decimal values are not allowed.",
        "source": "http://ig.fhir.de/igs/medication/StructureDefinition/TimingDgMP",
        "severity": "error",
        "expression": "(period.exists() implies period mod 1 = 0) and (periodMax.exists() implies periodMax mod 1 = 0)"
      }, {
        "key": "TimingBoundsDurationOnlyWholeNumber",
        "human": "boundsDuration.value must be a whole number; decimal values are not allowed.",
        "source": "http://ig.fhir.de/igs/medication/StructureDefinition/TimingDgMP",
        "severity": "error",
        "expression": "bounds.ofType(Duration).value.empty() or bounds.ofType(Duration).value mod 1 = 0"
      }, {
        "key": "TimingFreqOrPeriodGtOne",
        "human": "If frequency and period are given together, only one of them may exceed 1 - either the frequency including frequencyMax or the period including periodMax. A statement in which both exceed 1, such as 'six times within three hours', is hard to express in language and is not needed: the same meaning can be conveyed by adapting the period, e.g. 'every 30 minutes'.",
        "source": "http://ig.fhir.de/igs/medication/StructureDefinition/TimingDgMP",
        "severity": "error",
        "expression": "/* Detect Interval only */\n(\n  timeOfDay.empty() and\n  when.empty() and\n  dayOfWeek.empty() and\n  frequency.exists() and\n  period.exists()\n) implies\n(\n  (\n    (frequency > 1 or (frequencyMax.exists() and frequencyMax > 1))\n    implies\n    (\n      period = 1 and\n      (periodMax.empty() or periodMax = 1)\n    )\n  )\n  and\n  (\n    (period > 1 or (periodMax.exists() and periodMax > 1))\n    implies\n    (\n      frequency = 1 and\n      (frequencyMax.empty() or frequencyMax = 1)\n    )\n  )\n)"
      }, {
        "key": "TimingVarFreqGtMin",
        "human": "For a variable frequency, the maximum frequency must be greater than the minimum frequency.",
        "source": "http://ig.fhir.de/igs/medication/StructureDefinition/TimingDgMP",
        "severity": "error",
        "expression": "frequencyMax.empty() or frequency.empty() or\n  frequency.value.toInteger() < frequencyMax.value.toInteger()"
      }, {
        "key": "TimingVarPeriodGtMin",
        "human": "For a variable period, the maximum period must be greater than the minimum period.",
        "source": "http://ig.fhir.de/igs/medication/StructureDefinition/TimingDgMP",
        "severity": "error",
        "expression": "periodMax.empty() or period.empty() or period < periodMax"
      }, {
        "key": "TimingSingleDosageForTimeOfDay",
        "human": "If only timeOfDay is used and dosing is daily, the times must be modelled in a single Dosage element. Multiple Dosage elements are only allowed if every element carries a distinct dose, including its data type.",
        "source": "http://ig.fhir.de/igs/medication/StructureDefinition/TimingDgMP",
        "severity": "error",
        "expression": "(\n  %resource.ofType(MedicationRequest).dosageInstruction\n  | %resource.ofType(MedicationDispense).dosageInstruction\n  | %resource.ofType(MedicationStatement).dosage\n).all(\n  (\n    timing.repeat.dayOfWeek.empty() and\n    timing.repeat.timeOfDay.exists() and\n    timing.repeat.when.empty()\n  )\n  implies\n  (\n    (\n      (\n        %resource.ofType(MedicationRequest).dosageInstruction\n        | %resource.ofType(MedicationDispense).dosageInstruction\n        | %resource.ofType(MedicationStatement).dosage\n      ).where(\n        timing.repeat.dayOfWeek.empty() and timing.repeat.timeOfDay.exists() and timing.repeat.when.empty()\n      ).count() = 1\n    )\n    or\n    (\n      (\n        %resource.ofType(MedicationRequest).dosageInstruction\n        | %resource.ofType(MedicationDispense).dosageInstruction\n        | %resource.ofType(MedicationStatement).dosage\n      ).where(\n        timing.repeat.dayOfWeek.empty() and timing.repeat.timeOfDay.exists() and timing.repeat.when.empty()\n      ).doseAndRate.dose.distinct().count()\n      =\n      (\n        %resource.ofType(MedicationRequest).dosageInstruction\n        | %resource.ofType(MedicationDispense).dosageInstruction\n        | %resource.ofType(MedicationStatement).dosage\n      ).where(\n        timing.repeat.dayOfWeek.empty() and timing.repeat.timeOfDay.exists() and timing.repeat.when.empty()\n      ).count()\n    )\n  )\n)"
      }, {
        "key": "TimingSingleDosageForWhen",
        "human": "If only when is used and dosing is daily, the times of day must be modelled in a single Dosage element. Multiple Dosage elements are only allowed if every element carries a distinct dose, including its data type.",
        "source": "http://ig.fhir.de/igs/medication/StructureDefinition/TimingDgMP",
        "severity": "error",
        "expression": "(\n  %resource.ofType(MedicationRequest).dosageInstruction\n  | %resource.ofType(MedicationDispense).dosageInstruction\n  | %resource.ofType(MedicationStatement).dosage\n).all(\n  (\n    timing.repeat.dayOfWeek.empty() and\n    timing.repeat.when.exists() and\n    timing.repeat.timeOfDay.empty()\n  )\n  implies\n  (\n    (\n      (\n        %resource.ofType(MedicationRequest).dosageInstruction\n        | %resource.ofType(MedicationDispense).dosageInstruction\n        | %resource.ofType(MedicationStatement).dosage\n      ).where(\n        timing.repeat.dayOfWeek.empty() and timing.repeat.when.exists() and timing.repeat.timeOfDay.empty()\n      ).count() = 1\n    )\n    or\n    (\n      (\n        %resource.ofType(MedicationRequest).dosageInstruction\n        | %resource.ofType(MedicationDispense).dosageInstruction\n        | %resource.ofType(MedicationStatement).dosage\n      ).where(\n        timing.repeat.dayOfWeek.empty() and timing.repeat.when.exists() and timing.repeat.timeOfDay.empty()\n      ).doseAndRate.dose.distinct().count()\n      =\n      (\n        %resource.ofType(MedicationRequest).dosageInstruction\n        | %resource.ofType(MedicationDispense).dosageInstruction\n        | %resource.ofType(MedicationStatement).dosage\n      ).where(\n        timing.repeat.dayOfWeek.empty() and timing.repeat.when.exists() and timing.repeat.timeOfDay.empty()\n      ).count()\n    )\n  )\n)"
      }, {
        "key": "TimingBoundsUnitMatchesCode",
        "human": "boundsDuration.unit must match the UCUM boundsDuration.code (e.g. 'Woche(n)' only with code='wk').",
        "source": "http://ig.fhir.de/igs/medication/StructureDefinition/TimingDgMP",
        "severity": "error",
        "expression": "bounds.ofType(Duration).exists().not() or (\n  (\n    bounds.ofType(Duration).code = 'd'\n    implies \n    (\n      bounds.ofType(Duration).unit = 'Tag(e)' or\n      bounds.ofType(Duration).unit = 'Tag' or\n      bounds.ofType(Duration).unit = 'Tage'\n    )\n  ) and (\n    bounds.ofType(Duration).code = 'wk'\n    implies \n    (\n      bounds.ofType(Duration).unit = 'Woche(n)' or\n      bounds.ofType(Duration).unit = 'Woche' or\n      bounds.ofType(Duration).unit = 'Wochen'\n    )\n  ) and (\n    bounds.ofType(Duration).code = 'mo'\n    implies \n    (\n      bounds.ofType(Duration).unit = 'Monat(e)' or\n      bounds.ofType(Duration).unit = 'Monat' or\n      bounds.ofType(Duration).unit = 'Monate'\n    )\n  ) and (\n    bounds.ofType(Duration).code = 'a'\n    implies \n    (\n      bounds.ofType(Duration).unit = 'Jahr(e)' or\n      bounds.ofType(Duration).unit = 'Jahr' or\n      bounds.ofType(Duration).unit = 'Jahre'\n    )\n  )\n)"
      } ],
      "path": "Timing.repeat",
      "requirements": "Many timing schedules are determined by regular repetitions.",
      "min": 1,
      "definition": "Eine Menge von Regeln, die beschreiben, wann das Ereignis geplant ist.",
      "isModifier": false,
      "short": "Wann das Ereignis stattfinden soll",
      "mapping": [ {
        "map": "Implies PIVL or EIVL",
        "identity": "rim"
      } ],
      "type": [ {
        "code": "Element"
      } ],
      "mustSupport": true,
      "max": "1",
      "id": "Timing.repeat",
      "base": {
        "max": "1",
        "min": 0,
        "path": "Timing.repeat"
      },
      "isSummary": true
    }, {
      "path": "Timing.repeat.id",
      "min": 0,
      "definition": "Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.",
      "isModifier": false,
      "short": "Unique id for inter-element referencing",
      "mapping": [ {
        "map": "n/a",
        "identity": "rim"
      } ],
      "type": [ {
        "code": "http://hl7.org/fhirpath/System.String",
        "extension": [ {
          "url": "http://hl7.org/fhir/StructureDefinition/structuredefinition-fhir-type",
          "valueUrl": "string"
        } ]
      } ],
      "representation": [ "xmlAttr" ],
      "max": "1",
      "id": "Timing.repeat.id",
      "base": {
        "max": "1",
        "min": 0,
        "path": "Element.id"
      },
      "isSummary": false
    }, {
      "constraint": [ {
        "key": "ele-1",
        "human": "All FHIR elements must have a @value or children",
        "xpath": "@value|f:*|h:div",
        "source": "http://hl7.org/fhir/StructureDefinition/Element",
        "severity": "error",
        "expression": "hasValue() or (children().count() > id.count())"
      }, {
        "key": "ext-1",
        "human": "Must have either extensions or value[x], not both",
        "xpath": "exists(f:extension)!=exists(f:*[starts-with(local-name(.), \"value\")])",
        "source": "http://hl7.org/fhir/StructureDefinition/Extension",
        "severity": "error",
        "expression": "extension.exists() != value.exists()"
      } ],
      "path": "Timing.repeat.extension",
      "min": 0,
      "definition": "May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.",
      "isModifier": false,
      "short": "Additional content defined by implementations",
      "mapping": [ {
        "map": "n/a",
        "identity": "rim"
      } ],
      "slicing": {
        "rules": "open",
        "description": "Extensions are always sliced by (at least) url",
        "discriminator": [ {
          "path": "url",
          "type": "value"
        } ]
      },
      "type": [ {
        "code": "Extension"
      } ],
      "alias": [ "extensions", "user content" ],
      "max": "*",
      "id": "Timing.repeat.extension",
      "comment": "There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone.",
      "base": {
        "max": "*",
        "min": 0,
        "path": "Element.extension"
      },
      "isSummary": false
    }, {
      "constraint": [ {
        "key": "ele-1",
        "human": "All FHIR elements must have a @value or children",
        "xpath": "@value|f:*|h:div",
        "source": "http://hl7.org/fhir/StructureDefinition/Element",
        "severity": "error",
        "expression": "hasValue() or (children().count() > id.count())"
      } ],
      "path": "Timing.repeat.bounds[x]",
      "min": 0,
      "definition": "Entweder eine Dauer für die Länge des Zeitplans, ein Bereich möglicher Längen oder äußere Begrenzungen für Start- und/oder Endgrenzen des Zeitplans.",
      "isModifier": false,
      "short": "Länge/Bereich der Längen oder (Start- und/oder End-)Grenzen",
      "mapping": [ {
        "map": "IVL(TS) used in a QSI",
        "identity": "rim"
      } ],
      "slicing": {
        "rules": "closed",
        "ordered": false,
        "discriminator": [ {
          "path": "$this",
          "type": "type"
        } ]
      },
      "type": [ {
        "code": "Duration"
      }, {
        "code": "Period"
      } ],
      "mustSupport": true,
      "max": "1",
      "id": "Timing.repeat.bounds[x]",
      "comment": "Begründung Einschränkung Datentyp: Nur eine Angabe zur Dauer und Start- bzw. Enddatum sind in der aktuellen Ausbaustufe des dgMP vorgesehen, um die Komplexität zu reduzieren und die Übersichtlichkeit zu erhöhen.",
      "base": {
        "max": "1",
        "min": 0,
        "path": "Timing.repeat.bounds[x]"
      },
      "isSummary": true
    }, {
      "constraint": [ {
        "key": "ele-1",
        "human": "All FHIR elements must have a @value or children",
        "xpath": "@value|f:*|h:div",
        "source": "http://hl7.org/fhir/StructureDefinition/Element",
        "severity": "error",
        "expression": "hasValue() or (children().count() > id.count())"
      } ],
      "path": "Timing.repeat.bounds[x]",
      "min": 0,
      "definition": "Either a duration for the length of the timing schedule, a range of possible length, or outer bounds for start and/or end limits of the timing schedule.",
      "isModifier": false,
      "short": "Dauer der Dosieranweisung ausgedrückt in UCUM-Einheiten",
      "mapping": [ {
        "map": "IVL(TS) used in a QSI",
        "identity": "rim"
      } ],
      "type": [ {
        "code": "Duration"
      } ],
      "mustSupport": true,
      "sliceName": "boundsDuration",
      "max": "1",
      "id": "Timing.repeat.bounds[x]:boundsDuration",
      "base": {
        "max": "1",
        "min": 0,
        "path": "Timing.repeat.bounds[x]"
      },
      "isSummary": true
    }, {
      "path": "Timing.repeat.bounds[x].id",
      "min": 0,
      "definition": "Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.",
      "isModifier": false,
      "short": "Unique id for inter-element referencing",
      "mapping": [ {
        "map": "n/a",
        "identity": "rim"
      } ],
      "type": [ {
        "code": "http://hl7.org/fhirpath/System.String",
        "extension": [ {
          "url": "http://hl7.org/fhir/StructureDefinition/structuredefinition-fhir-type",
          "valueUrl": "string"
        } ]
      } ],
      "representation": [ "xmlAttr" ],
      "max": "1",
      "id": "Timing.repeat.bounds[x]:boundsDuration.id",
      "base": {
        "max": "1",
        "min": 0,
        "path": "Element.id"
      },
      "isSummary": false
    }, {
      "constraint": [ {
        "key": "ele-1",
        "human": "All FHIR elements must have a @value or children",
        "xpath": "@value|f:*|h:div",
        "source": "http://hl7.org/fhir/StructureDefinition/Element",
        "severity": "error",
        "expression": "hasValue() or (children().count() > id.count())"
      }, {
        "key": "ext-1",
        "human": "Must have either extensions or value[x], not both",
        "xpath": "exists(f:extension)!=exists(f:*[starts-with(local-name(.), \"value\")])",
        "source": "http://hl7.org/fhir/StructureDefinition/Extension",
        "severity": "error",
        "expression": "extension.exists() != value.exists()"
      } ],
      "path": "Timing.repeat.bounds[x].extension",
      "min": 0,
      "definition": "May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.",
      "isModifier": false,
      "short": "Additional content defined by implementations",
      "mapping": [ {
        "map": "n/a",
        "identity": "rim"
      } ],
      "slicing": {
        "rules": "open",
        "description": "Extensions are always sliced by (at least) url",
        "discriminator": [ {
          "path": "url",
          "type": "value"
        } ]
      },
      "type": [ {
        "code": "Extension"
      } ],
      "alias": [ "extensions", "user content" ],
      "max": "*",
      "id": "Timing.repeat.bounds[x]:boundsDuration.extension",
      "comment": "There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone.",
      "base": {
        "max": "*",
        "min": 0,
        "path": "Element.extension"
      },
      "isSummary": false
    }, {
      "constraint": [ {
        "key": "ele-1",
        "human": "All FHIR elements must have a @value or children",
        "xpath": "@value|f:*|h:div",
        "source": "http://hl7.org/fhir/StructureDefinition/Element",
        "severity": "error",
        "expression": "hasValue() or (children().count() > id.count())"
      } ],
      "path": "Timing.repeat.bounds[x].value",
      "requirements": "Precision is handled implicitly in almost all cases of measurement.",
      "min": 1,
      "definition": "The value of the measured amount. The value includes an implicit precision in the presentation of the value.",
      "isModifier": false,
      "short": "Numerical value (with implicit precision)",
      "mapping": [ {
        "map": "SN.2  / CQ - N/A",
        "identity": "v2"
      }, {
        "map": "PQ.value, CO.value, MO.value, IVL.high or IVL.low depending on the value",
        "identity": "rim"
      } ],
      "type": [ {
        "code": "decimal"
      } ],
      "mustSupport": true,
      "max": "1",
      "id": "Timing.repeat.bounds[x]:boundsDuration.value",
      "comment": "The implicit precision in the value should always be honored. Monetary values have their own rules for handling precision (refer to standard accounting text books).",
      "base": {
        "max": "1",
        "min": 0,
        "path": "Quantity.value"
      },
      "isSummary": true
    }, {
      "constraint": [ {
        "key": "ele-1",
        "human": "All FHIR elements must have a @value or children",
        "xpath": "@value|f:*|h:div",
        "source": "http://hl7.org/fhir/StructureDefinition/Element",
        "severity": "error",
        "expression": "hasValue() or (children().count() > id.count())"
      } ],
      "path": "Timing.repeat.bounds[x].comparator",
      "requirements": "Need a framework for handling measures where the value is <5ug/L or >400mg/L due to the limitations of measuring methodology.",
      "min": 0,
      "definition": "How the value should be understood and represented - whether the actual value is greater or less than the stated value due to measurement issues; e.g. if the comparator is \"<\" , then the real value is < stated value.",
      "isModifier": true,
      "short": "< | <= | >= | > - how to understand the value",
      "mapping": [ {
        "map": "SN.1  / CQ.1",
        "identity": "v2"
      }, {
        "map": "IVL properties",
        "identity": "rim"
      } ],
      "type": [ {
        "code": "code"
      } ],
      "meaningWhenMissing": "If there is no comparator, then there is no modification of the value",
      "binding": {
        "strength": "required",
        "valueSet": "http://hl7.org/fhir/ValueSet/quantity-comparator|4.0.1",
        "extension": [ {
          "url": "http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName",
          "valueString": "QuantityComparator"
        } ],
        "description": "How the Quantity should be understood and represented."
      },
      "max": "0",
      "id": "Timing.repeat.bounds[x]:boundsDuration.comparator",
      "base": {
        "max": "1",
        "min": 0,
        "path": "Quantity.comparator"
      },
      "isModifierReason": "This is labeled as \"Is Modifier\" because the comparator modifies the interpretation of the value significantly. If there is no comparator, then there is no modification of the value",
      "isSummary": true
    }, {
      "constraint": [ {
        "key": "ele-1",
        "human": "All FHIR elements must have a @value or children",
        "xpath": "@value|f:*|h:div",
        "source": "http://hl7.org/fhir/StructureDefinition/Element",
        "severity": "error",
        "expression": "hasValue() or (children().count() > id.count())"
      } ],
      "path": "Timing.repeat.bounds[x].unit",
      "requirements": "There are many representations for units of measure and in many contexts, particular representations are fixed and required. I.e. mcg for micrograms.",
      "min": 1,
      "definition": "A human-readable form of the unit.",
      "isModifier": false,
      "short": "Unit representation",
      "mapping": [ {
        "map": "(see OBX.6 etc.) / CQ.2",
        "identity": "v2"
      }, {
        "map": "PQ.unit",
        "identity": "rim"
      } ],
      "type": [ {
        "code": "string"
      } ],
      "mustSupport": true,
      "extension": [ {
        "url": "http://hl7.org/fhir/StructureDefinition/elementdefinition-translatable",
        "valueBoolean": true
      } ],
      "max": "1",
      "id": "Timing.repeat.bounds[x]:boundsDuration.unit",
      "base": {
        "max": "1",
        "min": 0,
        "path": "Quantity.unit"
      },
      "isSummary": true
    }, {
      "constraint": [ {
        "key": "ele-1",
        "human": "All FHIR elements must have a @value or children",
        "xpath": "@value|f:*|h:div",
        "source": "http://hl7.org/fhir/StructureDefinition/Element",
        "severity": "error",
        "expression": "hasValue() or (children().count() > id.count())"
      } ],
      "path": "Timing.repeat.bounds[x].system",
      "requirements": "Need to know the system that defines the coded form of the unit.",
      "min": 1,
      "definition": "The identification of the system that provides the coded form of the unit.",
      "isModifier": false,
      "short": "UCUM-Einheit für die Dauer",
      "fixedUri": "http://unitsofmeasure.org",
      "mapping": [ {
        "map": "(see OBX.6 etc.) / CQ.2",
        "identity": "v2"
      }, {
        "map": "CO.codeSystem, PQ.translation.codeSystem",
        "identity": "rim"
      } ],
      "type": [ {
        "code": "uri"
      } ],
      "mustSupport": true,
      "max": "1",
      "id": "Timing.repeat.bounds[x]:boundsDuration.system",
      "condition": [ "qty-3" ],
      "comment": "Die UCUM-Einheit für die Dauer, z. B. d für Tag, h für Stunde, min für Minute.",
      "base": {
        "max": "1",
        "min": 0,
        "path": "Quantity.system"
      },
      "isSummary": true
    }, {
      "constraint": [ {
        "key": "ele-1",
        "human": "All FHIR elements must have a @value or children",
        "xpath": "@value|f:*|h:div",
        "source": "http://hl7.org/fhir/StructureDefinition/Element",
        "severity": "error",
        "expression": "hasValue() or (children().count() > id.count())"
      } ],
      "path": "Timing.repeat.bounds[x].code",
      "requirements": "Need a computable form of the unit that is fixed across all forms. UCUM provides this for quantities, but SNOMED CT provides many units of interest.",
      "min": 1,
      "definition": "A computer processable form of the unit in some unit representation system.",
      "isModifier": false,
      "short": "Coded form of the unit",
      "mapping": [ {
        "map": "(see OBX.6 etc.) / CQ.2",
        "identity": "v2"
      }, {
        "map": "PQ.code, MO.currency, PQ.translation.code",
        "identity": "rim"
      } ],
      "type": [ {
        "code": "code"
      } ],
      "mustSupport": true,
      "binding": {
        "strength": "required",
        "valueSet": "http://ig.fhir.de/igs/medication/ValueSet/DosageUnitsOfTimeDgMP"
      },
      "max": "1",
      "id": "Timing.repeat.bounds[x]:boundsDuration.code",
      "comment": "The preferred system is UCUM, but SNOMED CT can also be used (for customary units) or ISO 4217 for currency.  The context of use may additionally require a code from a particular system.",
      "base": {
        "max": "1",
        "min": 0,
        "path": "Quantity.code"
      },
      "isSummary": true
    }, {
      "constraint": [ {
        "key": "ele-1",
        "human": "All FHIR elements must have a @value or children",
        "xpath": "@value|f:*|h:div",
        "source": "http://hl7.org/fhir/StructureDefinition/Element",
        "severity": "error",
        "expression": "hasValue() or (children().count() > id.count())"
      } ],
      "path": "Timing.repeat.bounds[x]",
      "min": 0,
      "definition": "Beschreibt die Gültigkeit einer Dosieranweisung mit einem konkreten Start- und/oder Endzeitpunkt. Neben einem Datum kann eine Uhrzeit mit Zeitzone angegeben werden.",
      "isModifier": false,
      "short": "Start- und Endzeitpunkt der Dosieranweisung.",
      "mapping": [ {
        "map": "IVL(TS) used in a QSI",
        "identity": "rim"
      } ],
      "type": [ {
        "code": "Period"
      } ],
      "mustSupport": true,
      "sliceName": "boundsPeriod",
      "max": "1",
      "id": "Timing.repeat.bounds[x]:boundsPeriod",
      "base": {
        "max": "1",
        "min": 0,
        "path": "Timing.repeat.bounds[x]"
      },
      "isSummary": true
    }, {
      "path": "Timing.repeat.bounds[x].id",
      "min": 0,
      "definition": "Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.",
      "isModifier": false,
      "short": "Unique id for inter-element referencing",
      "mapping": [ {
        "map": "n/a",
        "identity": "rim"
      } ],
      "type": [ {
        "code": "http://hl7.org/fhirpath/System.String",
        "extension": [ {
          "url": "http://hl7.org/fhir/StructureDefinition/structuredefinition-fhir-type",
          "valueUrl": "string"
        } ]
      } ],
      "representation": [ "xmlAttr" ],
      "max": "1",
      "id": "Timing.repeat.bounds[x]:boundsPeriod.id",
      "base": {
        "max": "1",
        "min": 0,
        "path": "Element.id"
      },
      "isSummary": false
    }, {
      "constraint": [ {
        "key": "ele-1",
        "human": "All FHIR elements must have a @value or children",
        "xpath": "@value|f:*|h:div",
        "source": "http://hl7.org/fhir/StructureDefinition/Element",
        "severity": "error",
        "expression": "hasValue() or (children().count() > id.count())"
      }, {
        "key": "ext-1",
        "human": "Must have either extensions or value[x], not both",
        "xpath": "exists(f:extension)!=exists(f:*[starts-with(local-name(.), \"value\")])",
        "source": "http://hl7.org/fhir/StructureDefinition/Extension",
        "severity": "error",
        "expression": "extension.exists() != value.exists()"
      } ],
      "path": "Timing.repeat.bounds[x].extension",
      "min": 0,
      "definition": "May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.",
      "isModifier": false,
      "short": "Additional content defined by implementations",
      "mapping": [ {
        "map": "n/a",
        "identity": "rim"
      } ],
      "slicing": {
        "rules": "open",
        "description": "Extensions are always sliced by (at least) url",
        "discriminator": [ {
          "path": "url",
          "type": "value"
        } ]
      },
      "type": [ {
        "code": "Extension"
      } ],
      "alias": [ "extensions", "user content" ],
      "max": "*",
      "id": "Timing.repeat.bounds[x]:boundsPeriod.extension",
      "comment": "There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone.",
      "base": {
        "max": "*",
        "min": 0,
        "path": "Element.extension"
      },
      "isSummary": false
    }, {
      "constraint": [ {
        "key": "ele-1",
        "human": "All FHIR elements must have a @value or children",
        "xpath": "@value|f:*|h:div",
        "source": "http://hl7.org/fhir/StructureDefinition/Element",
        "severity": "error",
        "expression": "hasValue() or (children().count() > id.count())"
      } ],
      "path": "Timing.repeat.bounds[x].start",
      "min": 0,
      "definition": "The start of the period. The boundary is inclusive.",
      "isModifier": false,
      "short": "Startdatum mit optionaler Uhrzeit und Zeitzone",
      "mapping": [ {
        "map": "DR.1",
        "identity": "v2"
      }, {
        "map": "./low",
        "identity": "rim"
      } ],
      "type": [ {
        "code": "dateTime"
      } ],
      "mustSupport": true,
      "max": "1",
      "id": "Timing.repeat.bounds[x]:boundsPeriod.start",
      "condition": [ "per-1" ],
      "comment": "If the low element is missing, the meaning is that the low boundary is not known.",
      "base": {
        "max": "1",
        "min": 0,
        "path": "Period.start"
      },
      "isSummary": true
    }, {
      "constraint": [ {
        "key": "ele-1",
        "human": "All FHIR elements must have a @value or children",
        "xpath": "@value|f:*|h:div",
        "source": "http://hl7.org/fhir/StructureDefinition/Element",
        "severity": "error",
        "expression": "hasValue() or (children().count() > id.count())"
      } ],
      "path": "Timing.repeat.bounds[x].end",
      "min": 0,
      "definition": "The end of the period. If the end of the period is missing, it means no end was known or planned at the time the instance was created. The start may be in the past, and the end date in the future, which means that period is expected/planned to end at that time.",
      "isModifier": false,
      "short": "Enddatum mit optionaler Uhrzeit und Zeitzone",
      "mapping": [ {
        "map": "DR.2",
        "identity": "v2"
      }, {
        "map": "./high",
        "identity": "rim"
      } ],
      "type": [ {
        "code": "dateTime"
      } ],
      "mustSupport": true,
      "meaningWhenMissing": "If the end of the period is missing, it means that the period is ongoing",
      "max": "1",
      "id": "Timing.repeat.bounds[x]:boundsPeriod.end",
      "condition": [ "per-1" ],
      "comment": "The high value includes any matching date/time. i.e. 2012-02-03T10:00:00 is in a period that has an end value of 2012-02-03.",
      "base": {
        "max": "1",
        "min": 0,
        "path": "Period.end"
      },
      "isSummary": true
    }, {
      "constraint": [ {
        "key": "ele-1",
        "human": "All FHIR elements must have a @value or children",
        "xpath": "@value|f:*|h:div",
        "source": "http://hl7.org/fhir/StructureDefinition/Element",
        "severity": "error",
        "expression": "hasValue() or (children().count() > id.count())"
      } ],
      "path": "Timing.repeat.count",
      "requirements": "Repetitions may be limited by end time or total occurrences.",
      "min": 0,
      "definition": "A total count of the desired number of repetitions across the duration of the entire timing specification. If countMax is present, this element indicates the lower bound of the allowed range of count values.",
      "isModifier": false,
      "short": "Number of times to repeat",
      "mapping": [ {
        "map": "PIVL.count",
        "identity": "rim"
      } ],
      "type": [ {
        "code": "positiveInt"
      } ],
      "max": "0",
      "id": "Timing.repeat.count",
      "comment": "Begründung Einschränkung Kardinalität: Wiederholungen sind in der ersten Ausbaustufe des dgMP nicht vorgesehen, um die Komplexität zu reduzieren und die Übersichtlichkeit zu erhöhen.",
      "base": {
        "max": "1",
        "min": 0,
        "path": "Timing.repeat.count"
      },
      "isSummary": true
    }, {
      "constraint": [ {
        "key": "ele-1",
        "human": "All FHIR elements must have a @value or children",
        "xpath": "@value|f:*|h:div",
        "source": "http://hl7.org/fhir/StructureDefinition/Element",
        "severity": "error",
        "expression": "hasValue() or (children().count() > id.count())"
      } ],
      "path": "Timing.repeat.countMax",
      "min": 0,
      "definition": "If present, indicates that the count is a range - so to perform the action between [count] and [countMax] times.",
      "isModifier": false,
      "short": "Maximum number of times to repeat",
      "mapping": [ {
        "map": "PIVL.count",
        "identity": "rim"
      } ],
      "type": [ {
        "code": "positiveInt"
      } ],
      "max": "0",
      "id": "Timing.repeat.countMax",
      "comment": "Begründung Einschränkung Kardinalität: Maximale Wiederholungen sind in der ersten Ausbaustufe des dgMP nicht vorgesehen, um die Komplexität zu reduzieren und die Übersichtlichkeit zu erhöhen.",
      "base": {
        "max": "1",
        "min": 0,
        "path": "Timing.repeat.countMax"
      },
      "isSummary": true
    }, {
      "constraint": [ {
        "key": "ele-1",
        "human": "All FHIR elements must have a @value or children",
        "xpath": "@value|f:*|h:div",
        "source": "http://hl7.org/fhir/StructureDefinition/Element",
        "severity": "error",
        "expression": "hasValue() or (children().count() > id.count())"
      } ],
      "path": "Timing.repeat.duration",
      "requirements": "Some activities are not instantaneous and need to be maintained for a period of time.",
      "min": 0,
      "definition": "How long this thing happens for when it happens. If durationMax is present, this element indicates the lower bound of the allowed range of the duration.",
      "isModifier": false,
      "short": "How long when it happens",
      "mapping": [ {
        "map": "PIVL.phase",
        "identity": "rim"
      } ],
      "type": [ {
        "code": "decimal"
      } ],
      "max": "0",
      "id": "Timing.repeat.duration",
      "comment": "Begründung Einschränkung Kardinalität: Angaben zur Dauer einer Einzelgabe sind in der ersten Ausbaustufe des dgMP nicht vorgesehen, um die Komplexität zu reduzieren und die Übersichtlichkeit zu erhöhen.",
      "base": {
        "max": "1",
        "min": 0,
        "path": "Timing.repeat.duration"
      },
      "isSummary": true
    }, {
      "constraint": [ {
        "key": "ele-1",
        "human": "All FHIR elements must have a @value or children",
        "xpath": "@value|f:*|h:div",
        "source": "http://hl7.org/fhir/StructureDefinition/Element",
        "severity": "error",
        "expression": "hasValue() or (children().count() > id.count())"
      } ],
      "path": "Timing.repeat.durationMax",
      "requirements": "Some activities are not instantaneous and need to be maintained for a period of time.",
      "min": 0,
      "definition": "If present, indicates that the duration is a range - so to perform the action between [duration] and [durationMax] time length.",
      "isModifier": false,
      "short": "How long when it happens (Max)",
      "mapping": [ {
        "map": "PIVL.phase",
        "identity": "rim"
      } ],
      "type": [ {
        "code": "decimal"
      } ],
      "max": "0",
      "id": "Timing.repeat.durationMax",
      "comment": "Begründung Einschränkung Kardinalität: Angaben zur maximalen Dauer einer Einzelgabe sind in der ersten Ausbaustufe desdgMP nicht vorgesehen, um die Komplexität zu reduzieren und die Übersichtlichkeit zu erhöhen.",
      "base": {
        "max": "1",
        "min": 0,
        "path": "Timing.repeat.durationMax"
      },
      "isSummary": true
    }, {
      "constraint": [ {
        "key": "ele-1",
        "human": "All FHIR elements must have a @value or children",
        "xpath": "@value|f:*|h:div",
        "source": "http://hl7.org/fhir/StructureDefinition/Element",
        "severity": "error",
        "expression": "hasValue() or (children().count() > id.count())"
      } ],
      "path": "Timing.repeat.durationUnit",
      "min": 0,
      "definition": "The units of time for the duration, in UCUM units.",
      "isModifier": false,
      "short": "s | min | h | d | wk | mo | a - unit of time (UCUM)",
      "mapping": [ {
        "map": "PIVL.phase.unit",
        "identity": "rim"
      } ],
      "type": [ {
        "code": "code"
      } ],
      "binding": {
        "strength": "required",
        "valueSet": "http://hl7.org/fhir/ValueSet/units-of-time|4.0.1",
        "extension": [ {
          "url": "http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName",
          "valueString": "UnitsOfTime"
        } ],
        "description": "A unit of time (units from UCUM)."
      },
      "max": "0",
      "id": "Timing.repeat.durationUnit",
      "comment": "Begründung Einschränkung Kardinalität: Angaben zur Einheit der Dauer einer Einzelgabe sind in der ersten Ausbaustufe desdgMP nicht vorgesehen, um die Komplexität zu reduzieren und die Übersichtlichkeit zu erhöhen.",
      "base": {
        "max": "1",
        "min": 0,
        "path": "Timing.repeat.durationUnit"
      },
      "isSummary": true
    }, {
      "constraint": [ {
        "key": "ele-1",
        "human": "All FHIR elements must have a @value or children",
        "xpath": "@value|f:*|h:div",
        "source": "http://hl7.org/fhir/StructureDefinition/Element",
        "severity": "error",
        "expression": "hasValue() or (children().count() > id.count())"
      } ],
      "path": "Timing.repeat.frequency",
      "min": 0,
      "definition": "Die Anzahl der Wiederholungen innerhalb des angegebenen Zeitraums. Falls frequencyMax vorhanden ist, gibt dieses Element die Untergrenze des zulässigen Bereichs der Häufigkeit an.",
      "isModifier": false,
      "short": "Ereignis tritt frequency-mal pro Zeitraum auf",
      "mapping": [ {
        "map": "PIVL.phase",
        "identity": "rim"
      } ],
      "type": [ {
        "code": "positiveInt"
      } ],
      "mustSupport": true,
      "meaningWhenMissing": "If no frequency is stated, the assumption is that the event occurs once per period, but systems SHOULD always be specific about this",
      "max": "1",
      "id": "Timing.repeat.frequency",
      "base": {
        "max": "1",
        "min": 0,
        "path": "Timing.repeat.frequency"
      },
      "isSummary": true
    }, {
      "constraint": [ {
        "key": "ele-1",
        "human": "All FHIR elements must have a @value or children",
        "xpath": "@value|f:*|h:div",
        "source": "http://hl7.org/fhir/StructureDefinition/Element",
        "severity": "error",
        "expression": "hasValue() or (children().count() > id.count())"
      } ],
      "path": "Timing.repeat.frequencyMax",
      "min": 0,
      "definition": "If present, indicates that the frequency is a range - so to repeat between [frequency] and [frequencyMax] times within the period or period range.",
      "isModifier": false,
      "short": "Event occurs up to frequencyMax times per period",
      "mapping": [ {
        "map": "PIVL.phase",
        "identity": "rim"
      } ],
      "type": [ {
        "code": "positiveInt"
      } ],
      "mustSupport": true,
      "max": "1",
      "id": "Timing.repeat.frequencyMax",
      "base": {
        "max": "1",
        "min": 0,
        "path": "Timing.repeat.frequencyMax"
      },
      "isSummary": true
    }, {
      "constraint": [ {
        "key": "ele-1",
        "human": "All FHIR elements must have a @value or children",
        "xpath": "@value|f:*|h:div",
        "source": "http://hl7.org/fhir/StructureDefinition/Element",
        "severity": "error",
        "expression": "hasValue() or (children().count() > id.count())"
      } ],
      "path": "Timing.repeat.period",
      "min": 0,
      "definition": "Gibt die Zeitspanne an, über die die Wiederholungen stattfinden sollen; z. B. um „3-mal täglich“ auszudrücken, wäre 3 die Häufigkeit und „1 Tag“ der Zeitraum. Falls periodMax vorhanden ist, gibt dieses Element die Untergrenze des zulässigen Bereichs der Zeitspanne an.",
      "isModifier": false,
      "short": "Ereignis tritt frequency-mal pro Zeitraum auf",
      "mapping": [ {
        "map": "PIVL.phase",
        "identity": "rim"
      } ],
      "type": [ {
        "code": "decimal"
      } ],
      "mustSupport": true,
      "max": "1",
      "id": "Timing.repeat.period",
      "base": {
        "max": "1",
        "min": 0,
        "path": "Timing.repeat.period"
      },
      "isSummary": true
    }, {
      "constraint": [ {
        "key": "ele-1",
        "human": "All FHIR elements must have a @value or children",
        "xpath": "@value|f:*|h:div",
        "source": "http://hl7.org/fhir/StructureDefinition/Element",
        "severity": "error",
        "expression": "hasValue() or (children().count() > id.count())"
      } ],
      "path": "Timing.repeat.periodMax",
      "min": 0,
      "definition": "If present, indicates that the period is a range from [period] to [periodMax], allowing expressing concepts such as \"do this once every 3-5 days.",
      "isModifier": false,
      "short": "Upper limit of period (3-4 hours)",
      "mapping": [ {
        "map": "PIVL.phase",
        "identity": "rim"
      } ],
      "type": [ {
        "code": "decimal"
      } ],
      "mustSupport": true,
      "max": "1",
      "id": "Timing.repeat.periodMax",
      "base": {
        "max": "1",
        "min": 0,
        "path": "Timing.repeat.periodMax"
      },
      "isSummary": true
    }, {
      "constraint": [ {
        "key": "ele-1",
        "human": "All FHIR elements must have a @value or children",
        "xpath": "@value|f:*|h:div",
        "source": "http://hl7.org/fhir/StructureDefinition/Element",
        "severity": "error",
        "expression": "hasValue() or (children().count() > id.count())"
      } ],
      "path": "Timing.repeat.periodUnit",
      "min": 0,
      "definition": "Die Zeiteinheit für den Zeitraum, in UCUM-Einheiten.",
      "isModifier": false,
      "short": "min | h | d | wk | mo - Zeiteinheit (UCUM)",
      "mapping": [ {
        "map": "PIVL.phase.unit",
        "identity": "rim"
      } ],
      "type": [ {
        "code": "code"
      } ],
      "mustSupport": true,
      "binding": {
        "strength": "required",
        "valueSet": "http://ig.fhir.de/igs/medication/ValueSet/PeriodUnitsOfTimeDgMP"
      },
      "max": "1",
      "id": "Timing.repeat.periodUnit",
      "base": {
        "max": "1",
        "min": 0,
        "path": "Timing.repeat.periodUnit"
      },
      "isSummary": true
    }, {
      "constraint": [ {
        "key": "ele-1",
        "human": "All FHIR elements must have a @value or children",
        "xpath": "@value|f:*|h:div",
        "source": "http://hl7.org/fhir/StructureDefinition/Element",
        "severity": "error",
        "expression": "hasValue() or (children().count() > id.count())"
      } ],
      "path": "Timing.repeat.dayOfWeek",
      "min": 0,
      "definition": "Wenn ein oder mehrere Wochentage angegeben sind, findet die Aktion nur an den angegebenen Tagen statt.",
      "isModifier": false,
      "short": "mon | tue | wed | thu | fri | sat | sun",
      "mapping": [ {
        "map": "n/a",
        "identity": "rim"
      } ],
      "type": [ {
        "code": "code"
      } ],
      "mustSupport": true,
      "binding": {
        "strength": "required",
        "valueSet": "http://hl7.org/fhir/ValueSet/days-of-week|4.0.1",
        "extension": [ {
          "url": "http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName",
          "valueString": "DayOfWeek"
        } ]
      },
      "max": "*",
      "id": "Timing.repeat.dayOfWeek",
      "comment": "Wenn keine Tage angegeben sind, wird angenommen, dass die Aktion an jedem Tag wie sonst angegeben stattfindet.",
      "base": {
        "max": "*",
        "min": 0,
        "path": "Timing.repeat.dayOfWeek"
      },
      "isSummary": true
    }, {
      "constraint": [ {
        "key": "ele-1",
        "human": "All FHIR elements must have a @value or children",
        "xpath": "@value|f:*|h:div",
        "source": "http://hl7.org/fhir/StructureDefinition/Element",
        "severity": "error",
        "expression": "hasValue() or (children().count() > id.count())"
      } ],
      "path": "Timing.repeat.timeOfDay",
      "min": 0,
      "definition": "Angegebene Tageszeit, zu der die Aktion stattfinden soll.",
      "isModifier": false,
      "short": "Tageszeit für die Aktion",
      "mapping": [ {
        "map": "n/a",
        "identity": "rim"
      } ],
      "type": [ {
        "code": "time"
      } ],
      "mustSupport": true,
      "max": "*",
      "id": "Timing.repeat.timeOfDay",
      "comment": "Wenn eine Tageszeit angegeben ist, wird angenommen, dass die Aktion jeden Tag (ggf. gefiltert durch dayOfWeek) zu den angegebenen Zeiten stattfindet.",
      "base": {
        "max": "*",
        "min": 0,
        "path": "Timing.repeat.timeOfDay"
      },
      "isSummary": true
    }, {
      "constraint": [ {
        "key": "ele-1",
        "human": "All FHIR elements must have a @value or children",
        "xpath": "@value|f:*|h:div",
        "source": "http://hl7.org/fhir/StructureDefinition/Element",
        "severity": "error",
        "expression": "hasValue() or (children().count() > id.count())"
      } ],
      "path": "Timing.repeat.when",
      "requirements": "Timings are frequently determined by occurrences such as waking, eating and sleep.",
      "min": 0,
      "definition": "Ein ungefährer Zeitraum während des Tages, der möglicherweise mit einem Ereignis des täglichen Lebens verknüpft ist und angibt, wann die Aktion stattfinden soll.",
      "isModifier": false,
      "short": "Code für den Zeitraum des Auftretens",
      "mapping": [ {
        "map": "EIVL.event",
        "identity": "rim"
      } ],
      "type": [ {
        "code": "code"
      } ],
      "mustSupport": true,
      "binding": {
        "strength": "required",
        "valueSet": "http://ig.fhir.de/igs/medication/ValueSet/TimingWhenDgMP"
      },
      "max": "*",
      "id": "Timing.repeat.when",
      "comment": "Wenn mehr als ein Ereignis angegeben ist, bezieht sich das Ereignis auf die Vereinigung der angegebenen Ereignisse.",
      "base": {
        "max": "*",
        "min": 0,
        "path": "Timing.repeat.when"
      },
      "isSummary": true
    }, {
      "constraint": [ {
        "key": "ele-1",
        "human": "All FHIR elements must have a @value or children",
        "xpath": "@value|f:*|h:div",
        "source": "http://hl7.org/fhir/StructureDefinition/Element",
        "severity": "error",
        "expression": "hasValue() or (children().count() > id.count())"
      } ],
      "path": "Timing.repeat.offset",
      "min": 0,
      "definition": "The number of minutes from the event. If the event code does not indicate whether the minutes is before or after the event, then the offset is assumed to be after the event.",
      "isModifier": false,
      "short": "Zeitversatz",
      "mapping": [ {
        "map": "EIVL.offset",
        "identity": "rim"
      } ],
      "type": [ {
        "code": "unsignedInt"
      } ],
      "max": "0",
      "id": "Timing.repeat.offset",
      "comment": "Begründung Einschränkung Kardinalität: Ein Zeitversatz ist in der ersten Ausbaustufe desdgMP nicht vorgesehen, um die Komplexität zu reduzieren und die Übersichtlichkeit zu erhöhen.",
      "base": {
        "max": "1",
        "min": 0,
        "path": "Timing.repeat.offset"
      },
      "isSummary": true
    }, {
      "constraint": [ {
        "key": "ele-1",
        "human": "All FHIR elements must have a @value or children",
        "xpath": "@value|f:*|h:div",
        "source": "http://hl7.org/fhir/StructureDefinition/Element",
        "severity": "error",
        "expression": "hasValue() or (children().count() > id.count())"
      } ],
      "path": "Timing.code",
      "min": 0,
      "definition": "A code for the timing schedule (or just text in code.text). Some codes such as BID are ubiquitous, but many institutions define their own additional codes. If a code is provided, the code is understood to be a complete statement of whatever is specified in the structured timing data, and either the code or the data may be used to interpret the Timing, with the exception that .repeat.bounds still applies over the code (and is not contained in the code).",
      "isModifier": false,
      "short": "BID | TID | QID | AM | PM | QD | QOD | +",
      "mapping": [ {
        "map": "QSC.code",
        "identity": "rim"
      } ],
      "type": [ {
        "code": "CodeableConcept"
      } ],
      "binding": {
        "strength": "preferred",
        "valueSet": "http://hl7.org/fhir/ValueSet/timing-abbreviation|4.0.1",
        "extension": [ {
          "url": "http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName",
          "valueString": "TimingAbbreviation"
        } ],
        "description": "Code for a known / defined timing pattern."
      },
      "max": "0",
      "id": "Timing.code",
      "comment": "Begründung Einschränkung Kardinalität: Ein Timing-Code ist in der ersten Ausbaustufe des dgMP nicht vorgesehen, um die Komplexität zu reduzieren und die Übersichtlichkeit zu erhöhen. Stattdessen muss das Zeitmuster explizit strukturiert angegeben werden.",
      "base": {
        "max": "1",
        "min": 0,
        "path": "Timing.code"
      },
      "isSummary": true
    } ],
    "extension": [ {
      "url": "http://hl7.org/fhir/tools/StructureDefinition/snapshot-base-version",
      "valueString": "2.0.0-ballot"
    } ]
  },
  "status": "active",
  "id": "345a1065-de39-4d36-88bc-de8d876df58f",
  "kind": "complex-type",
  "url": "http://ig.fhir.de/igs/medication/StructureDefinition/TimingDgMP",
  "version": "2.0.0-ballot",
  "differential": {
    "element": [ {
      "id": "Timing",
      "path": "Timing",
      "constraint": [ {
        "key": "TimingOnlyOnePeriodForDayOfWeek",
        "human": "In a schema that combines dayOfWeek with either timeOfDay or when, each combination of weekday and time must be unique across all Dosage elements of a resource.",
        "source": "http://ig.fhir.de/igs/medication/StructureDefinition/TimingDgMP",
        "severity": "error",
        "expression": "( /* Detect DayOfWeek and Time/4-Schema */\n  %resource.ofType(MedicationRequest).dosageInstruction\n  | %resource.ofType(MedicationDispense).dosageInstruction\n  | %resource.ofType(MedicationStatement).dosage\n).all(\n  (\n    timing.repeat.dayOfWeek.exists() and\n      (\n        (timing.repeat.timeOfDay.exists() and timing.repeat.when.empty()) or\n        (timing.repeat.when.exists() and timing.repeat.timeOfDay.empty())\n      )\n  )\n  implies\n  (\n    (\n      (%resource.ofType(MedicationRequest).exists() or %resource.ofType(MedicationDispense).exists())\n      implies\n      (\n        /* For each day of week */\n        /* if Mon occurs multiple times */\n        ((%resource.dosageInstruction.timing.repeat.dayOfWeek.where($this = 'mon').count() > 1) implies \n        (\n          (%resource.dosageInstruction.timing.repeat.where('mon' in dayOfWeek).when.distinct().count() = %resource.dosageInstruction.timing.repeat.where('mon' in dayOfWeek).when.count()) and\n          (%resource.dosageInstruction.timing.repeat.where('mon' in dayOfWeek).timeOfDay.distinct().count() = %resource.dosageInstruction.timing.repeat.where('mon' in dayOfWeek).timeOfDay.count())\n        )) and\n        \n        /* if tue occurs multiple times */\n        ((%resource.dosageInstruction.timing.repeat.dayOfWeek.where($this = 'tue').count() > 1) implies \n        (\n          (%resource.dosageInstruction.timing.repeat.where('tue' in dayOfWeek).when.distinct().count() = %resource.dosageInstruction.timing.repeat.where('tue' in dayOfWeek).when.count()) and\n          (%resource.dosageInstruction.timing.repeat.where('tue' in dayOfWeek).timeOfDay.distinct().count() = %resource.dosageInstruction.timing.repeat.where('tue' in dayOfWeek).timeOfDay.count())\n        )) and\n        /* if wed occurs multiple times */\n        ((%resource.dosageInstruction.timing.repeat.dayOfWeek.where($this = 'wed').count() > 1) implies \n        (\n          (%resource.dosageInstruction.timing.repeat.where('wed' in dayOfWeek).when.distinct().count() = %resource.dosageInstruction.timing.repeat.where('wed' in dayOfWeek).when.count()) and\n          (%resource.dosageInstruction.timing.repeat.where('wed' in dayOfWeek).timeOfDay.distinct().count() = %resource.dosageInstruction.timing.repeat.where('wed' in dayOfWeek).timeOfDay.count())\n        )) and\n        /* if thu occurs multiple times */\n        ((%resource.dosageInstruction.timing.repeat.dayOfWeek.where($this = 'thu').count() > 1) implies \n        (\n          (%resource.dosageInstruction.timing.repeat.where('thu' in dayOfWeek).when.distinct().count() = %resource.dosageInstruction.timing.repeat.where('thu' in dayOfWeek).when.count()) and\n          (%resource.dosageInstruction.timing.repeat.where('thu' in dayOfWeek).timeOfDay.distinct().count() = %resource.dosageInstruction.timing.repeat.where('thu' in dayOfWeek).timeOfDay.count())\n        )) and\n        /* if fri occurs multiple times */\n        ((%resource.dosageInstruction.timing.repeat.dayOfWeek.where($this = 'fri').count() > 1) implies \n        (\n          (%resource.dosageInstruction.timing.repeat.where('fri' in dayOfWeek).when.distinct().count() = %resource.dosageInstruction.timing.repeat.where('fri' in dayOfWeek).when.count()) and\n          (%resource.dosageInstruction.timing.repeat.where('fri' in dayOfWeek).timeOfDay.distinct().count() = %resource.dosageInstruction.timing.repeat.where('fri' in dayOfWeek).timeOfDay.count())\n        )) and\n        /* if sat occurs multiple times */\n        ((%resource.dosageInstruction.timing.repeat.dayOfWeek.where($this = 'sat').count() > 1) implies \n        (\n          (%resource.dosageInstruction.timing.repeat.where('sat' in dayOfWeek).when.distinct().count() = %resource.dosageInstruction.timing.repeat.where('sat' in dayOfWeek).when.count()) and\n          (%resource.dosageInstruction.timing.repeat.where('sat' in dayOfWeek).timeOfDay.distinct().count() = %resource.dosageInstruction.timing.repeat.where('sat' in dayOfWeek).timeOfDay.count())\n        )) and\n        \n        /* if sun occurs multiple times */\n        ((%resource.dosageInstruction.timing.repeat.dayOfWeek.where($this = 'sun').count() > 1) implies \n        (\n          (%resource.dosageInstruction.timing.repeat.where('sun' in dayOfWeek).when.distinct().count() = %resource.dosageInstruction.timing.repeat.where('sun' in dayOfWeek).when.count()) and\n          (%resource.dosageInstruction.timing.repeat.where('sun' in dayOfWeek).timeOfDay.distinct().count() = %resource.dosageInstruction.timing.repeat.where('sun' in dayOfWeek).timeOfDay.count())\n        ))\n      )\n    )\n    and\n    (\n      %resource.ofType(MedicationStatement).exists()\n      implies\n      (\n        /* For each day of week */\n        /* if Mon occurs multiple times */\n        ((%resource.dosage.timing.repeat.dayOfWeek.where($this = 'mon').count() > 1) implies \n        (\n          (%resource.dosage.timing.repeat.where('mon' in dayOfWeek).when.distinct().count() = %resource.dosage.timing.repeat.where('mon' in dayOfWeek).when.count()) and\n          (%resource.dosage.timing.repeat.where('mon' in dayOfWeek).timeOfDay.distinct().count() = %resource.dosage.timing.repeat.where('mon' in dayOfWeek).timeOfDay.count())\n        )) and\n        \n        /* if tue occurs multiple times */\n        ((%resource.dosage.timing.repeat.dayOfWeek.where($this = 'tue').count() > 1) implies \n        (\n          (%resource.dosage.timing.repeat.where('tue' in dayOfWeek).when.distinct().count() = %resource.dosage.timing.repeat.where('tue' in dayOfWeek).when.count()) and\n          (%resource.dosage.timing.repeat.where('tue' in dayOfWeek).timeOfDay.distinct().count() = %resource.dosage.timing.repeat.where('tue' in dayOfWeek).timeOfDay.count())\n        )) and\n        /* if wed occurs multiple times */\n        ((%resource.dosage.timing.repeat.dayOfWeek.where($this = 'wed').count() > 1) implies \n        (\n          (%resource.dosage.timing.repeat.where('wed' in dayOfWeek).when.distinct().count() = %resource.dosage.timing.repeat.where('wed' in dayOfWeek).when.count()) and\n          (%resource.dosage.timing.repeat.where('wed' in dayOfWeek).timeOfDay.distinct().count() = %resource.dosage.timing.repeat.where('wed' in dayOfWeek).timeOfDay.count())\n        )) and\n        /* if thu occurs multiple times */\n        ((%resource.dosage.timing.repeat.dayOfWeek.where($this = 'thu').count() > 1) implies \n        (\n          (%resource.dosage.timing.repeat.where('thu' in dayOfWeek).when.distinct().count() = %resource.dosage.timing.repeat.where('thu' in dayOfWeek).when.count()) and\n          (%resource.dosage.timing.repeat.where('thu' in dayOfWeek).timeOfDay.distinct().count() = %resource.dosage.timing.repeat.where('thu' in dayOfWeek).timeOfDay.count())\n        )) and\n        /* if fri occurs multiple times */\n        ((%resource.dosage.timing.repeat.dayOfWeek.where($this = 'fri').count() > 1) implies \n        (\n          (%resource.dosage.timing.repeat.where('fri' in dayOfWeek).when.distinct().count() = %resource.dosage.timing.repeat.where('fri' in dayOfWeek).when.count()) and\n          (%resource.dosage.timing.repeat.where('fri' in dayOfWeek).timeOfDay.distinct().count() = %resource.dosage.timing.repeat.where('fri' in dayOfWeek).timeOfDay.count())\n        )) and\n        /* if sat occurs multiple times */\n        ((%resource.dosage.timing.repeat.dayOfWeek.where($this = 'sat').count() > 1) implies \n        (\n          (%resource.dosage.timing.repeat.where('sat' in dayOfWeek).when.distinct().count() = %resource.dosage.timing.repeat.where('sat' in dayOfWeek).when.count()) and\n          (%resource.dosage.timing.repeat.where('sat' in dayOfWeek).timeOfDay.distinct().count() = %resource.dosage.timing.repeat.where('sat' in dayOfWeek).timeOfDay.count())\n        )) and\n        \n        /* if sun occurs multiple times */\n        ((%resource.dosage.timing.repeat.dayOfWeek.where($this = 'sun').count() > 1) implies \n        (\n          (%resource.dosage.timing.repeat.where('sun' in dayOfWeek).when.distinct().count() = %resource.dosage.timing.repeat.where('sun' in dayOfWeek).when.count()) and\n          (%resource.dosage.timing.repeat.where('sun' in dayOfWeek).timeOfDay.distinct().count() = %resource.dosage.timing.repeat.where('sun' in dayOfWeek).timeOfDay.count())\n        ))\n      )\n    )\n  )\n)"
      } ]
    }, {
      "id": "Timing.event",
      "max": "0",
      "path": "Timing.event",
      "comment": "Begründung Einschränkung Kardinalität: Der Zeitpunkt des Ereignisses ist in der ersten Ausbaustufe des dgMP nicht vorgesehen, um die Komplexität zu reduzieren und die Übersichtlichkeit zu erhöhen."
    }, {
      "id": "Timing.repeat",
      "min": 1,
      "path": "Timing.repeat",
      "constraint": [ {
        "key": "TimingOnlyOneType",
        "human": "Exactly one of the supported timing schemas is allowed. With dayOfWeek, frequency and the pair period = 1 and periodUnit = wk are optional redundant legacy statements; they do not constitute an interval schema. With when or timeOfDay, frequency is optional; a non-daily period distinguishes the daily schema from a time interval combined with a time-of-day or clock-time reference. A variable frequency (frequencyMax) is reserved for the pure interval, because concrete times or weekdays already determine the number of administrations.",
        "source": "http://ig.fhir.de/igs/medication/StructureDefinition/TimingDgMP",
        "severity": "error",
        "expression": "/* DayOfWeek only; legacy frequency and the exact 1 wk pair are optional */\n(\n  %resource.ofType(MedicationRequest).dosageInstruction |\n  %resource.ofType(MedicationDispense).dosageInstruction |\n  %resource.ofType(MedicationStatement).dosage\n).all(\n  timing.repeat.dayOfWeek.exists() and\n  timing.repeat.when.empty() and\n  timing.repeat.timeOfDay.empty() and\n  timing.repeat.frequencyMax.empty() and\n  timing.repeat.periodMax.empty() and\n  (\n    (timing.repeat.period.empty() and timing.repeat.periodUnit.empty()) or\n    (timing.repeat.period = 1 and timing.repeat.periodUnit = 'wk')\n  )\n) or\n\n/* Interval only (frequency + period + periodUnit, no when/timeOfDay/dayOfWeek) */\n(\n  %resource.ofType(MedicationRequest).dosageInstruction |\n  %resource.ofType(MedicationDispense).dosageInstruction |\n  %resource.ofType(MedicationStatement).dosage\n).all(\n  timing.repeat.frequency.exists() and\n  timing.repeat.period.exists() and\n  timing.repeat.periodUnit.exists() and\n  timing.repeat.when.empty() and\n  timing.repeat.timeOfDay.empty() and\n  timing.repeat.dayOfWeek.empty()\n) or\n\n/* DayOfWeek and Time/4-Schema; legacy frequency and the exact 1 wk pair are optional */\n(\n  %resource.ofType(MedicationRequest).dosageInstruction | \n  %resource.ofType(MedicationDispense).dosageInstruction | \n  %resource.ofType(MedicationStatement).dosage\n).all(\n  timing.repeat.dayOfWeek.exists() and\n  (\n    (timing.repeat.timeOfDay.exists() and timing.repeat.when.empty()) or\n    (timing.repeat.when.exists() and timing.repeat.timeOfDay.empty())\n  ) and\n  timing.repeat.frequencyMax.empty() and\n  timing.repeat.periodMax.empty() and\n  (\n    (timing.repeat.period.empty() and timing.repeat.periodUnit.empty()) or\n    (timing.repeat.period = 1 and timing.repeat.periodUnit = 'wk')\n  )\n) or\n\n/* Daily When or TimeOfDay; frequency is optional, a variable frequency is not */\n(\n  %resource.ofType(MedicationRequest).dosageInstruction |\n  %resource.ofType(MedicationDispense).dosageInstruction |\n  %resource.ofType(MedicationStatement).dosage\n).all(\n  timing.repeat.dayOfWeek.empty() and\n  (\n    (timing.repeat.timeOfDay.exists() and timing.repeat.when.empty()) or\n    (timing.repeat.when.exists() and timing.repeat.timeOfDay.empty())\n  ) and\n  timing.repeat.frequencyMax.empty() and\n  timing.repeat.periodMax.empty() and\n  (\n    (timing.repeat.period.empty() and timing.repeat.periodUnit.empty()) or\n    (timing.repeat.period = 1 and timing.repeat.periodUnit = 'd')\n  )\n) or\n\n/* Non-daily interval combined with When or TimeOfDay; frequency is optional, a\n   variable frequency is not */\n(\n  %resource.ofType(MedicationRequest).dosageInstruction |\n  %resource.ofType(MedicationDispense).dosageInstruction |\n  %resource.ofType(MedicationStatement).dosage\n).all(\n  timing.repeat.dayOfWeek.empty() and\n  (\n    (timing.repeat.timeOfDay.exists() and timing.repeat.when.empty()) or\n    (timing.repeat.when.exists() and timing.repeat.timeOfDay.empty())\n  ) and\n  timing.repeat.frequencyMax.empty() and\n  timing.repeat.period.exists() and\n  timing.repeat.periodUnit.exists() and\n  (timing.repeat.periodUnit = 'd' or timing.repeat.periodUnit = 'wk' or timing.repeat.periodUnit = 'mo') and\n  (\n    timing.repeat.periodUnit != 'd' or\n    timing.repeat.period != 1 or\n    timing.repeat.periodMax.exists()\n  )\n)"
      }, {
        "key": "TimingIntervalOnlyOneFrequency",
        "human": "If a dosage is defined by a pure interval, only one Dosage element is allowed in the resource.",
        "source": "http://ig.fhir.de/igs/medication/StructureDefinition/TimingDgMP",
        "severity": "error",
        "expression": "( /* Detect Interval */\n  %resource.ofType(MedicationRequest).dosageInstruction\n  | %resource.ofType(MedicationDispense).dosageInstruction\n  | %resource.ofType(MedicationStatement).dosage\n)\n.all(\n  (\n    timing.repeat.frequency.exists()\n    and timing.repeat.period.exists()\n    and timing.repeat.periodUnit.exists()\n    and timing.repeat.when.empty()\n    and timing.repeat.timeOfDay.empty()\n    and timing.repeat.dayOfWeek.empty()\n  )\n  /* Only One Dosage allowed for Interval */\n  implies\n  (\n    (\n      (\n        %resource.ofType(MedicationRequest).exists()\n        or %resource.ofType(MedicationDispense).exists()\n      )\n      implies (\n        %resource.dosageInstruction.count() = 1\n      )\n    )\n    and\n    (\n      %resource.ofType(MedicationStatement).exists()\n      implies\n      %resource.dosage.count() = 1\n    )\n  )\n)"
      }, {
        "key": "TimingOnlyOneWhen",
        "human": "In a schema that uses only when, no part of the day may occur in more than one Dosage element of a resource.",
        "source": "http://ig.fhir.de/igs/medication/StructureDefinition/TimingDgMP",
        "severity": "error",
        "expression": "( /* Detect when-based schema */\n  %resource.ofType(MedicationRequest).dosageInstruction\n  | %resource.ofType(MedicationDispense).dosageInstruction\n  | %resource.ofType(MedicationStatement).dosage\n).all(\n    timing.repeat.dayOfWeek.empty() and\n    timing.repeat.when.exists() and\n    timing.repeat.timeOfDay.empty()\n  implies\n  (\n    (\n      (%resource.ofType(MedicationRequest).exists() or %resource.ofType(MedicationDispense).exists())\n      implies\n      (%resource.dosageInstruction.timing.repeat.when.distinct().count() = %resource.dosageInstruction.timing.repeat.when.count())\n    )\n    and\n    (\n      %resource.ofType(MedicationStatement).exists()\n      implies\n      (%resource.dosage.timing.repeat.when.distinct().count() = %resource.dosage.timing.repeat.when.count())\n    )\n  )\n)"
      }, {
        "key": "TimingOnlyWhenOrTimeOfDay",
        "human": "The Dosage elements of a resource must not mix a time of day (timeOfDay) and a part of the day (when).",
        "source": "http://ig.fhir.de/igs/medication/StructureDefinition/TimingDgMP",
        "severity": "error",
        "expression": "(\n  %resource.ofType(MedicationRequest).dosageInstruction\n  | %resource.ofType(MedicationDispense).dosageInstruction\n  | %resource.ofType(MedicationStatement).dosage\n).all(\n    (timing.repeat.when.exists() or \n    timing.repeat.timeOfDay.exists())\n  implies\n  (\n    (\n      (%resource.ofType(MedicationRequest).exists() or %resource.ofType(MedicationDispense).exists())\n      implies\n      (%resource.dosageInstruction.timing.repeat.when.exists() xor %resource.dosageInstruction.timing.repeat.timeOfDay.exists())\n    )\n    and\n    (\n      %resource.ofType(MedicationStatement).exists()\n      implies\n      (%resource.dosage.timing.repeat.when.exists() xor %resource.dosage.timing.repeat.timeOfDay.exists())\n    )\n  )\n)"
      }, {
        "key": "TimingOnlyOneTimeOfDay",
        "human": "In a schema that uses only timeOfDay, no time of day may occur in more than one Dosage element of a resource.",
        "source": "http://ig.fhir.de/igs/medication/StructureDefinition/TimingDgMP",
        "severity": "error",
        "expression": "( /* Detect TimeOfDay */\n  %resource.ofType(MedicationRequest).dosageInstruction\n  | %resource.ofType(MedicationDispense).dosageInstruction\n  | %resource.ofType(MedicationStatement).dosage\n).all(\n  (\n    timing.repeat.dayOfWeek.empty() and\n    timing.repeat.timeOfDay.exists() and\n    timing.repeat.when.empty() \n  )\n  implies\n  (\n    (\n      (%resource.ofType(MedicationRequest).exists() or %resource.ofType(MedicationDispense).exists())\n      implies\n      (%resource.dosageInstruction.timing.repeat.timeOfDay.distinct().count() = %resource.dosageInstruction.timing.repeat.timeOfDay.count())\n    )\n    and\n    (\n      %resource.ofType(MedicationStatement).exists()\n      implies\n      (%resource.dosage.timing.repeat.timeOfDay.distinct().count() = %resource.dosage.timing.repeat.timeOfDay.count())\n    )\n  )\n)"
      }, {
        "key": "TimingOnlyOneDayOfWeek",
        "human": "In a schema that uses only dayOfWeek, no weekday may occur in more than one Dosage element of a resource.",
        "source": "http://ig.fhir.de/igs/medication/StructureDefinition/TimingDgMP",
        "severity": "error",
        "expression": "( /* Detect DayOfWeek */\n  %resource.ofType(MedicationRequest).dosageInstruction\n  | %resource.ofType(MedicationDispense).dosageInstruction\n  | %resource.ofType(MedicationStatement).dosage\n).all(\n  (\n    timing.repeat.dayOfWeek.exists() and\n    timing.repeat.when.empty() and \n    timing.repeat.timeOfDay.empty()\n  )\n  implies\n  (\n    (\n      (%resource.ofType(MedicationRequest).exists() or %resource.ofType(MedicationDispense).exists())\n      implies\n      (%resource.dosageInstruction.timing.repeat.dayOfWeek.distinct().count() = %resource.dosageInstruction.timing.repeat.dayOfWeek.count())\n    )\n    and\n    (\n      %resource.ofType(MedicationStatement).exists()\n      implies\n      (%resource.dosage.timing.repeat.dayOfWeek.distinct().count() = %resource.dosage.timing.repeat.dayOfWeek.count())\n    )\n  )\n)"
      }, {
        "key": "TimingOnlyOneTimeForInterval",
        "human": "In a schema that combines an interval with timeOfDay or when, all Dosage elements of a resource must use the same period and periodUnit, and each timeOfDay or when value must be unique across them.",
        "source": "http://ig.fhir.de/igs/medication/StructureDefinition/TimingDgMP",
        "severity": "error",
        "expression": "/* Detect Interval and Time/4-Schema */\n(\n  %resource.ofType(MedicationRequest).dosageInstruction\n  | %resource.ofType(MedicationDispense).dosageInstruction\n  | %resource.ofType(MedicationStatement).dosage\n)\n.all(\n  (\n    timing.repeat.period.exists() and\n    timing.repeat.periodUnit.exists() and\n    timing.repeat.dayOfWeek.empty() and\n    (\n      (timing.repeat.timeOfDay.exists() and timing.repeat.when.empty()) or\n      (timing.repeat.when.exists() and timing.repeat.timeOfDay.empty())\n    )\n  )\n  implies\n  (\n    (\n      %resource.ofType(MedicationRequest).exists()\n      or %resource.ofType(MedicationDispense).exists()\n    )\n    implies\n    (\n      %resource.dosageInstruction.timing.repeat.period.distinct().count() = 1\n      and %resource.dosageInstruction.timing.repeat.periodUnit.distinct().count() = 1\n    )\n    and\n    (\n      (%resource.dosageInstruction.timing.repeat.timeOfDay.distinct().count() = %resource.dosageInstruction.timing.repeat.timeOfDay.count())\n      and\n      (%resource.dosageInstruction.timing.repeat.when.distinct().count() = %resource.dosageInstruction.timing.repeat.when.count())\n    )\n  )\n  and\n  (\n    %resource.ofType(MedicationStatement).exists()\n    implies\n    (\n      (\n        %resource.dosage.timing.repeat.period.distinct().count() = 1\n        and %resource.dosage.timing.repeat.periodUnit.distinct().count() = 1\n      )\n      and\n      (\n        (%resource.dosage.timing.repeat.timeOfDay.distinct().count() = %resource.dosage.timing.repeat.timeOfDay.count())\n        and\n        (%resource.dosage.timing.repeat.when.distinct().count() = %resource.dosage.timing.repeat.when.count())\n      )\n    )\n  )\n)"
      }, {
        "key": "TimingOnlyOneBounds",
        "human": "All Dosage elements of a resource must state the same bounds (Duration or Period), and either all of them carry a bounds or none.",
        "source": "http://ig.fhir.de/igs/medication/StructureDefinition/TimingDgMP",
        "severity": "error",
        "expression": "(\n  %resource.ofType(MedicationRequest).dosageInstruction\n  | %resource.ofType(MedicationDispense).dosageInstruction\n  | %resource.ofType(MedicationStatement).dosage\n).all(\n  (\n    ( /* only one different value and code are allowed*/\n      (%resource.ofType(MedicationRequest).exists() or %resource.ofType(MedicationDispense).exists())\n      implies\n      %resource.dosageInstruction.timing.repeat.bounds.ofType(Duration).exists().not() or\n      (\n        (%resource.dosageInstruction.timing.repeat.bounds.ofType(Duration).value.distinct().count() = 1)\n        and\n        (%resource.dosageInstruction.timing.repeat.bounds.ofType(Duration).code.distinct().count() = 1)\n      )\n    )\n    and\n    (\n      %resource.ofType(MedicationStatement).exists()\n      implies\n      %resource.dosage.timing.repeat.bounds.ofType(Duration).exists().not() or\n      (\n        (%resource.dosage.timing.repeat.bounds.ofType(Duration).value.distinct().count() = 1)\n        and\n        (%resource.dosage.timing.repeat.bounds.ofType(Duration).code.distinct().count() = 1)\n      )\n    )\n    and\n    ( /* boundsPeriod: Start und Ende müssen ebenfalls über alle Dosierungen gleich sein.\n         Die Textgenerierung liest den Zeitrahmen nur aus dem ersten Dosage-Element. */\n      (%resource.ofType(MedicationRequest).exists() or %resource.ofType(MedicationDispense).exists())\n      implies\n      %resource.dosageInstruction.timing.repeat.bounds.ofType(Period).exists().not() or\n      (\n        (%resource.dosageInstruction.timing.repeat.bounds.ofType(Period).start.distinct().count() <= 1)\n        and\n        (%resource.dosageInstruction.timing.repeat.bounds.ofType(Period).end.distinct().count() <= 1)\n      )\n    )\n    and\n    (\n      %resource.ofType(MedicationStatement).exists()\n      implies\n      %resource.dosage.timing.repeat.bounds.ofType(Period).exists().not() or\n      (\n        (%resource.dosage.timing.repeat.bounds.ofType(Period).start.distinct().count() <= 1)\n        and\n        (%resource.dosage.timing.repeat.bounds.ofType(Period).end.distinct().count() <= 1)\n      )\n    )\n  )\n  and\n  ( /* Entweder alle Dosage-Elemente tragen einen Zeitrahmen oder keines. Die\n       Textgenerierung liest ihn nur aus dem ersten Element; ein Element ohne\n       Zeitrahmen wuerde sonst stillschweigend als begrenzt dargestellt. */\n    (\n      (\n        %resource.ofType(MedicationRequest).dosageInstruction |\n        %resource.ofType(MedicationDispense).dosageInstruction |\n        %resource.ofType(MedicationStatement).dosage\n      ).timing.repeat.bounds.exists()\n    )\n    implies\n    (\n      (\n        %resource.ofType(MedicationRequest).dosageInstruction |\n        %resource.ofType(MedicationDispense).dosageInstruction |\n        %resource.ofType(MedicationStatement).dosage\n      ).all(timing.repeat.bounds.exists())\n    )\n  )\n)"
      }, {
        "key": "TimingFrequencyCount",
        "human": "If frequency is given together with when, timeOfDay or dayOfWeek, its value must match the number of concrete administrations.",
        "source": "http://ig.fhir.de/igs/medication/StructureDefinition/TimingDgMP",
        "severity": "error",
        "expression": "(when.exists() and dayOfWeek.empty() and frequency.exists() implies when.count() = frequency)\nand\n(when.exists() and dayOfWeek.exists() and frequency.exists() implies (when.count() * dayOfWeek.count()) = frequency)\nand\n(timeOfDay.exists() and dayOfWeek.empty() and frequency.exists() implies timeOfDay.count() = frequency)\nand\n(timeOfDay.exists() and dayOfWeek.exists() and frequency.exists() implies (timeOfDay.count() * dayOfWeek.count()) = frequency)\nand\n(dayOfWeek.exists() and timeOfDay.empty() and when.empty() and frequency.exists() implies dayOfWeek.count() = frequency)"
      }, {
        "key": "TimingPeriodUnit",
        "human": "periodUnit may only be given together with period. With dayOfWeek, only the redundant weekly statement is allowed; with when or timeOfDay without dayOfWeek, days, weeks or months are allowed.",
        "source": "http://ig.fhir.de/igs/medication/StructureDefinition/TimingDgMP",
        "severity": "error",
        "expression": "periodUnit.empty() or (\n  period.exists() and\n  (\n    (dayOfWeek.exists() and periodUnit = 'wk') or\n    (\n      dayOfWeek.empty() and\n      (\n        (when.empty() and timeOfDay.empty()) or\n        periodUnit = 'd' or\n        periodUnit = 'wk' or\n        periodUnit = 'mo'\n      )\n    )\n  )\n)"
      }, {
        "key": "TimingPeriodOnlyWholeNumber",
        "human": "period and periodMax must be whole numbers; decimal values are not allowed.",
        "source": "http://ig.fhir.de/igs/medication/StructureDefinition/TimingDgMP",
        "severity": "error",
        "expression": "(period.exists() implies period mod 1 = 0) and (periodMax.exists() implies periodMax mod 1 = 0)"
      }, {
        "key": "TimingBoundsDurationOnlyWholeNumber",
        "human": "boundsDuration.value must be a whole number; decimal values are not allowed.",
        "source": "http://ig.fhir.de/igs/medication/StructureDefinition/TimingDgMP",
        "severity": "error",
        "expression": "bounds.ofType(Duration).value.empty() or bounds.ofType(Duration).value mod 1 = 0"
      }, {
        "key": "TimingFreqOrPeriodGtOne",
        "human": "If frequency and period are given together, only one of them may exceed 1 - either the frequency including frequencyMax or the period including periodMax. A statement in which both exceed 1, such as 'six times within three hours', is hard to express in language and is not needed: the same meaning can be conveyed by adapting the period, e.g. 'every 30 minutes'.",
        "source": "http://ig.fhir.de/igs/medication/StructureDefinition/TimingDgMP",
        "severity": "error",
        "expression": "/* Detect Interval only */\n(\n  timeOfDay.empty() and\n  when.empty() and\n  dayOfWeek.empty() and\n  frequency.exists() and\n  period.exists()\n) implies\n(\n  (\n    (frequency > 1 or (frequencyMax.exists() and frequencyMax > 1))\n    implies\n    (\n      period = 1 and\n      (periodMax.empty() or periodMax = 1)\n    )\n  )\n  and\n  (\n    (period > 1 or (periodMax.exists() and periodMax > 1))\n    implies\n    (\n      frequency = 1 and\n      (frequencyMax.empty() or frequencyMax = 1)\n    )\n  )\n)"
      }, {
        "key": "TimingVarFreqGtMin",
        "human": "For a variable frequency, the maximum frequency must be greater than the minimum frequency.",
        "source": "http://ig.fhir.de/igs/medication/StructureDefinition/TimingDgMP",
        "severity": "error",
        "expression": "frequencyMax.empty() or frequency.empty() or\n  frequency.value.toInteger() < frequencyMax.value.toInteger()"
      }, {
        "key": "TimingVarPeriodGtMin",
        "human": "For a variable period, the maximum period must be greater than the minimum period.",
        "source": "http://ig.fhir.de/igs/medication/StructureDefinition/TimingDgMP",
        "severity": "error",
        "expression": "periodMax.empty() or period.empty() or period < periodMax"
      }, {
        "key": "TimingSingleDosageForTimeOfDay",
        "human": "If only timeOfDay is used and dosing is daily, the times must be modelled in a single Dosage element. Multiple Dosage elements are only allowed if every element carries a distinct dose, including its data type.",
        "source": "http://ig.fhir.de/igs/medication/StructureDefinition/TimingDgMP",
        "severity": "error",
        "expression": "(\n  %resource.ofType(MedicationRequest).dosageInstruction\n  | %resource.ofType(MedicationDispense).dosageInstruction\n  | %resource.ofType(MedicationStatement).dosage\n).all(\n  (\n    timing.repeat.dayOfWeek.empty() and\n    timing.repeat.timeOfDay.exists() and\n    timing.repeat.when.empty()\n  )\n  implies\n  (\n    (\n      (\n        %resource.ofType(MedicationRequest).dosageInstruction\n        | %resource.ofType(MedicationDispense).dosageInstruction\n        | %resource.ofType(MedicationStatement).dosage\n      ).where(\n        timing.repeat.dayOfWeek.empty() and timing.repeat.timeOfDay.exists() and timing.repeat.when.empty()\n      ).count() = 1\n    )\n    or\n    (\n      (\n        %resource.ofType(MedicationRequest).dosageInstruction\n        | %resource.ofType(MedicationDispense).dosageInstruction\n        | %resource.ofType(MedicationStatement).dosage\n      ).where(\n        timing.repeat.dayOfWeek.empty() and timing.repeat.timeOfDay.exists() and timing.repeat.when.empty()\n      ).doseAndRate.dose.distinct().count()\n      =\n      (\n        %resource.ofType(MedicationRequest).dosageInstruction\n        | %resource.ofType(MedicationDispense).dosageInstruction\n        | %resource.ofType(MedicationStatement).dosage\n      ).where(\n        timing.repeat.dayOfWeek.empty() and timing.repeat.timeOfDay.exists() and timing.repeat.when.empty()\n      ).count()\n    )\n  )\n)"
      }, {
        "key": "TimingSingleDosageForWhen",
        "human": "If only when is used and dosing is daily, the times of day must be modelled in a single Dosage element. Multiple Dosage elements are only allowed if every element carries a distinct dose, including its data type.",
        "source": "http://ig.fhir.de/igs/medication/StructureDefinition/TimingDgMP",
        "severity": "error",
        "expression": "(\n  %resource.ofType(MedicationRequest).dosageInstruction\n  | %resource.ofType(MedicationDispense).dosageInstruction\n  | %resource.ofType(MedicationStatement).dosage\n).all(\n  (\n    timing.repeat.dayOfWeek.empty() and\n    timing.repeat.when.exists() and\n    timing.repeat.timeOfDay.empty()\n  )\n  implies\n  (\n    (\n      (\n        %resource.ofType(MedicationRequest).dosageInstruction\n        | %resource.ofType(MedicationDispense).dosageInstruction\n        | %resource.ofType(MedicationStatement).dosage\n      ).where(\n        timing.repeat.dayOfWeek.empty() and timing.repeat.when.exists() and timing.repeat.timeOfDay.empty()\n      ).count() = 1\n    )\n    or\n    (\n      (\n        %resource.ofType(MedicationRequest).dosageInstruction\n        | %resource.ofType(MedicationDispense).dosageInstruction\n        | %resource.ofType(MedicationStatement).dosage\n      ).where(\n        timing.repeat.dayOfWeek.empty() and timing.repeat.when.exists() and timing.repeat.timeOfDay.empty()\n      ).doseAndRate.dose.distinct().count()\n      =\n      (\n        %resource.ofType(MedicationRequest).dosageInstruction\n        | %resource.ofType(MedicationDispense).dosageInstruction\n        | %resource.ofType(MedicationStatement).dosage\n      ).where(\n        timing.repeat.dayOfWeek.empty() and timing.repeat.when.exists() and timing.repeat.timeOfDay.empty()\n      ).count()\n    )\n  )\n)"
      }, {
        "key": "TimingBoundsUnitMatchesCode",
        "human": "boundsDuration.unit must match the UCUM boundsDuration.code (e.g. 'Woche(n)' only with code='wk').",
        "source": "http://ig.fhir.de/igs/medication/StructureDefinition/TimingDgMP",
        "severity": "error",
        "expression": "bounds.ofType(Duration).exists().not() or (\n  (\n    bounds.ofType(Duration).code = 'd'\n    implies \n    (\n      bounds.ofType(Duration).unit = 'Tag(e)' or\n      bounds.ofType(Duration).unit = 'Tag' or\n      bounds.ofType(Duration).unit = 'Tage'\n    )\n  ) and (\n    bounds.ofType(Duration).code = 'wk'\n    implies \n    (\n      bounds.ofType(Duration).unit = 'Woche(n)' or\n      bounds.ofType(Duration).unit = 'Woche' or\n      bounds.ofType(Duration).unit = 'Wochen'\n    )\n  ) and (\n    bounds.ofType(Duration).code = 'mo'\n    implies \n    (\n      bounds.ofType(Duration).unit = 'Monat(e)' or\n      bounds.ofType(Duration).unit = 'Monat' or\n      bounds.ofType(Duration).unit = 'Monate'\n    )\n  ) and (\n    bounds.ofType(Duration).code = 'a'\n    implies \n    (\n      bounds.ofType(Duration).unit = 'Jahr(e)' or\n      bounds.ofType(Duration).unit = 'Jahr' or\n      bounds.ofType(Duration).unit = 'Jahre'\n    )\n  )\n)"
      } ]
    }, {
      "id": "Timing.repeat.bounds[x]",
      "path": "Timing.repeat.bounds[x]",
      "type": [ {
        "code": "Duration"
      }, {
        "code": "Period"
      } ],
      "comment": "Begründung Einschränkung Datentyp: Nur eine Angabe zur Dauer und Start- bzw. Enddatum sind in der aktuellen Ausbaustufe des dgMP vorgesehen, um die Komplexität zu reduzieren und die Übersichtlichkeit zu erhöhen."
    }, {
      "id": "Timing.repeat.bounds[x]:boundsDuration",
      "path": "Timing.repeat.bounds[x]",
      "type": [ {
        "code": "Duration"
      } ],
      "sliceName": "boundsDuration"
    }, {
      "id": "Timing.repeat.bounds[x]:boundsDuration.value",
      "min": 1,
      "path": "Timing.repeat.bounds[x].value"
    }, {
      "id": "Timing.repeat.bounds[x]:boundsDuration.comparator",
      "max": "0",
      "path": "Timing.repeat.bounds[x].comparator"
    }, {
      "id": "Timing.repeat.bounds[x]:boundsDuration.unit",
      "min": 1,
      "path": "Timing.repeat.bounds[x].unit"
    }, {
      "id": "Timing.repeat.bounds[x]:boundsDuration.system",
      "min": 1,
      "path": "Timing.repeat.bounds[x].system"
    }, {
      "id": "Timing.repeat.bounds[x]:boundsDuration.code",
      "min": 1,
      "path": "Timing.repeat.bounds[x].code",
      "binding": {
        "strength": "required",
        "valueSet": "http://ig.fhir.de/igs/medication/ValueSet/DosageUnitsOfTimeDgMP"
      }
    }, {
      "id": "Timing.repeat.bounds[x]:boundsPeriod",
      "path": "Timing.repeat.bounds[x]",
      "type": [ {
        "code": "Period"
      } ],
      "short": "Start- und Endzeitpunkt der Dosieranweisung.",
      "sliceName": "boundsPeriod",
      "definition": "Beschreibt die Gültigkeit einer Dosieranweisung mit einem konkreten Start- und/oder Endzeitpunkt. Neben einem Datum kann eine Uhrzeit mit Zeitzone angegeben werden."
    }, {
      "id": "Timing.repeat.bounds[x]:boundsPeriod.start",
      "path": "Timing.repeat.bounds[x].start",
      "short": "Startdatum mit optionaler Uhrzeit und Zeitzone"
    }, {
      "id": "Timing.repeat.bounds[x]:boundsPeriod.end",
      "path": "Timing.repeat.bounds[x].end",
      "short": "Enddatum mit optionaler Uhrzeit und Zeitzone"
    }, {
      "id": "Timing.repeat.count",
      "max": "0",
      "path": "Timing.repeat.count",
      "comment": "Begründung Einschränkung Kardinalität: Wiederholungen sind in der ersten Ausbaustufe des dgMP nicht vorgesehen, um die Komplexität zu reduzieren und die Übersichtlichkeit zu erhöhen."
    }, {
      "id": "Timing.repeat.countMax",
      "max": "0",
      "path": "Timing.repeat.countMax",
      "comment": "Begründung Einschränkung Kardinalität: Maximale Wiederholungen sind in der ersten Ausbaustufe des dgMP nicht vorgesehen, um die Komplexität zu reduzieren und die Übersichtlichkeit zu erhöhen."
    }, {
      "id": "Timing.repeat.duration",
      "max": "0",
      "path": "Timing.repeat.duration",
      "comment": "Begründung Einschränkung Kardinalität: Angaben zur Dauer einer Einzelgabe sind in der ersten Ausbaustufe des dgMP nicht vorgesehen, um die Komplexität zu reduzieren und die Übersichtlichkeit zu erhöhen."
    }, {
      "id": "Timing.repeat.durationMax",
      "max": "0",
      "path": "Timing.repeat.durationMax",
      "comment": "Begründung Einschränkung Kardinalität: Angaben zur maximalen Dauer einer Einzelgabe sind in der ersten Ausbaustufe desdgMP nicht vorgesehen, um die Komplexität zu reduzieren und die Übersichtlichkeit zu erhöhen."
    }, {
      "id": "Timing.repeat.durationUnit",
      "max": "0",
      "path": "Timing.repeat.durationUnit",
      "comment": "Begründung Einschränkung Kardinalität: Angaben zur Einheit der Dauer einer Einzelgabe sind in der ersten Ausbaustufe desdgMP nicht vorgesehen, um die Komplexität zu reduzieren und die Übersichtlichkeit zu erhöhen."
    }, {
      "id": "Timing.repeat.periodUnit",
      "path": "Timing.repeat.periodUnit",
      "short": "min | h | d | wk | mo - Zeiteinheit (UCUM)",
      "binding": {
        "strength": "required",
        "valueSet": "http://ig.fhir.de/igs/medication/ValueSet/PeriodUnitsOfTimeDgMP"
      }
    }, {
      "id": "Timing.repeat.when",
      "path": "Timing.repeat.when",
      "binding": {
        "strength": "required",
        "valueSet": "http://ig.fhir.de/igs/medication/ValueSet/TimingWhenDgMP"
      }
    }, {
      "id": "Timing.repeat.offset",
      "max": "0",
      "path": "Timing.repeat.offset",
      "short": "Zeitversatz",
      "comment": "Begründung Einschränkung Kardinalität: Ein Zeitversatz ist in der ersten Ausbaustufe desdgMP nicht vorgesehen, um die Komplexität zu reduzieren und die Übersichtlichkeit zu erhöhen."
    }, {
      "id": "Timing.code",
      "max": "0",
      "path": "Timing.code",
      "comment": "Begründung Einschränkung Kardinalität: Ein Timing-Code ist in der ersten Ausbaustufe des dgMP nicht vorgesehen, um die Komplexität zu reduzieren und die Übersichtlichkeit zu erhöhen. Stattdessen muss das Zeitmuster explizit strukturiert angegeben werden."
    } ]
  },
  "contact": [ {
    "name": "HL7 Deutschland e.V.",
    "telecom": [ {
      "value": "https://hl7.de",
      "system": "url"
    } ]
  } ],
  "baseDefinition": "http://ig.fhir.de/igs/medication/StructureDefinition/TimingDE"
}