opensafely-core / ehrql

ehrQL: the electronic health record query language for OpenSAFELY
https://docs.opensafely.org/ehrql/
Other
7 stars 3 forks source link

Expose `MedicationStatus` column in `medications` table #1991

Closed milanwiedemann closed 6 months ago

milanwiedemann commented 6 months ago

This is needed for the Pharmacy First project. We assume that the MedicationStatus has integers but we have not tested this and we do not know what they mean. We may want to consider adding this to the raw.core schema (similar to ons_deaths) for data exploration first:

evansd commented 6 months ago
SELECT * FROM DataDictionary WHERE [Table] = 'Medication';
Table Type Code Description
Medication DrugStatus 0 Normal
Medication DrugStatus 4 Historical
Medication DrugStatus 5 Blue script
Medication DrugStatus 6 Private
Medication DrugStatus 7 Not in possession
Medication DrugStatus 8 Repeat dispensed
Medication DrugStatus 9 In possession
Medication DrugStatus 10 Dental
Medication DrugStatus 11 Hospital
Medication DrugStatus 12 Problem substance
Medication DrugStatus 13 From patient group direction
Medication DrugStatus 14 To take out
Medication DrugStatus 15 On admission
Medication DrugStatus 16 Regular medication
Medication DrugStatus 17 As required medication
Medication DrugStatus 18 Variable dose medication
Medication DrugStatus 19 Rate-controlled single regular
Medication DrugStatus 20 Only once
Medication DrugStatus 21 Outpatient
Medication DrugStatus 22 Rate-controlled multiple regular
Medication DrugStatus 23 Rate-controlled multiple only once
Medication DrugStatus 24 Rate-controlled single only once
Medication DrugStatus 25 Placeholder
Medication DrugStatus 26 Unconfirmed
Medication DrugStatus 27 Infusion
Medication DrugStatus 28 Reducing dose blue script

Note that the name DrugStatus here doesn't exactly match the column name MedicationStatus. But the values are in the expected range and so I think it's clear that this is the column this dictionary refers to.