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 | Prescribing of continuous glucose monitoring sensors per 1000 patients |
---|---|
Why it matters | Continuous glucose monitoring devices (CGM) can significantly reduce the need for people with diabetes to conduct finger-prick testing. NICE guidance for Type 1 diabetes in adults, Type 2 diabetes in adults and Type 1 and Type 2 diabetes in children and young people were all updated in March 2022. The updates include recommendations that all patients with type 1 diabetes should be offered a choice of real-time continuous glucose monitoring (rtCGM) or intermittently scanned continuous glucose monitoring (isCGM) and that adults with type 2 diabetes on multiple daily insulin injections should be offered GM where they meet specific clinical criteria. |
Tags | Standard, Diabetes |
Implies cost savings | No |
Authored by | richard.croker |
Checked by | christopher.wood |
Last reviewed | 2024-08-05 |
Next review due | 2025-08-05 |
History | View change history on GitHub → |
SELECT
CAST(month AS DATE) AS month,
practice AS practice_id,
SUM(p.quantity) AS numerator
FROM hscic.normalised_prescribing p -- joins prescribing data to subquery below, filtering list to BNF codes created in subquery
INNER JOIN -- joins the prescribing data table to the subquery thereby filtering the prescribing data to only these codes
(SELECT bnf_code FROM dmd.vmp WHERE id = 34865511000001109 AND LOWER(nm) NOT LIKE '%transmitter%' -- selects bnf_codes from vmp table matching VMP id, excluding transmitters
UNION DISTINCT -- joins vmp and amp tables together
SELECT bnf_code FROM dmd.amp WHERE vmp = 34865511000001109 AND bnf_code IS NOT NULL AND LOWER(nm) NOT LIKE '%transmitter%') bnf -- selects bnf_codes from amp table matching VMP id where they exist, excluding transmitters
ON p.bnf_code = bnf.bnf_code
GROUP BY month, practice_id
SELECT
CAST(month AS DATE) AS month,
practice AS practice_id,
SUM(total_list_size / 1000.0) AS denominator
FROM hscic.practice_statistics
GROUP BY month, practice_id