{
  "resourceType": "StructureDefinition",
  "id": "pr-medication-dispense",
  "meta": {
    "source": "https://www.icanbwell.com/fhir_profile_definitions",
    "security": [
      {
        "system": "https://www.icanbwell.com/owner",
        "code": "bwell"
      },
      {
        "system": "https://www.icanbwell.com/access",
        "code": "bwell"
      }
    ]
  },
  "url": "https://fhir.icanbwell.com/4_0_0/StructureDefinition/pr-medication-dispense",
  "version": "1.00",
  "name": "MedicationDispense",
  "title": "Profile: Medication Dispense",
  "status": "active",
  "experimental": false,
  "date": "2022-07-27",
  "publisher": "b.Well Connected Health",
  "description": "Medication (re)fills",
  "jurisdiction": [
    {
      "coding": [
        {
          "system": "urn:iso:std:iso:3166",
          "code": "US",
          "display": "United States of America"
        }
      ],
      "text": "United States of America"
    }
  ],
  "fhirVersion": "4.0.0",
  "kind": "resource",
  "abstract": false,
  "type": "MedicationDispense",
  "baseDefinition": "http://hl7.org/fhir/StructureDefinition/MedicationDispense",
  "derivation": "constraint",
  "differential": {
    "element": [
      {
        "id": "MedicationDispense",
        "path": "MedicationDispense"
      },
      {
        "id": "MedicationDispense.id",
        "path": "MedicationDispense.id"
      },
      {
        "id": "MedicationDispense.meta",
        "path": "MedicationDispense.meta",
        "label": "meta",
        "min": 1,
        "max": "1",
        "type": [
          {
            "code": "Meta"
          }
        ]
      },
      {
        "id": "MedicationDispense.meta.source",
        "path": "MedicationDispense.meta.source",
        "sliceName": "meta-source",
        "label": "meta",
        "short": "uri of the data source",
        "definition": "Typically the data owner's URL followed by a source/file description",
        "requirements": "mandatory for all resources in bWell's FHIR Server",
        "min": 1,
        "max": "1",
        "type": [
          {
            "code": "uri"
          }
        ],
        "example": [
          {
            "label": "example of meta.source",
            "valueUri": "https://www.icanbwell.com/provider-directory"
          }
        ]
      },
      {
        "id": "MedicationDispense.meta.security",
        "path": "MedicationDispense.meta.security",
        "sliceName": "meta-security",
        "label": "meta",
        "short": "security tags representing the data's owner, vendor, and accessibility",
        "definition": "data owner: \n \n data vendor: \n \n data access: ",
        "requirements": "/owner & /access are mandatory for all resources in bWell's FHIR Server",
        "min": 1,
        "max": "*",
        "type": [
          {
            "code": "Coding"
          }
        ],
        "example": [
          {
            "label": "example of data owner security tag",
            "valueCoding": {
              "system": "https://www.icanbwell.com/owner",
              "code": "bwell"
            }
          },
          {
            "label": "example of data access security tag",
            "valueCoding": {
              "system": "https://www.icanbwell.com/access",
              "code": "bwell"
            }
          },
          {
            "label": "example of data vendor security tag",
            "valueCoding": {
              "system": "https://www.icanbwell.com/vendor",
              "code": "bwell"
            }
          }
        ]
      },
      {
        "id": "MedicationDispense.extension",
        "path": "MedicationDispense.extension",
        "slicing": {
          "description": "slice by url",
          "rules": "open"
        },
        "min": 0,
        "max": "*",
        "type": [
          {
            "code": "Extension"
          }
        ]
      },
      {
        "id": "ex-refills-remaining",
        "path": "MedicationDispense.extension",
        "sliceName": "refills-remaining",
        "min": 0,
        "max": "1",
        "type": [
          {
            "code": "Extension",
            "profile": [
              "https://fhir.icanbwell.com/4_0_0/StructureDefinition/ex-refills-remaining"
            ]
          }
        ]
      },
      {
        "id": "de-identifier",
        "path": "MedicationDispense.identifier",
        "label": "identifier",
        "slicing": {
          "description": "slice by types",
          "rules": "open"
        },
        "short": "a value to identify the resource by",
        "type": [
          {
            "code": "Identifier"
          }
        ]
      },
      {
        "id": "identifier.id",
        "path": "MedicationDispense.identifier.id",
        "label": "identifier",
        "short": "set case-by-case",
        "min": 1,
        "max": "1",
        "type": [
          {
            "code": "string"
          }
        ]
      },
      {
        "id": "identifier.use",
        "path": "MedicationDispense.identifier.use",
        "label": "identifier",
        "short": "usual | official | temp | secondary | old (If known)",
        "definition": "The purpose of this identifier.",
        "min": 0,
        "max": "1",
        "type": [
          {
            "code": "code"
          }
        ]
      },
      {
        "id": "identifier.type",
        "path": "MedicationDispense.identifier.type",
        "label": "identifier",
        "short": "Description of identifier",
        "definition": "A coded type for the identifier that can be used to determine which identifier to use for a specific purpose.",
        "requirements": "Needs binding valueset",
        "min": 1,
        "max": "1",
        "type": [
          {
            "code": "CodeableConcept"
          }
        ]
      },
      {
        "id": "identifier.system",
        "path": "MedicationDispense.identifier.system",
        "label": "identifier",
        "short": "The system which created the identifier",
        "definition": "Values may be an oid, uri, url, or canonical",
        "comment": "for mapped data, this is frequently a canonical url",
        "min": 1,
        "max": "1",
        "type": [
          {
            "code": "uri"
          }
        ],
        "example": [
          {
            "label": "a client's unknown system",
            "valueUri": "https://www.health.org/person-identifier"
          }
        ]
      },
      {
        "id": "identifier.value",
        "path": "MedicationDispense.identifier.value",
        "label": "identifier",
        "short": "The unique value",
        "definition": "The raw identifier value that represents a resource",
        "requirements": "This should be the raw value, as it exists in the source data (ie without prefix)",
        "min": 1,
        "max": "1",
        "type": [
          {
            "code": "string"
          }
        ]
      },
      {
        "id": "de-rx-number",
        "path": "MedicationDispense.identifier",
        "sliceName": "identifier-rx-number",
        "label": "identifier-rx-number",
        "code": [
          {
            "system": "https://www.icanbwell.com/product-feature-code"
          }
        ],
        "short": "The prescription (rx) number",
        "requirements": "system = source URI",
        "type": [
          {
            "code": "Identifier"
          }
        ],
        "example": [
          {
            "label": "RX Number",
            "valueIdentifier": {
              "id": "rx-number",
              "type": {
                "coding": [
                  {
                    "id": "rx-number-type",
                    "system": "https://fhir.icanbwell.com/4_0_0/CodeSystem/vs-identifier-type",
                    "code": "RX"
                  }
                ]
              }
            }
          }
        ]
      },
      {
        "id": "MedicationDispense.status",
        "path": "MedicationDispense.status",
        "min": 1,
        "max": "1",
        "type": [
          {
            "code": "code"
          }
        ]
      },
      {
        "id": "MedicationDispense.medication[x]",
        "path": "MedicationDispense.medication[x]",
        "short": "The value representing the medication",
        "min": 1,
        "max": "1",
        "type": [
          {
            "code": "CodeableConcept"
          },
          {
            "code": "Reference"
          }
        ]
      },
      {
        "id": "MedicationDispense.subject",
        "path": "MedicationDispense.subject",
        "short": "The patient",
        "min": 1,
        "max": "1",
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "https://fhir.icanbwell.com/4_0_0/StructureDefinition/pr-patient"
            ]
          }
        ]
      },
      {
        "id": "MedicationDispense.supportingInformation",
        "path": "MedicationDispense.supportingInformation",
        "short": "Reference to the MedicationStatement, if there is one",
        "min": 0,
        "max": "1",
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "https://fhir.icanbwell.com/4_0_0/StructureDefinition/pr-medication-statement",
              "https://fhir.icanbwell.com/4_0_0/StructureDefinition/pr-medication-request"
            ]
          }
        ]
      },
      {
        "id": "MedicationDispense.performer",
        "path": "MedicationDispense.performer",
        "slicing": {
          "description": "slice by types",
          "rules": "open"
        },
        "short": "The providers involved with the medication authoring and dispensing",
        "min": 0,
        "max": "*",
        "type": [
          {
            "code": "BackboneElement"
          }
        ]
      },
      {
        "id": "MedicationDispense.performer.id",
        "path": "MedicationDispense.performer.id",
        "min": 1,
        "max": "1"
      },
      {
        "id": "MedicationDispense.performer.function",
        "path": "MedicationDispense.performer.function",
        "min": 0,
        "max": "1",
        "type": [
          {
            "code": "CodeableConcept"
          }
        ]
      },
      {
        "id": "MedicationDispense.performer.actor",
        "path": "MedicationDispense.performer.actor",
        "short": "A reference to the provider",
        "min": 1,
        "max": "1",
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "https://fhir.icanbwell.com/4_0_0/StructureDefinition/pr-practitioner",
              "https://fhir.icanbwell.com/4_0_0/StructureDefinition/pr-organization"
            ]
          }
        ]
      },
      {
        "id": "de-medication-dispense-performer-prescribing",
        "path": "MedicationDispense.performer",
        "sliceName": "prescriber",
        "short": "The prescribing practitioner",
        "min": 0,
        "max": "1",
        "type": [
          {
            "code": "BackboneElement"
          }
        ]
      },
      {
        "id": "de-medication-dispense-performer-prescribing-function",
        "path": "MedicationDispense.performer.function",
        "sliceName": "prescriber",
        "short": "The coded function",
        "min": 1,
        "max": "1",
        "type": [
          {
            "code": "CodeableConcept"
          }
        ],
        "patternCodeableConcept": {
          "coding": [
            {
              "id": "prescribing",
              "system": "https://fhir.icanbwell.com/4_0_0/CodeSystem/vs-performer-role-code",
              "code": "prescribing"
            }
          ]
        }
      },
      {
        "id": "de-medication-dispense-performer-prescribing-actor",
        "path": "MedicationDispense.performer.actor",
        "sliceName": "prescriber",
        "short": "The practitioner",
        "min": 1,
        "max": "1",
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "https://fhir.icanbwell.com/4_0_0/StructureDefinition/pr-practitioner"
            ]
          }
        ]
      },
      {
        "id": "de-medication-dispense-performer-dispensing",
        "path": "MedicationDispense.performer",
        "sliceName": "dispensing-pharmacy",
        "short": "The dispensing pharmacy",
        "min": 1,
        "max": "1",
        "type": [
          {
            "code": "BackboneElement"
          }
        ]
      },
      {
        "id": "de-medication-dispense-performer-dispensing-function",
        "path": "MedicationDispense.performer.function",
        "sliceName": "dispensing-pharmacy",
        "short": "The coded function",
        "min": 1,
        "max": "1",
        "type": [
          {
            "code": "CodeableConcept"
          }
        ],
        "patternCodeableConcept": {
          "coding": [
            {
              "id": "dispensing",
              "system": "https://fhir.icanbwell.com/4_0_0/CodeSystem/vs-performer-role-code",
              "code": "dispensing"
            }
          ]
        }
      },
      {
        "id": "de-medication-dispense-performer-dispensing-actor",
        "path": "MedicationDispense.performer.actor",
        "sliceName": "dispensing-pharmacy",
        "short": "The pharmacy organization",
        "min": 1,
        "max": "1",
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "https://fhir.icanbwell.com/4_0_0/StructureDefinition/pr-organization"
            ]
          }
        ]
      },
      {
        "id": "MedicationDispense.location",
        "path": "MedicationDispense.location",
        "label": "dispensing-pharmacy-location",
        "short": "The pharmacy location",
        "min": 0,
        "max": "1",
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "https://fhir.icanbwell.com/4_0_0/StructureDefinition/pr-location"
            ]
          }
        ]
      },
      {
        "id": "MedicationDispense.authorizingPrescription",
        "path": "MedicationDispense.authorizingPrescription",
        "short": "The prescription",
        "min": 0,
        "max": "*",
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "https://fhir.icanbwell.com/4_0_0/StructureDefinition/pr-medication-request"
            ]
          }
        ]
      },
      {
        "id": "MedicationDispense.type",
        "path": "MedicationDispense.type",
        "min": 0,
        "max": "1",
        "type": [
          {
            "code": "CodeableConcept"
          }
        ],
        "example": [
          {
            "label": "refill",
            "valueCodeableConcept": {
              "coding": [
                {
                  "id": "refill",
                  "system": "http://terminology.hl7.org/CodeSystem/v3-ActCode",
                  "code": "RF",
                  "display": "Refill"
                }
              ]
            }
          }
        ]
      },
      {
        "id": "MedicationDispense.quantity",
        "path": "MedicationDispense.quantity",
        "min": 0,
        "max": "1",
        "example": [
          {
            "label": "quantity",
            "valueQuantity": {
              "value": 250,
              "system": "http://unitsofmeasure.org",
              "code": "mL"
            }
          }
        ]
      },
      {
        "id": "MedicationDispense.daysSupply",
        "path": "MedicationDispense.daysSupply",
        "min": 0,
        "max": "1",
        "example": [
          {
            "label": "days-supply",
            "valueQuantity": {
              "value": 1,
              "unit": "Day",
              "system": "http://unitsofmeasure.org",
              "code": "d"
            }
          }
        ]
      },
      {
        "id": "MedicationDispense.whenHandedOver",
        "path": "MedicationDispense.whenHandedOver",
        "short": "When the medication was dispensed",
        "min": 0,
        "max": "1",
        "type": [
          {
            "code": "dateTime"
          }
        ]
      },
      {
        "id": "MedicationDispense.dosageInstruction",
        "path": "MedicationDispense.dosageInstruction",
        "short": "When the medication was dispensed",
        "min": 0,
        "max": "*",
        "type": [
          {
            "code": "Dosage"
          }
        ]
      },
      {
        "id": "MedicationDispense.dosageInstruction.patientInstruction",
        "path": "MedicationDispense.dosageInstruction.patientInstruction",
        "short": "Specific dosage instruction or verbal instruction given to the patient",
        "min": 0,
        "max": "1",
        "type": [
          {
            "code": "string"
          }
        ]
      }
    ]
  }
}