PREVIEW: Proportion of immediate release oral morphine prescribed as liquid

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 Proportion of immediate release oral morphine prescribed as liquid formulations
Why it matters tbc
Tags
Implies cost savings No
History View change history on GitHub →

Numerator SQL

SELECT
     CAST(month AS DATE) AS month,
     practice AS practice_id,
     SUM(ome_dose) AS numerator
 FROM measures.vw__opioids_total_dmd pr
 WHERE pr.bnf_code IN ('0407020Q0BHAGCN','0407020Q0BCAGCN','0407020Q0AAGBGB','0407020Q0AACTCT','0407020Q0AACUCU','0407020Q0AACNCN','0407020Q0BCAHGB','0407020Q0BHAHA6','0407020Q0AADKDK','0407020Q0AADNDN','0407020Q0AADYDY','0407020Q0BCAICT','0407020Q0BCAJCU','0407020Q0AAERER','0407020Q0AAESES','0407020Q0AAETET','0407020Q0BCABA6','0407020Q0AAFAFA','0407020Q0AAFBFB','0407020Q0AAFFFF','0407020Q0AAFHFH','0407020Q0AAFIFI','0407020Q0AAFDFD','0407020Q0AAFEFE','0407020Q0AAFGFG','0407020Q0AAA6A6','0407020Q0AAECEC')
 GROUP BY month, practice_id

Denominator SQL

SELECT
     CAST(month AS DATE) AS month,
     practice AS practice_id,
     SUM(ome_dose) AS denominator
 FROM measures.vw__opioids_total_dmd pr
 WHERE pr.bnf_code IN ('0407020Q0AAA6A6','0407020Q0AACDCD','0407020Q0AACECE','0407020Q0AACNCN','0407020Q0AACTCT','0407020Q0AACUCU','0407020Q0AADKDK','0407020Q0AADNDN','0407020Q0AADRDR','0407020Q0AADYDY','0407020Q0AAECEC','0407020Q0AAERER','0407020Q0AAESES','0407020Q0AAETET','0407020Q0AAFAFA','0407020Q0AAFBFB','0407020Q0AAFDFD','0407020Q0AAFEFE','0407020Q0AAFFFF','0407020Q0AAFGFG','0407020Q0AAFHFH','0407020Q0AAFIFI','0407020Q0AAGBGB','0407020Q0AAGEGE','0407020Q0AAGFGF','0407020Q0AAGGGG','0407020Q0AAGHGH','0407020Q0AAGIGI','0407020Q0AAGJGJ','0407020Q0BCABA6','0407020Q0BCAGCN','0407020Q0BCAHGB','0407020Q0BCAICT','0407020Q0BCAJCU','0407020Q0BHACCD','0407020Q0BHADCE','0407020Q0BHAFDR','0407020Q0BHAGCN','0407020Q0BHAHA6','0407020Q0BQAAGE','0407020Q0BQABGF','0407020Q0BQACGG','0407020Q0BQADGH','0407020Q0BQAEGI','0407020Q0BQAFGJ')
 GROUP BY month, practice_id
Feedback