R6 Ballot (3rd Draft) FHIR CI-Build

Publish-box (todo) This is the Continuous Integration Build of FHIR (will be incorrect/inconsistent at times).
See the Directory of published versions

Medicationdispense.shex

Maturity Level : N/A
Responsible Owner: Pharmacy Work Group Standards Status : Informative Compartments : Encounter , Group , 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>

# ShEx Version 2.2
IMPORT <Code.shex>

IMPORT <Group.shex>
IMPORT <Dosage.shex>
IMPORT <Device.shex>
IMPORT <Patient.shex>
IMPORT <boolean.shex>
IMPORT <dateTime.shex>

IMPORT <Boolean.shex>
IMPORT <DateTime.shex>

IMPORT <Location.shex>
IMPORT <Quantity.shex>
IMPORT <markdown.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 <positiveInt.shex>

IMPORT <PositiveInt.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:status @<Code> AND

    	{fhir:v @fhirvs:medicationdispense-status};  # preparation | in-progress | 
                                            # cancelled | on-hold | completed | 
                                            # entered-in-error | stopped | 

                                            # entered-in-error | unfulfilled | 

                                            # declined | unknown 
    fhir:notPerformedReason @<CodeableReference>?;  # Why a dispense was not performed
    fhir:statusChanged @<dateTime>?;        # When the status changed

    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 

    fhir:medication @<CodeableReference>;   # What medication was (or was 
                                            # intended to be) supplied 
    fhir:subject @<Reference> AND {fhir:l 

    			@<Group> OR 
    			@<Patient> ? };  # Who the dispense is for
    fhir:encounter @<Reference> AND {fhir:link 

    fhir:encounter @<Reference> AND {fhir:l 

    			@<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 

    fhir:location @<Reference> AND {fhir:l 

    			@<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:quantity @<Quantity>?;             # Amount of medication

    fhir:daysSupply @<Quantity>?;           # Amount of medication expressed as 
                                            # a timing amount 
    fhir:fillNumber @<positiveInt>?;        # A number that represents the known 

    fhir:fillNumber @<PositiveInt>?;        # A number that represents the known 

                                            # fill this dispense represents 
    fhir:recorded @<dateTime>?;             # When the recording of the dispense 

    fhir:recorded @<DateTime>?;             # When the recording of the dispense 

                                            # started 
    fhir:whenPrepared @<dateTime>?;         # When product was packaged and 

    fhir:whenPrepared @<DateTime>?;         # When product was packaged and 

                                            # reviewed 
    fhir:whenHandedOver @<dateTime>?;       # When product was given out
    fhir:destination @<Reference> AND {fhir:link 

    fhir:whenHandedOver @<DateTime>?;       # When product was given out
    fhir:destination @<Reference> AND {fhir:l 

    			@<Location> ? }?;  # Where the medication was/will be 
                                            # sent 
    fhir:receiver @<OneOrMore_Reference_Group_OR_Location_OR_Patient_OR_Practitioner_OR_PractitionerRole_OR_RelatedPerson>?;  # Who collected the medication or 

    fhir:receiver @<OneOrMore_Reference_Group_OR_Location_OR_Organization_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 

    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:doseAdministrationAid @<CodeableConcept>?;  # Type of adherence packaging to use 
                                            # for the dispense 

    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:l 
    			@<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 

    fhir:actor @<Reference> AND {fhir:l 

    			@<CareTeam> OR 
    			@<Device> OR 
    			@<Group> OR 
    			@<Organization> OR 
    			@<Patient> OR 
    			@<Practitioner> OR 
    			@<PractitionerRole> OR 
    			@<RelatedPerson> ? };  # Individual who was performing
}  
# 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 
}  

#---------------------- 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 

    rdf:first @<Reference> AND {fhir:l 

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

    rdf:first @<Reference> AND {fhir:l 

			@<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 

    rdf:first @<Reference> AND {fhir:l 

			@<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 

    rdf:first @<Reference> AND {fhir:l 

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

<OneOrMore_Reference_Group_OR_Location_OR_Organization_OR_Patient_OR_Practitioner_OR_PractitionerRole_OR_RelatedPerson> CLOSED {
    rdf:first @<Reference> AND {fhir:l 

			@<Group> OR 
			@<Location> OR 
			@<Organization> OR 

			@<Patient> OR 
			@<Practitioner> OR 
			@<PractitionerRole> OR 
			@<RelatedPerson> } ;
    rdf:rest [rdf:nil] OR @<OneOrMore_Reference_Group_OR_Location_OR_Patient_OR_Practitioner_OR_PractitionerRole_OR_RelatedPerson> 

    rdf:rest [rdf:nil] OR @<OneOrMore_Reference_Group_OR_Location_OR_Organization_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 

    rdf:first @<Reference> AND {fhir:l 

			@<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"]

fhirvs:medicationdispense-status ["preparation" "in-progress" "cancelled" "on-hold" "completed" "entered-in-error" "unfulfilled" "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.