Common CQL Assets for FHIR (US-Based)
1.0.0-ballot - STU 1 Ballot United States of America flag

This page is part of the Common CQL Assets for FHIR (US-Based) (v1.0.0-ballot: STU 1 Ballot 1) based on FHIR (HL7® FHIR® Standard) R4. No current official version has been published yet. 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-ballot
Standards status: Informative 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.

Title: Expression Library for the Medical Necessity For Authorization Of Catheters Example
Id: MNACInitialExpressions
Version: 1.0.0-ballot
Url: Expression Library for the Medical Necessity For Authorization Of Catheters Example
Status: draft
Experimental: true
Type:

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

code: logic-library

Date: 2025-04-01 14:00:55+0000
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.

Jurisdiction: US
Related Artifacts:

Dependencies

Parameters:
NameTypeMinMaxIn/Out
ServiceRequestServiceRequest01In
PatientResource01Out
Date of RequestdateTime01Out
SR Related ConditionCondition0*Out
Diagnosisstring01Out
Item Requestedstring0*Out
UTI Diagnostic Reports Last YearDiagnosticReport0*Out
UTI in Last Yearboolean01Out
Lab Reports UTIsAttachment0*Out
Dates of UTIsdateTime0*Out
Antibiotics UsedMedicationStatement0*Out
Check Symptomsstring01Out
Fever Temperaturestring01Out
Catheterization Frequencystring01Out
Additional Commentstring01Out
Requesting PhysicianResource01Out
Physician Namestring0*Out
Physician Telephonestring01Out
Physician Faxstring01Out
Referring Physician Telephonestring01Out
Datedate01Out
Data Requirements:
TypeProfileMSCode Filter
Condition http://hl7.org/fhir/StructureDefinition/Condition
DiagnosticReport http://hl7.org/fhir/StructureDefinition/DiagnosticReport
MedicationStatement http://hl7.org/fhir/StructureDefinition/MedicationStatement
Practitioner http://hl7.org/fhir/us/core/StructureDefinition/us-core-practitioner
Content: text/cql
library MNACInitialExpressions

using USCore version '3.1.1'
using FHIR version '4.0.1'

include 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 "Date of Request":
  ServiceRequest.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":
  ServiceRequest.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":
  UC.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(ServiceRequest.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(ServiceRequest.requester.reference, P.id))

define function Fax(contactPoints List<USCore.ContactPoint>):
  singleton from (contactPoints P where P.system = 'fax')
Content: application/elm+xml
Encoded data (77072 characters)
Content: application/elm+json
Encoded data (145812 characters)