{
  "resourceType": "StructureDefinition",
  "id": "EPMedPrescriptionLine-77dfabb7-37e1-4286-8253-6b64e30589c0",
  "extension": [
    {
      "url": "http://hl7.org/fhir/StructureDefinition/structuredefinition-category",
      "valueString": "Clinical.Medications"
    },
    {
      "url": "http://hl7.org/fhir/StructureDefinition/structuredefinition-security-category",
      "valueCode": "patient"
    }
  ],
  "url": "https://www.esante.lu/fhir-spec/StructureDefinition/EPMedPrescriptionLine",
  "version": "0.1.0",
  "name": "EPMedPrescriptionLine",
  "status": "draft",
  "fhirVersion": "4.0.1",
  "mapping": [
    {
      "identity": "workflow",
      "uri": "http://hl7.org/fhir/workflow",
      "name": "Workflow Pattern"
    },
    {
      "identity": "script10.6",
      "uri": "http://ncpdp.org/SCRIPT10_6",
      "name": "Mapping to NCPDP SCRIPT 10.6"
    },
    {
      "identity": "rim",
      "uri": "http://hl7.org/v3",
      "name": "RIM Mapping"
    },
    {
      "identity": "w5",
      "uri": "http://hl7.org/fhir/fivews",
      "name": "FiveWs Pattern Mapping"
    },
    {
      "identity": "v2",
      "uri": "http://hl7.org/v2",
      "name": "HL7 v2 Mapping"
    }
  ],
  "kind": "resource",
  "abstract": false,
  "type": "MedicationRequest",
  "baseDefinition": "http://hl7.org/fhir/StructureDefinition/MedicationRequest",
  "derivation": "constraint",
  "differential": {
    "element": [
      {
        "id": "MedicationRequest",
        "path": "MedicationRequest",
        "short": "A prescription line"
      },
      {
        "id": "MedicationRequest.id",
        "path": "MedicationRequest.id",
        "definition": "The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.\r\nIs assigned by the server, do not provide a value."
      },
      {
        "id": "MedicationRequest.meta",
        "path": "MedicationRequest.meta",
        "min": 1
      },
      {
        "id": "MedicationRequest.meta.id",
        "path": "MedicationRequest.meta.id",
        "max": "0"
      },
      {
        "id": "MedicationRequest.meta.versionId",
        "path": "MedicationRequest.meta.versionId",
        "max": "0"
      },
      {
        "id": "MedicationRequest.meta.lastUpdated",
        "path": "MedicationRequest.meta.lastUpdated",
        "max": "0"
      },
      {
        "id": "MedicationRequest.meta.source",
        "path": "MedicationRequest.meta.source",
        "max": "0"
      },
      {
        "id": "MedicationRequest.meta.profile",
        "path": "MedicationRequest.meta.profile",
        "min": 1,
        "max": "1",
        "fixedCanonical": "https://www.esante.lu/fhir-spec/StructureDefinition/EPMedPrescriptionLine"
      },
      {
        "id": "MedicationRequest.meta.security",
        "path": "MedicationRequest.meta.security",
        "max": "0"
      },
      {
        "id": "MedicationRequest.meta.tag",
        "path": "MedicationRequest.meta.tag",
        "max": "0"
      },
      {
        "id": "MedicationRequest.implicitRules",
        "path": "MedicationRequest.implicitRules",
        "max": "0"
      },
      {
        "id": "MedicationRequest.language",
        "path": "MedicationRequest.language",
        "max": "0"
      },
      {
        "id": "MedicationRequest.text",
        "path": "MedicationRequest.text",
        "max": "0"
      },
      {
        "id": "MedicationRequest.contained",
        "path": "MedicationRequest.contained",
        "max": "0"
      },
      {
        "id": "MedicationRequest.identifier",
        "path": "MedicationRequest.identifier",
        "short": "Identifier of the prescription line",
        "min": 1,
        "max": "1",
        "type": [
          {
            "code": "Identifier",
            "profile": [
              "https://www.esante.lu/fhir-spec/StructureDefinition/EPSimpleIdentifier"
            ]
          }
        ]
      },
      {
        "id": "MedicationRequest.status",
        "path": "MedicationRequest.status",
        "condition": [
          "val-activeOrCompleted"
        ],
        "constraint": [
          {
            "key": "val-activeOrCompleted",
            "severity": "error",
            "human": "Only active or completed is allowed",
            "expression": "$this=\"active\" or $this=\"completed\"",
            "source": "https://www.esante.lu/fhir-spec/StructureDefinition/EPMedPrescriptionLine"
          }
        ]
      },
      {
        "id": "MedicationRequest.statusReason",
        "path": "MedicationRequest.statusReason",
        "max": "0"
      },
      {
        "id": "MedicationRequest.intent",
        "path": "MedicationRequest.intent",
        "short": "order",
        "definition": "Constant",
        "fixedCode": "order"
      },
      {
        "id": "MedicationRequest.category",
        "path": "MedicationRequest.category",
        "short": "Type of request",
        "definition": "Constant",
        "min": 1,
        "max": "1"
      },
      {
        "id": "MedicationRequest.category.id",
        "path": "MedicationRequest.category.id",
        "max": "0"
      },
      {
        "id": "MedicationRequest.category.coding",
        "path": "MedicationRequest.category.coding",
        "min": 1,
        "max": "1",
        "fixedCoding": {
          "code": "MED_PRESC_LINE",
          "system": "urn:oid:1.3.182.5.56"
        }
      },
      {
        "id": "MedicationRequest.category.coding.id",
        "path": "MedicationRequest.category.coding.id",
        "max": "0"
      },
      {
        "id": "MedicationRequest.category.coding.system",
        "path": "MedicationRequest.category.coding.system",
        "min": 1
      },
      {
        "id": "MedicationRequest.category.coding.version",
        "path": "MedicationRequest.category.coding.version",
        "max": "0"
      },
      {
        "id": "MedicationRequest.category.coding.code",
        "path": "MedicationRequest.category.coding.code",
        "min": 1
      },
      {
        "id": "MedicationRequest.category.coding.display",
        "path": "MedicationRequest.category.coding.display",
        "max": "0"
      },
      {
        "id": "MedicationRequest.category.coding.userSelected",
        "path": "MedicationRequest.category.coding.userSelected",
        "max": "0"
      },
      {
        "id": "MedicationRequest.category.text",
        "path": "MedicationRequest.category.text",
        "max": "0"
      },
      {
        "id": "MedicationRequest.priority",
        "path": "MedicationRequest.priority",
        "max": "0"
      },
      {
        "id": "MedicationRequest.doNotPerform",
        "path": "MedicationRequest.doNotPerform",
        "max": "0"
      },
      {
        "id": "MedicationRequest.reported[x]",
        "path": "MedicationRequest.reported[x]",
        "max": "0"
      },
      {
        "id": "MedicationRequest.medication[x]",
        "path": "MedicationRequest.medication[x]",
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "https://www.esante.lu/fhir-spec/StructureDefinition/EPMedicationPrescription",
              "https://www.esante.lu/fhir-spec/StructureDefinition/EPMedicationNoRef"
            ],
            "aggregation": [
              "referenced",
              "bundled"
            ]
          }
        ]
      },
      {
        "id": "MedicationRequest.medication[x].id",
        "path": "MedicationRequest.medication[x].id",
        "max": "0"
      },
      {
        "id": "MedicationRequest.medication[x].reference",
        "path": "MedicationRequest.medication[x].reference",
        "short": "A medication",
        "definition": "See examples:\r\nIf the medication is in the referential, simply link to it through the prescription code\r\nIf the medication is not in the referential, you have to create it, put it in the Bundle and link to it through its fullURL",
        "min": 1,
        "example": [
          {
            "label": "Known medication",
            "valueString": "Medication?identifier=urn:oid:1.3.182.5.47|2006028443"
          },
          {
            "label": "Medication not in the referential",
            "valueString": "Medication/urn:uuid:595bbd26-b841-4028-817d-adbcc4cdad3b"
          }
        ],
        "condition": [
          "val-refMedicationPres"
        ],
        "constraint": [
          {
            "key": "val-refMedicationPres",
            "severity": "error",
            "human": "SHALL reference a prescriptable medication by its identifier or by its fullURL",
            "expression": "(startsWith('Medication?identifier=urn:oid:1.3.182.5.47|') and length()=53) or (startsWith('Medication/urn:uuid:') and length()=56)",
            "source": "https://www.esante.lu/fhir-spec/StructureDefinition/EPMedPrescriptionLine"
          }
        ]
      },
      {
        "id": "MedicationRequest.medication[x].type",
        "path": "MedicationRequest.medication[x].type",
        "max": "0"
      },
      {
        "id": "MedicationRequest.medication[x].identifier",
        "path": "MedicationRequest.medication[x].identifier",
        "max": "0"
      },
      {
        "id": "MedicationRequest.medication[x].display",
        "path": "MedicationRequest.medication[x].display",
        "max": "0"
      },
      {
        "id": "MedicationRequest.subject",
        "path": "MedicationRequest.subject",
        "short": "The patient",
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "http://hl7.org/fhir/StructureDefinition/Patient"
            ],
            "aggregation": [
              "referenced"
            ]
          }
        ]
      },
      {
        "id": "MedicationRequest.subject.id",
        "path": "MedicationRequest.subject.id",
        "max": "0"
      },
      {
        "id": "MedicationRequest.subject.reference",
        "path": "MedicationRequest.subject.reference",
        "short": "The patient referenced by its matricule",
        "min": 1,
        "example": [
          {
            "label": "Example",
            "valueString": "Patient?identifier=urn:oid:1.3.182.4.4|1904112000166"
          }
        ],
        "condition": [
          "val-patByMatricule"
        ],
        "constraint": [
          {
            "key": "val-patByMatricule",
            "severity": "error",
            "human": "The Patient SHALL be referenced by its matricule",
            "expression": "startsWith('Patient?identifier=urn:oid:1.3.182.4.4|') and length()=52",
            "source": "https://www.esante.lu/fhir-spec/StructureDefinition/EPMedPrescriptionLine"
          }
        ]
      },
      {
        "id": "MedicationRequest.subject.type",
        "path": "MedicationRequest.subject.type",
        "max": "0"
      },
      {
        "id": "MedicationRequest.subject.identifier",
        "path": "MedicationRequest.subject.identifier",
        "max": "0"
      },
      {
        "id": "MedicationRequest.subject.display",
        "path": "MedicationRequest.subject.display",
        "max": "0"
      },
      {
        "id": "MedicationRequest.encounter",
        "path": "MedicationRequest.encounter",
        "max": "0"
      },
      {
        "id": "MedicationRequest.supportingInformation",
        "path": "MedicationRequest.supportingInformation",
        "max": "0"
      },
      {
        "id": "MedicationRequest.supportingInformation.reference",
        "path": "MedicationRequest.supportingInformation.reference",
        "min": 1
      },
      {
        "id": "MedicationRequest.supportingInformation.type",
        "path": "MedicationRequest.supportingInformation.type",
        "max": "0"
      },
      {
        "id": "MedicationRequest.supportingInformation.identifier",
        "path": "MedicationRequest.supportingInformation.identifier",
        "max": "0"
      },
      {
        "id": "MedicationRequest.supportingInformation.display",
        "path": "MedicationRequest.supportingInformation.display",
        "max": "0"
      },
      {
        "id": "MedicationRequest.authoredOn",
        "path": "MedicationRequest.authoredOn",
        "short": "Prescrpition date",
        "min": 1
      },
      {
        "id": "MedicationRequest.requester",
        "path": "MedicationRequest.requester",
        "short": "The prescriber",
        "min": 1,
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "https://www.esante.lu/fhir-spec/StructureDefinition/EPPractitioner"
            ],
            "aggregation": [
              "referenced"
            ]
          }
        ]
      },
      {
        "id": "MedicationRequest.requester.id",
        "path": "MedicationRequest.requester.id",
        "max": "0"
      },
      {
        "id": "MedicationRequest.requester.reference",
        "path": "MedicationRequest.requester.reference",
        "short": "A health professional referenced by its eHealthID",
        "min": 1,
        "example": [
          {
            "label": "Example",
            "valueString": "Practitioner?identifier=urn:oid:1.3.182.4.1|2999999617"
          }
        ],
        "condition": [
          "val-1"
        ],
        "constraint": [
          {
            "key": "val-1",
            "severity": "error",
            "human": "A Practitioner SHALL be referenced by its eHealthID",
            "expression": "startsWith('Practitioner?identifier=urn:oid:1.3.182.4.1|2') and length()=54",
            "source": "https://www.esante.lu/fhir-spec/StructureDefinition/EPMedPrescriptionLine"
          }
        ]
      },
      {
        "id": "MedicationRequest.requester.type",
        "path": "MedicationRequest.requester.type",
        "max": "0"
      },
      {
        "id": "MedicationRequest.requester.identifier",
        "path": "MedicationRequest.requester.identifier",
        "max": "0"
      },
      {
        "id": "MedicationRequest.requester.display",
        "path": "MedicationRequest.requester.display",
        "max": "0"
      },
      {
        "id": "MedicationRequest.performer",
        "path": "MedicationRequest.performer",
        "max": "0"
      },
      {
        "id": "MedicationRequest.performerType",
        "path": "MedicationRequest.performerType",
        "max": "0"
      },
      {
        "id": "MedicationRequest.recorder",
        "path": "MedicationRequest.recorder",
        "max": "0"
      },
      {
        "id": "MedicationRequest.reasonCode",
        "path": "MedicationRequest.reasonCode",
        "max": "0"
      },
      {
        "id": "MedicationRequest.reasonReference",
        "path": "MedicationRequest.reasonReference",
        "max": "0"
      },
      {
        "id": "MedicationRequest.instantiatesCanonical",
        "path": "MedicationRequest.instantiatesCanonical",
        "max": "0"
      },
      {
        "id": "MedicationRequest.instantiatesUri",
        "path": "MedicationRequest.instantiatesUri",
        "max": "0"
      },
      {
        "id": "MedicationRequest.basedOn",
        "path": "MedicationRequest.basedOn",
        "max": "0"
      },
      {
        "id": "MedicationRequest.groupIdentifier",
        "path": "MedicationRequest.groupIdentifier",
        "max": "0"
      },
      {
        "id": "MedicationRequest.courseOfTherapyType",
        "path": "MedicationRequest.courseOfTherapyType",
        "max": "0"
      },
      {
        "id": "MedicationRequest.insurance",
        "path": "MedicationRequest.insurance",
        "max": "0"
      },
      {
        "id": "MedicationRequest.note",
        "path": "MedicationRequest.note",
        "max": "0"
      },
      {
        "id": "MedicationRequest.dosageInstruction",
        "path": "MedicationRequest.dosageInstruction",
        "min": 1
      },
      {
        "id": "MedicationRequest.dosageInstruction.id",
        "path": "MedicationRequest.dosageInstruction.id",
        "max": "0"
      },
      {
        "id": "MedicationRequest.dosageInstruction.sequence",
        "path": "MedicationRequest.dosageInstruction.sequence",
        "max": "0"
      },
      {
        "id": "MedicationRequest.dosageInstruction.text",
        "path": "MedicationRequest.dosageInstruction.text",
        "short": "Free text dosage instructions"
      },
      {
        "id": "MedicationRequest.dosageInstruction.additionalInstruction",
        "path": "MedicationRequest.dosageInstruction.additionalInstruction",
        "max": "0"
      },
      {
        "id": "MedicationRequest.dosageInstruction.patientInstruction",
        "path": "MedicationRequest.dosageInstruction.patientInstruction",
        "short": "Patient oriented instructions"
      },
      {
        "id": "MedicationRequest.dosageInstruction.timing",
        "path": "MedicationRequest.dosageInstruction.timing",
        "short": "When medication should be taken"
      },
      {
        "id": "MedicationRequest.dosageInstruction.timing.id",
        "path": "MedicationRequest.dosageInstruction.timing.id",
        "max": "0"
      },
      {
        "id": "MedicationRequest.dosageInstruction.timing.event",
        "path": "MedicationRequest.dosageInstruction.timing.event",
        "max": "0"
      },
      {
        "id": "MedicationRequest.dosageInstruction.timing.repeat",
        "path": "MedicationRequest.dosageInstruction.timing.repeat",
        "min": 1
      },
      {
        "id": "MedicationRequest.dosageInstruction.timing.repeat.id",
        "path": "MedicationRequest.dosageInstruction.timing.repeat.id",
        "max": "0"
      },
      {
        "id": "MedicationRequest.dosageInstruction.timing.repeat.bounds[x]",
        "path": "MedicationRequest.dosageInstruction.timing.repeat.bounds[x]",
        "type": [
          {
            "code": "Duration"
          },
          {
            "code": "Period"
          }
        ]
      },
      {
        "id": "MedicationRequest.dosageInstruction.timing.code",
        "path": "MedicationRequest.dosageInstruction.timing.code",
        "max": "0"
      },
      {
        "id": "MedicationRequest.dosageInstruction.asNeeded[x]",
        "path": "MedicationRequest.dosageInstruction.asNeeded[x]",
        "max": "0"
      },
      {
        "id": "MedicationRequest.dosageInstruction.site",
        "path": "MedicationRequest.dosageInstruction.site",
        "max": "0"
      },
      {
        "id": "MedicationRequest.dosageInstruction.route",
        "path": "MedicationRequest.dosageInstruction.route",
        "short": "Route of administration",
        "type": [
          {
            "code": "CodeableConcept",
            "profile": [
              "https://www.esante.lu/fhir-spec/StructureDefinition/EPCodeableConcept"
            ]
          }
        ]
      },
      {
        "id": "MedicationRequest.dosageInstruction.route.coding",
        "path": "MedicationRequest.dosageInstruction.route.coding",
        "binding": {
          "strength": "required",
          "valueSet": "https://www.esante.lu/fhir-spec/ValueSet/PharRoutes"
        }
      },
      {
        "id": "MedicationRequest.dosageInstruction.method",
        "path": "MedicationRequest.dosageInstruction.method",
        "max": "0"
      },
      {
        "id": "MedicationRequest.dosageInstruction.doseAndRate",
        "path": "MedicationRequest.dosageInstruction.doseAndRate",
        "short": "Amount of medication"
      },
      {
        "id": "MedicationRequest.dosageInstruction.doseAndRate.id",
        "path": "MedicationRequest.dosageInstruction.doseAndRate.id",
        "max": "0"
      },
      {
        "id": "MedicationRequest.dosageInstruction.doseAndRate.type",
        "path": "MedicationRequest.dosageInstruction.doseAndRate.type",
        "max": "0"
      },
      {
        "id": "MedicationRequest.dosageInstruction.maxDosePerPeriod",
        "path": "MedicationRequest.dosageInstruction.maxDosePerPeriod",
        "max": "0"
      },
      {
        "id": "MedicationRequest.dosageInstruction.maxDosePerAdministration",
        "path": "MedicationRequest.dosageInstruction.maxDosePerAdministration",
        "max": "0"
      },
      {
        "id": "MedicationRequest.dosageInstruction.maxDosePerLifetime",
        "path": "MedicationRequest.dosageInstruction.maxDosePerLifetime",
        "max": "0"
      },
      {
        "id": "MedicationRequest.dispenseRequest",
        "path": "MedicationRequest.dispenseRequest",
        "max": "0"
      },
      {
        "id": "MedicationRequest.dispenseRequest.dispenseInterval",
        "path": "MedicationRequest.dispenseRequest.dispenseInterval",
        "max": "0"
      },
      {
        "id": "MedicationRequest.dispenseRequest.numberOfRepeatsAllowed",
        "path": "MedicationRequest.dispenseRequest.numberOfRepeatsAllowed",
        "max": "0"
      },
      {
        "id": "MedicationRequest.dispenseRequest.expectedSupplyDuration",
        "path": "MedicationRequest.dispenseRequest.expectedSupplyDuration",
        "max": "0"
      },
      {
        "id": "MedicationRequest.dispenseRequest.performer",
        "path": "MedicationRequest.dispenseRequest.performer",
        "max": "0"
      },
      {
        "id": "MedicationRequest.substitution",
        "path": "MedicationRequest.substitution",
        "max": "0"
      },
      {
        "id": "MedicationRequest.priorPrescription",
        "path": "MedicationRequest.priorPrescription",
        "max": "0"
      },
      {
        "id": "MedicationRequest.detectedIssue",
        "path": "MedicationRequest.detectedIssue",
        "max": "0"
      },
      {
        "id": "MedicationRequest.eventHistory",
        "path": "MedicationRequest.eventHistory",
        "max": "0"
      }
    ]
  }
}