Hi,
Is it possible to create a Visibility to show when patient has active medication in a specific drug classification? If it is obvious, I am missing it. Thanks!
The simple answer is yes. Reality is a little more complicated. You need to use MEDS_AFTER("delimited"), get the GPI code in the fourth element of the medication row, determine if the GPI starts with the number sequence you are interest in, if so add the med to a string of med matches, after processing the array, place the string in a document variable to display the results. These steps could be done via a function call in a data display field to automate the process.
Here is what I use to pull the GPI classification.
{fn GetMedsByClass(med_class, num, update)
{
local rets = ""
local meds_array = getfield(MEDS_AFTER("delimited"), "|", "")
for i = 1, i <= size(meds_array), i = i + 1
do
local med_array = getfield(meds_array[i], "^", "")
if (ok(med_array[4])) then
if (med_array[4] <> "") then
if (sub(med_array[4], 1, num) == med_class) then
rets = "Yes - " + rets + med_array[1] + HRET
else
continue
endif
else
continue
endif
else
continue
endif
endfor
if (rets == "") then
rets = "No"
endif
return rets
}}
And call it by using this:
{GetMedsByClass("83",2,MED_LIST_CHANGES())}
Here is my list GPI list for the drug classifications: GPI classification system