{
  "resourceType": "StructureDefinition",
  "id": "MedicationStatementMERT",
  "url": "https://intrahealth.com/fhir/mert/StructureDefinition/MedicationStatementMERT",
  "name": "MedicationStatementMERT",
  "title": "MedicationStatement (MERT)",
  "status": "draft",
  "description": "This profile describes the MedicationStatement for MERT.",
  "fhirVersion": "4.0.1",
  "kind": "resource",
  "abstract": false,
  "type": "MedicationStatement",
  "baseDefinition": "http://hl7.org/fhir/StructureDefinition/MedicationStatement",
  "derivation": "constraint",
  "differential": {
    "element": [
      {
        "id": "MedicationStatement",
        "path": "MedicationStatement",
        "constraint": [
          {
            "key": "mert-med-din-should",
            "severity": "warning",
            "human": "When medication as a CodeableConcept has codings, a DIN coding should be included (Canada-first).",
            "expression": "medication.ofType(CodeableConcept).coding.empty() or medication.ofType(CodeableConcept).coding.where(system = 'http://hl7.org/fhir/sid/ca-din').exists()",
            "source": "https://intrahealth.com/fhir/mert/StructureDefinition/MedicationStatementMERT"
          },
          {
            "key": "mert-ms-statusreason-text",
            "severity": "warning",
            "human": "If statusReason is present, it should carry user-entered text.",
            "expression": "statusReason.empty() or statusReason.text.exists()",
            "source": "https://intrahealth.com/fhir/mert/StructureDefinition/MedicationStatementMERT"
          }
        ]
      },
      {
        "id": "MedicationStatement.status",
        "path": "MedicationStatement.status",
        "mustSupport": true
      },
      {
        "id": "MedicationStatement.statusReason",
        "path": "MedicationStatement.statusReason",
        "short": "Free-text reason for the current medication status.",
        "comment": "MERT systems typically capture user-entered reasons in CodeableConcept.text. Codings may be supplied when available.",
        "mustSupport": true
      },
      {
        "id": "MedicationStatement.statusReason.text",
        "path": "MedicationStatement.statusReason.text",
        "mustSupport": true
      },
      {
        "id": "MedicationStatement.medication[x]",
        "path": "MedicationStatement.medication[x]",
        "slicing": {
          "discriminator": [
            {
              "type": "type",
              "path": "$this"
            }
          ],
          "ordered": false,
          "rules": "open"
        },
        "mustSupport": true
      },
      {
        "id": "MedicationStatement.medication[x]:medicationCodeableConcept",
        "path": "MedicationStatement.medication[x]",
        "sliceName": "medicationCodeableConcept",
        "min": 0,
        "max": "1",
        "type": [
          {
            "code": "CodeableConcept"
          }
        ],
        "mustSupport": true,
        "binding": {
          "strength": "extensible",
          "valueSet": "https://intrahealth.com/fhir/mert/ValueSet/mert-medication-din"
        }
      },
      {
        "id": "MedicationStatement.medication[x]:medicationCodeableConcept.coding",
        "path": "MedicationStatement.medication[x].coding",
        "slicing": {
          "discriminator": [
            {
              "type": "value",
              "path": "system"
            }
          ],
          "rules": "open"
        }
      },
      {
        "id": "MedicationStatement.medication[x]:medicationCodeableConcept.coding:din",
        "path": "MedicationStatement.medication[x].coding",
        "sliceName": "din",
        "min": 0,
        "max": "1",
        "mustSupport": true
      },
      {
        "id": "MedicationStatement.medication[x]:medicationCodeableConcept.coding:din.system",
        "path": "MedicationStatement.medication[x].coding.system",
        "min": 1,
        "patternUri": "http://hl7.org/fhir/sid/ca-din"
      },
      {
        "id": "MedicationStatement.medication[x]:medicationCodeableConcept.coding:din.code",
        "path": "MedicationStatement.medication[x].coding.code",
        "min": 1
      },
      {
        "id": "MedicationStatement.medication[x]:medicationReference",
        "path": "MedicationStatement.medication[x]",
        "sliceName": "medicationReference",
        "min": 0,
        "max": "1",
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "http://hl7.org/fhir/StructureDefinition/Medication"
            ]
          }
        ],
        "mustSupport": true
      },
      {
        "id": "MedicationStatement.subject",
        "path": "MedicationStatement.subject",
        "mustSupport": true
      },
      {
        "id": "MedicationStatement.context",
        "path": "MedicationStatement.context",
        "mustSupport": true
      },
      {
        "id": "MedicationStatement.effective[x]",
        "path": "MedicationStatement.effective[x]",
        "mustSupport": true
      },
      {
        "id": "MedicationStatement.reasonCode",
        "path": "MedicationStatement.reasonCode",
        "mustSupport": true
      },
      {
        "id": "MedicationStatement.note",
        "path": "MedicationStatement.note",
        "mustSupport": true
      },
      {
        "id": "MedicationStatement.dosage",
        "path": "MedicationStatement.dosage",
        "mustSupport": true
      }
    ]
  }
}