To create an expression specifically requesting information that a MedicationAdministration intentionally did not occur for a medical, patient or system reason, use the profile QICore-mednotadministered.
The following example illustrates the use of a MedicationAdministration resource:
// connectathon/fhir4/cql/EXM108_FHIR4-8.2.000.cql
define "Low Dose Unfractionated Heparin Administration":
["MedicationAdministration": medication in "Low Dose Unfractionated Heparin for VTE Prophylaxis"] VTEMedication
where VTEMedication.status = 'completed'
and VTEMedication.category ~ "Inpatient"
See the patterns page for implementation and usage patterns.