﻿{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "id": "http://hl7.org/fhir/json-schema/MedicationAdministration",
  "$ref": "#/definitions/MedicationAdministration",
  "description": "see http://hl7.org/fhir/json.html#schema for information about the FHIR Json Schemas",
  "definitions": {
    "MedicationAdministration": {
      "allOf": [
        {
          "$ref": "DomainResource.schema.json/definitions/DomainResource"
        },
        {
          "description": "Describes the event of a patient consuming or otherwise being administered a medication.  This may be as simple as swallowing a tablet or it may be a long running infusion.  Related resources tie this event to the authorizing prescription, and the specific encounter between patient and health care practitioner.",
          "properties": {
            "resourceType": {
              "description": "This is a MedicationAdministration resource",
              "type": "string",
              "enum": [
                "MedicationAdministration"
              ]
            },
            "identifier": {
              "description": "External identifier - FHIR will generate its own internal identifiers (probably URLs) which do not need to be explicitly managed by the resource.  The identifier here is one that would be used by another non-FHIR system - for example an automated medication pump would provide a record each time it operated; an administration while the patient was off the ward might be made with a different system and entered after the event.  Particularly important if these records have to be updated.",
              "type": "array",
              "items": {
                "$ref": "Identifier.schema.json/definitions/Identifier"
              }
            },
            "status": {
              "description": "Will generally be set to show that the administration has been completed.  For some long running administrations such as infusions it is possible for an administration to be started but not completed or it may be paused while some other process is under way.",
              "type": "string",
              "pattern": "[^\\s]+([\\s]?[^\\s]+)*"
            },
            "status_": {
              "description": "Extensions for status",
              "$ref": "Element.schema.json/definitions/Element"
            },
            "medicationCodeableConcept": {
              "description": "Identifies the medication that was administered. This is either a link to a resource representing the details of the medication or a simple attribute carrying a code that identifies the medication from a known list of medications.",
              "$ref": "CodeableConcept.schema.json/definitions/CodeableConcept"
            },
            "medicationReference": {
              "description": "Identifies the medication that was administered. This is either a link to a resource representing the details of the medication or a simple attribute carrying a code that identifies the medication from a known list of medications.",
              "$ref": "Reference.schema.json/definitions/Reference"
            },
            "patient": {
              "description": "The person or animal receiving the medication.",
              "$ref": "Reference.schema.json/definitions/Reference"
            },
            "encounter": {
              "description": "The visit, admission or other contact between patient and health care provider the medication administration was performed as part of.",
              "$ref": "Reference.schema.json/definitions/Reference"
            },
            "effectiveTimeDateTime": {
              "description": "A specific date/time or interval of time during which the administration took place (or did not take place, when the \u0027notGiven\u0027 attribute is true). For many administrations, such as swallowing a tablet the use of dateTime is more appropriate.",
              "pattern": "-?[0-9]{4}(-(0[1-9]|1[0-2])(-(0[0-9]|[1-2][0-9]|3[0-1])(T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9](\\.[0-9]+)?(Z|(\\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00)))?)?)?",
              "type": "string"
            },
            "effectiveTimeDateTime_": {
              "description": "Extensions for effectiveTimeDateTime",
              "$ref": "Element.schema.json/definitions/Element"
            },
            "effectiveTimePeriod": {
              "description": "A specific date/time or interval of time during which the administration took place (or did not take place, when the \u0027notGiven\u0027 attribute is true). For many administrations, such as swallowing a tablet the use of dateTime is more appropriate.",
              "$ref": "Period.schema.json/definitions/Period"
            },
            "performer": {
              "description": "The individual who was responsible for giving the medication to the patient.",
              "$ref": "Reference.schema.json/definitions/Reference"
            },
            "prescription": {
              "description": "The original request, instruction or authority to perform the administration.",
              "$ref": "Reference.schema.json/definitions/Reference"
            },
            "wasNotGiven": {
              "description": "Set this to true if the record is saying that the medication was NOT administered.",
              "type": "true | false"
            },
            "wasNotGiven_": {
              "description": "Extensions for wasNotGiven",
              "$ref": "Element.schema.json/definitions/Element"
            },
            "reasonNotGiven": {
              "description": "A code indicating why the administration was not performed.",
              "type": "array",
              "items": {
                "$ref": "CodeableConcept.schema.json/definitions/CodeableConcept"
              }
            },
            "reasonGiven": {
              "description": "A code indicating why the medication was given.",
              "type": "array",
              "items": {
                "$ref": "CodeableConcept.schema.json/definitions/CodeableConcept"
              }
            },
            "device": {
              "description": "The device used in administering the medication to the patient.  For example, a particular infusion pump.",
              "type": "array",
              "items": {
                "$ref": "Reference.schema.json/definitions/Reference"
              }
            },
            "note": {
              "description": "Extra information about the medication administration that is not conveyed by the other attributes.",
              "type": "array",
              "items": {
                "$ref": "Annotation.schema.json/definitions/Annotation"
              }
            },
            "dosage": {
              "description": "Describes the medication dosage information details e.g. dose, rate, site, route, etc.",
              "$ref": "#/definitions/MedicationAdministration.Dosage"
            },
            "eventHistory": {
              "description": "A summary of the events of interest that have occurred, such as when the administration was verified.",
              "type": "array",
              "items": {
                "$ref": "#/definitions/MedicationAdministration.EventHistory"
              }
            }
          },
          "required": [
            "patient",
            "resourceType"
          ]
        }
      ]
    },
    "MedicationAdministration.Dosage": {
      "allOf": [
        {
          "$ref": "BackboneElement.schema.json/definitions/BackboneElement"
        },
        {
          "description": "Describes the event of a patient consuming or otherwise being administered a medication.  This may be as simple as swallowing a tablet or it may be a long running infusion.  Related resources tie this event to the authorizing prescription, and the specific encounter between patient and health care practitioner.",
          "properties": {
            "text": {
              "description": "Free text dosage can be used for cases where the dosage administered is too complex to code. When coded dosage is present, the free text dosage may still be present for display to humans.\r\rThe dosage instructions should reflect the dosage of the medication that was administered.",
              "type": "string"
            },
            "text_": {
              "description": "Extensions for text",
              "$ref": "Element.schema.json/definitions/Element"
            },
            "siteCodeableConcept": {
              "description": "A coded specification of the anatomic site where the medication first entered the body.  For example, \"left arm\".",
              "$ref": "CodeableConcept.schema.json/definitions/CodeableConcept"
            },
            "siteReference": {
              "description": "A coded specification of the anatomic site where the medication first entered the body.  For example, \"left arm\".",
              "$ref": "Reference.schema.json/definitions/Reference"
            },
            "route": {
              "description": "A code specifying the route or physiological path of administration of a therapeutic agent into or onto the patient.  For example, topical, intravenous, etc.",
              "$ref": "CodeableConcept.schema.json/definitions/CodeableConcept"
            },
            "method": {
              "description": "A coded value indicating the method by which the medication is intended to be or was introduced into or on the body.  This attribute will most often NOT be populated.  It is most commonly used for injections.  For example, Slow Push, Deep IV.",
              "$ref": "CodeableConcept.schema.json/definitions/CodeableConcept"
            },
            "dose": {
              "description": "The amount of the medication given at one administration event.   Use this value when the administration is essentially an instantaneous event such as a swallowing a tablet or giving an injection.",
              "$ref": "SimpleQuantity.schema.json/definitions/SimpleQuantity"
            },
            "rateRatio": {
              "description": "Identifies the speed with which the medication was or will be introduced into the patient.  Typically the rate for an infusion e.g. 100 ml per 1 hour or 100 ml/hr.  May also be expressed as a rate per unit of time e.g. 500 ml per 2 hours.  Other examples:  200 mcg/min or 200 mcg/1 minute; 1 liter/8 hours.",
              "$ref": "Ratio.schema.json/definitions/Ratio"
            },
            "rateSimpleQuantity": {
              "description": "Identifies the speed with which the medication was or will be introduced into the patient.  Typically the rate for an infusion e.g. 100 ml per 1 hour or 100 ml/hr.  May also be expressed as a rate per unit of time e.g. 500 ml per 2 hours.  Other examples:  200 mcg/min or 200 mcg/1 minute; 1 liter/8 hours.",
              "$ref": "SimpleQuantity.schema.json/definitions/SimpleQuantity"
            }
          }
        }
      ]
    },
    "MedicationAdministration.EventHistory": {
      "allOf": [
        {
          "$ref": "BackboneElement.schema.json/definitions/BackboneElement"
        },
        {
          "description": "Describes the event of a patient consuming or otherwise being administered a medication.  This may be as simple as swallowing a tablet or it may be a long running infusion.  Related resources tie this event to the authorizing prescription, and the specific encounter between patient and health care practitioner.",
          "properties": {
            "status": {
              "description": "The status for the event.",
              "type": "string",
              "pattern": "[^\\s]+([\\s]?[^\\s]+)*"
            },
            "status_": {
              "description": "Extensions for status",
              "$ref": "Element.schema.json/definitions/Element"
            },
            "action": {
              "description": "The action that was taken (e.g. verify).",
              "$ref": "CodeableConcept.schema.json/definitions/CodeableConcept"
            },
            "dateTime": {
              "description": "The date/time at which the event occurred.",
              "type": "string",
              "pattern": "-?[0-9]{4}(-(0[1-9]|1[0-2])(-(0[0-9]|[1-2][0-9]|3[0-1])(T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9](\\.[0-9]+)?(Z|(\\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00)))?)?)?"
            },
            "dateTime_": {
              "description": "Extensions for dateTime",
              "$ref": "Element.schema.json/definitions/Element"
            },
            "actor": {
              "description": "The person responsible for taking the action.",
              "$ref": "Reference.schema.json/definitions/Reference"
            },
            "reason": {
              "description": "The reason why the action was taken.",
              "$ref": "CodeableConcept.schema.json/definitions/CodeableConcept"
            }
          }
        }
      ]
    }
  }
}