For one of our Clinical decision support rules I am currently "Trying" to figure out where to begin! They are asking for a alert (pop up) for either USEROK or USERYESNO if the patient has Diabetes on the active problem list and if the patient is not currently taking an ace or arb medication! They would like this to pop up when the provider addresses the diabetes from the assessment and plan page of the note? Any suggestion, solutions or a place to begin would be greatly appreciated!
Thanks in advance
I think I can help get you started.
The first thing you'll need to figure out is how you will get this pop-up to only happen (and maybe also limit how many times it happens) while they are doing the assessment and plan part of the note. You're going to need some sort trigger to let your code know to run the diabetes ace/arb check.
As for the actual code to check if the Diabetic patient is on an ace or arb, I have this coded out already, but it is in a different format than what you are trying to accomplish:
This code can be used to find active meds for a patient based on a GPI #. Med_class is the GPI # and num is the number of characters to use for your comparisons (you could actually just use size(med_class)). It returns a string of all the medications that match the GPI you sent separated by HRET:
{!fn GetMedsByClass(med_class, num) { local meds = "" 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 meds = meds + med_array[1] + HRET else continue endif else continue endif else continue endif endfor return meds }}
GetMedsByClass will be called through this next function to see if this patient is on an ACE/ARB. The parameter changes is used to see if there have been changes to the meds list since the last time it ran. This is so if you are using it in the background, it only runs once there have been changes to the patient's medications list. It returns TRUE if an ACE/ARB was found or FALSE if not:
{!fn NeedsAceArb(changes) { if ((changes <> DOCUMENT.ACE_ARB_CHECK OR did_acearb <> "T") AND IsDiab()) then DOCUMENT.ACE_ARB_CHECK = changes did_acearb = "T" local ace = GetMedsByClass("3610", 4) + GetMedsByClass("36991802", 8) + GetMedsByClass("36991502", 8) local arb = GetMedsByClass("3615", 4) + GetMedsByClass("36993002", 8) + GetMedsByClass("36994503", 8) + GetMedsByClass("36994002", 8) if arb <> "" AND ace <> "" then return FALSE else return TRUE endif }}
This is used to check to see if patient has diabetes in the active problem list:
{fn IsDiab() { return match(PROB_AFTER("List"), "250") > 0 }}
This will need to be initialized for storing the last medication's list to see if it has been update. The global variable is so it runs at the beginning of the creation of the document:
{DOCUMENT.ACE_ARB_CHECK}
{global did_acearb}
So, with all of this code in your coding window, you should be able to call NeedsAceArb(MED_LIST_CHANGES()) somewhere in your form. It will give you TRUE or FALSE for what you need. Manipulate any of the code here to do whatever you need it to.
1) For problems, imagine you will use: {PROB_AFTER("list")}
which would list out problems
2) For medications, imagine you will use: {MEDS_AFTER('Delimited')}
which will create a list of medications; think you will pay attention to the 5th field for the first 2 or 4 characters of the DDID.
To get an idea of the programming, I did the following once before to simply list out the ICD codes from the problem list. It is a quicktext (I found it sometimes quicker to create quicktexts to play with my programming).
{global prbl = getfield(PROB_AFTER("list"),"\r","")
global probsize = size(prbl)
global probicd = ""
for cnt = 1, cnt < probsize, cnt = cnt + 1
do
icddlm =match(prbl[cnt],"(")
icddlm2 =match(prbl[cnt],")")
if icddlm > 0 then
icdlen = icddlm2 - icddlm - 1
prb_d = sub(prbl[cnt],icddlm+1,icdlen)
// probicd = probicd + prbl[cnt] + str(HRET)
probicd = probicd + prb_d + str(HRET)
endif
endfor
probicd
}
mikeseale said:
I think I can help get you started.
The first thing you'll need to figure out is how you will get this pop-up to only happen (and maybe also limit how many times it happens) while they are doing the assessment and plan part of the note. You're going to need some sort trigger to let your code know to run the diabetes ace/arb check.
As for the actual code to check if the Diabetic patient is on an ace or arb, I have this coded out already, but it is in a different format than what you are trying to accomplish:
This code can be used to find active meds for a patient based on a GPI #. Med_class is the GPI # and num is the number of characters to use for your comparisons (you could actually just use size(med_class)). It returns a string of all the medications that match the GPI you sent separated by HRET:
{!fn GetMedsByClass(med_class, num) { local meds = "" 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 meds = meds + med_array[1] + HRET else continue endif else continue endif else continue endif endfor return meds }}GetMedsByClass will be called through this next function to see if this patient is on an ACE/ARB. The parameter changes is used to see if there have been changes to the meds list since the last time it ran. This is so if you are using it in the background, it only runs once there have been changes to the patient's medications list. It returns TRUE if an ACE/ARB was found or FALSE if not:
{!fn NeedsAceArb(changes) { if ((changes <> DOCUMENT.ACE_ARB_CHECK OR did_acearb <> "T") AND IsDiab()) then DOCUMENT.ACE_ARB_CHECK = changes did_acearb = "T" local ace = GetMedsByClass("3610", 4) + GetMedsByClass("36991802", 8) + GetMedsByClass("36991502", 8) local arb = GetMedsByClass("3615", 4) + GetMedsByClass("36993002", 8) + GetMedsByClass("36994503", 8) + GetMedsByClass("36994002", 8) if arb <> "" AND ace <> "" then return FALSE else return TRUE endif }}This is used to check to see if patient has diabetes in the active problem list:
{fn IsDiab() { return match(PROB_AFTER("List"), "250") > 0 }}This will need to be initialized for storing the last medication's list to see if it has been update. The global variable is so it runs at the beginning of the creation of the document:
{DOCUMENT.ACE_ARB_CHECK}{global did_acearb}So, with all of this code in your coding window, you should be able to call NeedsAceArb(MED_LIST_CHANGES()) somewhere in your form. It will give you TRUE or FALSE for what you need. Manipulate any of the code here to do whatever you need it to.
Thank You both i will give it a shot!!!