High dose opioids as percentage regular opioids

Below are the database queries which are used to create this measure. These are run against a copy of the BSA prescribing data which we store in Google BigQuery. We're working on making our BigQuery tables publicly available at which point it will be possible to run and modify these queries yourself. But even where code and database queries are not directly useable by others we believe it is always preferable to make them public.

Description Opioids with likely daily dose of ≥120mg morphine equivalence compared with prescribing of all doses of these opioids
Why it matters The Opioids Aware project seeks to improve prescribing of opioid analgesia. There is little evidence that opioids are helpful in long term pain, and the risk of harm increases significantly above 120mg morphine (or equivalent) per day, without much increase in benefit. We have assumed that if a patient is on regular doses of 120mg morphine a day or above that they are likely to have also had additional opioids for breakthrough pain. This is why we have set the threshold at ≥120mg morphine equivalence per day. The calculations are based on likely doses of long acting, regular opioids, for example morphine sulphate tablets or fentanyl patches. For example, we have assumed that MST 60mg tablets are “high dose”, as they are usually taken as one tablet twice daily (120mg daily dose), whereas MST 30mg are not, as the daily dose is 60mg. We have not included preparations used for breakthrough pain, e.g. Oramorph, or opioid injections which tend to be used more commonly in palliative care. We have calculated morphine equivalencies using the tables available from the Faculty of Pain Medicine, Royal College of Anaesthetists.
Tags Standard, Opioids, Pain, Safety
Implies cost savings No
History View change history on GitHub →

Numerator SQL

SELECT
     CAST(month AS DATE) AS month,
     practice AS practice_id,
     SUM(items) AS numerator
 FROM hscic.normalised_prescribing
 WHERE bnf_code IN ("0407020A0AAAFAF", "0407020A0AAAGAG", "0407020A0AAAHAH", "0407020A0BBABAF", "0407020A0BBACAG", "0407020A0BBADAH", "0407020A0BBAJAF", "0407020A0BBAKAG", "0407020A0BBALAH", "0407020A0BDABAF", "0407020A0BDACAG", "0407020A0BDADAH", "0407020A0BEACAF", "0407020A0BEADAG", "0407020A0BEAEAH", "0407020A0BFACAF", "0407020A0BFADAG", "0407020A0BFAEAH", "0407020A0BGABAF", "0407020A0BGACAG", "0407020A0BGADAH", "0407020A0BHABAF", "0407020A0BHACAG", "0407020A0BHADAH", "0407020A0BLABAF", "0407020A0BLACAG", "0407020A0BLADAH", "0407020A0BMABAF", "0407020A0BMACAG", "0407020A0BMADAH", "0407020A0BQACAF", "0407020A0BQADAG", "0407020A0BQAEAH", "0407020A0BRACAG", "0407020A0BRADAH", "0407020A0BRAEAF", "0407020A0BRAHAF", "0407020A0BRAIAG", "0407020A0BRAJAH", "0407020A0BUACAF", "0407020A0BUADAG", "0407020A0BUAEAH", "0407020A0BVACAF", "0407020A0BVADAG", "0407020A0BVAEAH", "0407020ADAAAHAH", "0407020ADAAAIAI", "0407020ADAAAPAP", "0407020ADAAAQAQ", "0407020ADAAARAR", "0407020ADBCACAH", "0407020ADBCADAI", "0407020ADBCAFAP", "0407020ADBCAGAQ", "0407020ADBCAHAR", "0407020ADBDADAH", "0407020ADBDAEAI", "0407020ADBEADAH", "0407020ADBEAEAI", "0407020ADBEAFAP", "0407020ADBEAHAR", "0407020ADBEAIAQ", "0407020ADBFADAH", "0407020ADBFAEAI", "0407020ADBKADAH", "0407020ADBKAEAI", "0407020ADBKAGAR", "0407020ADBKAHAQ", "0407020ADBLABAI", "0407020ADBLACAR", "0407020ADBLADAQ", "0407020ADBLAEAH", "0407020ADBMAEAH", "0407020ADBMAFAR", "0407020ADBMAGAQ", "0407020ADBMAHAI", "0407020ADBNAAAI", "0407020ADBNABAH", "0407020ADBPADAR", "0407020ADBPAEAH", "0407020ADBPAFAQ", "0407020ADBPAGAI", "0407020ADBQACAH", "0407020ADBQADAI", "0407020ADBRAEAR", "0407020ADBRAFAH", "0407020ADBRAGAQ", "0407020ADBSAEAR", "0407020ADBSAFAH", "0407020ADBSAGAQ", "0407020ADBSAHAI", "0407020ADBTAEAR", "0407020ADBTAFAH", "0407020ADBTAGAQ", "0407020ADBTAHAI", "0407020AFAAADAD", "0407020AFBBADAD", "0407020AGAAAFAF", "0407020AGAAAGAG", "0407020AGBBAFAF", "0407020AGBBAGAG", "0407020B0AAAFAF", "0407020B0AAAGAG", "0407020B0BDABAF", "0407020B0BDACAG", "0407020B0BGABAF", "0407020B0BGACAG", "0407020B0BIABAF", "0407020B0BIACAG", "0407020B0BJABAF", "0407020B0BJACAG", "0407020B0BNABAF", "0407020B0BNACAG", "0407020B0BPABAF", "0407020B0BPACAG", "0407020B0BSABAF", "0407020B0BSACAG", "0407020B0BTABAF", "0407020B0BTACAG", "0407020Q0AAAGAG", "0407020Q0AAAHAH", "0407020Q0AAAIAI", "0407020Q0AADCDC", "0407020Q0AADDDD", "0407020Q0AADEDE", "0407020Q0AADUDU", "0407020Q0AADVDV", "0407020Q0AADWDW", "0407020Q0AAEBEB", "0407020Q0AAEHEH", "0407020Q0AAEIEI", "0407020Q0BBACAI", "0407020Q0BBADAH", "0407020Q0BBAEAG", "0407020Q0BBAHDC", "0407020Q0BBAIDD", "0407020Q0BBAJDE", "0407020Q0BIABEH", "0407020Q0BIACDU", "0407020Q0BIADDV", "0407020Q0BIAEDW", "0407020Q0BIAFEI", "0407020Q0BJACEB", "0407020Q0BKACEH", "0407020Q0BKADEB", "0407020Q0BKAEEI", "0407020Q0BMACAI", "0407020Q0BMADAH", "0407020Q0BMAEAG", "0407020Q0BNACAI", "0407020Q0BNADAH")
 GROUP BY month, practice_id

Denominator SQL

SELECT
     CAST(month AS DATE) AS month,
     practice AS practice_id,
     SUM(items) AS denominator
 FROM hscic.normalised_prescribing
 WHERE bnf_code IN ("0407020A0AAAEAE", "0407020A0AAAFAF", "0407020A0AAAGAG", "0407020A0AAAHAH", "0407020A0AAAUAU", "0407020A0AABWBW", "0407020A0BBAAAE", "0407020A0BBABAF", "0407020A0BBACAG", "0407020A0BBADAH", "0407020A0BBAIAE", "0407020A0BBAJAF", "0407020A0BBAKAG", "0407020A0BBALAH", "0407020A0BBAMAU", "0407020A0BDAAAE", "0407020A0BDABAF", "0407020A0BDACAG", "0407020A0BDADAH", "0407020A0BEAAAU", "0407020A0BEABAE", "0407020A0BEACAF", "0407020A0BEADAG", "0407020A0BEAEAH", "0407020A0BFAAAU", "0407020A0BFABAE", "0407020A0BFACAF", "0407020A0BFADAG", "0407020A0BFAEAH", "0407020A0BFAFBW", "0407020A0BGAAAE", "0407020A0BGABAF", "0407020A0BGACAG", "0407020A0BGADAH", "0407020A0BHAAAE", "0407020A0BHABAF", "0407020A0BHACAG", "0407020A0BHADAH", "0407020A0BLAAAE", "0407020A0BLABAF", "0407020A0BLACAG", "0407020A0BLADAH", "0407020A0BLAEAU", "0407020A0BMAAAE", "0407020A0BMABAF", "0407020A0BMACAG", "0407020A0BMADAH", "0407020A0BMAEAU", "0407020A0BQAAAU", "0407020A0BQABAE", "0407020A0BQACAF", "0407020A0BQADAG", "0407020A0BQAEAH", "0407020A0BRAAAU", "0407020A0BRABAE", "0407020A0BRACAG", "0407020A0BRADAH", "0407020A0BRAEAF", "0407020A0BRAFAU", "0407020A0BRAGAE", "0407020A0BRAHAF", "0407020A0BRAIAG", "0407020A0BRAJAH", "0407020A0BUAAAU", "0407020A0BUABAE", "0407020A0BUACAF", "0407020A0BUADAG", "0407020A0BUAEAH", "0407020A0BVAAAU", "0407020A0BVABAE", "0407020A0BVACAF", "0407020A0BVADAG", "0407020A0BVAEAH", "0407020ADAAAFAF", "0407020ADAAAGAG", "0407020ADAAAHAH", "0407020ADAAAIAI", "0407020ADAAAKAK", "0407020ADAAAPAP", "0407020ADAAAQAQ", "0407020ADAAARAR", "0407020ADAAASAS", "0407020ADBCAAAF", "0407020ADBCABAG", "0407020ADBCACAH", "0407020ADBCADAI", "0407020ADBCAEAK", "0407020ADBCAFAP", "0407020ADBCAGAQ", "0407020ADBCAHAR", "0407020ADBCAIAS", "0407020ADBDAAAK", "0407020ADBDABAF", "0407020ADBDACAG", "0407020ADBDADAH", "0407020ADBDAEAI", "0407020ADBEAAAK", "0407020ADBEABAF", "0407020ADBEACAG", "0407020ADBEADAH", "0407020ADBEAEAI", "0407020ADBEAFAP", "0407020ADBEAGAS", "0407020ADBEAHAR", "0407020ADBEAIAQ", "0407020ADBFAAAK", "0407020ADBFABAF", "0407020ADBFACAG", "0407020ADBFADAH", "0407020ADBFAEAI", "0407020ADBFAFAK", "0407020ADBFAHAG", "0407020ADBKAAAK", "0407020ADBKABAF", "0407020ADBKACAG", "0407020ADBKADAH", "0407020ADBKAEAI", "0407020ADBKAFAS", "0407020ADBKAGAR", "0407020ADBKAHAQ", "0407020ADBLAAAK", "0407020ADBLABAI", "0407020ADBLACAR", "0407020ADBLADAQ", "0407020ADBLAEAH", "0407020ADBLAFAF", "0407020ADBLAGAS", "0407020ADBLAHAG", "0407020ADBMAAAK", "0407020ADBMABAF", "0407020ADBMACAS", "0407020ADBMADAG", "0407020ADBMAEAH", "0407020ADBMAFAR", "0407020ADBMAGAQ", "0407020ADBMAHAI", "0407020ADBNAAAI", "0407020ADBNABAH", "0407020ADBNACAK", "0407020ADBNADAF", "0407020ADBNAEAG", "0407020ADBPAAAK", "0407020ADBPABAF", "0407020ADBPACAG", "0407020ADBPADAR", "0407020ADBPAEAH", "0407020ADBPAFAQ", "0407020ADBPAGAI", "0407020ADBQAAAF", "0407020ADBQABAG", "0407020ADBQACAH", "0407020ADBQADAI", "0407020ADBRAAAK", "0407020ADBRABAF", "0407020ADBRACAS", "0407020ADBRADAG", "0407020ADBRAEAR", "0407020ADBRAFAH", "0407020ADBRAGAQ", "0407020ADBSAAAK", "0407020ADBSABAF", "0407020ADBSACAS", "0407020ADBSADAG", "0407020ADBSAEAR", "0407020ADBSAFAH", "0407020ADBSAGAQ", "0407020ADBSAHAI", "0407020ADBTAAAK", "0407020ADBTABAF", "0407020ADBTACAS", "0407020ADBTADAG", "0407020ADBTAEAR", "0407020ADBTAFAH", "0407020ADBTAGAQ", "0407020ADBTAHAI", "0407020AFAAAAAA", "0407020AFAAABAB", "0407020AFAAACAC", "0407020AFAAADAD", "0407020AFBBAAAA", "0407020AFBBABAB", "0407020AFBBACAC", "0407020AFBBADAD", "0407020AGAAACAC", "0407020AGAAADAD", "0407020AGAAAEAE", "0407020AGAAAFAF", "0407020AGAAAGAG", "0407020AGBBACAC", "0407020AGBBADAD", "0407020AGBBAEAE", "0407020AGBBAFAF", "0407020AGBBAGAG", "0407020B0AAAEAE", "0407020B0AAAFAF", "0407020B0AAAGAG", "0407020B0AAAHAH", "0407020B0AAAIAI", "0407020B0AAAJAJ", "0407020B0BDAAAE", "0407020B0BDABAF", "0407020B0BDACAG", "0407020B0BEAAAH", "0407020B0BEABAI", "0407020B0BEACAJ", "0407020B0BGAAAE", "0407020B0BGABAF", "0407020B0BGACAG", "0407020B0BHAAAH", "0407020B0BHABAI", "0407020B0BHACAJ", "0407020B0BIAAAE", "0407020B0BIABAF", "0407020B0BIACAG", "0407020B0BJAAAE", "0407020B0BJABAF", "0407020B0BJACAG", "0407020B0BKAAAH", "0407020B0BKABAI", "0407020B0BKADAJ", "0407020B0BLAAAH", "0407020B0BLABAI", "0407020B0BLACAJ", "0407020B0BMAAAH", "0407020B0BMABAI", "0407020B0BMACAJ", "0407020B0BNAAAE", "0407020B0BNABAF", "0407020B0BNACAG", "0407020B0BPAAAE", "0407020B0BPABAF", "0407020B0BPACAG", "0407020B0BQAAAH", "0407020B0BQABAI", "0407020B0BQACAJ", "0407020B0BRAAAH", "0407020B0BRABAI", "0407020B0BRACAJ", "0407020B0BSAAAE", "0407020B0BSABAF", "0407020B0BSACAG", "0407020B0BTAAAE", "0407020B0BTABAF", "0407020B0BTACAG", "0407020B0BUAAAH", "0407020B0BUABAI", "0407020B0BUACAJ", "0407020Q0AAAGAG", "0407020Q0AAAHAH", "0407020Q0AAAIAI", "0407020Q0AAAKAK", "0407020Q0AAALAL", "0407020Q0AACFCF", "0407020Q0AACGCG", "0407020Q0AACPCP", "0407020Q0AACVCV", "0407020Q0AADCDC", "0407020Q0AADDDD", "0407020Q0AADEDE", "0407020Q0AADUDU", "0407020Q0AADVDV", "0407020Q0AADWDW", "0407020Q0AAEBEB", "0407020Q0AAEFEF", "0407020Q0AAEGEG", "0407020Q0AAEHEH", "0407020Q0AAEIEI", "0407020Q0BBAAAK", "0407020Q0BBABAL", "0407020Q0BBACAI", "0407020Q0BBADAH", "0407020Q0BBAEAG", "0407020Q0BBAFCV", "0407020Q0BBAGCP", "0407020Q0BBAHDC", "0407020Q0BBAIDD", "0407020Q0BBAJDE", "0407020Q0BBAKCG", "0407020Q0BBALCF", "0407020Q0BIAAEG", "0407020Q0BIABEH", "0407020Q0BIACDU", "0407020Q0BIADDV", "0407020Q0BIAEDW", "0407020Q0BIAFEI", "0407020Q0BJACEB", "0407020Q0BKAAEF", "0407020Q0BKABEG", "0407020Q0BKACEH", "0407020Q0BKADEB", "0407020Q0BKAEEI", "0407020Q0BMAAAK", "0407020Q0BMABAL", "0407020Q0BMACAI", "0407020Q0BMADAH", "0407020Q0BMAEAG", "0407020Q0BNAAAK", "0407020Q0BNABAL", "0407020Q0BNACAI", "0407020Q0BNADAH")
 GROUP BY month, practice_id