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

Library: Tests for the Morphine Milligram Equivalent (MME) Calculator for FHIR R4

Id: MMECalculatorTests
Url: http://fhir.org/guides/cdc/opioid-mme-r4/Library/MMECalculatorTests
Version: 3.0.0
Name: MMECalculatorTests
Title: Tests for the Morphine Milligram Equivalent (MME) Calculator for FHIR R4
Status: active
Experimental: true
Type:

system: http://terminology.hl7.org/CodeSystem/library-type

code: logic-library

Date: 2021-11-25T15:13:44+11:00
Publisher: Alphora
Description: This library contains tests to validate the functionality of the FHIR R4 MME calculator
Knowledge Capability: shareable computable publishable executable
Knowledge Representation Level: structured
Jurisdiction: 840
Copyright: Copyright 2019+ Centers for Disease Control and Prevention (CDC)
Related Artifacts:

Dependencies

  • http://fhir.org/guides/cdc/opioid-mme-r4/Library/MMECalculator|3.0.0
  • http://fhir.org/guides/cdc/opioid-mme-r4/Library/OMTKLogic|3.0.0
  • http://fhir.org/guides/cdc/opioid-mme-r4/Library/OMTKData|3.0.0
  • http://fhir.org/guides/cdc/opioid-mme-r4/Library/ConversionFactors|3.0.0
  • http://terminology.hl7.org/CodeSystem/usage-context-type
  • http://fhir.org/guides/cdc/opioid-mme-r4/CodeSystem/CDCMMEUsageContextCodes
Parameters:
NameTypeMinMaxIn/Out
ErrorLevelstring01in
ConversionFactorSupplementNamestring01in
PatientPatient01out
TotalMMEQuantity01out
Data Requirements:
TypeProfileMSCode Filter
Patient http://hl7.org/fhir/StructureDefinition/Patient
MedicationRequest http://hl7.org/fhir/StructureDefinition/MedicationRequest
Content: text/cql
library MMECalculatorTests version '3.0.0'

using FHIR version '4.0.1'

include FHIRHelpers version '4.0.1'
include MMECalculator version '3.0.0'
include OMTKLogic version '3.0.0'
include OMTKData version '3.0.0'

context Patient

//define MedicationRequestCode: [MedicationRequest] M return M.medication
//define MedicationRequestRxNormCode: [MedicationRequest] M return OMTKLogic.GetMedicationCode(M.medication)
/*
define MedicationRequestRxNormCode:
  (([MedicationRequest] M return M.medication C return FHIRHelpers.ToConcept(C)).codes) X
    where X.system = 'http://www.nlm.nih.gov/research/umls/rxnorm'
      return {
        drugCode: X.code,
        code:
          singleton from (
            OMTKData.DrugIngredients DI
              where DI.drugCode = ToInteger(X.code)
              return Code {
                code: ToString(DI.drugCode),
                system: 'http://www.nlm.nih.gov/research/umls/rxnorm',
                display: DI.drugName
              }
          )
      }
*/
//define MedicationRequestRxNormCodings:
//  [MedicationRequest] M
//    return (M.medication.coding C where C.system = 'http://www.nlm.nih.gov/research/umls/rxnorm' return C.code)
//define MedicationRequests: [MedicationRequest]
//define Prescriptions: MMECalculator.Prescriptions([MedicationRequest])
define TotalMME: MMECalculator.TotalMME([MedicationRequest])
Content: application/elm+xml
Encoded data (7612 characters)
Content: application/elm+json
Encoded data (22120 characters)