Skip to content

Commit

Permalink
Update opioidspercentimsolid.json
Browse files Browse the repository at this point in the history
added in extra things
  • Loading branch information
richiecroker committed Oct 23, 2023
1 parent 7d604fd commit 044333d
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions openprescribing/measure_definitions/opioidspercentimsolid.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,29 +18,33 @@
"is_cost_based": false,
"low_is_good": true,
"numerator_type": "custom",
"numerator_columns": "SUM(p.ome_dose) AS numerator",
"numerator_columns": "SUM(ome_dose) AS numerator",
"numerator_from":[
"{measures}.vw__opioids_total_dmd"
],
"numerator_bnf_codes_query": [
"SELECT DISTINCT p.bnf_code ",
"FROM {hscic}.normalised_prescribing p ",
"INNER JOIN {dmd}.vmp vmp ON CONCAT(SUBSTR(p.bnf_code,0,9),'AA', SUBSTR(p.bnf_code,-2), SUBSTR(p.bnf_code,-2)) = vmp.bnf_code -- joins prescribing data to vmp table using generic BNF code \n",
"SELECT DISTINCT pr.bnf_code ",
"FROM {hscic}.presentation pr ",
"INNER JOIN {measures}.vw__opioids_total_dmd op",
"ON pr.bnf_code = op.bnf_code ",
"INNER JOIN dmd.vmp vmp ON CONCAT(SUBSTR(pr.bnf_code,0,9),'AA', SUBSTR(pr.bnf_code,-2), SUBSTR(pr.bnf_code,-2)) = vmp.bnf_code -- joins prescribing data to vmp table using generic BNF code \n",
"INNER JOIN {dmd}.vpi AS vpi ON vmp.id = vpi.vmp -- joins vmp to vpi table to get ingredient strengths (strnt_nmrtr_val) \n",
"INNER JOIN {dmd}.ont AS ont ON vmp.id = ont.vmp -- joins vmp to ont table to get formulation codes \n",
"INNER JOIN {dmd}.ontformroute AS route ON ont.form = route.cd -- joins ont table to ontform table to get formulation names ",
"WHERE ",
"vpi.ing = 60886004 AND route.descr = ('solution.oral') -- morphine oral solution preparations"
],
"denominator_type": "custom",
"denominator_columns": "SUM(p.ome_dose) AS denominator",
"denominator_columns": "SUM(ome_dose) AS denominator",
"denominator_from":[
"{measures}.vw__opioids_total_dmd"
],
"denominator_bnf_codes_query": [
"SELECT DISTINCT p.bnf_code ",
"FROM {hscic}.normalised_prescribing p ",
"INNER JOIN {dmd}.vmp vmp ON CONCAT(SUBSTR(p.bnf_code,0,9),'AA', SUBSTR(p.bnf_code,-2), SUBSTR(p.bnf_code,-2)) = vmp.bnf_code -- joins prescribing data to vmp table using generic BNF code \n",
"SELECT DISTINCT pr.bnf_code ",
"FROM {hscic}.presentation pr ",
"INNER JOIN {measures}.vw__opioids_total_dmd op",
"ON pr.bnf_code = op.bnf_code ",
"INNER JOIN dmd.vmp vmp ON CONCAT(SUBSTR(pr.bnf_code,0,9),'AA', SUBSTR(pr.bnf_code,-2), SUBSTR(pr.bnf_code,-2)) = vmp.bnf_code -- joins prescribing data to vmp table using generic BNF code \n",
"INNER JOIN {dmd}.vpi AS vpi ON vmp.id = vpi.vmp -- joins vmp to vpi table to get ingredient strengths (strnt_nmrtr_val) \n",
"INNER JOIN {dmd}.ont AS ont ON vmp.id = ont.vmp -- joins vmp to ont table to get formulation codes \n",
"INNER JOIN {dmd}.ontformroute AS route ON ont.form = route.cd -- joins ont table to ontform table to get formulation names ",
Expand Down

0 comments on commit 044333d

Please sign in to comment.