{
  "resourceType": "StructureDefinition",
  "id": "EPLabMedicationStatement-1b57509e-e344-4561-8092-93386c21bdc4",
  "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/EPLabMedicationStatement",
  "version": "0.1.0",
  "name": "EPLabMedicationStatement",
  "status": "draft",
  "fhirVersion": "4.0.1",
  "mapping": [
    {
      "identity": "workflow",
      "uri": "http://hl7.org/fhir/workflow",
      "name": "Workflow Pattern"
    },
    {
      "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": "MedicationStatement",
  "baseDefinition": "http://hl7.org/fhir/StructureDefinition/MedicationStatement",
  "derivation": "constraint",
  "differential": {
    "element": [
      {
        "id": "MedicationStatement.id",
        "path": "MedicationStatement.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": "MedicationStatement.meta",
        "path": "MedicationStatement.meta",
        "min": 1
      },
      {
        "id": "MedicationStatement.meta.id",
        "path": "MedicationStatement.meta.id",
        "max": "0"
      },
      {
        "id": "MedicationStatement.meta.versionId",
        "path": "MedicationStatement.meta.versionId",
        "max": "0"
      },
      {
        "id": "MedicationStatement.meta.lastUpdated",
        "path": "MedicationStatement.meta.lastUpdated",
        "max": "0"
      },
      {
        "id": "MedicationStatement.meta.source",
        "path": "MedicationStatement.meta.source",
        "max": "0"
      },
      {
        "id": "MedicationStatement.meta.profile",
        "path": "MedicationStatement.meta.profile",
        "min": 1,
        "max": "1",
        "fixedCanonical": "https://www.esante.lu/fhir-spec/StructureDefinition/EPLabMedicationStatement"
      },
      {
        "id": "MedicationStatement.meta.security",
        "path": "MedicationStatement.meta.security",
        "max": "0"
      },
      {
        "id": "MedicationStatement.meta.tag",
        "path": "MedicationStatement.meta.tag",
        "max": "0"
      },
      {
        "id": "MedicationStatement.implicitRules",
        "path": "MedicationStatement.implicitRules",
        "max": "0"
      },
      {
        "id": "MedicationStatement.language",
        "path": "MedicationStatement.language",
        "max": "0"
      },
      {
        "id": "MedicationStatement.text",
        "path": "MedicationStatement.text",
        "max": "0"
      },
      {
        "id": "MedicationStatement.contained",
        "path": "MedicationStatement.contained",
        "max": "0"
      },
      {
        "id": "MedicationStatement.identifier",
        "path": "MedicationStatement.identifier",
        "max": "0"
      },
      {
        "id": "MedicationStatement.basedOn",
        "path": "MedicationStatement.basedOn",
        "max": "0"
      },
      {
        "id": "MedicationStatement.partOf",
        "path": "MedicationStatement.partOf",
        "max": "0"
      },
      {
        "id": "MedicationStatement.status",
        "path": "MedicationStatement.status",
        "definition": "A code representing the patient or other source's judgment about the state of the medication used that this statement is about.",
        "comment": "In the context of ePrescription, we are only interested in medication relevant for the dispenser, i.e. that still have an effect. As such, we consider the status as being active (even though this MedicationStatement could be for the last intake of a treatment).",
        "fixedCode": "active"
      },
      {
        "id": "MedicationStatement.statusReason",
        "path": "MedicationStatement.statusReason",
        "max": "0"
      },
      {
        "id": "MedicationStatement.category",
        "path": "MedicationStatement.category",
        "max": "0"
      },
      {
        "id": "MedicationStatement.medication[x]",
        "path": "MedicationStatement.medication[x]",
        "short": "The medication stated",
        "definition": "It is linked in the referential with \"CurrentTreatements\"",
        "type": [
          {
            "code": "CodeableConcept",
            "profile": [
              "https://www.esante.lu/fhir-spec/StructureDefinition/EPCodeableConcept"
            ]
          }
        ],
        "example": [
          {
            "label": "Example",
            "valueCodeableConcept": {
              "coding": [
                {
                  "code": "161",
                  "system": "urn:oid:1.3.182.5.54"
                }
              ]
            }
          }
        ],
        "binding": {
          "strength": "required",
          "valueSet": "https://www.esante.lu/fhir-spec/ValueSet/BioPrescQualifiers"
        }
      },
      {
        "id": "MedicationStatement.medication[x].coding",
        "path": "MedicationStatement.medication[x].coding",
        "binding": {
          "strength": "required",
          "valueSet": "https://www.esante.lu/fhir-spec/ValueSet/BioPrescQualifiers"
        }
      },
      {
        "id": "MedicationStatement.subject",
        "path": "MedicationStatement.subject",
        "short": "The patient",
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "https://www.esante.lu/fhir-spec/StructureDefinition/EPPatient"
            ],
            "aggregation": [
              "referenced"
            ]
          }
        ]
      },
      {
        "id": "MedicationStatement.subject.id",
        "path": "MedicationStatement.subject.id",
        "max": "0"
      },
      {
        "id": "MedicationStatement.subject.reference",
        "path": "MedicationStatement.subject.reference",
        "short": "Reference to the patient with 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/EPLabMedicationStatement"
          }
        ]
      },
      {
        "id": "MedicationStatement.subject.type",
        "path": "MedicationStatement.subject.type",
        "max": "0"
      },
      {
        "id": "MedicationStatement.subject.identifier",
        "path": "MedicationStatement.subject.identifier",
        "max": "0"
      },
      {
        "id": "MedicationStatement.subject.display",
        "path": "MedicationStatement.subject.display",
        "max": "0"
      },
      {
        "id": "MedicationStatement.context",
        "path": "MedicationStatement.context",
        "max": "0"
      },
      {
        "id": "MedicationStatement.effective[x]",
        "path": "MedicationStatement.effective[x]",
        "max": "0"
      },
      {
        "id": "MedicationStatement.dateAsserted",
        "path": "MedicationStatement.dateAsserted",
        "definition": "The date when the medication statement was asserted by the information source. Normally the same as the prescription date. Shall be precise to the day.",
        "min": 1,
        "example": [
          {
            "label": "Example",
            "valueDateTime": "2022-03-01"
          }
        ],
        "condition": [
          "val-dateDayPrecision"
        ],
        "constraint": [
          {
            "key": "val-dateDayPrecision",
            "severity": "error",
            "human": "Shall be precise to the day",
            "expression": "toString().length()=10",
            "source": "https://www.esante.lu/fhir-spec/StructureDefinition/EPLabMedicationStatement"
          }
        ]
      },
      {
        "id": "MedicationStatement.informationSource",
        "path": "MedicationStatement.informationSource",
        "short": "The health professional stating this",
        "min": 1,
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "http://hl7.org/fhir/StructureDefinition/Practitioner"
            ],
            "aggregation": [
              "referenced"
            ]
          }
        ]
      },
      {
        "id": "MedicationStatement.informationSource.id",
        "path": "MedicationStatement.informationSource.id",
        "max": "0"
      },
      {
        "id": "MedicationStatement.informationSource.reference",
        "path": "MedicationStatement.informationSource.reference",
        "short": "A reference to the health professional",
        "min": 1,
        "example": [
          {
            "label": "Example",
            "valueString": "Practitioner?identifier=urn:oid:1.3.182.4.1|2777777717"
          }
        ],
        "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/EPLabMedicationStatement"
          }
        ]
      },
      {
        "id": "MedicationStatement.informationSource.type",
        "path": "MedicationStatement.informationSource.type",
        "max": "0"
      },
      {
        "id": "MedicationStatement.informationSource.identifier",
        "path": "MedicationStatement.informationSource.identifier",
        "max": "0"
      },
      {
        "id": "MedicationStatement.informationSource.display",
        "path": "MedicationStatement.informationSource.display",
        "max": "0"
      },
      {
        "id": "MedicationStatement.derivedFrom",
        "path": "MedicationStatement.derivedFrom",
        "max": "0"
      },
      {
        "id": "MedicationStatement.reasonCode",
        "path": "MedicationStatement.reasonCode",
        "max": "0"
      },
      {
        "id": "MedicationStatement.reasonReference",
        "path": "MedicationStatement.reasonReference",
        "max": "0"
      },
      {
        "id": "MedicationStatement.note",
        "path": "MedicationStatement.note",
        "max": "0"
      },
      {
        "id": "MedicationStatement.dosage",
        "path": "MedicationStatement.dosage",
        "short": "Details of how medication was last taken",
        "comment": "If the referential contains CurrentTreatements.IndicateTimeLastTaken = true, please provide a value",
        "max": "1"
      },
      {
        "id": "MedicationStatement.dosage.id",
        "path": "MedicationStatement.dosage.id",
        "max": "0"
      },
      {
        "id": "MedicationStatement.dosage.sequence",
        "path": "MedicationStatement.dosage.sequence",
        "max": "0"
      },
      {
        "id": "MedicationStatement.dosage.text",
        "path": "MedicationStatement.dosage.text",
        "short": "Free text for the last dose taken",
        "example": [
          {
            "label": "Example",
            "valueString": "75mg"
          }
        ]
      },
      {
        "id": "MedicationStatement.dosage.additionalInstruction",
        "path": "MedicationStatement.dosage.additionalInstruction",
        "max": "0"
      },
      {
        "id": "MedicationStatement.dosage.patientInstruction",
        "path": "MedicationStatement.dosage.patientInstruction",
        "max": "0"
      },
      {
        "id": "MedicationStatement.dosage.timing",
        "path": "MedicationStatement.dosage.timing",
        "short": "Date last taken"
      },
      {
        "id": "MedicationStatement.dosage.timing.id",
        "path": "MedicationStatement.dosage.timing.id",
        "max": "0"
      },
      {
        "id": "MedicationStatement.dosage.timing.event",
        "path": "MedicationStatement.dosage.timing.event",
        "short": "Date last taken",
        "definition": "Shall have the format : 2022-01-02T13:00:00+01:00\r\nIf time is not known, try to estimate it. If not, put 00:00:00",
        "max": "1",
        "condition": [
          "val-size25"
        ],
        "constraint": [
          {
            "key": "val-size25",
            "severity": "error",
            "human": "Shall have the right format",
            "expression": "toString().length()=25",
            "source": "https://www.esante.lu/fhir-spec/StructureDefinition/EPLabMedicationStatement"
          }
        ]
      },
      {
        "id": "MedicationStatement.dosage.timing.repeat",
        "path": "MedicationStatement.dosage.timing.repeat",
        "max": "0"
      },
      {
        "id": "MedicationStatement.dosage.timing.code",
        "path": "MedicationStatement.dosage.timing.code",
        "max": "0"
      },
      {
        "id": "MedicationStatement.dosage.asNeeded[x]",
        "path": "MedicationStatement.dosage.asNeeded[x]",
        "max": "0"
      },
      {
        "id": "MedicationStatement.dosage.site",
        "path": "MedicationStatement.dosage.site",
        "max": "0"
      },
      {
        "id": "MedicationStatement.dosage.route",
        "path": "MedicationStatement.dosage.route",
        "max": "0"
      },
      {
        "id": "MedicationStatement.dosage.method",
        "path": "MedicationStatement.dosage.method",
        "max": "0"
      },
      {
        "id": "MedicationStatement.dosage.doseAndRate",
        "path": "MedicationStatement.dosage.doseAndRate",
        "max": "0"
      },
      {
        "id": "MedicationStatement.dosage.maxDosePerPeriod",
        "path": "MedicationStatement.dosage.maxDosePerPeriod",
        "max": "0"
      },
      {
        "id": "MedicationStatement.dosage.maxDosePerAdministration",
        "path": "MedicationStatement.dosage.maxDosePerAdministration",
        "max": "0"
      },
      {
        "id": "MedicationStatement.dosage.maxDosePerLifetime",
        "path": "MedicationStatement.dosage.maxDosePerLifetime",
        "max": "0"
      }
    ]
  }
}