CDC MME CQL Calculator
3.0.0 - release

This page is part of the CDC Opioid MME Calculator (v3.0.0: Release) based on FHIR R4. This is the current published version in its permanent home (it will always be available at this URL). For a full list of available versions, see the Directory of published versions

Home Page


This implementation guide provides Morphine Milligram Equivalent (MME) calculation logic as described by the Centers For Disease Control and Prevention (CDC) Guideline for Prescribing Opioids for Chronic Pain — United States, 2016, hereafter referred to as the CDC Opioid Prescribing Guideline, or just the Guideline:

CDC Guideline for Prescribing Opioids for Chronic Pain

The MME calculator is expressed using Clinical Quality Language (CQL), and can be applied to Health Level 7 (HL7) Fast Healthcare Interoperability Resources (FHIR). A primary use case for this calculator is Recommendation #5 of the Guideline:

When opioids are started, providers should prescribe the lowest effective dosage. Providers should use caution when prescribing opioids at any dosage, should carefully reassess evidence of individual benefits and risks when considering increasing dosage to ≥50 morphine milligram equivalents (MME)/day, and should avoid increasing dosage to ≥90 MME/day or carefully justify a decision to titrate dosage to >90 MME/day (recommendation category: A, evidence type: 3).

This implementation guide was developed based on work initially done as part of the Clinical Quality Framework (CQF) Initiative, a public-private partnership sponsored by the Centers for Medicare & Medicaid Services (CMS) and the U.S. Office of the National Coordinator for Health Information Technology (ONC) to identify, develop, and harmonize standards for clinical decision support and electronic clinical quality measurement, as well as a joint effort by the Centers for Disease Control and Prevention (CDC) and the Office of the National Coordinator for Health IT (ONC) focused on improving processes for the development of standardized, shareable, computable decision support artifacts using the CDC Opioid Prescribing Guideline as a model case.

Feedback and contributions are welcome and can be submitted using the New Issue link in the footer of every page. Discussions on the use of this IG as well as other CQF projects take place regularly on the CPG-on-FHIR calls, a subworkgroup of the HL7 Clinical Decision Support Workgroup.


The MME calculation information provided above is based on conversion factors for each of the various opioids. Due to the possibility of combination drugs, the component ingredients of a drug need to be considered in order to correctly determine the opioid ingredient strength. To determine this, the calculator requires drug component information to be available. This information can be determined using the RxNav Application Programming Interface (API). To avoid having to include a service call to this API during the calculation, the required information is cached according to the process described here.

That process results in a Microsoft Access database. Within Clinical Quality Language (CQL), that data can be accessed by defining a data model (using CQL ModelInfo) and using that to retrieve data from that database. However, that approach would introduce a run-time dependency for the MME calculator that would then need to be distributed with the calculator, as well as require implementing systems to support access using this data model. To avoid this runtime dependency, the data are converted to a "pure" CQL expression, and distributed in the OMTKData CQL library.

For a more detailed description of the MME calculator, refer to the MME Calculator page in this guide.

For a detailed description of configuration of conversion factors, refer to the Conversion Factors page in this guide.

For a discussion of the process used to create and maintain the OMTKData library, see the Opioid Terminology Management Knowledge (OMTK) Data Processing page in this guide.


Table of Contents

The MME calculation logic is contained within four libraries:

  • ConversionFactors - Logic to determine appropriate conversion factor for a given ingredient, dose form, and dose quantity.
  • OMTKData - The RxNorm drug ingredient data required to determine the strength of individual ingredients within combination drugs.
  • OMTKLogic - The core MME calculator, expressed in pure CQL and independent of any particular data model
  • MMECalculator - Logic to apply the MME calculator to FHIR R4 MedicationRequest resources

Layering the calculator in this way enables it to be used with different data models. In particular, the calculator is being used with Quality Data Model as part of the specification of a Potential Opioid Overuse electronic Clinical Quality Measure (eCQM), and as part of the computable representation of the CDC Opioid Prescribing Guideline in both FHIR STU3 and FHIR R4 versions.

Note that because FHIR implementation guides typically only target a single FHIR version, the canonical base and package id for this implementation guide include the `r4` designator to distinguish packages targeting FHIR R4.

Data Elements

The FHIR R4 MME calculator only uses the MedicationRequest resource. To ensure proper functioning with this calculator, this implementation guide defines a MedicationRequest profile. Resources used with this calculator must conform to this profile in order to produce the expected results:


The calculator is intended to be used by referencing this content IG as a dependency, allowing the calculator to be referenced by including the MMECalculator in a CQL library:

library Example version '0.1.0'

using FHIR version '4.0.1'

include fhir.cdc."opioid-mme-r4".MMECalculator version '3.0.0'

context Patient

define TotalMME: MMECalculator.TotalMME([MedicationRequest])

This example library calls the TotalMME function of the MMECalculator library, passing the set of MedicationRequest resources for the patient in context. The calculator uses whatever medication requests it is given to calculate a total MME for a point-in-time. The calculator does not attempt to do any filtering of the medication requests it is given, that logic is the responsibility of the caller, so a production usage would of course include filtering to determine active medication requests.

The result of the TotalMME expression is then a CQL Quantity value, with units of {MME}/d, representing the combined Morphine Milligram Equivalent (MME) value of the input prescriptions.

To use the MMECalculator in this way, declare this implementation guide as a dependency using the dependsOn element of the ImplementationGuide resource:

  <packageId value="fhir.cdc.opioid-mme-r4"/>
  <version value="dev"/>

Note the use of the dev value for version. This value indicates that the version to be used is available locally. Until the Opioid MME calculator is published in a permanent site, this is the approach that must be taken because the publication tooling has no way to look up the required package listing.


To validate the functionality of the MME Calculator, this implementation guide includes test cases for a representative set of opioids for both the core calculator, as well as the FHIR R4 calculator:

The core calculator tests are expressed in pure CQL as expressions with expected result values. For example:

// 100 mg X (60 tablets/30 days) X 0.4 = 80 MME/day
  define TestDrug_Tapentadol: {
    rxNormCode: Code '1148797' from OMTKLogic.RXNORM display '12 HR tapentadol 100 MG Extended Release Oral Tablet',
    doseQuantity: 1 '{tab}',
    dosesPerDay: 2.0,
    mme: 80 '{MME}/d'

This test indicates that for the drug '12 HR tapentadol 100 MG Extended Release Oral Tablet', prescribed at 2 tablets per day, the expected result is 80 '{MME}/d'.

See the CQL content of the OMTKLogicTests library for a complete description of the tests.

Tests for the FHIR R4 MME calculator involve test MedicationRequest resources, contained in the tests folder of the source for this implementation guide:

  |-- tests
        |-- MMECalculatorTests // This folder is the same name as the library under test
              |-- patient-mme-greater-than-fifty // Folders at this level are named the same as the id of the patient under test
                    |-- Patient // Folders at this level are the name of the resource type in the test
                          |-- patient-mme-greater-than-fifty.json // The patient resource as a JSON file
                    |-- MedicationRequest
                          |-- example-rec-05-mme-greater-than-fifty-context.json // The medication request resource as a JSON file
              |-- patient-mme-less-than-fifty
                    |-- Patient
                    |-- MedicationRequest
                    |-- ...
              |-- ... // more test cases can be added by adding to this list


The calculator provided here uses per-ingredient strength values for combination drugs with opioid ingredients. This data is gathered from RxNorm using the RxNav API, and distributed as a CQL library. The process for producing and maintaining this information as RxNorm data is updated over time is provided in the following topic:

Opioid Terminology Management Knowledge (OMTK) Data Processing

References and Disclaimers

RxNorm: This product uses publicly available data courtesy of the U.S. National Library of Medicine (NLM), National Institutes of Health, Department of Health and Human Services; NLM is not responsible for the product and does not endorse or recommend this or any other product.

Nelson SJ, Zeng K, Kilbourne J, Powell T, Moore R. Normalized names for clinical drugs: RxNorm at 6 years.
J Am Med Inform Assoc. 2011 Jul-Aug;18(4)441-8. doi: 10.1136/amiajnl-2011-000116.
Epub 2011 Apr 21. PubMed PMID: 21515544; PubMed Central PMCID: PMC3128404.
Full text

UCUM: This product includes all or a portion of the UCUM table, UCUM codes, and UCUM definitions or is derived from it, subject to a license from Regenstrief Institute, Inc. and The UCUM Organization. Your use of the UCUM table, UCUM codes, UCUM definitions also is subject to this license, a copy of which is available at
The current complete UCUM table, UCUM Specification are available for download at
The UCUM table and UCUM codes are copyright © 1995-2009, Regenstrief Institute, Inc. and the Unified Codes for Units of Measures (UCUM) Organization.
All rights reserved.


Dowell D, Haegerich TM, Chou R. CDC Guideline for Prescribing Opioids for Chronic Pain — United States, 2016. MMWR Recmm Rep 2016;65(No. RR-1):1–49. DOI:

MME Calculation: National Center for Injury Prevention and Control. Calculating total daily dose of opioids for safer dosage. Atlanta, GA: Centers for Disease Control and Prevention;, accessed November 19th, 2020.

NOTE: Do not use the calculated dose in MMEs to determine dosage for converting one opioid to another—the new opioid should be lower to avoid unintentional overdose caused by incomplete cross-tolerance and individual differences in opioid pharmacokinetics. Consult the medication label.

NOTE: Refer to the Cautions associated with use of this content on the Conversion Factors and MME Calculator pages.

License and Disclaimer: This content is licensed under an Apache 2.0 License with the following additional disclaimer:

Health-Related Additional Disclaimer of Warranty and Limitation of Liability

In the United States, or any other jurisdictions where they may apply, the following additional disclaimer of warranty and limitation of liability are hereby incorporated into the terms and conditions of Apache License 2.0:

  • a. No warranties of any kind whatsoever are made as to the results that You will obtain from relying upon the covered code (or any information or content obtained by way of the covered code), including but not limited to compliance with privacy laws or regulations or clinical care industry standards and protocols. Use of the covered code is not a substitute for a health care provider's standard practice or professional judgment.  Any decision with regard to the appropriateness of, or the validity or reliability of information or content made available by the covered code, is the sole responsibility of the health care provider. Consequently, it is incumbent upon each health care provider to verify all medical history and treatment plans with each patient.
  • b. Under no circumstances and under no legal theory, whether tort (including negligence), contract, or otherwise, shall any Contributor, or anyone who distributes Covered Software as permitted by the license, be liable to You for any indirect, special, incidental, consequential damages of any character including, without limitation, damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other damages or losses, of any nature whatsoever (direct or otherwise) on account of or associated with the use or inability to use the covered content (including, without limitation, the use of  information or content made available by the covered code, all  documentation associated therewith, and the failure of the covered code to comply with privacy laws and regulations or clinical care industry standards and protocols), even if such party shall have been informed of the possibility of such damages.

The findings and conclusions on this website are those of the authors and do not necessarily represent the official position of, the Centers for Disease Control and Prevention/the Agency for Toxic Substances and Disease Registry, or the other organizations involved, nor does the mention of trade names, commercial products, or organizations imply endorsement by the U.S. Government.


Contributing Authors
Bryn Rhodes
Floyd Eisenberg, MD, MPH
Kensaku Kawamoto, MD, PhD, MHS
Robert McClure, MD