Common CQL Artifacts for FHIR (US-Based)
1.0.0 - Informative 1 United States of America flag

This page is part of the Common CQL Assets for FHIR (US-Based) (v1.0.0: Informative 1 - Informative) based on FHIR (HL7® FHIR® Standard) R4. This is the current published version. For a full list of available versions, see the Directory of published versions

Library: Expression Library for the Medical Necessity For Authorization Of Catheters Example (Experimental)

Official URL: http://hl7.org/fhir/us/cql/Library/MNACInitialExpressions Version: 1.0.0
Standards status: Informative Maturity Level: 3 Computable Name: MNACInitialExpressions

This library defines initial expressions for use in populating answers to questions in the Medical Necessity For Authorization Of Catheters example questionnaire.

Metadata
Title Expression Library for the Medical Necessity For Authorization Of Catheters Example
Version 1.0.0
Status Draft
Experimental true
Jurisdiction United States of America
Steward (Publisher) HL7 International / Clinical Decision Support
Description

This library defines initial expressions for use in populating answers to questions in the Medical Necessity For Authorization Of Catheters example questionnaire.

Type logic-library from http://terminology.hl7.org/CodeSystem/library-type
Dependency Description: Library FHIRHelpers
Resource: http://hl7.org/fhir/uv/cql/Library/FHIRHelpers|4.0.1
Canonical URL: http://hl7.org/fhir/uv/cql/Library/FHIRHelpers|4.0.1
Dependency Description: Library UC
Resource: US Core Common
Canonical URL: http://hl7.org/fhir/us/cql/Library/USCoreCommon
Dependency Description: Library UCE
Resource: US Core Elements
Canonical URL: http://hl7.org/fhir/us/cql/Library/USCoreElements
Dependency Description: Code System Identifier Type
Resource: identifierType
Canonical URL: http://terminology.hl7.org/CodeSystem/v2-0203
Dependency Description: Code System ICD10
Resource: International Classification of Diseases, 10th Revision, Clinical Modification (ICD-10-CM)
Canonical URL: http://hl7.org/fhir/sid/icd-10-cm
Dependency Description: Code System SNOMED CT
Resource: SNOMED CT (all versions)
Canonical URL: http://snomed.info/sct
Data Requirement Type: ServiceRequest
Profile(s): ServiceRequest
Data Requirement Type: Condition
Profile(s): Condition
Data Requirement Type: DiagnosticReport
Profile(s): DiagnosticReport
Data Requirement Type: MedicationStatement
Profile(s): MedicationStatement
Data Requirement Type: Practitioner
Profile(s): US Core Practitioner Profile
Parameters
Name Use Card. Type Documentation
ServiceRequest In 0..1 ServiceRequest
Patient Out 0..1 Resource
Retrieve Service Request test parameter Out 0..1 ServiceRequest
Service Request Out 0..1 ServiceRequest
Date of Request Out 0..1 dateTime
SR Related Condition Out 0..* Condition
Diagnosis Out 0..1 string
Item Requested Out 0..* string
UTI Diagnostic Reports Last Year Out 0..* DiagnosticReport
UTI in Last Year Out 0..1 boolean
Lab Reports UTIs Out 0..* Attachment
Dates of UTIs Out 0..* dateTime
Antibiotics Used Out 0..* MedicationStatement
Check Symptoms Out 0..1 string
Fever Temperature Out 0..1 string
Catheterization Frequency Out 0..1 string
Additional Comment Out 0..1 string
Requesting Physician Out 0..1 Resource
Physician Name Out 0..* string
Physician Telephone Out 0..1 string
Physician Fax Out 0..1 string
Referring Physician Telephone Out 0..1 string
Date Out 0..1 date
Library Content
CQL Content
library MNACInitialExpressions

using USCore version '7.0.0'
using FHIR version '4.0.1'

include hl7.fhir.uv.cql.FHIRHelpers version '4.0.1'
include USCoreCommon called UC
include USCoreElements called UCE

codesystem "Identifier Type": 'http://terminology.hl7.org/CodeSystem/v2-0203'
codesystem "ICD10": 'http://hl7.org/fhir/sid/icd-10-cm'
codesystem "SNOMED CT": 'http://snomed.info/sct'

code "Member Number": 'MB' from "Identifier Type"
code "UTI": 'T83.5' from "ICD10"
code "Abnormal Urine Finding": '102866000' from "SNOMED CT"

parameter "ServiceRequest" FHIR.ServiceRequest

context Patient

define "Retrieve Service Request test parameter":
  // The VSCode extension doesn't support parameters
  // When executing CQL with the VSCode extension retrieve the resource specific for the test case
  //   the list of resource ids match the resources from the test case folders
  singleton from ([FHIR.ServiceRequest] SR where SR.id in { 
    'service-request-example'})

define "Service Request":
  Coalesce(
    ServiceRequest,
    "Retrieve Service Request test parameter"
  )

define "Date of Request":
  "Service Request".authoredOn.value

//https://www.hca.wa.gov/assets/billers-and-providers/13-760.pdf

define "Diagnosis":
  First("SR Related Condition".code).text.value

define "Item Requested":
  "Service Request".code.coding.display.value

define "UTI in Last Year":
  Exists("UTI Diagnostic Reports Last Year")

define "Lab Reports UTIs":
  "UTI Diagnostic Reports Last Year".presentedForm

define "Dates of UTIs":
  "UTI Diagnostic Reports Last Year".effective.value

//TODO: create example MedicationStatement
define "Antibiotics Used":
  [FHIR.MedicationStatement] MS
    where First(MS.reasonReference.reference) in "UTI Diagnostic Reports Last Year".id

define "Check Symptoms":
  'TBD'

define "Fever Temperature":
  'TBD'

define "Catheterization Frequency":
  'TBD'

define "Additional Comment":
  'TBD'

define "Physician Name":
  "Requesting Physician".name.family 

define "Physician Telephone":
  Mobile("Requesting Physician".telecom).value

define "Physician Fax":
  Fax("Requesting Physician".telecom).value

define "Referring Physician Telephone":
  'TBD'

define "Date":
  Today()

//helper definitions
// define "All ServiceRequests":
//   [FHIR.ServiceRequest]

// define "Most Recent ServiceRequest":
//   UC.MostRecent("All ServiceRequests")

define "SR Related Condition":
  [FHIR.Condition] C
  where EndsWith(First("Service Request".reasonReference.reference.value), C.id)

define "UTI Diagnostic Reports Last Year":
  [FHIR.DiagnosticReport] C
  where "Abnormal Urine Finding".code in C.conclusionCode.coding.code
  and C.effective	> (Today() - 1 year)

define "Requesting Physician":
  singleton from (
    [USCore.PractitionerProfile] P
  where EndsWith("Service Request".requester.reference, P.id))

define function Fax(contactPoints List<ContactPoint>):
  singleton from (contactPoints P where P.system = 'fax')

define function Mobile(contactPoints List<ContactPoint>):
  singleton from (contactPoints P where P.system = 'mobile')
ELM XML Content
Encoded data 
ELM JSON Content
Encoded data 
Generated using version 0.5.3-cibuild of the sample-content-ig Liquid templates