From 329b619b7c7f216a1441da5d04fb1988391bf929 Mon Sep 17 00:00:00 2001 From: Amy Chen Date: Wed, 13 Nov 2024 08:46:35 -0800 Subject: [PATCH] add quantity --- src/config/report_config.js | 1 + src/cql/r4/Report_LogicLibrary.cql | 1 + src/cql/r4/Report_LogicLibrary.json | 57 +++++++++++++++++++++++++++++ 3 files changed, 59 insertions(+) diff --git a/src/config/report_config.js b/src/config/report_config.js index 3c0dffb79..8cd773770 100644 --- a/src/config/report_config.js +++ b/src/config/report_config.js @@ -446,6 +446,7 @@ const reportConfig = [ id: `${MEDICATION_LIST_DATA_KEY}_table`, headers: { Drug_Description: "Name", + Quantity: "Quantity", Dosage: "Dosage", Written_Date: { key: "Start", diff --git a/src/cql/r4/Report_LogicLibrary.cql b/src/cql/r4/Report_LogicLibrary.cql index 67018392a..3b127bd18 100644 --- a/src/cql/r4/Report_LogicLibrary.cql +++ b/src/cql/r4/Report_LogicLibrary.cql @@ -93,6 +93,7 @@ define MedicationList: Name: ConceptText(M.medication as FHIR.CodeableConcept), Start: DateTimeText(M.authoredOn), Dosage: M.dosageInstruction.text.value, + Quantity: if M.dispenseRequest is not null and M.dispenseRequest.quantity is not null then M.dispenseRequest.quantity.value.value else null, Prescriber: M.requester.display.value, Authored: M.authoredOn.value } diff --git a/src/cql/r4/Report_LogicLibrary.json b/src/cql/r4/Report_LogicLibrary.json index 045f72a2c..7a7dca498 100644 --- a/src/cql/r4/Report_LogicLibrary.json +++ b/src/cql/r4/Report_LogicLibrary.json @@ -1042,6 +1042,63 @@ } } } + }, { + "name" : "Quantity", + "value" : { + "type" : "If", + "condition" : { + "type" : "And", + "operand" : [ { + "type" : "Not", + "operand" : { + "type" : "IsNull", + "operand" : { + "path" : "dispenseRequest", + "scope" : "M", + "type" : "Property" + } + } + }, { + "type" : "Not", + "operand" : { + "type" : "IsNull", + "operand" : { + "path" : "quantity", + "type" : "Property", + "source" : { + "path" : "dispenseRequest", + "scope" : "M", + "type" : "Property" + } + } + } + } ] + }, + "then" : { + "path" : "value", + "type" : "Property", + "source" : { + "path" : "value", + "type" : "Property", + "source" : { + "path" : "quantity", + "type" : "Property", + "source" : { + "path" : "dispenseRequest", + "scope" : "M", + "type" : "Property" + } + } + } + }, + "else" : { + "asType" : "{urn:hl7-org:elm-types:r1}Decimal", + "type" : "As", + "operand" : { + "type" : "Null" + } + } + } }, { "name" : "Prescriber", "value" : {