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

Common CQL Artifacts for FHIR (US-Based), published by HL7 International / Clinical Decision Support. This guide is not an authorized publication; it is the continuous build for version 1.0.0 built by the FHIR (HL7® FHIR® Standard) CI Build. This version is based on the current content of https://github.com/HL7/us-cql-ig/ and changes regularly. 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
Parameter Name: ServiceRequest
Use: In
Min Cardinality: 0
Max Cardinality: 1
Type: ServiceRequest
Parameter Name: Patient
Use: Out
Min Cardinality: 0
Max Cardinality: 1
Type: Resource
Parameter Name: Retrieve Service Request test parameter
Use: Out
Min Cardinality: 0
Max Cardinality: 1
Type: ServiceRequest
Parameter Name: Service Request
Use: Out
Min Cardinality: 0
Max Cardinality: 1
Type: ServiceRequest
Parameter Name: Date of Request
Use: Out
Min Cardinality: 0
Max Cardinality: 1
Type: dateTime
Parameter Name: SR Related Condition
Use: Out
Min Cardinality: 0
Max Cardinality: *
Type: Condition
Parameter Name: Diagnosis
Use: Out
Min Cardinality: 0
Max Cardinality: 1
Type: string
Parameter Name: Item Requested
Use: Out
Min Cardinality: 0
Max Cardinality: *
Type: string
Parameter Name: UTI Diagnostic Reports Last Year
Use: Out
Min Cardinality: 0
Max Cardinality: *
Type: DiagnosticReport
Parameter Name: UTI in Last Year
Use: Out
Min Cardinality: 0
Max Cardinality: 1
Type: boolean
Parameter Name: Lab Reports UTIs
Use: Out
Min Cardinality: 0
Max Cardinality: *
Type: Attachment
Parameter Name: Dates of UTIs
Use: Out
Min Cardinality: 0
Max Cardinality: *
Type: dateTime
Parameter Name: Antibiotics Used
Use: Out
Min Cardinality: 0
Max Cardinality: *
Type: MedicationStatement
Parameter Name: Check Symptoms
Use: Out
Min Cardinality: 0
Max Cardinality: 1
Type: string
Parameter Name: Fever Temperature
Use: Out
Min Cardinality: 0
Max Cardinality: 1
Type: string
Parameter Name: Catheterization Frequency
Use: Out
Min Cardinality: 0
Max Cardinality: 1
Type: string
Parameter Name: Additional Comment
Use: Out
Min Cardinality: 0
Max Cardinality: 1
Type: string
Parameter Name: Requesting Physician
Use: Out
Min Cardinality: 0
Max Cardinality: 1
Type: Resource
Parameter Name: Physician Name
Use: Out
Min Cardinality: 0
Max Cardinality: *
Type: string
Parameter Name: Physician Telephone
Use: Out
Min Cardinality: 0
Max Cardinality: 1
Type: string
Parameter Name: Physician Fax
Use: Out
Min Cardinality: 0
Max Cardinality: 1
Type: string
Parameter Name: Referring Physician Telephone
Use: Out
Min Cardinality: 0
Max Cardinality: 1
Type: string
Parameter Name: Date
Use: Out
Min Cardinality: 0
Max Cardinality: 1
Type: date
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
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 (86304 characters)
ELM JSON Content
Encoded data (162384 characters)
Generated using version 0.4.9 of the sample-content-ig Liquid templates