Definition
The Drug Record model captures medication prescribing records at patient level, including prescribing details, issue cadence, quantities, and lifecycle status. Multiple issue records can be created from a single drug record for repeat prescriptions.
Constraints and Notes
Section titled “Constraints and Notes”Soft deletion: Whenis_deletedis true, data fields will be nullified in upstream transformations and should be excluded from most analytical queries. Primary keys and foreign keys to patient data are preserved so deleted records and their relationships can still be identified. Foreign keys to coding tables are nullified as the coded information is no longer valid.- If a source code is superseded or removed, derived coded mappings may be
NULL. dmd_product_code_idis resolved fromcode_idand may beNULLif no matching concept exists.
Examples
Section titled “Examples”Find active medication records
Section titled “Find active medication records”SELECT drug_record_id, patient_id, code_id, effective_datetime, review_dateFROM explorer_open_safely.medication_drug_recordORDER BY effective_datetime DESCFind records due for review
Section titled “Find records due for review”SELECT drug_record_id, patient_id, dosage, review_dateFROM explorer_open_safely.medication_drug_recordWHERE review_date <= CURRENT_DATEORDER BY review_date ASCRelated FAQ
Section titled “Related FAQ”- Why can a medication drug record exist without a matching issue record?
- What date and time formats are used across OpenSafely models?
- How should I use the organisation field in patient and other models?