Prescribing of high cost tramadol preparations

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 Items prescribed of high cost tramadol preparations as a proportion of all tramadol items prescribed
Why it matters Modified release and non-standard tramadol preparations vary widely in cost. Generic tramadol 50mg capsules are low-cost. Ideally modified-release and other high cost preparations should be reserved for patients who have compliance issues.
Tags Standard, Cost Saving, Opioids, Pain
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 ("040702040AAABAB", "040702040AAACAC", "040702040AAADAD", "040702040AAAEAE", "040702040AAAFAF", "040702040AAAGAG", "040702040AAAHAH", "040702040AAAIAI", "040702040AAAJAJ", "040702040AAAMAM", "040702040AAANAN", "040702040AAAPAP", "040702040AAATAT", "040702040AAAUAU", "040702040AAAYAY", "040702040AAAZAZ", "040702040AABABA", "040702040AABBBB", "040702040AABCBC", "040702040AABDBD", "040702040BBAAAA", "040702040BBABAB", "040702040BBACAC", "040702040BBADAD", "040702040BBAEAE", "040702040BBAFAF", "040702040BBAGAD", "040702040BBAHAE", "040702040BBAIAM", "040702040BBAJAN", "040702040BBAKAY", "040702040BDAAAA", "040702040BDABAG", "040702040BDACAH", "040702040BDADAI", "040702040BDAEAJ", "040702040BDAFAB", "040702040BDAGAT", "040702040BDAHAD", "040702040BDAIAE", "040702040BDAJAM", "040702040BDAKAN", "040702040BEABAC", "040702040BEADAE", "040702040BFAAAU", "040702040BFABBA", "040702040BGAAAC", "040702040BGABAD", "040702040BGACAE", "040702040BHAAAC", "040702040BHABAD", "040702040BHACAE", "040702040BHADAC", "040702040BHAEAD", "040702040BHAFAE", "040702040BIAAAC", "040702040BIABAE", "040702040BIACAM", "040702040BJAAAG", "040702040BJABAH", "040702040BJACAI", "040702040BJADAJ", "040702040BKAAAC", "040702040BKABAD", "040702040BKACAE", "040702040BLAAAC", "040702040BLABAD", "040702040BLACAE", "040702040BNAAAC", "040702040BNABAD", "040702040BNACAE", "040702040BNADAE", "040702040BNAEAD", "040702040BNAFAC", "040702040BPAAAG", "040702040BPABAH", "040702040BPACAI", "040702040BPADAJ", "040702040BQAAAC", "040702040BQABAD", "040702040BQACAE", "040702040BSAAAC", "040702040BSABAD", "040702040BSACAE", "040702040BTAAAC", "040702040BTABAD", "040702040BTACAE", "040702040BUAAAC", "040702040BUABAD", "040702040BUACAE", "040702040BVAAAD", "040702040BVABAP", "040702040BVACAC", "040702040BVADAE", "040702040BWAAAC", "040702040BWABAE", "040702040BYAAAU")
 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 ("040702040AAAAAA", "040702040AAABAB", "040702040AAACAC", "040702040AAADAD", "040702040AAAEAE", "040702040AAAFAF", "040702040AAAGAG", "040702040AAAHAH", "040702040AAAIAI", "040702040AAAJAJ", "040702040AAAMAM", "040702040AAANAN", "040702040AAAPAP", "040702040AAATAT", "040702040AAAUAU", "040702040AAAYAY", "040702040AAAZAZ", "040702040AABABA", "040702040AABBBB", "040702040AABCBC", "040702040AABDBD", "040702040BBAAAA", "040702040BBABAB", "040702040BBACAC", "040702040BBADAD", "040702040BBAEAE", "040702040BBAFAF", "040702040BBAGAD", "040702040BBAHAE", "040702040BBAIAM", "040702040BBAJAN", "040702040BBAKAY", "040702040BDAAAA", "040702040BDABAG", "040702040BDACAH", "040702040BDADAI", "040702040BDAEAJ", "040702040BDAFAB", "040702040BDAGAT", "040702040BDAHAD", "040702040BDAIAE", "040702040BDAJAM", "040702040BDAKAN", "040702040BEABAC", "040702040BEADAE", "040702040BFAAAU", "040702040BFABBA", "040702040BGAAAC", "040702040BGABAD", "040702040BGACAE", "040702040BHAAAC", "040702040BHABAD", "040702040BHACAE", "040702040BHADAC", "040702040BHAEAD", "040702040BHAFAE", "040702040BIAAAC", "040702040BIABAE", "040702040BIACAM", "040702040BJAAAG", "040702040BJABAH", "040702040BJACAI", "040702040BJADAJ", "040702040BKAAAC", "040702040BKABAD", "040702040BKACAE", "040702040BLAAAC", "040702040BLABAD", "040702040BLACAE", "040702040BNAAAC", "040702040BNABAD", "040702040BNACAE", "040702040BNADAE", "040702040BNAEAD", "040702040BNAFAC", "040702040BPAAAG", "040702040BPABAH", "040702040BPACAI", "040702040BPADAJ", "040702040BQAAAC", "040702040BQABAD", "040702040BQACAE", "040702040BSAAAC", "040702040BSABAD", "040702040BSACAE", "040702040BTAAAC", "040702040BTABAD", "040702040BTACAE", "040702040BUAAAC", "040702040BUABAD", "040702040BUACAE", "040702040BVAAAD", "040702040BVABAP", "040702040BVACAC", "040702040BVADAE", "040702040BWAAAC", "040702040BWABAE", "040702040BYAAAU")
 GROUP BY month, practice_id