Here is a snippet of code that illustrates the technique. This is based on the initial digits of the GPI code. Just identify the GPI codes of the meds you are interested in and substitute in the code.
The opiate initial 4 digits is 6510. This includes fentanyl, hydromorphone, methadone, morphine oxycodone, tramadol. Combination drugs oxycodone + other drug are 6599.
In the following sample, enter with the test GPI string in strTest, and Meds_After("List") in strList. If no match, return 0, else integer. This is quick and dirty approach and has some problems.
/*Check to see if generic in list of meds*/
{ fn Check_Med(strTest,strList)
{
local arrayList
local i=0
if strList<>"" then
arrayList=getfield(strList,"|","")
for i=1,i<=size(arrayList),i=i+1 do
if match(strTest,arrayList[i])<>0 then
return i
endif
endfor
endif
return 0
}
}
Please note, the above is not the best way to do this as the GPI sequence could occur later in the GPI string. The better solution is to use Meds_After("delimited") and create a two dimensional array checking specifically for the initial characters of the GPI string. This is in column 4 of the array line.
Following is a much longer code snippet, The section on checking for antihypertensive groups illustrates the solution. Note the check for a null GPI, much sweating over that issue.
if strMeds_After<>"" then
arrayMeds=getfield(strMeds_After,"|","")
for i=1, i<=size(arrayMeds),i=i+1 do
arrayMeds[i]=getfield(arraymeds[i],"^","")
.
.
.
//Process checking for antihypertensive groups
if size(arrayMeds[i][4])>=4 then
strGPI=sub(arrayMeds[i][4],1,4)
strMed=arrayMeds[i][1]
cond
case strGPI=="3760" or strGPI=="3799" or strGPI=="3720" //HCTZ, T/HCTZ, loop diuretics
Add_AHG("thiazide diuretics",strMed)
case strGPI=="3400" //CCB
Add_AHG("calcium channel blockers",strMed)
case strGPI=="3610" //ACE
Add_AHG("ACE",strMed)
case strGPI=="3615" //ARB
Add_AHG("ARB",strMed)
case strGPI=="3320" or strGPI=="3310" or strGPI=="3310" //BB nonselective, selective. mixed alpha/beta
Add_AHG("beta blockers",strMed)
case strGPI=="3640" //vasodilators: hydralazine
Add_AHG("vasodilators",strMed)
case strGPI=="3750" or strGP=I="3625" //aldosterone antagonists, spironolactone, eplerinone
Add_AHG("aldosterone antagonists",strMed)
case strGPI=="3620" //adrenergic agonists: clonidine
Add_AHG("adrenergic agonists",strMed) //clonidine
endcond
endif
endfor
Feel free to contact me directly if you have any questions.
Posted : March 14, 2017 5:24 am