opensafely / codelist-development

Repository for discussion of OpenSAFELY codelists
7 stars 3 forks source link

*MEDICINE* Opioid-containing medicines #237

Closed richiecroker closed 1 year ago

richiecroker commented 1 year ago

I've created a series of codelists for opioid-containing medicines.

I used a modified version of the SQL used to create the measure definition for the opioid OME measure on OpenPrescribing. More details on the methodology can be found here.

I replaced the prescribing data table with the BNF hierarchy table, and removed any code that related to calculating the OME, leaving only identification of products containing opioids, as defined in the measure definition.

SQL for this:

#subquery to create a "simple" administration route. 
WITH 
simp_form AS ( 
SELECT DISTINCT vmp, #vmp code
                CASE 
                    WHEN descr LIKE '%injection%' THEN 'injection' #creates "injection" as route, regardless of whether injection or infusion. this also removes injection routes, e.g.
                    WHEN descr LIKE '%infusion%' THEN 'injection'  #s/c, i/v etc, AS often injections have many licensed routes, which would multiply the row
                    ELSE SUBSTR(form.descr, STRPOS(form.descr,".")+1) #takes the dosage form out of the string (e.g. tablet.oral) TO leave route.
                END AS simple_form 
FROM dmd.ont AS ont #the coded route for dosage form, includes vmp code 
INNER JOIN dmd.ontformroute AS form ON form.cd=ont.form #text description of route 
  )
#main query to calculate the OME
SELECT simple_form, 
       rx.presentation_code as bnf_code, #BNF code to link to prescribing data
       rx.presentation as bnf_name, #BNF name from prescribing data
FROM dmd.vpi AS vpi #VPI has both ING and VMP codes in the table
INNER JOIN dmd.ing AS ing ON vpi.ing=ing.id #join to ING to get ING codes and name
INNER JOIN dmd.vmp AS vmp ON vpi.vmp=vmp.id #join to get BNF codes for both VMPs and AMPs joined indirectly TO ING. 
INNER JOIN simp_form AS form ON vmp.id=form.vmp #join to subquery for simplified administration route
INNER JOIN richard.opioid_class AS opioid ON opioid.id=ing.id AND opioid.form=form.simple_form #join to OME table, which has OME value for ING/route pairs
INNER JOIN hscic.bnf AS rx ON CONCAT(SUBSTR(rx.presentation_code,0,9),'AA',SUBSTR(rx.presentation_code,-2,2)) = CONCAT(SUBSTR(vmp.bnf_code,0,11),SUBSTR(vmp.bnf_code,-2,2))
WHERE rx.presentation_code NOT LIKE '0410%' #remove drugs used in opiate dependence
GROUP BY simple_form, 
         rx.presentation_code,
         rx.presentation

Drugs in section 4.10 of the legacy BNF (drugs used in substance misuse) are excluded. Drugs outside of this, but not included in "opioid analgesics" in the BNF ARE included (e.g. co-codamol, alfentanil)

I have created different codelists based on the formulation:

https://www.opencodelists.org/codelist/user/richard-croker/opioid-containing-medicines-buccal-nasal-and-oromucosal-excluding-drugs-for-substance-misuse/65df1cba/ https://www.opencodelists.org/codelist/user/richard-croker/opioid-containing-medicines-inhalation-excluding-drugs-for-substance-misuse/7eee8fef/ https://www.opencodelists.org/codelist/user/richard-croker/opioid-containing-medicines-oral-excluding-drugs-for-substance-misuse/632c5cc4/ https://www.opencodelists.org/codelist/user/richard-croker/opioid-containing-medicines-parenteral-excluding-drugs-for-substance-misuse/4a1ce98f/ https://www.opencodelists.org/codelist/user/richard-croker/opioid-containing-medicines-rectal-excluding-drugs-for-substance-misuse/17fe0325/ https://www.opencodelists.org/codelist/user/richard-croker/opioid-containing-medicines-transdermal-excluding-drugs-for-substance-misuse/310d765a/

The inhalation codelist does contain methadone cigarettes, which are listed as in opioid analgesics, rather than substance misuse. Should we exclude them?

chrisjwood16 commented 1 year ago

@richiecroker following our discussion and review of the methodology I'm happy to approve these codelists. I agree seems reasonable to exclude methadone cigarettes.