Skip to content

Commit

Permalink
Merge pull request #5112 from bennettoxford/amend_measure__bdzper1000…
Browse files Browse the repository at this point in the history
…_jan_25

Update bdzper1000.json
  • Loading branch information
richiecroker authored Jan 21, 2025
2 parents fc0cc50 + 9a57477 commit 33dc013
Show file tree
Hide file tree
Showing 3 changed files with 80 additions and 12 deletions.
24 changes: 12 additions & 12 deletions openprescribing/measures/definitions/bdzper1000.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
{
"name": "Anxiolytics and Hypnotics: Average Daily Quantity per 1000 patients",
"title": "Anxiolytics and Hypnotics: Average Daily Quantity per 1000 patients",
"description": "Number of average daily quantities (ADQs) of Anxiolytics and Hypnotics per 1000 patients",
"numerator_short": "Anxiolytics and Hypnotics ADQ",
"description": "Number of average daily quantities (ADQs) of oral Anxiolytics and Hypnotics per 1000 patients",
"numerator_short": "Oral Anxiolytics and Hypnotics ADQ",
"denominator_short": "1000 Patients",
"y_label": "ADQ per 1000 patients",
"why_it_matters": [
"Anxiolytics and Hypnotics are drugs that are prescribed for short-term treatment of conditions such as",
"anxiety and sleep problems. <a href='https://www.rcpsych.ac.uk/expertadvice/treatments/benzodiazepines.aspx'> The Royal College of Psychiatrists states</a> ",
"that \"around 4 in every 10 people who take them every day for more than 6 weeks will become addicted\" ",
"and therefore they should not be prescribed for longer than 4 weeks. This measure shows the Average Daily Quantity (ADQ) of drug given per 1000 registered patients, ",
"and therefore they should not be prescribed for longer than 4 weeks. This measure shows the Average Daily Quantity (ADQ) of oral drugs given per 1000 registered patients, ",
"for both the older benzodiazepines, such as diazepam and temazepam, and the newer \"Z-drugs\", such as zopiclone. It excludes items that do not have ",
"an ADQ, such as melatonin."
"an ADQ, such as melatonin and daridorexant."
],
"tags": [
"core",
Expand All @@ -24,23 +24,23 @@
"is_cost_based": false,
"low_is_good": true,
"numerator_type": "custom",
"numerator_columns": "SUM(p.quantity * r.percent_of_adq) AS numerator",
"numerator_from": "{hscic}.normalised_prescribing p LEFT JOIN {hscic}.bdz_adq r ON concat(substr(p.bnf_code,0,9),substr(p.bnf_code,-2)) = concat(substr(r.bnf_code,0,9),substr(r.bnf_code,-2)) ",
"numerator_columns": "SUM(p.total_adq_usage) AS numerator",
"numerator_from": "{measures}.vw__bdz_total_adq p",
"numerator_where": [
"p.bnf_code LIKE '0401%' AND --Hypnotics and Anxiolytics \n",
"p.bnf_code NOT LIKE '0401010S0%' AND --Potassium bromide \n",
"p.bnf_code NOT LIKE '0401010AC%' AND --Sodium Oxybate \n",
"p.bnf_code NOT LIKE '0401010AD%' AND --Melatonin \n",
"p.bnf_code NOT LIKE '0401020K0%AD' AND --Diazepam_Soln 5mg/2.5ml Rectal Tube \n",
"p.bnf_code NOT LIKE '0401020K0%AE' AND --Diazepam_Soln 10mg/2.5ml Rectal Tube \n",
"p.bnf_code NOT LIKE '0401020K0%BQ' --Diazepam_Soln 2.5mg/1.25ml Rectal Tube"
"p.bnf_code NOT LIKE '0401040%' --Other hypnotics and anxiolytics \n"
],
"denominator_type": "list_size",
"no_analyse_url": true,
"authored_by": "[email protected]",
"checked_by": "[email protected]",
"date_reviewed": "2024-02-12",
"next_review": "2025-02-12",
"date_reviewed": "2025-01-20",
"next_review": "2027-01-20",
"measure_complexity": "medium",
"measure_type": "custom",
"radar_exclude": false
}
}

18 changes: 18 additions & 0 deletions openprescribing/measures/tables/adq_bdz.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
chemical_name,chemical_code,adq,adq_unit
Lorazepam,0401020P0,2.5,mg
Nitrazepam,0401010R0,5.0,mg
Zopiclone,0401010Z0,7.5,mg
Zaleplon,0401010W0,7.5,mg
Zolpidem tartrate,0401010Y0,10.0,mg
Diazepam,0401020K0,10.0,mg
Temazepam,0401010T0,20.0,mg
Oxazepam,0401020T0,30.0,mg
Buspirone hydrochloride,0401020B0,30.0,mg
Chlordiazepoxide hydrochloride,0401020E0,30.0,mg
Clomethiazole,0401010F0,384.0,mg
Lormetazepam,0401010P0,1.0,mg
Loprazolam mesilate,0401010N0,1.0,mg
Cloral betaine,0401010C0,1414.0,mg
Clomethiazole edisilate,0401010D0,500.0,mg
Chloral hydrate,0401010B0,1000.0,mg
Meprobamate,0401020R0,1200.0,mg
50 changes: 50 additions & 0 deletions openprescribing/measures/views/vw__bdz_total_adq.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
-- this sql calculates the ADQ values for benzodiazepines
SELECT
rx.month AS month,
rx.practice AS practice,
rx.bnf_name AS bnf_name,
rx.bnf_code AS bnf_code,
SUM(quantity) AS quantity,
SUM(items) AS items,
strnt_nmrtr_val, -- strength numerator value from dmd
strnt_nmrtr_uom, -- strength numerator unit of measurement from dmd
strnt_dnmtr_val, -- strength denominator value from dmd
strnt_dnmtr_uom, -- strength numerator unit of measurement from dmd
adq.adq AS adq_value,
SUM(quantity) * IEEE_DIVIDE( -- multiplies quantity by normalised adq value to get total usage value
CASE
WHEN strnt_nmrtr_uom = 258685003 THEN strnt_nmrtr_val / 1000 -- divides where uom is in micrograms by 1000 to get milligram value for consistency
ELSE strnt_nmrtr_val
END,
COALESCE(strnt_dnmtr_val, 1) -- divides by unit size value, or 1 if this does not exist
) / adq.adq AS total_adq_usage -- gets adq usage value normalised to mg
FROM
hscic.normalised_prescribing AS rx
INNER JOIN
dmd.vmp AS vmp
ON CONCAT(SUBSTR(rx.bnf_code, 0, 9), SUBSTR(rx.bnf_code, -2)) = CONCAT(SUBSTR(vmp.bnf_code, 0, 9), SUBSTR(vmp.bnf_code, -2)) --joins "generic" BNF code to dm+d
INNER JOIN
dmd.vpi AS vpi
ON vpi.vmp = vmp.id -- joins from vmp to vpi (where strengths are stored)
INNER JOIN
measures.adq_bdz AS adq --joins to bdz ADQ table
ON SUBSTR(rx.bnf_code, 0, 9) = adq.chemical_code
INNER JOIN
dmd.droute AS droute -- joins to droute to get route codes
ON vmp.id = droute.vmp
INNER JOIN
dmd.route AS route -- joins to route to get route names
ON route.cd = droute.route
WHERE
route.descr = 'Oral' AND -- Oral preps only
rx.bnf_code LIKE '0401%' -- Hypnotics and Anxiolytics
GROUP BY
month,
rx.bnf_name,
rx.bnf_code,
rx.practice,
strnt_nmrtr_val,
strnt_nmrtr_uom,
strnt_dnmtr_val,
strnt_dnmtr_uom,
adq.adq

0 comments on commit 33dc013

Please sign in to comment.