{
  "resourceType": "StructureDefinition",
  "url": "http://apiframework.dedalus.eu/fhir/StructureDefinition/MedicationRequest",
  "name": "MedicationRequest",
  "title": "API Framework MedicationRequest",
  "status": "active",
  "experimental": false,
  "description": "API Framework Core Profile for MedicationRequest",
  "fhirVersion": "3.0.1",
  "kind": "resource",
  "abstract": false,
  "type": "MedicationRequest",
  "baseDefinition": "http://hl7.org/fhir/StructureDefinition/MedicationRequest",
  "derivation": "constraint",
  "differential": {
    "element": [
      {
        "id": "MedicationRequest.meta",
        "path": "MedicationRequest.meta",
        "type": [
          {
            "code": "Meta",
            "profile": "http://apiframework.dedalus.eu/fhir/StructureDefinition/Meta-ForCommonConformance"
          }
        ]
      },
      {
        "id": "MedicationRequest.meta.tag",
        "path": "MedicationRequest.meta.tag",
        "slicing": {
          "discriminator": [
            {
              "type": "value",
              "path": "system"
            }
          ],
          "rules": "open"
        }
      },
      {
        "id": "MedicationRequest.text",
        "path": "MedicationRequest.text",
        "mustSupport": true
      },
      {
        "id": "MedicationRequest.contained",
        "path": "MedicationRequest.contained",
        "slicing": {
          "discriminator": [
            {
              "type": "type",
              "path": "$this"
            }
          ],
          "rules": "closed"
        },
        "mustSupport": true
      },
      {
        "id": "MedicationRequest.contained:containedObservation",
        "path": "MedicationRequest.contained",
        "sliceName": "containedObservation",
        "requirements": "Contained Observations are used to record clinical information useful exclusively in the context of this medication request, eg. weight",
        "type": [
          {
            "code": "Resource",
            "profile": "http://apiframework.dedalus.eu/fhir/StructureDefinition/Observation"
          }
        ]
      },
      {
        "id": "MedicationRequest.identifier",
        "path": "MedicationRequest.identifier",
        "mustSupport": true
      },
      {
        "id": "MedicationRequest.basedOn",
        "path": "MedicationRequest.basedOn",
        "max": "1",
        "type": [
          {
            "code": "Reference",
            "targetProfile": "http://apiframework.dedalus.eu/fhir/StructureDefinition/MedicationRequest"
          }
        ],
        "mustSupport": true
      },
      {
        "id": "MedicationRequest.groupIdentifier",
        "path": "MedicationRequest.groupIdentifier",
        "requirements": "Each MedicationRequest istance must be link to the RequestGroup representing the general order",
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "MedicationRequest.intent",
        "path": "MedicationRequest.intent",
        "mustSupport": true
      },
      {
        "id": "MedicationRequest.medication[x]:medicationCodeableConcept",
        "path": "MedicationRequest.medicationCodeableConcept",
        "sliceName": "medicationCodeableConcept",
        "type": [
          {
            "code": "CodeableConcept"
          }
        ],
        "mustSupport": true
      },
      {
        "id": "MedicationRequest.medication[x]:medicationCodeableConcept.coding",
        "path": "MedicationRequest.medicationCodeableConcept.coding",
        "min": 1
      },
      {
        "id": "MedicationRequest.subject",
        "path": "MedicationRequest.subject",
        "type": [
          {
            "code": "Reference",
            "targetProfile": "http://apiframework.dedalus.eu/fhir/StructureDefinition/Patient"
          }
        ],
        "mustSupport": true
      },
      {
        "id": "MedicationRequest.context",
        "path": "MedicationRequest.context",
        "type": [
          {
            "code": "Reference",
            "targetProfile": "http://apiframework.dedalus.eu/fhir/StructureDefinition/Encounter"
          },
          {
            "code": "Reference",
            "targetProfile": "http://apiframework.dedalus.eu/fhir/StructureDefinition/EpisodeOfCare"
          }
        ],
        "mustSupport": true
      },
      {
        "id": "MedicationRequest.supportingInformation",
        "path": "MedicationRequest.supportingInformation",
        "slicing": {
          "discriminator": [
            {
              "type": "type",
              "path": "$this"
            }
          ],
          "rules": "open"
        },
        "mustSupport": true
      },
      {
        "id": "MedicationRequest.supportingInformation:observation",
        "path": "MedicationRequest.supportingInformation",
        "sliceName": "observation",
        "requirements": "Reference to an observation supporting this request. Might be an instance existing on the repository as well as a contained observation instance.",
        "type": [
          {
            "code": "Reference",
            "targetProfile": "http://apiframework.dedalus.eu/fhir/StructureDefinition/Observation"
          }
        ]
      },
      {
        "id": "MedicationRequest.authoredOn",
        "path": "MedicationRequest.authoredOn",
        "mustSupport": true
      },
      {
        "id": "MedicationRequest.requester",
        "path": "MedicationRequest.requester",
        "mustSupport": true
      },
      {
        "id": "MedicationRequest.requester.agent",
        "path": "MedicationRequest.requester.agent",
        "type": [
          {
            "code": "Reference",
            "targetProfile": "http://apiframework.dedalus.eu/fhir/StructureDefinition/Practitioner"
          },
          {
            "code": "Reference",
            "targetProfile": "http://apiframework.dedalus.eu/fhir/StructureDefinition/Organization"
          }
        ]
      },
      {
        "id": "MedicationRequest.reasonCode",
        "path": "MedicationRequest.reasonCode",
        "mustSupport": true
      },
      {
        "id": "MedicationRequest.reasonReference",
        "path": "MedicationRequest.reasonReference",
        "mustSupport": true
      },
      {
        "id": "MedicationRequest.note",
        "path": "MedicationRequest.note",
        "type": [
          {
            "code": "Annotation",
            "profile": "http://apiframework.dedalus.eu/fhir/StructureDefinition/Annotation-WithType"
          }
        ],
        "mustSupport": true
      },
      {
        "id": "MedicationRequest.note.extension:type",
        "path": "MedicationRequest.note.extension",
        "sliceName": "type",
        "binding": {
          "strength": "required",
          "valueSetUri": "http://apiframework.dedalus.eu/fhir/ValueSet/MedicationRequestNoteTypes"
        }
      },
      {
        "id": "MedicationRequest.dosageInstruction",
        "path": "MedicationRequest.dosageInstruction",
        "type": [
          {
            "code": "Dosage",
            "profile": "http://apiframework.dedalus.eu/fhir/StructureDefinition/Dosage"
          }
        ],
        "mustSupport": true
      },
      {
        "id": "MedicationRequest.dosageInstruction.timing.repeat.extension",
        "path": "MedicationRequest.dosageInstruction.timing.repeat.extension",
        "slicing": {
          "discriminator": [
            {
              "type": "value",
              "path": "url"
            }
          ],
          "rules": "open"
        }
      },
      {
        "id": "MedicationRequest.dosageInstruction.timing.repeat.extension:cycle",
        "path": "MedicationRequest.dosageInstruction.timing.repeat.extension",
        "sliceName": "cycle",
        "short": "Define Cycle (count, day, length)",
        "max": "1",
        "type": [
          {
            "code": "Extension",
            "profile": "http://apiframework.dedalus.eu/fhir/StructureDefinition/extension-Timing-ForMedication"
          }
        ],
        "mustSupport": true
      }
    ]
  }
}