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 | Number of prescription items for all NSAIDs excluding ibuprofen and naproxen as a percentage of the total items for all NSAIDs |
---|---|
Why it matters | There have been a number of concerns about the safety of a number of anti-inflammatory drugs, including COX-2 inhibitors and some 'traditional' NSAIDS, for their effects on the stomach, kidneys and the risk of blood clots. NICE CKD recommends that in patients with ischaemic heart disease, cerebrovascular disease, or peripheral arterial disease ibuprofen (up to 1200mg per day) and naproxen (up to 1000mg) should be prescribed first-line and COX-2 inhibitors, diclofenac, and high-dose ibuprofen are contraindicated |
Tags | Cardiovascular system, Standard, NICE, Pain, Safety |
Implies cost savings | No |
Authored by | richard.croker |
Checked by | andrew.brown |
Last reviewed | 2024-02-12 |
Next review due | 2026-02-12 |
History | View change history on GitHub → |
SELECT
CAST(month AS DATE) AS month,
practice AS practice_id,
SUM(items) AS numerator
FROM hscic.normalised_prescribing
WHERE bnf_code IN ("100101040AAAAAA", "100101040BBAAAA", "100101050AAAAAA", "100101080AAAAAA", "100101080BBAAAA", "1001010AAAAAAAA", "1001010AAAAABAB", "1001010AAAAAJAJ", "1001010AAAAAKAK", "1001010AABBAAAA", "1001010ADAAABAB", "1001010ADAAACAC", "1001010ADBCABAC", "1001010ADBCACAB", "1001010ADBEABAC", "1001010ADBFAAAB", "1001010AEAAAAAA", "1001010AEBBAAAA", "1001010AGAAAAAA", "1001010AGAAABAB", "1001010AGBBAAAA", "1001010AGBBABAB", "1001010AHAAAAAA", "1001010AHAAABAB", "1001010AHBBAAAA", "1001010AHBBABAB", "1001010AJAAAAAA", "1001010AJAAABAB", "1001010AJAAACAC", "1001010AJAAADAD", "1001010AJBBAAAA", "1001010AJBBABAB", "1001010AJBBACAC", "1001010AJBBADAD", "1001010AMAAAAAA", "1001010AMAAABAB", "1001010AMBBACAA", "1001010APAAAAAA", "1001010APAAABAB", "1001010APBBAAAA", "1001010APBBACAA", "1001010APBCAAAA", "1001010APBCABAB", "1001010APBCACAA", "1001010C0AAAAAA", "1001010C0AAABAB", "1001010C0AAACAC", "1001010C0AAADAD", "1001010C0AAAEAE", "1001010C0AAAFAF", "1001010C0AAAJAJ", "1001010C0AAALAL", "1001010C0AAAMAM", "1001010C0AAANAN", "1001010C0AAARAR", "1001010C0AAATAT", "1001010C0AAAUAU", "1001010C0AAAVAV", "1001010C0AAAWAW", "1001010C0AAAXAX", "1001010C0AABBBB", "1001010C0AABJBJ", "1001010C0AABLBL", "1001010C0AABMBM", "1001010C0BBAAAD", "1001010C0BBABAE", "1001010C0BBACAA", "1001010C0BBADAC", "1001010C0BBAEAB", "1001010C0BBAFAF", "1001010C0BBAGAJ", "1001010C0BBAHAL", "1001010C0BBAIAT", "1001010C0BBAJAU", "1001010C0BDAFAW", "1001010C0BDAIAW", "1001010C0BDAJAN", "1001010C0BLAAAM", "1001010C0BLABAX", "1001010C0BMAAAN", "1001010C0BMABAW", "1001010C0BPAAAR", "1001010C0BQAAAD", "1001010C0BQABAE", "1001010C0BQACAF", "1001010C0BQADAL", "1001010C0BQAJAD", "1001010C0BQAKAE", "1001010C0BQALAL", "1001010C0BQAMAF", "1001010C0BQANAL", "1001010C0BSAAAL", "1001010C0BSABAF", "1001010C0BZAAAL", "1001010C0CEAAAL", "1001010C0CFAAAC", "1001010C0CIAAAL", "1001010C0CJABAE", "1001010C0CJACAL", "1001010C0CJADAF", "1001010C0CKAAAL", "1001010C0CMABAF", "1001010C0CNAAAM", "1001010C0CNABAX", "1001010C0CQAABM", "1001010C0CRAAAL", "1001010E0AAACAC", "1001010E0AAADAD", "1001010E0BBADAD", "1001010E0BFAAAC", "1001010E0BGAAAD", "1001010E0BHAAAD", "1001010I0AAABAB", "1001010I0AAACAC", "1001010K0AAAAAA", "1001010K0AAABAB", "1001010K0AAACAC", "1001010K0AAADAD", "1001010K0AAAFAF", "1001010K0AAAQAQ", "1001010K0AAARAR", "1001010K0AAAXAX", "1001010K0AABABA", "1001010K0AABBBB", "1001010K0BDADAF", "1001010K0BXAAAD", "1001010L0AAAAAA", "1001010L0AAABAB", "1001010L0AAAIAI", "1001010L0AAAJAJ", "1001010L0AAAMAM", "1001010L0AAAPAP", "1001010L0BDAAAI", "1001010L0BDABAJ", "1001010L0BHAAAJ", "1001010L0BNAAAJ", "1001010L0BNADAJ", "1001010L0BQAAAM", "1001010N0AAAAAA", "1001010N0AAABAB", "1001010N0AAADAD", "1001010N0AAAJAJ", "1001010N0BBAAAA", "1001010N0BBABAD", "1001010Q0AAABAB", "1001010R0AAAAAA", "1001010R0AAABAB", "1001010R0AAAGAG", "1001010R0AAAKAK", "1001010R0BBAAAA", "1001010R0BBABAB", "1001010R0BBAGAG", "1001010R0BHAAAK", "1001010S0AAAAAA", "1001010S0AAABAB", "1001010T0AAACAC", "1001010T0BBABAC", "1001010X0AAAAAA", "1001010X0BBAAAA")
GROUP BY month, practice_id
SELECT
CAST(month AS DATE) AS month,
practice AS practice_id,
SUM(items) AS denominator
FROM hscic.normalised_prescribing
WHERE bnf_code IN ("100101040AAAAAA", "100101040BBAAAA", "100101050AAAAAA", "100101080AAAAAA", "100101080BBAAAA", "1001010AAAAAAAA", "1001010AAAAABAB", "1001010AAAAAJAJ", "1001010AAAAAKAK", "1001010AABBAAAA", "1001010ADAAABAB", "1001010ADAAACAC", "1001010ADBCABAC", "1001010ADBCACAB", "1001010ADBEABAC", "1001010ADBFAAAB", "1001010AEAAAAAA", "1001010AEBBAAAA", "1001010AGAAAAAA", "1001010AGAAABAB", "1001010AGBBAAAA", "1001010AGBBABAB", "1001010AHAAAAAA", "1001010AHAAABAB", "1001010AHBBAAAA", "1001010AHBBABAB", "1001010AJAAAAAA", "1001010AJAAABAB", "1001010AJAAACAC", "1001010AJAAADAD", "1001010AJBBAAAA", "1001010AJBBABAB", "1001010AJBBACAC", "1001010AJBBADAD", "1001010AMAAAAAA", "1001010AMAAABAB", "1001010AMBBACAA", "1001010APAAAAAA", "1001010APAAABAB", "1001010APBBAAAA", "1001010APBBACAA", "1001010APBCAAAA", "1001010APBCABAB", "1001010APBCACAA", "1001010C0AAAAAA", "1001010C0AAABAB", "1001010C0AAACAC", "1001010C0AAADAD", "1001010C0AAAEAE", "1001010C0AAAFAF", "1001010C0AAAJAJ", "1001010C0AAALAL", "1001010C0AAAMAM", "1001010C0AAANAN", "1001010C0AAARAR", "1001010C0AAATAT", "1001010C0AAAUAU", "1001010C0AAAVAV", "1001010C0AAAWAW", "1001010C0AAAXAX", "1001010C0AABBBB", "1001010C0AABJBJ", "1001010C0AABLBL", "1001010C0AABMBM", "1001010C0BBAAAD", "1001010C0BBABAE", "1001010C0BBACAA", "1001010C0BBADAC", "1001010C0BBAEAB", "1001010C0BBAFAF", "1001010C0BBAGAJ", "1001010C0BBAHAL", "1001010C0BBAIAT", "1001010C0BBAJAU", "1001010C0BDAFAW", "1001010C0BDAIAW", "1001010C0BDAJAN", "1001010C0BLAAAM", "1001010C0BLABAX", "1001010C0BMAAAN", "1001010C0BMABAW", "1001010C0BPAAAR", "1001010C0BQAAAD", "1001010C0BQABAE", "1001010C0BQACAF", "1001010C0BQADAL", "1001010C0BQAJAD", "1001010C0BQAKAE", "1001010C0BQALAL", "1001010C0BQAMAF", "1001010C0BQANAL", "1001010C0BSAAAL", "1001010C0BSABAF", "1001010C0BZAAAL", "1001010C0CEAAAL", "1001010C0CFAAAC", "1001010C0CIAAAL", "1001010C0CJABAE", "1001010C0CJACAL", "1001010C0CJADAF", "1001010C0CKAAAL", "1001010C0CMABAF", "1001010C0CNAAAM", "1001010C0CNABAX", "1001010C0CQAABM", "1001010C0CRAAAL", "1001010E0AAACAC", "1001010E0AAADAD", "1001010E0BBADAD", "1001010E0BFAAAC", "1001010E0BGAAAD", "1001010E0BHAAAD", "1001010I0AAABAB", "1001010I0AAACAC", "1001010J0AAAAAA", "1001010J0AAABAB", "1001010J0AAACAC", "1001010J0AAADAD", "1001010J0AAAEAE", "1001010J0AAAFAF", "1001010J0AAANAN", "1001010J0AAAPAP", "1001010J0AAAUAU", "1001010J0AAAYAY", "1001010J0AABABA", "1001010J0AABHBH", "1001010J0AABIBI", "1001010J0AABJBJ", "1001010J0AABMBM", "1001010J0AABNBN", "1001010J0AABQBQ", "1001010J0AABRBR", "1001010J0AABSBS", "1001010J0B4ABAD", "1001010J0B4AEAD", "1001010J0B4AHBN", "1001010J0B4AIAA", "1001010J0B4AJBH", "1001010J0B4AKAY", "1001010J0B4ALBM", "1001010J0B4ANAB", "1001010J0B4APBJ", "1001010J0B4AQBH", "1001010J0B4ARBM", "1001010J0B4AUAA", "1001010J0B4AVAU", "1001010J0B4AWAA", "1001010J0B4AXBH", "1001010J0B4AYBH", "1001010J0B4AZAA", "1001010J0B4BBBQ", "1001010J0B4BCBR", "1001010J0B4BDBR", "1001010J0BCAAAD", "1001010J0BCABAE", "1001010J0BCACAF", "1001010J0BCADAC", "1001010J0BCAEAN", "1001010J0BCAFAP", "1001010J0BMACAE", "1001010J0CCACBA", "1001010J0CDADAE", "1001010J0CFABBH", "1001010J0CFAEBA", "1001010J0CJABAA", "1001010J0CSAABJ", "1001010J0CSABBS", "1001010J0CUABBH", "1001010J0CXABBH", "1001010J0DBAABH", "1001010J0DBACBM", "1001010J0DFACBH", "1001010J0DHAAAD", "1001010J0DHABAE", "1001010J0DIAAAA", "1001010J0DJAAAD", "1001010J0DJABAE", "1001010J0DKAABR", "1001010J0DKABBR", "1001010K0AAAAAA", "1001010K0AAABAB", "1001010K0AAACAC", "1001010K0AAADAD", "1001010K0AAAFAF", "1001010K0AAAQAQ", "1001010K0AAARAR", "1001010K0AAAXAX", "1001010K0AABABA", "1001010K0AABBBB", "1001010K0BDADAF", "1001010K0BXAAAD", "1001010L0AAAAAA", "1001010L0AAABAB", "1001010L0AAAIAI", "1001010L0AAAJAJ", "1001010L0AAAMAM", "1001010L0AAAPAP", "1001010L0BDAAAI", "1001010L0BDABAJ", "1001010L0BHAAAJ", "1001010L0BNAAAJ", "1001010L0BNADAJ", "1001010L0BQAAAM", "1001010N0AAAAAA", "1001010N0AAABAB", "1001010N0AAADAD", "1001010N0AAAJAJ", "1001010N0BBAAAA", "1001010N0BBABAD", "1001010P0AAADAD", "1001010P0AAAEAE", "1001010P0AAAHAH", "1001010P0AAAIAI", "1001010P0AAAJAJ", "1001010P0AAALAL", "1001010P0AAAQAQ", "1001010P0AAARAR", "1001010P0AABBBB", "1001010P0AABCBC", "1001010P0AABDBD", "1001010P0AABEBE", "1001010P0AABFBF", "1001010P0BCAAAD", "1001010P0BCABAE", "1001010P0BCAGAH", "1001010P0BCAHAJ", "1001010P0BCAIAI", "1001010P0BCAJAQ", "1001010P0BKAAAL", "1001010P0BSAAAH", "1001010P0BUAABB", "1001010P0BXAABD", "1001010P0BYAAAH", "1001010P0BYACAI", "1001010P0BZAAAH", "1001010Q0AAABAB", "1001010R0AAAAAA", "1001010R0AAABAB", "1001010R0AAAGAG", "1001010R0AAAKAK", "1001010R0BBAAAA", "1001010R0BBABAB", "1001010R0BBAGAG", "1001010R0BHAAAK", "1001010S0AAAAAA", "1001010S0AAABAB", "1001010T0AAACAC", "1001010T0BBABAC", "1001010X0AAAAAA", "1001010X0BBAAAA")
GROUP BY month, practice_id