Release 5

This page is part of the FHIR Specification (v5.0.0: R5 - STU). This is the current published version. For a full list of available versions, see the Directory of published versions . Page versions: R5 R4B R4 R3

Medicationdispense.shex

Pharmacy Work GroupMaturity Level: N/AStandards Status: InformativeCompartments: Encounter, Patient, Practitioner

Raw ShEx

ShEx statement for medicationdispense

PREFIX fhir: <http://hl7.org/fhir/> 
PREFIX fhirvs: <http://hl7.org/fhir/ValueSet/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> 
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 

IMPORT <code.shex>
IMPORT <Group.shex>
IMPORT <Dosage.shex>
IMPORT <Device.shex>
IMPORT <Patient.shex>
IMPORT <boolean.shex>
IMPORT <dateTime.shex>
IMPORT <Location.shex>
IMPORT <Quantity.shex>
IMPORT <markdown.shex>
IMPORT <CareTeam.shex>
IMPORT <CarePlan.shex>
IMPORT <Resource.shex>
IMPORT <Reference.shex>
IMPORT <Encounter.shex>
IMPORT <Procedure.shex>
IMPORT <Identifier.shex>
IMPORT <Annotation.shex>
IMPORT <Provenance.shex>
IMPORT <Organization.shex>
IMPORT <Practitioner.shex>
IMPORT <RelatedPerson.shex>
IMPORT <DomainResource.shex>
IMPORT <CodeableConcept.shex>
IMPORT <BackboneElement.shex>
IMPORT <PractitionerRole.shex>
IMPORT <CodeableReference.shex>
IMPORT <MedicationRequest.shex>
IMPORT <MedicationAdministration.shex>


start=@<MedicationDispense> AND {fhir:nodeRole [fhir:treeRoot]}

# Dispensing a medication to a named patient
<MedicationDispense> EXTENDS @<DomainResource> CLOSED {   

    a [fhir:MedicationDispense]?;
    fhir:nodeRole [fhir:treeRoot]?;

    fhir:identifier @<OneOrMore_Identifier>?;  # External identifier
    fhir:basedOn @<OneOrMore_Reference_CarePlan>?;  # Plan that is fulfilled by this 
                                            # dispense 
    fhir:partOf @<OneOrMore_Reference_MedicationAdministration_OR_Procedure>?;  # Event that dispense is part of
    fhir:status @<code> AND
    	{fhir:v @fhirvs:medicationdispense-status};  # preparation | in-progress | 
                                            # cancelled | on-hold | completed | 
                                            # entered-in-error | stopped | 
                                            # declined | unknown 
    fhir:notPerformedReason @<CodeableReference>?;  # Why a dispense was not performed
    fhir:statusChanged @<dateTime>?;        # When the status changed
    fhir:category @<OneOrMore_CodeableConcept>?;  # Type of medication dispense
    fhir:medication @<CodeableReference>;   # What medication was supplied
    fhir:subject @<Reference> AND {fhir:link 
    			@<Group> OR 
    			@<Patient> ? };  # Who the dispense is for
    fhir:encounter @<Reference> AND {fhir:link 
    			@<Encounter> ? }?;  # Encounter associated with event
    fhir:supportingInformation @<OneOrMore_Reference_Resource>?;  # Information that supports the 
                                            # dispensing of the medication 
    fhir:performer @<OneOrMore_MedicationDispense.performer>?;  # Who performed event
    fhir:location @<Reference> AND {fhir:link 
    			@<Location> ? }?;  # Where the dispense occurred
    fhir:authorizingPrescription @<OneOrMore_Reference_MedicationRequest>?;  # Medication order that authorizes 
                                            # the dispense 
    fhir:type @<CodeableConcept>?;          # Trial fill, partial fill, 
                                            # emergency fill, etc 
    fhir:quantity @<Quantity>?;             # Amount dispensed
    fhir:daysSupply @<Quantity>?;           # Amount of medication expressed as 
                                            # a timing amount 
    fhir:recorded @<dateTime>?;             # When the recording of the dispense 
                                            # started 
    fhir:whenPrepared @<dateTime>?;         # When product was packaged and 
                                            # reviewed 
    fhir:whenHandedOver @<dateTime>?;       # When product was given out
    fhir:destination @<Reference> AND {fhir:link 
    			@<Location> ? }?;  # Where the medication was/will be 
                                            # sent 
    fhir:receiver @<OneOrMore_Reference_Location_OR_Patient_OR_Practitioner_OR_PractitionerRole_OR_RelatedPerson>?;  # Who collected the medication or 
                                            # where the medication was delivered 
    fhir:note @<OneOrMore_Annotation>?;     # Information about the dispense
    fhir:renderedDosageInstruction @<markdown>?;  # Full representation of the dosage 
                                            # instructions 
    fhir:dosageInstruction @<OneOrMore_Dosage>?;  # How the medication is to be used 
                                            # by the patient or administered by 
                                            # the caregiver 
    fhir:substitution @<MedicationDispense.substitution>?;  # Whether a substitution was 
                                            # performed on the dispense 
    fhir:eventHistory @<OneOrMore_Reference_Provenance>?;  # A list of relevant lifecycle events
}  

# Whether a substitution was performed on the dispense
<MedicationDispense.substitution> EXTENDS @<BackboneElement> CLOSED {   
    fhir:wasSubstituted @<boolean>;         # Whether a substitution was or was 
                                            # not performed on the dispense 
    fhir:type @<CodeableConcept>?;          # Code signifying whether a 
                                            # different drug was dispensed from 
                                            # what was prescribed 
    fhir:reason @<OneOrMore_CodeableConcept>?;  # Why was substitution made
    fhir:responsibleParty @<Reference> AND {fhir:link 
    			@<Organization> OR 
    			@<Practitioner> OR 
    			@<PractitionerRole> ? }?;  # Who is responsible for the 
                                            # substitution 
}  

# Who performed event
<MedicationDispense.performer> EXTENDS @<BackboneElement> CLOSED {   
    fhir:function @<CodeableConcept>?;      # Who performed the dispense and 
                                            # what they did 
    fhir:actor @<Reference> AND {fhir:link 
    			@<CareTeam> OR 
    			@<Device> OR 
    			@<Organization> OR 
    			@<Patient> OR 
    			@<Practitioner> OR 
    			@<PractitionerRole> OR 
    			@<RelatedPerson> ? };  # Individual who was performing
}  

#---------------------- Cardinality Types (OneOrMore) -------------------

<OneOrMore_Identifier> CLOSED {
    rdf:first @<Identifier>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_Identifier> 
}

<OneOrMore_Reference_CarePlan> CLOSED {
    rdf:first @<Reference> AND {fhir:link 
			@<CarePlan> } ;
    rdf:rest [rdf:nil] OR @<OneOrMore_Reference_CarePlan> 
}

<OneOrMore_Reference_MedicationAdministration_OR_Procedure> CLOSED {
    rdf:first @<Reference> AND {fhir:link 
			@<MedicationAdministration> OR 
			@<Procedure> } ;
    rdf:rest [rdf:nil] OR @<OneOrMore_Reference_MedicationAdministration_OR_Procedure> 
}

<OneOrMore_CodeableConcept> CLOSED {
    rdf:first @<CodeableConcept>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_CodeableConcept> 
}

<OneOrMore_Reference_Resource> CLOSED {
    rdf:first @<Reference> AND {fhir:link 
			@<Resource> } ;
    rdf:rest [rdf:nil] OR @<OneOrMore_Reference_Resource> 
}

<OneOrMore_MedicationDispense.performer> CLOSED {
    rdf:first @<MedicationDispense.performer>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_MedicationDispense.performer> 
}

<OneOrMore_Reference_MedicationRequest> CLOSED {
    rdf:first @<Reference> AND {fhir:link 
			@<MedicationRequest> } ;
    rdf:rest [rdf:nil] OR @<OneOrMore_Reference_MedicationRequest> 
}

<OneOrMore_Reference_Location_OR_Patient_OR_Practitioner_OR_PractitionerRole_OR_RelatedPerson> CLOSED {
    rdf:first @<Reference> AND {fhir:link 
			@<Location> OR 
			@<Patient> OR 
			@<Practitioner> OR 
			@<PractitionerRole> OR 
			@<RelatedPerson> } ;
    rdf:rest [rdf:nil] OR @<OneOrMore_Reference_Location_OR_Patient_OR_Practitioner_OR_PractitionerRole_OR_RelatedPerson> 
}

<OneOrMore_Annotation> CLOSED {
    rdf:first @<Annotation>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_Annotation> 
}

<OneOrMore_Dosage> CLOSED {
    rdf:first @<Dosage>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_Dosage> 
}

<OneOrMore_Reference_Provenance> CLOSED {
    rdf:first @<Reference> AND {fhir:link 
			@<Provenance> } ;
    rdf:rest [rdf:nil] OR @<OneOrMore_Reference_Provenance> 
}

#---------------------- Value Sets ------------------------

# MedicationDispense Status Codes
fhirvs:medicationdispense-status ["preparation" "in-progress" "cancelled" "on-hold" "completed" "entered-in-error" "stopped" "declined" "unknown"]


Usage note: every effort has been made to ensure that the ShEx files are correct and useful, but they are not a normative part of the specification.