Antibiotic stewardship: prescribing of trimethoprim vs nitrofurantoin

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 Trimethoprim as a percentage of prescribing of nitrofurantoin and trimethoprim
Why it matters Resistance to trimethoprim is increasing, and therefore NICE guidelines recommend that nitrofurantoin is used first for empirical treatment of urinary tract infections unless there is a low risk of trimethoprim resistance.

You can read our paper on the implementation of this guidance in the Journal of Antimicrobial Chemotherapy.

Tags Antimicrobial Stewardship, Infections
Implies cost savings No
Authored by christopher.wood
Checked by richard.croker
Last reviewed 2023-09-04
Next review due 2025-09-04
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 ("0501080W0AAADAD", "0501080W0AAAEAE", "0501080W0AAAIAI", "0501080W0AAAMAM", "0501080W0AAAQAQ", "0501080W0BCACAI", "0501080W0BGABAE", "0501080W0BHAAAD", "0501080W0BHABAE")
 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 ("0501080W0AAADAD", "0501080W0AAAEAE", "0501080W0AAAIAI", "0501080W0AAAMAM", "0501080W0AAAQAQ", "0501080W0BCACAI", "0501080W0BGABAE", "0501080W0BHAAAD", "0501080W0BHABAE", "0501130R0AAAAAA", "0501130R0AAABAB", "0501130R0AAACAC", "0501130R0AAADAD", "0501130R0AAAEAE", "0501130R0AAAGAG", "0501130R0AAAJAJ", "0501130R0AAAMAM", "0501130R0AAANAN", "0501130R0AAARAR", "0501130R0AAATAT", "0501130R0AAAUAU", "0501130R0AAAVAV", "0501130R0AABEBE", "0501130R0AABSBS", "0501130R0AACMCM", "0501130R0BBAAAD", "0501130R0BBACAC", "0501130R0BCAAAA", "0501130R0BCABAB", "0501130R0BGAAAG", "0501130R0BHAAAE", "0501130R0BHABAD")
 GROUP BY month, practice_id
Feedback