From 44e4bda692aabd3f02e1505ed71539079a609d0f Mon Sep 17 00:00:00 2001 From: Amy Chen Date: Wed, 13 Nov 2024 10:54:16 -0800 Subject: [PATCH] Feature/mme graph updates (#213) * MME graph - add no bup line, copy button * add comment, remove commented out code * fix line order * add bg color for copying * add variable * fix color * refactor * changes based on feedback * changes based on feedback * add comment, remove unwanted file * add back old code * remove debug statement * fix per feedback, fix MME text * fix get data code * remove devug statement * refactor * fix scale * graph stats display fix * fix stroke width * update alert for naloxone consideration to consider only non-bup med only * refactor --------- Co-authored-by: Amy Chen Co-authored-by: Amy Chen Co-authored-by: Amy Chen --- src/components/Landing/index.js | 58 +- src/components/Landing/utility.js | 60 +- src/components/graph/MMEGraph.js | 470 +++- src/components/graph/line.js | 10 +- src/components/graph/markers.js | 10 +- src/components/graph/tooltip.js | 9 +- src/config/summary_config.json | 80 +- ...ider_in_Managing_Chronic_Pain_FHIRv400.cql | 103 +- ...der_in_Managing_Chronic_Pain_FHIRv400.json | 2259 ++++++++++------- src/cql/valueset-db.json | 392 +++ src/styles/components/_Summary.scss | 24 +- 11 files changed, 2458 insertions(+), 1017 deletions(-) diff --git a/src/components/Landing/index.js b/src/components/Landing/index.js index 5a9b64b5d1..75ce6e6d17 100644 --- a/src/components/Landing/index.js +++ b/src/components/Landing/index.js @@ -22,7 +22,7 @@ import Timeout from "../../helpers/timeout"; import { getTokenInfoFromStorage } from "../../helpers/timeout"; import summaryMap from "../../config/summary_config.json"; -import { getEnv, getEnvs, fetchEnvData } from "../../utils/envConfig"; +import { getEnvs, fetchEnvData } from "../../utils/envConfig"; import SystemBanner from "../SystemBanner"; import Header from "../Header"; import Report from "../Report"; @@ -378,8 +378,12 @@ export default class Landing extends Component { landingUtils.savePDMPSummaryData(summary, fileName); } + hasOverviewSection() { + return summaryMap && summaryMap[this.getOverviewSectionKey()]; + } + setSummaryAlerts(summary, sectionFlags) { - if (!summaryMap[this.getOverviewSectionKey()]) return; + if (!this.hasOverviewSection()) return; summary[this.getOverviewSectionKey() + "_alerts"] = landingUtils.getProcessedAlerts(sectionFlags, { tags: ["alert"], @@ -387,54 +391,20 @@ export default class Landing extends Component { }); } setSummaryGraphData(summary) { - let overviewSection = summaryMap[this.getOverviewSectionKey()]; - if (!overviewSection) { - return false; - } + if (!this.hasOverviewSection()) return; //process graph data - let graphConfig = overviewSection.graphConfig; - if (!(graphConfig && graphConfig.summaryDataSource)) { - return; - } - //get the data from summary data - let sections = graphConfig.summaryDataSource; - let graph_data = []; - - //demo config set to on, then draw just the demo graph data - if (getEnv(graphConfig.demoConfigKey)) { - graph_data = graphConfig.demoData; - summary[this.getOverviewSectionKey() + "_graph"] = graph_data; - return; - } - sections.forEach((item) => { - if ( - summary[item.section_key] && - summary[item.section_key][item.subSection_key] - ) { - graph_data = [ - ...graph_data, - ...summary[item.section_key][item.subSection_key], - ]; - } - }); + const overviewSection = summaryMap[this.getOverviewSectionKey()]; summary[this.getOverviewSectionKey() + "_graph"] = - landingUtils.getProcessedGraphData(graphConfig, graph_data); + landingUtils.getSummaryGraphDataSet(overviewSection.graphConfig, summary); } setSummaryOverviewStatsData(summary) { + if (!this.hasOverviewSection()) return; const overviewSection = summaryMap[this.getOverviewSectionKey()]; - if (!overviewSection) { - return false; - } - const config = overviewSection.statsConfig; - if (!config || !config.data) { - summary[this.getOverviewSectionKey() + "_stats"] = {}; - return; - } - const dataSource = summary[config.dataKeySource] - ? summary[config.dataKeySource][config.dataKey] - : []; - const stats = landingUtils.getProcessedStatsData(config.data, dataSource); + const stats = landingUtils.getProcessedStatsData( + overviewSection.statsConfig, + summary + ); summary[this.getOverviewSectionKey() + "_stats"] = stats; } diff --git a/src/components/Landing/utility.js b/src/components/Landing/utility.js index 40f7eec2b0..5164034303 100644 --- a/src/components/Landing/utility.js +++ b/src/components/Landing/utility.js @@ -250,6 +250,55 @@ export function getProcessedSummaryData(summary, summaryMap) { return { sectionFlags, flaggedCount }; } +export function getSummaryGraphDataSet(graphConfig, summaryData) { + if (!summaryData) return null; + if (!(graphConfig && graphConfig.summaryDataSource)) { + return null; + } + //demo config set to on, then draw just the demo graph data + if (getEnv(graphConfig.demoConfigKey)) { + return graphConfig.demoData; + } + //get the data from summary data + let sections = graphConfig.summaryDataSource; + let graphDataSet = {}; + sections.forEach((item) => { + if ( + summaryData[item.section_key] && + summaryData[item.section_key][item.subSection_key] && + !isEmptyArray(summaryData[item.section_key][item.subSection_key]) + ) { + const sectionKey = + item.key ?? `${item.section_key}_${item.subSection_key}`; + graphDataSet[sectionKey] = { + ...item, + data: getProcessedGraphData( + graphConfig, + JSON.parse( + JSON.stringify(summaryData[item.section_key][item.subSection_key]) + ) + ), + }; + } + }); + if (Object.keys(graphDataSet).length === 0) { + const defaultConfig = graphConfig.defaultDataSource; + graphDataSet[defaultConfig.key] = { + ...defaultConfig, + data: getProcessedGraphData( + graphConfig, + JSON.parse( + JSON.stringify( + summaryData[defaultConfig.section_key][defaultConfig.subSection_key] + ) + ) + ), + }; + } + console.log("graphData Set ", graphDataSet); + return graphDataSet; +} + export function getProcessedGraphData(graphConfig, graphDataSource) { const [ startDateFieldName, @@ -280,7 +329,7 @@ export function getProcessedGraphData(graphConfig, graphDataSource) { /* * 'NaN' is the value for null when coerced into number, need to make sure that is not included */ - const getRealNumber = (o) => (o && !isNaN(o) ? o : 0); + const getRealNumber = (o) => (o !== null && !isNaN(o) && o >= 0 ? o : 0); let dataPoints = []; let prevObj = null, nextObj = null; @@ -449,7 +498,6 @@ export function getProcessedGraphData(graphConfig, graphDataSource) { } prevObj = finalDataPoints[finalDataPoints.length - 1]; }); - console.log("graph data ", finalDataPoints); let formattedData = JSON.parse(JSON.stringify(finalDataPoints)) .map((point) => { let o = {}; @@ -547,9 +595,13 @@ export function getProcessedAlerts(sectionFlags, logParams) { ); } -export function getProcessedStatsData(statsFields, dataSource) { +export function getProcessedStatsData(statsConfig, summaryData) { let stats = {}; - if (isEmptyArray(statsFields)) return stats; + if (!statsConfig || isEmptyArray(statsConfig.data)) return stats; + const statsFields = statsConfig.data; + const dataSource = summaryData[statsConfig.dataKeySource] + ? summaryData[statsConfig.dataKeySource][statsConfig.dataKey] + : []; //compile tally of source identified by a key statsFields.forEach((item) => { diff --git a/src/components/graph/MMEGraph.js b/src/components/graph/MMEGraph.js index 236abc98df..9dc2157115 100644 --- a/src/components/graph/MMEGraph.js +++ b/src/components/graph/MMEGraph.js @@ -8,7 +8,13 @@ import Markers from "./markers"; import Tooltip from "./tooltip"; import { dateFormat } from "../../helpers/formatit"; import { dateCompare } from "../../helpers/sortit"; -import { sumArray, daysFromToday } from "../../helpers/utility"; +import { + sumArray, + daysFromToday, + isEmptyArray, + renderImageFromSVG, +} from "../../helpers/utility"; +import CopyButton from "../CopyButton"; const defaultFields = { x: "date", @@ -16,7 +22,34 @@ const defaultFields = { }; const xFieldName = defaultFields.x; const yFieldName = defaultFields.y; +const Y_FIELD_LABEL = "MME"; +const DEFAULT_STROKE_COLOR = "#168698"; export default class MMEGraph extends Component { + constructor() { + super(...arguments); + this.state = { + lineIds: Object.entries(this.props.data ?? []).map((o) => `${o[1].key}`), + }; + this.arrLineObj = Object.entries(this.props.data ?? []).map((o) => o[1]); + + //refs + this.containerRef = React.createRef(); + this.switchCheckboxRefs = []; + this.graphRef = React.createRef(); + this.printImageRef = React.createRef(); + + // This binding is necessary to make `this` work in the callback + this.addLineToGraph = this.addLineToGraph.bind(this); + this.removeLineFromGraph = this.removeLineFromGraph.bind(this); + this.handleSwitchChange = this.handleSwitchChange.bind(this); + } + componentDidMount() { + this.initSwitchCheckboxRefs(); + setTimeout(() => { + // rendering image for printing + renderImageFromSVG(this.printImageRef.current, this.graphRef.current); + }, 1500); + } getDefaultDataValueSet( paramValue, paramMinDate, @@ -39,7 +72,7 @@ export default class MMEGraph extends Component { } if (!minDate) { minDate = new Date(); - minDate.setDate(maxDate.getDate() - total * 30); + minDate.setDate(maxDate.getDate() - total * 60); } let index = 0; let increment = Math.ceil((maxDate.getTime() - minDate.getTime()) / total); @@ -63,6 +96,7 @@ export default class MMEGraph extends Component { } getMaxMMEValue(data) { + if (!data) return 0; let maxValue = 0; data.forEach((item) => { maxValue = Math.max(maxValue, item["MMEValue"]); @@ -70,10 +104,10 @@ export default class MMEGraph extends Component { return maxValue; } - getStats(data) { - if (!data || !data.length) return []; + getStats(dataObj) { + if (!dataObj || isEmptyArray(dataObj.data)) return []; //look in data points up to today - const copyData = data + const copyData = dataObj.data .map((item) => { return { ...item }; }) @@ -120,28 +154,222 @@ export default class MMEGraph extends Component { //average MED for last 90 days const averageNintyDays = averageMME(90); const mostRecentMME = arrDates[arrDates.length - 1]; - return [ - { - display: "MED today", - value: `${todayMME} (${dateFormat("", new Date(), "YYYY-MM-DD")})`, - }, - { - display: "Average MED in the last 60 days", - value: averageSixtyDays, - }, + return { + title: + dataObj.statsProps && dataObj.statsProps.title + ? dataObj.statsProps.title.replace("{Y_FIELD_LABEL}", Y_FIELD_LABEL) + : "", + data: [ + { + display: `${Y_FIELD_LABEL} today`, + value: `${todayMME} (${dateFormat("", new Date(), "YYYY-MM-DD")})`, + }, + { + display: `Average ${Y_FIELD_LABEL} in the last 60 days`, + value: averageSixtyDays, + }, + { + display: `Most recent ${Y_FIELD_LABEL}`, + value: `${parseInt(mostRecentMME[yFieldName])} (${dateFormat( + "", + mostRecentMME[xFieldName], + "YYYY-MM-DD" + )})`, + }, + { + display: `Average ${Y_FIELD_LABEL} in the last 90 days`, + value: averageNintyDays, + }, + ], + }; + } + + initSwitchCheckboxRefs() { + // Initialize the array with React.createRef() objects + for (let i = 0; i < this.state.lineIds.length; i++) { + this.switchCheckboxRefs.push(React.createRef()); + } + } + + renderCopyButton() { + return ( + + ); + } + + renderLine(data, lineProps) { + if (isEmptyArray(data)) return null; + const lineId = lineProps?.id; + return ; + } + + renderLineMarkers(data, lineProps, markerProps) { + if (isEmptyArray(data)) return null; + return ( + + + + + ); + } + + renderSwitches() { + const oLines = this.arrLineObj.filter((o) => !!o.legendProps); + if (!oLines.length) return null; + return ( +
+
+ {oLines.map((item, index) => { + const legendProps = item.legendProps; + return ( +
+
+ + {legendProps.label + .replace("{Y_FIELD_LABEL}", Y_FIELD_LABEL) + .toUpperCase()} + +
+ +
+ +
+
+ ); + })} +
+
+ ); + } + + isInSelectedLineIds(id) { + return this.state.lineIds.find((item) => item === id); + } + + isInGraph(id) { + if (isEmptyArray(this.state.lineIds)) return false; + return this.state.lineIds.find((item) => item === id); + } + + addLineToGraph(id, callback) { + if (!id) { + return; + } + this.setState( { - display: "Most recent MED", - value: `${parseInt(mostRecentMME[yFieldName])} (${dateFormat( - "", - mostRecentMME[xFieldName], - "YYYY-MM-DD" - )})`, + lineIds: [...new Set([...this.state.lineIds, id])], }, + callback + ); + } + removeLineFromGraph(id, callback) { + this.setState( { - display: "Average MED in the last 90 days", - value: averageNintyDays, + lineIds: this.state.lineIds.filter((item) => item !== id), }, - ]; + callback + ); + } + + hasOnlyOneGraphLine() { + return this.state.lineIds.length === 1; + } + + handleSwitchChange(e) { + const itemValue = e.target.value; + const dataIndex = parseInt(e.target.getAttribute("dataindex")); + let targetElement = this.switchCheckboxRefs[dataIndex]?.current; + if (targetElement) targetElement.setAttribute("checked", e.target.checked); + if (e.target.checked) { + this.addLineToGraph(itemValue); + } else { + this.removeLineFromGraph(itemValue); + } + } + + renderPrintOnlyImage() { + return ( +
+ for print +
+ ); + } + + renderStats(graphStats) { + if (!graphStats || !graphStats.data) return null; + return ( +
+ {graphStats.title && ( + +
+ {graphStats.title} +
+
 
+
+ )} + {graphStats.data.map((item, index) => ( +
+ {item.display} + {item.value} +
+ ))} +
+ ); } render() { @@ -159,10 +387,22 @@ export default class MMEGraph extends Component { const xIntervals = 12; let lineParamsSet = [xIntervals, xFieldName, yFieldName]; const hasError = this.props.showError; + const propData = this.props.data; + let compiledData = []; + for (let key in propData) { + const processedData = + propData[key] && !isEmptyArray(propData[key].data) + ? propData[key].data.map((o) => { + o.category = key; + return o; + }) + : []; + compiledData = [...compiledData, ...processedData]; + } //make a copy of the data so as not to accidentally mutate it //need to make sure the dates are sorted for line to draw correctly - let computedData = this.props.data - ? this.props.data.map((item) => { + let computedData = !isEmptyArray(compiledData) + ? compiledData.map((item) => { return { ...item, }; @@ -179,7 +419,10 @@ export default class MMEGraph extends Component { return d; }); //get stats for data - let graphStats = this.getStats(this.props.data); + //let graphStats = this.getStats(compiledData); + let graphStats = this.getStats( + this.arrLineObj.filter((o) => !isEmptyArray(o.data) && !!o.stats)[0] + ); let arrayDates = data.map((d) => { return d[xFieldName]; }); @@ -237,7 +480,7 @@ export default class MMEGraph extends Component { } } let calcMaxDate = new Date(maxDate.valueOf()); - maxDate = calcMaxDate.setDate(calcMaxDate.getDate() + 1); + maxDate = calcMaxDate.setDate(calcMaxDate.getDate() + 90); maxDate = new Date(maxDate); const diffTime = Math.abs(maxDate - minDate); const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24)); @@ -254,13 +497,11 @@ export default class MMEGraph extends Component { maxDate, ...lineParamsSet ); - //let CDCData = this.getDefaultDataValueSet(CDC_MAX_VALUE, baseLineDate, maxDate, ...lineParamsSet); - const margins = { - top: 0, - right: 56, - bottom: 48, - left: 56, + top: 24, + right: 48, + bottom: 56, + left: 48, }; const width = parentWidth - margins.left - margins.right; @@ -287,18 +528,18 @@ export default class MMEGraph extends Component { xName: xFieldName, yName: yFieldName, }; - const dataStrokeColor = "#168698"; const additionalProps = { - strokeColor: dataStrokeColor, - strokeFill: dataStrokeColor, - strokeWidth: 2.25, + strokeColor: DEFAULT_STROKE_COLOR, + strokeFill: DEFAULT_STROKE_COLOR, + // strokeWidth: 2.5, + strokeWidth: 2.8, markerSize: 4, }; additionalProps["dataPointsProps"] = { ...additionalProps, ...{ strokeWidth: 2.5, - strokeFill: dataStrokeColor, + strokeFill: DEFAULT_STROKE_COLOR, }, }; const tickInterval = Math.ceil(diffDays / 30 / xIntervals); @@ -340,20 +581,23 @@ export default class MMEGraph extends Component { ...defaultLegendSettings, }; - const dataLineProps = { ...defaultProps, ...additionalProps }; + const defaultLineProps = { ...defaultProps, ...additionalProps }; + const defaultMarkerProps = additionalProps["dataPointsProps"]; const graphWidth = width + margins.left + margins.right; const graphHeight = height + margins.top + margins.bottom; + const shouldShowSwitches = Object.keys(this.props.data).length > 1; + if (hasError) { return (
-
Morphine Equivalent Dose (MED)
+
{`Morphine Equivalent Dose (${Y_FIELD_LABEL})`}
- Graph not shown. One or more of this patient's opioid medications - was not found in RxNav, therefore the MED could not be calculated - and the summary graph will be incorrect. + {`Graph not shown. One or more of this patient's opioid medications + was not found in RxNav, therefore the ${Y_FIELD_LABEL} could not be calculated + and the summary graph will be incorrect.`}
- Please use the information in the State PMP Prescriptions table - below to calculate the patient's MED. + {`Please use the information in the State PMP Prescriptions table + below to calculate the patient's ${Y_FIELD_LABEL}.`}
); @@ -361,7 +605,7 @@ export default class MMEGraph extends Component { if (noEntry) { return (
-
Morphine Equivalent Dose (MED)
+
{`Morphine Equivalent Dose (${Y_FIELD_LABEL})`}
No opioid Rx found for this patient in the PMP
@@ -369,67 +613,97 @@ export default class MMEGraph extends Component { ); } return ( - -
-
Morphine Equivalent Dose (MED)
-
- +
+
+
{`Morphine Equivalent Dose (${Y_FIELD_LABEL})`}
+
{this.renderCopyButton()}
+
+
+
- - - - - - - {/* */} - - - WA State: Consultation threshold - - - CDC: Consider offering naloxone - - {/* + + + + {this.arrLineObj.map((o) => { + return ( + this.isInGraph(o.key) && + this.renderLine( + data.filter((d) => d.category === o.key), + { ...defaultLineProps, ...o.lineProps }, + { ...defaultMarkerProps, ...o.markerProps } + ) + ); + })} + {/* */} + + + {/* */} + {/* */} + + WA State: Consultation threshold + + + CDC: Consider offering naloxone + + {this.arrLineObj.map( + (o) => + this.isInGraph(o.key) && + this.renderLineMarkers( + data.filter((d) => d.category === o.key), + { ...defaultLineProps, ...o.lineProps }, + { ...defaultMarkerProps, ...o.markerProps } + ) + )} + {/* CDC avoid/justify threshold */} - - + + + {this.renderPrintOnlyImage()} +
+ {shouldShowSwitches && this.renderSwitches()}
+ {this.renderStats(graphStats)}
- {graphStats.length > 0 && ( -
- {graphStats.map((item, index) => ( -
- {item.display} - {item.value} -
- ))} -
- )} - +
); } } MMEGraph.propTypes = { - data: PropTypes.array, + data: PropTypes.object, showError: PropTypes.bool, }; diff --git a/src/components/graph/line.js b/src/components/graph/line.js index ef2675f063..ba48722097 100644 --- a/src/components/graph/line.js +++ b/src/components/graph/line.js @@ -65,9 +65,13 @@ class Line extends React.Component { .attr("class", className) .attr("d", lineGenerator); if (this.props.dotted) { - currentNode.style("stroke-dasharray", this.props.dotSpacing || "3, 3"); // <== This line here!! + currentNode.style("stroke-dasharray", this.props.dotSpacing || "3, 3") + } - const dataId = dataPointsProps && dataPointsProps.id ? String(dataPointsProps.id).toUpperCase() : "data"; + const dataId = + dataPointsProps && dataPointsProps.id + ? String(dataPointsProps.id).toUpperCase() + : "data"; //print label - PRINT ONLY if (showPrintLabel) { select(node) @@ -91,7 +95,7 @@ class Line extends React.Component { line.datum(data).transition(t).attr("d", lineGenerator); } render() { - return ; + return ; } } diff --git a/src/components/graph/markers.js b/src/components/graph/markers.js index dc873b2448..4db3b7c9ce 100644 --- a/src/components/graph/markers.js +++ b/src/components/graph/markers.js @@ -46,6 +46,8 @@ class Markers extends React.Component { dataPointsProps, } = this.props; const PLACEHOLDER_IDENTIFIER = "placeholder"; + const BASELINE_IDENTIFIER = "baseline"; + const isExcludeItem = (item) => !item[yName] || item[BASELINE_IDENTIFIER] || item[PLACEHOLDER_IDENTIFIER]; this.setState({ xName: xName, @@ -58,7 +60,7 @@ class Markers extends React.Component { } const animationDuration = 100; const dataId = dataPointsProps.id ? String(dataPointsProps.id).toUpperCase() : "data"; - const markerType = String(this.props.markerType).toLowerCase(); + const markerType = this.props.markerType ? String(this.props.markerType).toLowerCase() : "circle"; const markerSize = this.props.markerSize ? this.props.markerSize : 10; let markerShape = MARKER_SHAPES[this.props.markerType]; if (!markerShape) markerShape = d3.symbolCircle; @@ -66,7 +68,7 @@ class Markers extends React.Component { const strokeWidth = dataPointsProps.strokeWidth || 2; select(node) .selectAll(`.${markerType}`) - .data(data.filter((item) => !item[PLACEHOLDER_IDENTIFIER])) + .data(data.filter((item) => !isExcludeItem(item))) .enter() .append("path") .attr("d", d3.symbol().type(markerShape).size(markerSize)) @@ -79,7 +81,7 @@ class Markers extends React.Component { .attr("stroke-width", strokeWidth) .attr("fill", dataPointsProps.fillColor) .on("mouseover", (d, i) => { - if (d["baseline"] || d[PLACEHOLDER_IDENTIFIER]) { + if (isExcludeItem(d)) { return; } select(`#${markerType}_${dataId}${i}`) @@ -92,7 +94,7 @@ class Markers extends React.Component { d3.selectAll(`.tooltip_${dataId}${i}`).style("display", "block"); }) .on("mouseout", (d, i) => { - if (d["baseline"] || d[PLACEHOLDER_IDENTIFIER]) { + if (isExcludeItem(d)) { return; } select(`#${markerType}_${dataId}${i}`) diff --git a/src/components/graph/tooltip.js b/src/components/graph/tooltip.js index fb824d8575..56e152bce9 100644 --- a/src/components/graph/tooltip.js +++ b/src/components/graph/tooltip.js @@ -46,6 +46,7 @@ class Tooltip extends React.Component { showDataIdInLabel, } = this.props; const PLACEHOLDER_IDENTIFIER = "placeholder"; + const BASELINE_IDENTIFIER = "baseline"; this.setState({ xName: xName, @@ -56,10 +57,12 @@ class Tooltip extends React.Component { const formatDate = timeFormat(`%Y-%b-%d`); const dataId = dataPointsProps.id ? String(dataPointsProps.id).toUpperCase() : "data"; + const isExcludeItem = (item) => !item[yName] || item[BASELINE_IDENTIFIER] || item[PLACEHOLDER_IDENTIFIER]; + const displayRect = () => select(node) .selectAll(".tooltip-rect") - .data(data.filter((item) => !item[PLACEHOLDER_IDENTIFIER])) + .data(data.filter((item) => !isExcludeItem(item))) .enter() .append("rect") .attr("class", (d, i) => `tooltip-rect tooltip_${dataId}${i}`) @@ -79,7 +82,7 @@ class Tooltip extends React.Component { const displayToolTipText = (xOffset, yOffset) => select(node) .selectAll(".tooltip_text") - .data(data.filter((item) => !item[PLACEHOLDER_IDENTIFIER])) + .data(data.filter((item) => !isExcludeItem(item))) .enter() .append("text") .attr("class", (d, i) => `tooltip_text tooltip_${dataId}${i}`) @@ -96,7 +99,7 @@ class Tooltip extends React.Component { const displayToolTipId = (xOffset, yOffset) => select(node) .selectAll(".tooltip_text_id") - .data(data.filter((item) => !item[PLACEHOLDER_IDENTIFIER])) + .data(data.filter((item) => !isExcludeItem(item))) .enter() .append("text") .attr("class", (d, i) => `tooltip_text_id tooltip_${dataId}${i}`) diff --git a/src/config/summary_config.json b/src/config/summary_config.json index e3d87ddb49..bbdc6a39ee 100644 --- a/src/config/summary_config.json +++ b/src/config/summary_config.json @@ -87,10 +87,88 @@ {"date": "2020-12-08", "MMEValue": 0, "placeholder": true} ], + "defaultDataSource": { + "section_key": "RiskConsiderations", + "subSection_key": "ReportMMEByDates", + "key": "default", + "lineProps": { + "id": "dataLine_default", + "strokeColor": "#168698", + "strokeFill": "#168698", + "strokeWidth": 2.8 + }, + "markerProps": { + "id": "dataLine_default_markers", + "strokeColor": "#168698", + "strokeFill": "#168698", + "markerSize": 4 + }, + "stats": true, + "statsProps": { + "title": "Total {Y_FIELD_LABEL}" + } + }, "summaryDataSource": [ { "section_key": "RiskConsiderations", - "subSection_key": "ReportMMEByDates" + "subSection_key": "ReportDailyMMEByDateWithoutBuprenorphine", + "key": "wo_buprenorphine", + "lineProps": { + "id": "dataLine_wo_bup", + "strokeColor": "#024242", + "strokeFill": "#024242", + "strokeWidth": 3.5, + "dotted": true, + "dotSpacing": "4, 2" + }, + "markerProps": { + "id": "dataLine_wo_bup_markers", + "strokeColor": "#024242", + "strokeFill": "#024242", + "markerSize": 4 + }, + "legendProps": { + "label": "Total {Y_FIELD_LABEL} w/o Bup", + "style": { + "borderBottomColor": "#024242", + "borderBottomWidth": "2px", + "borderBottomStyle": "dotted" + } + }, + "stats": true, + "statsProps": { + "title": "Total {Y_FIELD_LABEL} w/o Bup" + } + }, + { + "section_key": "RiskConsiderations", + "subSection_key": "ReportDailyMMEByDateWithBuprenorphineOnly", + "key": "buprenorphine_only", + "lineProps": { + "id": "dataLine_bup_only", + "strokeColor": "#dc6bab", + "strokeWidth": "2", + "strokeFill": "#dc6bab" + + }, + "markerProps": { + "id": "dataLine_bup_only_markers", + "strokeColor": "#dc6bab", + "strokeFill": "#dc6bab", + "markerSize": 4 + }, + "legendProps": { + "label": "Bup-only {Y_FIELD_LABEL}", + "style": { + "borderBottomColor": "#dc6bab", + "borderBottomWidth": "3px", + "borderBottomStyle": "solid" + } + }, + "stats": true, + "statsProps": { + "title": "Total Bup-only {Y_FIELD_LABEL}" + } } ] }, diff --git a/src/cql/r4/Factors_to_Consider_in_Managing_Chronic_Pain_FHIRv400.cql b/src/cql/r4/Factors_to_Consider_in_Managing_Chronic_Pain_FHIRv400.cql index 36e3f73323..11688a5dab 100644 --- a/src/cql/r4/Factors_to_Consider_in_Managing_Chronic_Pain_FHIRv400.cql +++ b/src/cql/r4/Factors_to_Consider_in_Managing_Chronic_Pain_FHIRv400.cql @@ -66,7 +66,11 @@ // Remove currentMME, reportCurrentMME as calculations are being done via frontend JS // When Report MME, compile MME for medications classified as Opioid Medication and also from PDMP // Update 20241010 -// Add Naloxone prescription alert check, see MedicationRequestsForNaloxoneConsideration +// Add Naloxone prescription alert check, see MedicationRequestsForNaloxoneConsideration +// Update 20241104 +// Buprenorphine related changes, see ReportBuprenorphineMedicationRequests, GetBuprenorphineMMEListByDates,GetNoNBuprenorphineMMEListByDates, +// ReportDailyMMEByDateWithoutBuprenorphine, ReportDailyMMEByDateWithBuprenorphineOnly +// update alert check for MedicationRequestsForNaloxoneConsideration to consider Non-Bup MedicationRequests only, see NonBupMedRequestsForNaloxoneConsiderationLastTwoYears library Factors_to_Consider_in_Managing_Chronic_Pain_FHIRv400 version '1.0.0' @@ -181,6 +185,9 @@ valueset "Urine drug screen for pain management": '2.16.840.1.113762.1.4.1032.28 // [See value set in VSAC](https://vsac.nlm.nih.gov/valueset/2.16.840.1.113762.1.4.1032.44/expansion) valueset "Stool softeners and laxatives": '2.16.840.1.113762.1.4.1032.44' +// [custom set for buprenorphine] +valueset "Buprenorphine medications": '2.16.840.1.buprenorphine.custom' + // ## Individual codes ## // List of individual codes from code systems used directly in the CQL logic. Individual codes are used when there is @@ -696,6 +703,16 @@ define ReportOpioidMedications: (ReportOpioidMedicationRequests union ReportOpioidMedicationStatements) M sort by Start desc, End desc +//a list of MedicationRequest FHIR resources for Buprenorphine +define ReportBuprenorphineMedicationRequests: + [MedicationRequest: "Buprenorphine medications"] + +//Buprenorphine RXCUIs in list +define BuprenorphineRxCUIs: + (ReportBuprenorphineMedicationRequests) o + let + c: (o.medication as FHIR.CodeableConcept) + return Coalesce((c.coding) c2 where c2.system.value ~ 'http://www.nlm.nih.gov/research/umls/rxnorm' return c2.code.value) // medication requests from PDMP // using relevant system identifier for filtering @@ -740,15 +757,15 @@ define HasNaloxoneInLastYear: where M.AuthoredOn <= Today() and M.AuthoredOn >= (Today() - 1 year) ) > 0 -define MedicationRequestsLastTwoYears: - (ReportPDMPMedicationRequests) M - where M.MME >= 50 and ((year from Today() - year from M.CalculatedEnd) <= 2) +define NonBupMedRequestsForNaloxoneConsiderationLastTwoYears: + (GetNonBuprenorphineMMEListByDates) M + where M.MMEValue >= 50 and ((year from Today() - year from ToDate(M.End)) <= 2) define MedicationRequestsForNaloxoneConsideration: if HasNaloxoneInLastYear then null else - MedicationRequestsLastTwoYears + NonBupMedRequestsForNaloxoneConsiderationLastTwoYears // Non-opioid medication orders and statements with dates (lookback 2 years) @@ -908,15 +925,87 @@ define ReportMMEByDates: (ReportMME) R where //make sure not to include null MME value - R.End is not null and R.MMEValue is not null and ((year from Today() - year from R.CalculatedEnd) <= 2) + R.End is not null and + R.MMEValue is not null and + ((year from Today() - year from R.CalculatedEnd) <= 2) return { Start: R.Start, End: R.End, rxNormCode: R.rxNormCode, + rxCUI: R.rxNormCode.code, + MMEValue: R.MMEValue, + isBup: R.rxNormCode.code in BuprenorphineRxCUIs, + category: 'default' + } + sort by End + +//a list including non-null MME value for non - Buprenorphine +define GetNonBuprenorphineMMEListByDates: + ((ReportMMEByDates) O + where not (O.rxCUI in BuprenorphineRxCUIs) + ) R + return { + Start: R.Start, + End: R.End, + rxNormCode: R.rxNormCode, + rxCUI: R.rxNormCode.code, MMEValue: R.MMEValue } sort by End +//a list including non-null MME value for Buprenorphine +define GetBuprenorphineMMEListByDates: + ((ReportMMEByDates) O + where O.rxCUI in BuprenorphineRxCUIs + ) R + return { + Start: R.Start, + End: R.End, + rxNormCode: R.rxNormCode, + rxCUI: R.rxNormCode.code, + MMEValue: R.MMEValue + } + sort by End + +// a list of daily total MME values without Buprenorphine +define ReportDailyMMEByDateWithoutBuprenorphine: +if First(GetBuprenorphineMMEListByDates) is null then + null +else if First(GetNonBuprenorphineMMEListByDates) is null then + null +else + (ReportMMEByDates) R + return + { + Start: R.Start, + End: R.End, + rxNormCode: R.rxNormCode, + rxCUI: R.rxNormCode.code, + //miniscule value for displaying on graph above x-axis + MMEValue: if R.rxCUI in BuprenorphineRxCUIs then 0.000000001 else R.MMEValue, + category: 'wo_buprenorphine' + } + sort by End + +// a list of daily total MME values with Buprenorphine ONLY +define ReportDailyMMEByDateWithBuprenorphineOnly: + if First(GetBuprenorphineMMEListByDates) is null then + null + else + (ReportMMEByDates) R + return + { + Start: R.Start, + End: R.End, + rxNormCode: R.rxNormCode, + rxCUI: R.rxNormCode.code, + //miniscule value for displaying on graph above x-axis + MMEValue: if not (R.rxCUI in BuprenorphineRxCUIs) then 0.000000001 else R.MMEValue, + category: 'buprenorphine_only' + } + sort by End + + define ReportPrescriptions: (OpioidMedicationRequests) M return MMECalculator.Prescriptions(M) @@ -1206,6 +1295,8 @@ define Summary: { RiskConsiderations: { ReportMME: ReportMME, ReportMMEByDates: ReportMMEByDates, + ReportDailyMMEByDateWithoutBuprenorphine: ReportDailyMMEByDateWithoutBuprenorphine, + ReportDailyMMEByDateWithBuprenorphineOnly: ReportDailyMMEByDateWithBuprenorphineOnly, //for debugging, uncomment to test //ReportPrescriptions: ReportPrescriptions, BenzodiazepineMedications: ReportBenzodiazepineMedications, diff --git a/src/cql/r4/Factors_to_Consider_in_Managing_Chronic_Pain_FHIRv400.json b/src/cql/r4/Factors_to_Consider_in_Managing_Chronic_Pain_FHIRv400.json index 92434e2897..116625e43a 100644 --- a/src/cql/r4/Factors_to_Consider_in_Managing_Chronic_Pain_FHIRv400.json +++ b/src/cql/r4/Factors_to_Consider_in_Managing_Chronic_Pain_FHIRv400.json @@ -168,6 +168,10 @@ "name" : "Stool softeners and laxatives", "id" : "2.16.840.1.113762.1.4.1032.44", "accessLevel" : "Public" + }, { + "name" : "Buprenorphine medications", + "id" : "2.16.840.1.buprenorphine.custom", + "accessLevel" : "Public" } ] }, "codes" : { @@ -4396,6 +4400,99 @@ } ] } } + }, { + "name" : "ReportBuprenorphineMedicationRequests", + "context" : "Patient", + "accessLevel" : "Public", + "expression" : { + "dataType" : "{http://hl7.org/fhir}MedicationRequest", + "codeProperty" : "medication", + "codeComparator" : "in", + "type" : "Retrieve", + "codes" : { + "name" : "Buprenorphine medications", + "preserve" : true, + "type" : "ValueSetRef" + } + } + }, { + "name" : "BuprenorphineRxCUIs", + "context" : "Patient", + "accessLevel" : "Public", + "expression" : { + "type" : "Query", + "source" : [ { + "alias" : "o", + "expression" : { + "name" : "ReportBuprenorphineMedicationRequests", + "type" : "ExpressionRef" + } + } ], + "let" : [ { + "identifier" : "c", + "expression" : { + "strict" : false, + "type" : "As", + "operand" : { + "path" : "medication", + "scope" : "o", + "type" : "Property" + }, + "asTypeSpecifier" : { + "name" : "{http://hl7.org/fhir}CodeableConcept", + "type" : "NamedTypeSpecifier" + } + } + } ], + "relationship" : [ ], + "return" : { + "expression" : { + "type" : "Coalesce", + "operand" : [ { + "type" : "Query", + "source" : [ { + "alias" : "c2", + "expression" : { + "path" : "coding", + "type" : "Property", + "source" : { + "name" : "c", + "type" : "QueryLetRef" + } + } + } ], + "relationship" : [ ], + "where" : { + "type" : "Equivalent", + "operand" : [ { + "path" : "value", + "type" : "Property", + "source" : { + "path" : "system", + "scope" : "c2", + "type" : "Property" + } + }, { + "valueType" : "{urn:hl7-org:elm-types:r1}String", + "value" : "http://www.nlm.nih.gov/research/umls/rxnorm", + "type" : "Literal" + } ] + }, + "return" : { + "expression" : { + "path" : "value", + "type" : "Property", + "source" : { + "path" : "code", + "scope" : "c2", + "type" : "Property" + } + } + } + } ] + } + } + } }, { "name" : "PDMPMedicationRequests", "context" : "Patient", @@ -5069,362 +5166,120 @@ } ] } }, { - "name" : "MedicationRequestsLastTwoYears", + "name" : "ReportMME", "context" : "Patient", "accessLevel" : "Public", "expression" : { "type" : "Query", "source" : [ { - "alias" : "M", + "alias" : "O", "expression" : { - "name" : "ReportPDMPMedicationRequests", - "type" : "ExpressionRef" + "type" : "Union", + "operand" : [ { + "name" : "PDMPMedicationRequests", + "type" : "ExpressionRef" + }, { + "dataType" : "{http://hl7.org/fhir}MedicationRequest", + "codeProperty" : "medication", + "codeComparator" : "in", + "type" : "Retrieve", + "codes" : { + "name" : "Opioid Pain Medications", + "preserve" : true, + "type" : "ValueSetRef" + } + } ] } } ], - "relationship" : [ ], - "where" : { - "type" : "And", - "operand" : [ { - "type" : "GreaterOrEqual", + "let" : [ { + "identifier" : "MME_Object", + "expression" : { + "name" : "MME", + "libraryName" : "MMECalculator", + "type" : "FunctionRef", "operand" : [ { - "path" : "MME", - "scope" : "M", - "type" : "Property" - }, { - "type" : "ToDecimal", + "type" : "ToList", "operand" : { - "valueType" : "{urn:hl7-org:elm-types:r1}Integer", - "value" : "50", - "type" : "Literal" + "name" : "O", + "type" : "AliasRef" } } ] - }, { - "type" : "LessOrEqual", + } + }, { + "identifier" : "CalculatedEnd", + "expression" : { + "name" : "GetMedicationRequestEndDate", + "type" : "FunctionRef", "operand" : [ { - "type" : "Subtract", + "name" : "O", + "type" : "AliasRef" + } ] + } + }, { + "identifier" : "CalculatedStatus", + "expression" : { + "type" : "If", + "condition" : { + "type" : "SameOrAfter", "operand" : [ { - "precision" : "Year", - "type" : "DateTimeComponentFrom", - "operand" : { - "type" : "Today" - } + "name" : "CalculatedEnd", + "type" : "QueryLetRef" }, { - "precision" : "Year", - "type" : "DateTimeComponentFrom", - "operand" : { - "path" : "CalculatedEnd", - "scope" : "M", - "type" : "Property" - } + "type" : "Today" } ] - }, { - "valueType" : "{urn:hl7-org:elm-types:r1}Integer", - "value" : "2", + }, + "then" : { + "valueType" : "{urn:hl7-org:elm-types:r1}String", + "value" : "active", "type" : "Literal" - } ] - } ] - } - } - }, { - "name" : "MedicationRequestsForNaloxoneConsideration", - "context" : "Patient", - "accessLevel" : "Public", - "expression" : { - "type" : "If", - "condition" : { - "name" : "HasNaloxoneInLastYear", - "type" : "ExpressionRef" - }, - "then" : { - "type" : "As", - "operand" : { - "type" : "Null" - }, - "asTypeSpecifier" : { - "type" : "ListTypeSpecifier", - "elementType" : { - "type" : "TupleTypeSpecifier", - "element" : [ { - "name" : "Type", - "elementType" : { - "name" : "{urn:hl7-org:elm-types:r1}String", - "type" : "NamedTypeSpecifier" - } - }, { - "name" : "Name", - "elementType" : { - "name" : "{urn:hl7-org:elm-types:r1}String", - "type" : "NamedTypeSpecifier" - } - }, { - "name" : "Start", - "elementType" : { - "name" : "{urn:hl7-org:elm-types:r1}String", - "type" : "NamedTypeSpecifier" - } - }, { - "name" : "DispensedDate", - "elementType" : { - "name" : "{urn:hl7-org:elm-types:r1}String", - "type" : "NamedTypeSpecifier" - } - }, { + }, + "else" : { + "asType" : "{urn:hl7-org:elm-types:r1}String", + "type" : "As", + "operand" : { + "type" : "Null" + } + } + } + } ], + "relationship" : [ ], + "return" : { + "expression" : { + "type" : "Tuple", + "element" : [ { + "name" : "Type", + "value" : { + "valueType" : "{urn:hl7-org:elm-types:r1}String", + "value" : "Request", + "type" : "Literal" + } + }, { + "name" : "Name", + "value" : { + "name" : "ConceptText", + "type" : "FunctionRef", + "operand" : [ { + "strict" : false, + "type" : "As", + "operand" : { + "path" : "medication", + "scope" : "O", + "type" : "Property" + }, + "asTypeSpecifier" : { + "name" : "{http://hl7.org/fhir}CodeableConcept", + "type" : "NamedTypeSpecifier" + } + } ] + } + }, { + "name" : "CalculatedEnd", + "value" : { "name" : "CalculatedEnd", - "elementType" : { - "name" : "{urn:hl7-org:elm-types:r1}Date", - "type" : "NamedTypeSpecifier" - } - }, { - "name" : "End", - "elementType" : { - "name" : "{urn:hl7-org:elm-types:r1}String", - "type" : "NamedTypeSpecifier" - } - }, { - "name" : "Quantity", - "elementType" : { - "name" : "{urn:hl7-org:elm-types:r1}Decimal", - "type" : "NamedTypeSpecifier" - } - }, { - "name" : "Duration", - "elementType" : { - "name" : "{urn:hl7-org:elm-types:r1}Decimal", - "type" : "NamedTypeSpecifier" - } - }, { - "name" : "doseQuantity", - "elementType" : { - "name" : "{urn:hl7-org:elm-types:r1}Quantity", - "type" : "NamedTypeSpecifier" - } - }, { - "name" : "dosesPerDay", - "elementType" : { - "name" : "{urn:hl7-org:elm-types:r1}Decimal", - "type" : "NamedTypeSpecifier" - } - }, { - "name" : "strength", - "elementType" : { - "type" : "ListTypeSpecifier", - "elementType" : { - "name" : "{urn:hl7-org:elm-types:r1}Quantity", - "type" : "NamedTypeSpecifier" - } - } - }, { - "name" : "factor", - "elementType" : { - "type" : "ListTypeSpecifier", - "elementType" : { - "name" : "{urn:hl7-org:elm-types:r1}Decimal", - "type" : "NamedTypeSpecifier" - } - } - }, { - "name" : "MME", - "elementType" : { - "name" : "{urn:hl7-org:elm-types:r1}Decimal", - "type" : "NamedTypeSpecifier" - } - }, { - "name" : "Prescriber", - "elementType" : { - "name" : "{urn:hl7-org:elm-types:r1}String", - "type" : "NamedTypeSpecifier" - } - }, { - "name" : "Pharmacy", - "elementType" : { - "name" : "{urn:hl7-org:elm-types:r1}String", - "type" : "NamedTypeSpecifier" - } - }, { - "name" : "NDC_Code", - "elementType" : { - "name" : "{urn:hl7-org:elm-types:r1}String", - "type" : "NamedTypeSpecifier" - } - }, { - "name" : "RXNorm_Code", - "elementType" : { - "name" : "{urn:hl7-org:elm-types:r1}String", - "type" : "NamedTypeSpecifier" - } - }, { - "name" : "Status", - "elementType" : { - "name" : "{urn:hl7-org:elm-types:r1}String", - "type" : "NamedTypeSpecifier" - } - }, { - "name" : "Class", - "elementType" : { - "type" : "ListTypeSpecifier", - "elementType" : { - "type" : "ChoiceTypeSpecifier", - "choice" : [ { - "name" : "{urn:hl7-org:elm-types:r1}Boolean", - "type" : "NamedTypeSpecifier" - }, { - "name" : "{urn:hl7-org:elm-types:r1}Time", - "type" : "NamedTypeSpecifier" - }, { - "name" : "{urn:hl7-org:elm-types:r1}DateTime", - "type" : "NamedTypeSpecifier" - }, { - "name" : "{http://hl7.org/fhir}CodeableConcept", - "type" : "NamedTypeSpecifier" - }, { - "name" : "{http://hl7.org/fhir}Quantity", - "type" : "NamedTypeSpecifier" - }, { - "name" : "{http://hl7.org/fhir}Range", - "type" : "NamedTypeSpecifier" - }, { - "name" : "{http://hl7.org/fhir}Reference", - "type" : "NamedTypeSpecifier" - }, { - "name" : "{urn:hl7-org:elm-types:r1}Integer", - "type" : "NamedTypeSpecifier" - }, { - "name" : "{http://hl7.org/fhir}decimal", - "type" : "NamedTypeSpecifier" - }, { - "name" : "{http://hl7.org/fhir}string", - "type" : "NamedTypeSpecifier" - }, { - "name" : "{urn:hl7-org:elm-types:r1}Date", - "type" : "NamedTypeSpecifier" - }, { - "name" : "{urn:hl7-org:elm-types:r1}String", - "type" : "NamedTypeSpecifier" - }, { - "name" : "{urn:hl7-org:elm-types:r1}Decimal", - "type" : "NamedTypeSpecifier" - } ] - } - } - }, { - "name" : "AuthoredOn", - "elementType" : { - "name" : "{http://hl7.org/fhir}dateTime", - "type" : "NamedTypeSpecifier" - } - } ] - } - } - }, - "else" : { - "name" : "MedicationRequestsLastTwoYears", - "type" : "ExpressionRef" - } - } - }, { - "name" : "NonOpioidMedicationRequests", - "context" : "Patient", - "accessLevel" : "Public", - "expression" : { - "name" : "MedicationRequestLookBack", - "libraryName" : "C3F", - "type" : "FunctionRef", - "operand" : [ { - "dataType" : "{http://hl7.org/fhir}MedicationRequest", - "codeProperty" : "medication", - "codeComparator" : "in", - "type" : "Retrieve", - "codes" : { - "name" : "Non opiod pain medications", - "preserve" : true, - "type" : "ValueSetRef" - } - }, { - "value" : 100, - "unit" : "years", - "type" : "Quantity" - } ] - } - }, { - "name" : "NonOpioidMedicationStatements", - "context" : "Patient", - "accessLevel" : "Public", - "expression" : { - "name" : "MedicationStatementLookBack", - "libraryName" : "C3F", - "type" : "FunctionRef", - "operand" : [ { - "dataType" : "{http://hl7.org/fhir}MedicationStatement", - "codeProperty" : "medication", - "codeComparator" : "in", - "type" : "Retrieve", - "codes" : { - "name" : "Non opiod pain medications", - "preserve" : true, - "type" : "ValueSetRef" - } - }, { - "value" : 100, - "unit" : "years", - "type" : "Quantity" - } ] - } - }, { - "name" : "ReportNonOpioidMedicationRequests", - "context" : "Patient", - "accessLevel" : "Public", - "expression" : { - "type" : "Query", - "source" : [ { - "alias" : "O", - "expression" : { - "name" : "NonOpioidMedicationRequests", - "type" : "ExpressionRef" - } - } ], - "let" : [ { - "identifier" : "CalculatedEnd", - "expression" : { - "name" : "GetMedicationRequestEndDate", - "type" : "FunctionRef", - "operand" : [ { - "name" : "O", - "type" : "AliasRef" - } ] - } - } ], - "relationship" : [ ], - "return" : { - "expression" : { - "type" : "Tuple", - "element" : [ { - "name" : "Type", - "value" : { - "valueType" : "{urn:hl7-org:elm-types:r1}String", - "value" : "Request", - "type" : "Literal" - } - }, { - "name" : "Name", - "value" : { - "name" : "ConceptText", - "type" : "FunctionRef", - "operand" : [ { - "strict" : false, - "type" : "As", - "operand" : { - "path" : "medication", - "scope" : "O", - "type" : "Property" - }, - "asTypeSpecifier" : { - "name" : "{http://hl7.org/fhir}CodeableConcept", - "type" : "NamedTypeSpecifier" - } - } ] + "type" : "QueryLetRef" } }, { - "name" : "Start", + "name" : "Written", "value" : { "name" : "DateTimeText", "type" : "FunctionRef", @@ -5435,12 +5290,12 @@ } ] } }, { - "name" : "DispensedDate", + "name" : "Start", "value" : { "name" : "DateTimeText", "type" : "FunctionRef", "operand" : [ { - "name" : "GetMedicationRequestDispensedDate", + "name" : "GetMedicationRequestStartDate", "type" : "FunctionRef", "operand" : [ { "name" : "O", @@ -5448,12 +5303,6 @@ } ] } ] } - }, { - "name" : "CalculatedEnd", - "value" : { - "name" : "CalculatedEnd", - "type" : "QueryLetRef" - } }, { "name" : "End", "value" : { @@ -5464,151 +5313,149 @@ } } }, { - "name" : "Quantity", + "name" : "Status", "value" : { - "name" : "GetMedicationRequestDispensedQuantity", - "type" : "FunctionRef", - "operand" : [ { - "name" : "O", - "type" : "AliasRef" - } ] + "name" : "CalculatedStatus", + "type" : "QueryLetRef" } }, { - "name" : "Prescriber", + "name" : "doseQuantity", "value" : { - "path" : "value", + "path" : "doseQuantity", "type" : "Property", "source" : { - "path" : "display", - "type" : "Property", - "source" : { - "path" : "requester", - "scope" : "O", - "type" : "Property" - } - } - } - }, { - "name" : "Pharmacy", - "value" : { - "name" : "GetMedicationRequestPharmacy", - "type" : "FunctionRef", - "operand" : [ { - "name" : "O", - "type" : "AliasRef" - } ] + "type" : "Indexer", + "operand" : [ { + "name" : "MME_Object", + "type" : "QueryLetRef" + }, { + "valueType" : "{urn:hl7-org:elm-types:r1}Integer", + "value" : "0", + "type" : "Literal" + } ] + } } }, { - "name" : "Status", + "name" : "dosesPerDay", "value" : { - "path" : "value", + "path" : "dosesPerDay", "type" : "Property", "source" : { - "path" : "status", - "scope" : "O", - "type" : "Property" + "type" : "Indexer", + "operand" : [ { + "name" : "MME_Object", + "type" : "QueryLetRef" + }, { + "valueType" : "{urn:hl7-org:elm-types:r1}Integer", + "value" : "0", + "type" : "Literal" + } ] } } - } ] - } - }, - "sort" : { - "by" : [ { - "direction" : "desc", - "path" : "Start", - "type" : "ByColumn" - }, { - "direction" : "desc", - "path" : "End", - "type" : "ByColumn" - } ] - } - } - }, { - "name" : "ReportNonOpioidMedicationStatements", - "context" : "Patient", - "accessLevel" : "Public", - "expression" : { - "type" : "Query", - "source" : [ { - "alias" : "S", - "expression" : { - "name" : "NonOpioidMedicationStatements", - "type" : "ExpressionRef" - } - } ], - "relationship" : [ ], - "return" : { - "expression" : { - "type" : "Tuple", - "element" : [ { - "name" : "Type", + }, { + "name" : "strength", "value" : { - "valueType" : "{urn:hl7-org:elm-types:r1}String", - "value" : "Statement", - "type" : "Literal" + "path" : "strength", + "type" : "Property", + "source" : { + "type" : "Indexer", + "operand" : [ { + "name" : "MME_Object", + "type" : "QueryLetRef" + }, { + "valueType" : "{urn:hl7-org:elm-types:r1}Integer", + "value" : "0", + "type" : "Literal" + } ] + } } }, { - "name" : "Name", + "name" : "supplyQuantity", "value" : { - "name" : "ConceptText", - "type" : "FunctionRef", - "operand" : [ { - "strict" : false, - "type" : "As", - "operand" : { - "path" : "medication", - "scope" : "S", - "type" : "Property" - }, - "asTypeSpecifier" : { - "name" : "{http://hl7.org/fhir}CodeableConcept", - "type" : "NamedTypeSpecifier" - } - } ] + "path" : "supplyQuantity", + "type" : "Property", + "source" : { + "type" : "Indexer", + "operand" : [ { + "name" : "MME_Object", + "type" : "QueryLetRef" + }, { + "valueType" : "{urn:hl7-org:elm-types:r1}Integer", + "value" : "0", + "type" : "Literal" + } ] + } } }, { - "name" : "Start", + "name" : "supplyDuration", "value" : { - "name" : "MedicationStatementDate", - "type" : "FunctionRef", - "operand" : [ { - "name" : "S", - "type" : "AliasRef" - } ] + "path" : "supplyDuration", + "type" : "Property", + "source" : { + "type" : "Indexer", + "operand" : [ { + "name" : "MME_Object", + "type" : "QueryLetRef" + }, { + "valueType" : "{urn:hl7-org:elm-types:r1}Integer", + "value" : "0", + "type" : "Literal" + } ] + } } }, { - "name" : "End", + "name" : "factor", "value" : { - "name" : "DateTimeText", - "type" : "FunctionRef", - "operand" : [ { - "path" : "end", + "path" : "conversionFactor", + "type" : "Property", + "source" : { + "type" : "Indexer", + "operand" : [ { + "name" : "MME_Object", + "type" : "QueryLetRef" + }, { + "valueType" : "{urn:hl7-org:elm-types:r1}Integer", + "value" : "0", + "type" : "Literal" + } ] + } + } + }, { + "name" : "MMEValue", + "value" : { + "path" : "value", + "type" : "Property", + "source" : { + "path" : "mme", "type" : "Property", "source" : { - "strict" : false, - "type" : "As", - "operand" : { - "path" : "effective", - "scope" : "S", - "type" : "Property" - }, - "asTypeSpecifier" : { - "name" : "{http://hl7.org/fhir}Period", - "type" : "NamedTypeSpecifier" - } + "type" : "Indexer", + "operand" : [ { + "name" : "MME_Object", + "type" : "QueryLetRef" + }, { + "valueType" : "{urn:hl7-org:elm-types:r1}Integer", + "value" : "0", + "type" : "Literal" + } ] } - } ] + } } }, { - "name" : "Status", + "name" : "rxNormCode", "value" : { - "path" : "value", + "path" : "rxNormCode", "type" : "Property", "source" : { - "path" : "status", - "scope" : "S", - "type" : "Property" + "type" : "Indexer", + "operand" : [ { + "name" : "MME_Object", + "type" : "QueryLetRef" + }, { + "valueType" : "{urn:hl7-org:elm-types:r1}Integer", + "value" : "0", + "type" : "Literal" + } ] } } } ] @@ -5616,10 +5463,6 @@ }, "sort" : { "by" : [ { - "direction" : "desc", - "path" : "Start", - "type" : "ByColumn" - }, { "direction" : "desc", "path" : "End", "type" : "ByColumn" @@ -5627,54 +5470,707 @@ } } }, { - "name" : "ReportNonOpioidMedications", + "name" : "ReportMMEByDates", "context" : "Patient", "accessLevel" : "Public", "expression" : { "type" : "Query", "source" : [ { - "alias" : "M", + "alias" : "R", "expression" : { - "type" : "Union", + "name" : "ReportMME", + "type" : "ExpressionRef" + } + } ], + "relationship" : [ ], + "where" : { + "type" : "And", + "operand" : [ { + "type" : "And", "operand" : [ { - "type" : "As", + "type" : "Not", "operand" : { - "name" : "ReportNonOpioidMedicationRequests", - "type" : "ExpressionRef" - }, - "asTypeSpecifier" : { - "type" : "ListTypeSpecifier", - "elementType" : { - "type" : "ChoiceTypeSpecifier", - "choice" : [ { - "type" : "TupleTypeSpecifier", - "element" : [ { - "name" : "Type", - "elementType" : { - "name" : "{urn:hl7-org:elm-types:r1}String", - "type" : "NamedTypeSpecifier" - } - }, { - "name" : "Name", - "elementType" : { - "name" : "{urn:hl7-org:elm-types:r1}String", - "type" : "NamedTypeSpecifier" - } - }, { - "name" : "Start", - "elementType" : { - "name" : "{urn:hl7-org:elm-types:r1}String", - "type" : "NamedTypeSpecifier" - } - }, { - "name" : "End", - "elementType" : { - "name" : "{urn:hl7-org:elm-types:r1}String", - "type" : "NamedTypeSpecifier" - } - }, { - "name" : "Status", - "elementType" : { + "type" : "IsNull", + "operand" : { + "path" : "End", + "scope" : "R", + "type" : "Property" + } + } + }, { + "type" : "Not", + "operand" : { + "type" : "IsNull", + "operand" : { + "path" : "MMEValue", + "scope" : "R", + "type" : "Property" + } + } + } ] + }, { + "type" : "LessOrEqual", + "operand" : [ { + "type" : "Subtract", + "operand" : [ { + "precision" : "Year", + "type" : "DateTimeComponentFrom", + "operand" : { + "type" : "Today" + } + }, { + "precision" : "Year", + "type" : "DateTimeComponentFrom", + "operand" : { + "path" : "CalculatedEnd", + "scope" : "R", + "type" : "Property" + } + } ] + }, { + "valueType" : "{urn:hl7-org:elm-types:r1}Integer", + "value" : "2", + "type" : "Literal" + } ] + } ] + }, + "return" : { + "expression" : { + "type" : "Tuple", + "element" : [ { + "name" : "Start", + "value" : { + "path" : "Start", + "scope" : "R", + "type" : "Property" + } + }, { + "name" : "End", + "value" : { + "path" : "End", + "scope" : "R", + "type" : "Property" + } + }, { + "name" : "rxNormCode", + "value" : { + "path" : "rxNormCode", + "scope" : "R", + "type" : "Property" + } + }, { + "name" : "rxCUI", + "value" : { + "path" : "code", + "type" : "Property", + "source" : { + "path" : "rxNormCode", + "scope" : "R", + "type" : "Property" + } + } + }, { + "name" : "MMEValue", + "value" : { + "path" : "MMEValue", + "scope" : "R", + "type" : "Property" + } + }, { + "name" : "isBup", + "value" : { + "type" : "In", + "operand" : [ { + "path" : "code", + "type" : "Property", + "source" : { + "path" : "rxNormCode", + "scope" : "R", + "type" : "Property" + } + }, { + "name" : "BuprenorphineRxCUIs", + "type" : "ExpressionRef" + } ] + } + }, { + "name" : "category", + "value" : { + "valueType" : "{urn:hl7-org:elm-types:r1}String", + "value" : "default", + "type" : "Literal" + } + } ] + } + }, + "sort" : { + "by" : [ { + "direction" : "asc", + "path" : "End", + "type" : "ByColumn" + } ] + } + } + }, { + "name" : "GetNonBuprenorphineMMEListByDates", + "context" : "Patient", + "accessLevel" : "Public", + "expression" : { + "type" : "Query", + "source" : [ { + "alias" : "R", + "expression" : { + "type" : "Query", + "source" : [ { + "alias" : "O", + "expression" : { + "name" : "ReportMMEByDates", + "type" : "ExpressionRef" + } + } ], + "relationship" : [ ], + "where" : { + "type" : "Not", + "operand" : { + "type" : "In", + "operand" : [ { + "path" : "rxCUI", + "scope" : "O", + "type" : "Property" + }, { + "name" : "BuprenorphineRxCUIs", + "type" : "ExpressionRef" + } ] + } + } + } + } ], + "relationship" : [ ], + "return" : { + "expression" : { + "type" : "Tuple", + "element" : [ { + "name" : "Start", + "value" : { + "path" : "Start", + "scope" : "R", + "type" : "Property" + } + }, { + "name" : "End", + "value" : { + "path" : "End", + "scope" : "R", + "type" : "Property" + } + }, { + "name" : "rxNormCode", + "value" : { + "path" : "rxNormCode", + "scope" : "R", + "type" : "Property" + } + }, { + "name" : "rxCUI", + "value" : { + "path" : "code", + "type" : "Property", + "source" : { + "path" : "rxNormCode", + "scope" : "R", + "type" : "Property" + } + } + }, { + "name" : "MMEValue", + "value" : { + "path" : "MMEValue", + "scope" : "R", + "type" : "Property" + } + } ] + } + }, + "sort" : { + "by" : [ { + "direction" : "asc", + "path" : "End", + "type" : "ByColumn" + } ] + } + } + }, { + "name" : "NonBupMedRequestsForNaloxoneConsiderationLastTwoYears", + "context" : "Patient", + "accessLevel" : "Public", + "expression" : { + "type" : "Query", + "source" : [ { + "alias" : "M", + "expression" : { + "name" : "GetNonBuprenorphineMMEListByDates", + "type" : "ExpressionRef" + } + } ], + "relationship" : [ ], + "where" : { + "type" : "And", + "operand" : [ { + "type" : "GreaterOrEqual", + "operand" : [ { + "path" : "MMEValue", + "scope" : "M", + "type" : "Property" + }, { + "type" : "ToDecimal", + "operand" : { + "valueType" : "{urn:hl7-org:elm-types:r1}Integer", + "value" : "50", + "type" : "Literal" + } + } ] + }, { + "type" : "LessOrEqual", + "operand" : [ { + "type" : "Subtract", + "operand" : [ { + "precision" : "Year", + "type" : "DateTimeComponentFrom", + "operand" : { + "type" : "Today" + } + }, { + "precision" : "Year", + "type" : "DateTimeComponentFrom", + "operand" : { + "type" : "ToDate", + "operand" : { + "path" : "End", + "scope" : "M", + "type" : "Property" + } + } + } ] + }, { + "valueType" : "{urn:hl7-org:elm-types:r1}Integer", + "value" : "2", + "type" : "Literal" + } ] + } ] + } + } + }, { + "name" : "MedicationRequestsForNaloxoneConsideration", + "context" : "Patient", + "accessLevel" : "Public", + "expression" : { + "type" : "If", + "condition" : { + "name" : "HasNaloxoneInLastYear", + "type" : "ExpressionRef" + }, + "then" : { + "type" : "As", + "operand" : { + "type" : "Null" + }, + "asTypeSpecifier" : { + "type" : "ListTypeSpecifier", + "elementType" : { + "type" : "TupleTypeSpecifier", + "element" : [ { + "name" : "Start", + "elementType" : { + "name" : "{urn:hl7-org:elm-types:r1}String", + "type" : "NamedTypeSpecifier" + } + }, { + "name" : "End", + "elementType" : { + "name" : "{urn:hl7-org:elm-types:r1}String", + "type" : "NamedTypeSpecifier" + } + }, { + "name" : "rxNormCode", + "elementType" : { + "name" : "{urn:hl7-org:elm-types:r1}Code", + "type" : "NamedTypeSpecifier" + } + }, { + "name" : "rxCUI", + "elementType" : { + "name" : "{urn:hl7-org:elm-types:r1}String", + "type" : "NamedTypeSpecifier" + } + }, { + "name" : "MMEValue", + "elementType" : { + "name" : "{urn:hl7-org:elm-types:r1}Decimal", + "type" : "NamedTypeSpecifier" + } + } ] + } + } + }, + "else" : { + "name" : "NonBupMedRequestsForNaloxoneConsiderationLastTwoYears", + "type" : "ExpressionRef" + } + } + }, { + "name" : "NonOpioidMedicationRequests", + "context" : "Patient", + "accessLevel" : "Public", + "expression" : { + "name" : "MedicationRequestLookBack", + "libraryName" : "C3F", + "type" : "FunctionRef", + "operand" : [ { + "dataType" : "{http://hl7.org/fhir}MedicationRequest", + "codeProperty" : "medication", + "codeComparator" : "in", + "type" : "Retrieve", + "codes" : { + "name" : "Non opiod pain medications", + "preserve" : true, + "type" : "ValueSetRef" + } + }, { + "value" : 100, + "unit" : "years", + "type" : "Quantity" + } ] + } + }, { + "name" : "NonOpioidMedicationStatements", + "context" : "Patient", + "accessLevel" : "Public", + "expression" : { + "name" : "MedicationStatementLookBack", + "libraryName" : "C3F", + "type" : "FunctionRef", + "operand" : [ { + "dataType" : "{http://hl7.org/fhir}MedicationStatement", + "codeProperty" : "medication", + "codeComparator" : "in", + "type" : "Retrieve", + "codes" : { + "name" : "Non opiod pain medications", + "preserve" : true, + "type" : "ValueSetRef" + } + }, { + "value" : 100, + "unit" : "years", + "type" : "Quantity" + } ] + } + }, { + "name" : "ReportNonOpioidMedicationRequests", + "context" : "Patient", + "accessLevel" : "Public", + "expression" : { + "type" : "Query", + "source" : [ { + "alias" : "O", + "expression" : { + "name" : "NonOpioidMedicationRequests", + "type" : "ExpressionRef" + } + } ], + "let" : [ { + "identifier" : "CalculatedEnd", + "expression" : { + "name" : "GetMedicationRequestEndDate", + "type" : "FunctionRef", + "operand" : [ { + "name" : "O", + "type" : "AliasRef" + } ] + } + } ], + "relationship" : [ ], + "return" : { + "expression" : { + "type" : "Tuple", + "element" : [ { + "name" : "Type", + "value" : { + "valueType" : "{urn:hl7-org:elm-types:r1}String", + "value" : "Request", + "type" : "Literal" + } + }, { + "name" : "Name", + "value" : { + "name" : "ConceptText", + "type" : "FunctionRef", + "operand" : [ { + "strict" : false, + "type" : "As", + "operand" : { + "path" : "medication", + "scope" : "O", + "type" : "Property" + }, + "asTypeSpecifier" : { + "name" : "{http://hl7.org/fhir}CodeableConcept", + "type" : "NamedTypeSpecifier" + } + } ] + } + }, { + "name" : "Start", + "value" : { + "name" : "DateTimeText", + "type" : "FunctionRef", + "operand" : [ { + "path" : "authoredOn", + "scope" : "O", + "type" : "Property" + } ] + } + }, { + "name" : "DispensedDate", + "value" : { + "name" : "DateTimeText", + "type" : "FunctionRef", + "operand" : [ { + "name" : "GetMedicationRequestDispensedDate", + "type" : "FunctionRef", + "operand" : [ { + "name" : "O", + "type" : "AliasRef" + } ] + } ] + } + }, { + "name" : "CalculatedEnd", + "value" : { + "name" : "CalculatedEnd", + "type" : "QueryLetRef" + } + }, { + "name" : "End", + "value" : { + "type" : "ToString", + "operand" : { + "name" : "CalculatedEnd", + "type" : "QueryLetRef" + } + } + }, { + "name" : "Quantity", + "value" : { + "name" : "GetMedicationRequestDispensedQuantity", + "type" : "FunctionRef", + "operand" : [ { + "name" : "O", + "type" : "AliasRef" + } ] + } + }, { + "name" : "Prescriber", + "value" : { + "path" : "value", + "type" : "Property", + "source" : { + "path" : "display", + "type" : "Property", + "source" : { + "path" : "requester", + "scope" : "O", + "type" : "Property" + } + } + } + }, { + "name" : "Pharmacy", + "value" : { + "name" : "GetMedicationRequestPharmacy", + "type" : "FunctionRef", + "operand" : [ { + "name" : "O", + "type" : "AliasRef" + } ] + } + }, { + "name" : "Status", + "value" : { + "path" : "value", + "type" : "Property", + "source" : { + "path" : "status", + "scope" : "O", + "type" : "Property" + } + } + } ] + } + }, + "sort" : { + "by" : [ { + "direction" : "desc", + "path" : "Start", + "type" : "ByColumn" + }, { + "direction" : "desc", + "path" : "End", + "type" : "ByColumn" + } ] + } + } + }, { + "name" : "ReportNonOpioidMedicationStatements", + "context" : "Patient", + "accessLevel" : "Public", + "expression" : { + "type" : "Query", + "source" : [ { + "alias" : "S", + "expression" : { + "name" : "NonOpioidMedicationStatements", + "type" : "ExpressionRef" + } + } ], + "relationship" : [ ], + "return" : { + "expression" : { + "type" : "Tuple", + "element" : [ { + "name" : "Type", + "value" : { + "valueType" : "{urn:hl7-org:elm-types:r1}String", + "value" : "Statement", + "type" : "Literal" + } + }, { + "name" : "Name", + "value" : { + "name" : "ConceptText", + "type" : "FunctionRef", + "operand" : [ { + "strict" : false, + "type" : "As", + "operand" : { + "path" : "medication", + "scope" : "S", + "type" : "Property" + }, + "asTypeSpecifier" : { + "name" : "{http://hl7.org/fhir}CodeableConcept", + "type" : "NamedTypeSpecifier" + } + } ] + } + }, { + "name" : "Start", + "value" : { + "name" : "MedicationStatementDate", + "type" : "FunctionRef", + "operand" : [ { + "name" : "S", + "type" : "AliasRef" + } ] + } + }, { + "name" : "End", + "value" : { + "name" : "DateTimeText", + "type" : "FunctionRef", + "operand" : [ { + "path" : "end", + "type" : "Property", + "source" : { + "strict" : false, + "type" : "As", + "operand" : { + "path" : "effective", + "scope" : "S", + "type" : "Property" + }, + "asTypeSpecifier" : { + "name" : "{http://hl7.org/fhir}Period", + "type" : "NamedTypeSpecifier" + } + } + } ] + } + }, { + "name" : "Status", + "value" : { + "path" : "value", + "type" : "Property", + "source" : { + "path" : "status", + "scope" : "S", + "type" : "Property" + } + } + } ] + } + }, + "sort" : { + "by" : [ { + "direction" : "desc", + "path" : "Start", + "type" : "ByColumn" + }, { + "direction" : "desc", + "path" : "End", + "type" : "ByColumn" + } ] + } + } + }, { + "name" : "ReportNonOpioidMedications", + "context" : "Patient", + "accessLevel" : "Public", + "expression" : { + "type" : "Query", + "source" : [ { + "alias" : "M", + "expression" : { + "type" : "Union", + "operand" : [ { + "type" : "As", + "operand" : { + "name" : "ReportNonOpioidMedicationRequests", + "type" : "ExpressionRef" + }, + "asTypeSpecifier" : { + "type" : "ListTypeSpecifier", + "elementType" : { + "type" : "ChoiceTypeSpecifier", + "choice" : [ { + "type" : "TupleTypeSpecifier", + "element" : [ { + "name" : "Type", + "elementType" : { + "name" : "{urn:hl7-org:elm-types:r1}String", + "type" : "NamedTypeSpecifier" + } + }, { + "name" : "Name", + "elementType" : { + "name" : "{urn:hl7-org:elm-types:r1}String", + "type" : "NamedTypeSpecifier" + } + }, { + "name" : "Start", + "elementType" : { + "name" : "{urn:hl7-org:elm-types:r1}String", + "type" : "NamedTypeSpecifier" + } + }, { + "name" : "End", + "elementType" : { + "name" : "{urn:hl7-org:elm-types:r1}String", + "type" : "NamedTypeSpecifier" + } + }, { + "name" : "Status", + "elementType" : { "name" : "{urn:hl7-org:elm-types:r1}String", "type" : "NamedTypeSpecifier" } @@ -6555,414 +7051,463 @@ } } }, { - "name" : "ReportMME", + "name" : "GetBuprenorphineMMEListByDates", "context" : "Patient", "accessLevel" : "Public", "expression" : { "type" : "Query", "source" : [ { - "alias" : "O", - "expression" : { - "type" : "Union", - "operand" : [ { - "name" : "PDMPMedicationRequests", - "type" : "ExpressionRef" - }, { - "dataType" : "{http://hl7.org/fhir}MedicationRequest", - "codeProperty" : "medication", - "codeComparator" : "in", - "type" : "Retrieve", - "codes" : { - "name" : "Opioid Pain Medications", - "preserve" : true, - "type" : "ValueSetRef" - } - } ] - } - } ], - "let" : [ { - "identifier" : "MME_Object", + "alias" : "R", "expression" : { - "name" : "MME", - "libraryName" : "MMECalculator", - "type" : "FunctionRef", - "operand" : [ { - "type" : "ToList", - "operand" : { - "name" : "O", - "type" : "AliasRef" + "type" : "Query", + "source" : [ { + "alias" : "O", + "expression" : { + "name" : "ReportMMEByDates", + "type" : "ExpressionRef" } - } ] - } - }, { - "identifier" : "CalculatedEnd", - "expression" : { - "name" : "GetMedicationRequestEndDate", - "type" : "FunctionRef", - "operand" : [ { - "name" : "O", - "type" : "AliasRef" - } ] - } - }, { - "identifier" : "CalculatedStatus", - "expression" : { - "type" : "If", - "condition" : { - "type" : "SameOrAfter", + } ], + "relationship" : [ ], + "where" : { + "type" : "In", "operand" : [ { - "name" : "CalculatedEnd", - "type" : "QueryLetRef" + "path" : "rxCUI", + "scope" : "O", + "type" : "Property" }, { - "type" : "Today" + "name" : "BuprenorphineRxCUIs", + "type" : "ExpressionRef" } ] - }, - "then" : { - "valueType" : "{urn:hl7-org:elm-types:r1}String", - "value" : "active", - "type" : "Literal" - }, - "else" : { - "asType" : "{urn:hl7-org:elm-types:r1}String", - "type" : "As", - "operand" : { - "type" : "Null" - } } } - } ], - "relationship" : [ ], - "return" : { - "expression" : { - "type" : "Tuple", - "element" : [ { - "name" : "Type", - "value" : { - "valueType" : "{urn:hl7-org:elm-types:r1}String", - "value" : "Request", - "type" : "Literal" - } - }, { - "name" : "Name", - "value" : { - "name" : "ConceptText", - "type" : "FunctionRef", - "operand" : [ { - "strict" : false, - "type" : "As", - "operand" : { - "path" : "medication", - "scope" : "O", - "type" : "Property" - }, - "asTypeSpecifier" : { - "name" : "{http://hl7.org/fhir}CodeableConcept", - "type" : "NamedTypeSpecifier" - } - } ] - } - }, { - "name" : "CalculatedEnd", - "value" : { - "name" : "CalculatedEnd", - "type" : "QueryLetRef" - } - }, { - "name" : "Written", - "value" : { - "name" : "DateTimeText", - "type" : "FunctionRef", - "operand" : [ { - "path" : "authoredOn", - "scope" : "O", - "type" : "Property" - } ] - } - }, { - "name" : "Start", - "value" : { - "name" : "DateTimeText", - "type" : "FunctionRef", - "operand" : [ { - "name" : "GetMedicationRequestStartDate", - "type" : "FunctionRef", - "operand" : [ { - "name" : "O", - "type" : "AliasRef" - } ] - } ] + } ], + "relationship" : [ ], + "return" : { + "expression" : { + "type" : "Tuple", + "element" : [ { + "name" : "Start", + "value" : { + "path" : "Start", + "scope" : "R", + "type" : "Property" } }, { "name" : "End", "value" : { - "type" : "ToString", - "operand" : { - "name" : "CalculatedEnd", - "type" : "QueryLetRef" - } + "path" : "End", + "scope" : "R", + "type" : "Property" } }, { - "name" : "Status", + "name" : "rxNormCode", "value" : { - "name" : "CalculatedStatus", - "type" : "QueryLetRef" + "path" : "rxNormCode", + "scope" : "R", + "type" : "Property" } }, { - "name" : "doseQuantity", + "name" : "rxCUI", "value" : { - "path" : "doseQuantity", + "path" : "code", "type" : "Property", "source" : { - "type" : "Indexer", - "operand" : [ { - "name" : "MME_Object", - "type" : "QueryLetRef" - }, { - "valueType" : "{urn:hl7-org:elm-types:r1}Integer", - "value" : "0", - "type" : "Literal" - } ] + "path" : "rxNormCode", + "scope" : "R", + "type" : "Property" } } }, { - "name" : "dosesPerDay", + "name" : "MMEValue", "value" : { - "path" : "dosesPerDay", - "type" : "Property", - "source" : { - "type" : "Indexer", - "operand" : [ { - "name" : "MME_Object", - "type" : "QueryLetRef" - }, { - "valueType" : "{urn:hl7-org:elm-types:r1}Integer", - "value" : "0", - "type" : "Literal" - } ] - } + "path" : "MMEValue", + "scope" : "R", + "type" : "Property" } - }, { - "name" : "strength", - "value" : { - "path" : "strength", - "type" : "Property", - "source" : { - "type" : "Indexer", - "operand" : [ { - "name" : "MME_Object", - "type" : "QueryLetRef" - }, { - "valueType" : "{urn:hl7-org:elm-types:r1}Integer", - "value" : "0", - "type" : "Literal" - } ] + } ] + } + }, + "sort" : { + "by" : [ { + "direction" : "asc", + "path" : "End", + "type" : "ByColumn" + } ] + } + } + }, { + "name" : "ReportDailyMMEByDateWithoutBuprenorphine", + "context" : "Patient", + "accessLevel" : "Public", + "expression" : { + "type" : "If", + "condition" : { + "type" : "IsNull", + "operand" : { + "type" : "First", + "source" : { + "name" : "GetBuprenorphineMMEListByDates", + "type" : "ExpressionRef" + } + } + }, + "then" : { + "type" : "As", + "operand" : { + "type" : "Null" + }, + "asTypeSpecifier" : { + "type" : "ListTypeSpecifier", + "elementType" : { + "type" : "TupleTypeSpecifier", + "element" : [ { + "name" : "Start", + "elementType" : { + "name" : "{urn:hl7-org:elm-types:r1}String", + "type" : "NamedTypeSpecifier" } - } - }, { - "name" : "supplyQuantity", - "value" : { - "path" : "supplyQuantity", - "type" : "Property", - "source" : { - "type" : "Indexer", - "operand" : [ { - "name" : "MME_Object", - "type" : "QueryLetRef" - }, { - "valueType" : "{urn:hl7-org:elm-types:r1}Integer", - "value" : "0", - "type" : "Literal" - } ] + }, { + "name" : "End", + "elementType" : { + "name" : "{urn:hl7-org:elm-types:r1}String", + "type" : "NamedTypeSpecifier" } - } - }, { - "name" : "supplyDuration", - "value" : { - "path" : "supplyDuration", - "type" : "Property", - "source" : { - "type" : "Indexer", - "operand" : [ { - "name" : "MME_Object", - "type" : "QueryLetRef" - }, { - "valueType" : "{urn:hl7-org:elm-types:r1}Integer", - "value" : "0", - "type" : "Literal" - } ] + }, { + "name" : "rxNormCode", + "elementType" : { + "name" : "{urn:hl7-org:elm-types:r1}Code", + "type" : "NamedTypeSpecifier" } - } - }, { - "name" : "factor", - "value" : { - "path" : "conversionFactor", - "type" : "Property", - "source" : { - "type" : "Indexer", - "operand" : [ { - "name" : "MME_Object", - "type" : "QueryLetRef" - }, { - "valueType" : "{urn:hl7-org:elm-types:r1}Integer", - "value" : "0", - "type" : "Literal" - } ] + }, { + "name" : "rxCUI", + "elementType" : { + "name" : "{urn:hl7-org:elm-types:r1}String", + "type" : "NamedTypeSpecifier" + } + }, { + "name" : "MMEValue", + "elementType" : { + "name" : "{urn:hl7-org:elm-types:r1}Decimal", + "type" : "NamedTypeSpecifier" } + }, { + "name" : "category", + "elementType" : { + "name" : "{urn:hl7-org:elm-types:r1}String", + "type" : "NamedTypeSpecifier" + } + } ] + } + } + }, + "else" : { + "type" : "If", + "condition" : { + "type" : "IsNull", + "operand" : { + "type" : "First", + "source" : { + "name" : "GetNonBuprenorphineMMEListByDates", + "type" : "ExpressionRef" } - }, { - "name" : "MMEValue", - "value" : { - "path" : "value", - "type" : "Property", - "source" : { - "path" : "mme", - "type" : "Property", - "source" : { - "type" : "Indexer", - "operand" : [ { - "name" : "MME_Object", - "type" : "QueryLetRef" - }, { - "valueType" : "{urn:hl7-org:elm-types:r1}Integer", - "value" : "0", + } + }, + "then" : { + "type" : "As", + "operand" : { + "type" : "Null" + }, + "asTypeSpecifier" : { + "type" : "ListTypeSpecifier", + "elementType" : { + "type" : "TupleTypeSpecifier", + "element" : [ { + "name" : "Start", + "elementType" : { + "name" : "{urn:hl7-org:elm-types:r1}String", + "type" : "NamedTypeSpecifier" + } + }, { + "name" : "End", + "elementType" : { + "name" : "{urn:hl7-org:elm-types:r1}String", + "type" : "NamedTypeSpecifier" + } + }, { + "name" : "rxNormCode", + "elementType" : { + "name" : "{urn:hl7-org:elm-types:r1}Code", + "type" : "NamedTypeSpecifier" + } + }, { + "name" : "rxCUI", + "elementType" : { + "name" : "{urn:hl7-org:elm-types:r1}String", + "type" : "NamedTypeSpecifier" + } + }, { + "name" : "MMEValue", + "elementType" : { + "name" : "{urn:hl7-org:elm-types:r1}Decimal", + "type" : "NamedTypeSpecifier" + } + }, { + "name" : "category", + "elementType" : { + "name" : "{urn:hl7-org:elm-types:r1}String", + "type" : "NamedTypeSpecifier" + } + } ] + } + } + }, + "else" : { + "type" : "Query", + "source" : [ { + "alias" : "R", + "expression" : { + "name" : "ReportMMEByDates", + "type" : "ExpressionRef" + } + } ], + "relationship" : [ ], + "return" : { + "expression" : { + "type" : "Tuple", + "element" : [ { + "name" : "Start", + "value" : { + "path" : "Start", + "scope" : "R", + "type" : "Property" + } + }, { + "name" : "End", + "value" : { + "path" : "End", + "scope" : "R", + "type" : "Property" + } + }, { + "name" : "rxNormCode", + "value" : { + "path" : "rxNormCode", + "scope" : "R", + "type" : "Property" + } + }, { + "name" : "rxCUI", + "value" : { + "path" : "code", + "type" : "Property", + "source" : { + "path" : "rxNormCode", + "scope" : "R", + "type" : "Property" + } + } + }, { + "name" : "MMEValue", + "value" : { + "type" : "If", + "condition" : { + "type" : "In", + "operand" : [ { + "path" : "rxCUI", + "scope" : "R", + "type" : "Property" + }, { + "name" : "BuprenorphineRxCUIs", + "type" : "ExpressionRef" + } ] + }, + "then" : { + "valueType" : "{urn:hl7-org:elm-types:r1}Decimal", + "value" : "0.000000001", "type" : "Literal" - } ] + }, + "else" : { + "path" : "MMEValue", + "scope" : "R", + "type" : "Property" + } } - } - } - }, { - "name" : "rxNormCode", - "value" : { - "path" : "rxNormCode", - "type" : "Property", - "source" : { - "type" : "Indexer", - "operand" : [ { - "name" : "MME_Object", - "type" : "QueryLetRef" - }, { - "valueType" : "{urn:hl7-org:elm-types:r1}Integer", - "value" : "0", + }, { + "name" : "category", + "value" : { + "valueType" : "{urn:hl7-org:elm-types:r1}String", + "value" : "wo_buprenorphine", "type" : "Literal" - } ] - } + } + } ] } - } ] + }, + "sort" : { + "by" : [ { + "direction" : "asc", + "path" : "End", + "type" : "ByColumn" + } ] + } } - }, - "sort" : { - "by" : [ { - "direction" : "desc", - "path" : "End", - "type" : "ByColumn" - } ] } } }, { - "name" : "ReportMMEByDates", + "name" : "ReportDailyMMEByDateWithBuprenorphineOnly", "context" : "Patient", "accessLevel" : "Public", "expression" : { - "type" : "Query", - "source" : [ { - "alias" : "R", - "expression" : { - "name" : "ReportMME", - "type" : "ExpressionRef" + "type" : "If", + "condition" : { + "type" : "IsNull", + "operand" : { + "type" : "First", + "source" : { + "name" : "GetBuprenorphineMMEListByDates", + "type" : "ExpressionRef" + } } - } ], - "relationship" : [ ], - "where" : { - "type" : "And", - "operand" : [ { - "type" : "And", - "operand" : [ { - "type" : "Not", - "operand" : { - "type" : "IsNull", - "operand" : { - "path" : "End", + }, + "then" : { + "type" : "As", + "operand" : { + "type" : "Null" + }, + "asTypeSpecifier" : { + "type" : "ListTypeSpecifier", + "elementType" : { + "type" : "TupleTypeSpecifier", + "element" : [ { + "name" : "Start", + "elementType" : { + "name" : "{urn:hl7-org:elm-types:r1}String", + "type" : "NamedTypeSpecifier" + } + }, { + "name" : "End", + "elementType" : { + "name" : "{urn:hl7-org:elm-types:r1}String", + "type" : "NamedTypeSpecifier" + } + }, { + "name" : "rxNormCode", + "elementType" : { + "name" : "{urn:hl7-org:elm-types:r1}Code", + "type" : "NamedTypeSpecifier" + } + }, { + "name" : "rxCUI", + "elementType" : { + "name" : "{urn:hl7-org:elm-types:r1}String", + "type" : "NamedTypeSpecifier" + } + }, { + "name" : "MMEValue", + "elementType" : { + "name" : "{urn:hl7-org:elm-types:r1}Decimal", + "type" : "NamedTypeSpecifier" + } + }, { + "name" : "category", + "elementType" : { + "name" : "{urn:hl7-org:elm-types:r1}String", + "type" : "NamedTypeSpecifier" + } + } ] + } + } + }, + "else" : { + "type" : "Query", + "source" : [ { + "alias" : "R", + "expression" : { + "name" : "ReportMMEByDates", + "type" : "ExpressionRef" + } + } ], + "relationship" : [ ], + "return" : { + "expression" : { + "type" : "Tuple", + "element" : [ { + "name" : "Start", + "value" : { + "path" : "Start", "scope" : "R", "type" : "Property" } - } - }, { - "type" : "Not", - "operand" : { - "type" : "IsNull", - "operand" : { - "path" : "MMEValue", + }, { + "name" : "End", + "value" : { + "path" : "End", "scope" : "R", "type" : "Property" } - } - } ] - }, { - "type" : "LessOrEqual", - "operand" : [ { - "type" : "Subtract", - "operand" : [ { - "precision" : "Year", - "type" : "DateTimeComponentFrom", - "operand" : { - "type" : "Today" - } }, { - "precision" : "Year", - "type" : "DateTimeComponentFrom", - "operand" : { - "path" : "CalculatedEnd", + "name" : "rxNormCode", + "value" : { + "path" : "rxNormCode", "scope" : "R", "type" : "Property" } + }, { + "name" : "rxCUI", + "value" : { + "path" : "code", + "type" : "Property", + "source" : { + "path" : "rxNormCode", + "scope" : "R", + "type" : "Property" + } + } + }, { + "name" : "MMEValue", + "value" : { + "type" : "If", + "condition" : { + "type" : "Not", + "operand" : { + "type" : "In", + "operand" : [ { + "path" : "rxCUI", + "scope" : "R", + "type" : "Property" + }, { + "name" : "BuprenorphineRxCUIs", + "type" : "ExpressionRef" + } ] + } + }, + "then" : { + "valueType" : "{urn:hl7-org:elm-types:r1}Decimal", + "value" : "0.000000001", + "type" : "Literal" + }, + "else" : { + "path" : "MMEValue", + "scope" : "R", + "type" : "Property" + } + } + }, { + "name" : "category", + "value" : { + "valueType" : "{urn:hl7-org:elm-types:r1}String", + "value" : "buprenorphine_only", + "type" : "Literal" + } } ] - }, { - "valueType" : "{urn:hl7-org:elm-types:r1}Integer", - "value" : "2", - "type" : "Literal" - } ] - } ] - }, - "return" : { - "expression" : { - "type" : "Tuple", - "element" : [ { - "name" : "Start", - "value" : { - "path" : "Start", - "scope" : "R", - "type" : "Property" - } - }, { - "name" : "End", - "value" : { - "path" : "End", - "scope" : "R", - "type" : "Property" - } - }, { - "name" : "rxNormCode", - "value" : { - "path" : "rxNormCode", - "scope" : "R", - "type" : "Property" - } - }, { - "name" : "MMEValue", - "value" : { - "path" : "MMEValue", - "scope" : "R", - "type" : "Property" - } + } + }, + "sort" : { + "by" : [ { + "direction" : "asc", + "path" : "End", + "type" : "ByColumn" } ] } - }, - "sort" : { - "by" : [ { - "direction" : "asc", - "path" : "End", - "type" : "ByColumn" - } ] } } }, { @@ -10159,6 +10704,18 @@ "name" : "ReportMMEByDates", "type" : "ExpressionRef" } + }, { + "name" : "ReportDailyMMEByDateWithoutBuprenorphine", + "value" : { + "name" : "ReportDailyMMEByDateWithoutBuprenorphine", + "type" : "ExpressionRef" + } + }, { + "name" : "ReportDailyMMEByDateWithBuprenorphineOnly", + "value" : { + "name" : "ReportDailyMMEByDateWithBuprenorphineOnly", + "type" : "ExpressionRef" + } }, { "name" : "BenzodiazepineMedications", "value" : { diff --git a/src/cql/valueset-db.json b/src/cql/valueset-db.json index 1d778d256f..fc40f163e1 100644 --- a/src/cql/valueset-db.json +++ b/src/cql/valueset-db.json @@ -47171,5 +47171,397 @@ "version": "2013" } ] + }, + "2.16.840.1.buprenorphine.custom": { + "20241017": [ + { + "code": "205533", + "system": "http://www.nlm.nih.gov/research/umls/rxnorm" + }, + { + "code": "238129", + "system": "http://www.nlm.nih.gov/research/umls/rxnorm" + }, + { + "code": "330801", + "system": "http://www.nlm.nih.gov/research/umls/rxnorm" + }, + { + "code": "332698", + "system": "http://www.nlm.nih.gov/research/umls/rxnorm" + }, + { + "code": "333623", + "system": "http://www.nlm.nih.gov/research/umls/rxnorm" + }, + { + "code": "351264", + "system": "http://www.nlm.nih.gov/research/umls/rxnorm" + }, + { + "code": "351265", + "system": "http://www.nlm.nih.gov/research/umls/rxnorm" + }, + { + "code": "351266", + "system": "http://www.nlm.nih.gov/research/umls/rxnorm" + }, + { + "code": "351267", + "system": "http://www.nlm.nih.gov/research/umls/rxnorm" + }, + { + "code": "353390", + "system": "http://www.nlm.nih.gov/research/umls/rxnorm" + }, + { + "code": "353391", + "system": "http://www.nlm.nih.gov/research/umls/rxnorm" + }, + { + "code": "904869", + "system": "http://www.nlm.nih.gov/research/umls/rxnorm" + }, + { + "code": "904870", + "system": "http://www.nlm.nih.gov/research/umls/rxnorm" + }, + { + "code": "904874", + "system": "http://www.nlm.nih.gov/research/umls/rxnorm" + }, + { + "code": "904875", + "system": "http://www.nlm.nih.gov/research/umls/rxnorm" + }, + { + "code": "904876", + "system": "http://www.nlm.nih.gov/research/umls/rxnorm" + }, + { + "code": "904878", + "system": "http://www.nlm.nih.gov/research/umls/rxnorm" + }, + { + "code": "904879", + "system": "http://www.nlm.nih.gov/research/umls/rxnorm" + }, + { + "code": "904880", + "system": "http://www.nlm.nih.gov/research/umls/rxnorm" + }, + { + "code": "904882", + "system": "http://www.nlm.nih.gov/research/umls/rxnorm" + }, + { + "code": "1010600", + "system": "http://www.nlm.nih.gov/research/umls/rxnorm" + }, + { + "code": "1010603", + "system": "http://www.nlm.nih.gov/research/umls/rxnorm" + }, + { + "code": "1010604", + "system": "http://www.nlm.nih.gov/research/umls/rxnorm" + }, + { + "code": "1010606", + "system": "http://www.nlm.nih.gov/research/umls/rxnorm" + }, + { + "code": "1010608", + "system": "http://www.nlm.nih.gov/research/umls/rxnorm" + }, + { + "code": "1307054", + "system": "http://www.nlm.nih.gov/research/umls/rxnorm" + }, + { + "code": "1307056", + "system": "http://www.nlm.nih.gov/research/umls/rxnorm" + }, + { + "code": "1307058", + "system": "http://www.nlm.nih.gov/research/umls/rxnorm" + }, + { + "code": "1307059", + "system": "http://www.nlm.nih.gov/research/umls/rxnorm" + }, + { + "code": "1307061", + "system": "http://www.nlm.nih.gov/research/umls/rxnorm" + }, + { + "code": "1307063", + "system": "http://www.nlm.nih.gov/research/umls/rxnorm" + }, + { + "code": "1431074", + "system": "http://www.nlm.nih.gov/research/umls/rxnorm" + }, + { + "code": "1431076", + "system": "http://www.nlm.nih.gov/research/umls/rxnorm" + }, + { + "code": "1431083", + "system": "http://www.nlm.nih.gov/research/umls/rxnorm" + }, + { + "code": "1431099", + "system": "http://www.nlm.nih.gov/research/umls/rxnorm" + }, + { + "code": "1431102", + "system": "http://www.nlm.nih.gov/research/umls/rxnorm" + }, + { + "code": "1431104", + "system": "http://www.nlm.nih.gov/research/umls/rxnorm" + }, + { + "code": "1432968", + "system": "http://www.nlm.nih.gov/research/umls/rxnorm" + }, + { + "code": "1432969", + "system": "http://www.nlm.nih.gov/research/umls/rxnorm" + }, + { + "code": "1432971", + "system": "http://www.nlm.nih.gov/research/umls/rxnorm" + }, + { + "code": "1542386", + "system": "http://www.nlm.nih.gov/research/umls/rxnorm" + }, + { + "code": "1542390", + "system": "http://www.nlm.nih.gov/research/umls/rxnorm" + }, + { + "code": "1542396", + "system": "http://www.nlm.nih.gov/research/umls/rxnorm" + }, + { + "code": "1542996", + "system": "http://www.nlm.nih.gov/research/umls/rxnorm" + }, + { + "code": "1542997", + "system": "http://www.nlm.nih.gov/research/umls/rxnorm" + }, + { + "code": "1542999", + "system": "http://www.nlm.nih.gov/research/umls/rxnorm" + }, + { + "code": "1544849", + "system": "http://www.nlm.nih.gov/research/umls/rxnorm" + }, + { + "code": "1544851", + "system": "http://www.nlm.nih.gov/research/umls/rxnorm" + }, + { + "code": "1544853", + "system": "http://www.nlm.nih.gov/research/umls/rxnorm" + }, + { + "code": "1544854", + "system": "http://www.nlm.nih.gov/research/umls/rxnorm" + }, + { + "code": "1544856", + "system": "http://www.nlm.nih.gov/research/umls/rxnorm" + }, + { + "code": "1594649", + "system": "http://www.nlm.nih.gov/research/umls/rxnorm" + }, + { + "code": "1597566", + "system": "http://www.nlm.nih.gov/research/umls/rxnorm" + }, + { + "code": "1597568", + "system": "http://www.nlm.nih.gov/research/umls/rxnorm" + }, + { + "code": "1597570", + "system": "http://www.nlm.nih.gov/research/umls/rxnorm" + }, + { + "code": "1597573", + "system": "http://www.nlm.nih.gov/research/umls/rxnorm" + }, + { + "code": "1597575", + "system": "http://www.nlm.nih.gov/research/umls/rxnorm" + }, + { + "code": "1655032", + "system": "http://www.nlm.nih.gov/research/umls/rxnorm" + }, + { + "code": "1666336", + "system": "http://www.nlm.nih.gov/research/umls/rxnorm" + }, + { + "code": "1666338", + "system": "http://www.nlm.nih.gov/research/umls/rxnorm" + }, + { + "code": "1666385", + "system": "http://www.nlm.nih.gov/research/umls/rxnorm" + }, + { + "code": "1716054", + "system": "http://www.nlm.nih.gov/research/umls/rxnorm" + }, + { + "code": "1716057", + "system": "http://www.nlm.nih.gov/research/umls/rxnorm" + }, + { + "code": "1716063", + "system": "http://www.nlm.nih.gov/research/umls/rxnorm" + }, + { + "code": "1716065", + "system": "http://www.nlm.nih.gov/research/umls/rxnorm" + }, + { + "code": "1716067", + "system": "http://www.nlm.nih.gov/research/umls/rxnorm" + }, + { + "code": "1716068", + "system": "http://www.nlm.nih.gov/research/umls/rxnorm" + }, + { + "code": "1716069", + "system": "http://www.nlm.nih.gov/research/umls/rxnorm" + }, + { + "code": "1716071", + "system": "http://www.nlm.nih.gov/research/umls/rxnorm" + }, + { + "code": "1716072", + "system": "http://www.nlm.nih.gov/research/umls/rxnorm" + }, + { + "code": "1716073", + "system": "http://www.nlm.nih.gov/research/umls/rxnorm" + }, + { + "code": "1716075", + "system": "http://www.nlm.nih.gov/research/umls/rxnorm" + }, + { + "code": "1716076", + "system": "http://www.nlm.nih.gov/research/umls/rxnorm" + }, + { + "code": "1716077", + "system": "http://www.nlm.nih.gov/research/umls/rxnorm" + }, + { + "code": "1716079", + "system": "http://www.nlm.nih.gov/research/umls/rxnorm" + }, + { + "code": "1716080", + "system": "http://www.nlm.nih.gov/research/umls/rxnorm" + }, + { + "code": "1716081", + "system": "http://www.nlm.nih.gov/research/umls/rxnorm" + }, + { + "code": "1716083", + "system": "http://www.nlm.nih.gov/research/umls/rxnorm" + }, + { + "code": "1716084", + "system": "http://www.nlm.nih.gov/research/umls/rxnorm" + }, + { + "code": "1716086", + "system": "http://www.nlm.nih.gov/research/umls/rxnorm" + }, + { + "code": "1716090", + "system": "http://www.nlm.nih.gov/research/umls/rxnorm" + }, + { + "code": "1797647", + "system": "http://www.nlm.nih.gov/research/umls/rxnorm" + }, + { + "code": "1797650", + "system": "http://www.nlm.nih.gov/research/umls/rxnorm" + }, + { + "code": "1797655", + "system": "http://www.nlm.nih.gov/research/umls/rxnorm" + }, + { + "code": "1864410", + "system": "http://www.nlm.nih.gov/research/umls/rxnorm" + }, + { + "code": "1864412", + "system": "http://www.nlm.nih.gov/research/umls/rxnorm" + }, + { + "code": "1864414", + "system": "http://www.nlm.nih.gov/research/umls/rxnorm" + }, + { + "code": "1996182", + "system": "http://www.nlm.nih.gov/research/umls/rxnorm" + }, + { + "code": "1996184", + "system": "http://www.nlm.nih.gov/research/umls/rxnorm" + }, + { + "code": "1996189", + "system": "http://www.nlm.nih.gov/research/umls/rxnorm" + }, + { + "code": "1996192", + "system": "http://www.nlm.nih.gov/research/umls/rxnorm" + }, + { + "code": "1996193", + "system": "http://www.nlm.nih.gov/research/umls/rxnorm" + }, + { + "code": "2058257", + "system": "http://www.nlm.nih.gov/research/umls/rxnorm" + }, + { + "code": "2106368", + "system": "http://www.nlm.nih.gov/research/umls/rxnorm" + }, + { + "code": "2599844", + "system": "http://www.nlm.nih.gov/research/umls/rxnorm" + }, + { + "code": "2639020", + "system": "http://www.nlm.nih.gov/research/umls/rxnorm" + }, + { + "code": "2639035", + "system": "http://www.nlm.nih.gov/research/umls/rxnorm" + } + ] } } diff --git a/src/styles/components/_Summary.scss b/src/styles/components/_Summary.scss index 7bdc691760..f22c1d4e35 100644 --- a/src/styles/components/_Summary.scss +++ b/src/styles/components/_Summary.scss @@ -123,6 +123,8 @@ } .info-count-text { + display: inline-block; + margin-bottom: 4px; margin-right: 4px; } .info-count-text:empty { @@ -364,6 +366,9 @@ @media (min-width: 992px) { .MME-svg-container { padding-bottom: 80%; + &.smaller { + padding-bottom: 65%; + } } } .MMEChartSvg { @@ -415,9 +420,12 @@ & { max-width: 85%; } + &.contain-switches { + max-width: 100%; + } } .title { - margin-left: 42px; + margin-left: 24px; font-weight: 700; font-size: 1.3em; } @@ -599,14 +607,17 @@ .graph { .stats-container { - margin-left: 24px; - margin-right: 24px; + margin-left: 16px; + margin-right: 16px; margin-bottom: 16px; font-size: 14px; padding: 8px 16px; border: 2px solid $color-gray-lighter; min-height: 36px; position: relative; + &.include-title { + min-height: 56px; + } .stats-item { margin-bottom: 4px; width: 50%; @@ -614,6 +625,10 @@ } .title { margin-right: 8px; + margin-right: 8px; + margin-left: 0; + font-size: 0.9rem; + font-weight: normal; } .description { font-weight: 600; @@ -632,6 +647,9 @@ flex: 1; align-self: stretch; min-width: 480px; + &:has(.contain-switches) { + min-width: 640px; + } } } }