Please contact me directly if you have questions. All calling parameters need to be supplied. I have a .dlg file if you would like it. In addition, I have a routine to extract all of the parameters from the database. Contact me. Following is the VFE code.
/*watcher function call for recalculate scores*/
{ DOCUMENT.CVSCORE=Calc_CHA2DS2(DOCUMENT.AF_CHF,DOCUMENT.AF_HTN,DOCUMENT.AF_75,DOCUMENT.AF_DM,DOCUMENT.AF_CVATIA,DOCUMENT.AF_IVD,DOCUMENT.AF_65,DOCUMENT.AF_F)
}
{ fn Calc_CHA2DS2(strCHF,strHTN,str75,strDM,strCVA,strMIPAD,str65,strF)
{
local valScore=0
local strScore=""
if (strCHF=="yes") then
valScore=valScore+1
endif
if (strHTN=="yes") then
valScore=valScore+1
endif
if (str75=="yes") then
valScore=valScore+2
endif
if (strDM=="yes") then
valScore=valScore+1
endif
if (strCVA=="yes") then
valScore=valScore+2
endif
if (strMIPAD=="yes") then
valScore=valScore+1
endif
if (str65=="yes") then
valScore=valScore+1
endif
if (strF=="yes") then
valScore=valScore+1
endif
strScore=str(valScore)
OBSNOW("CHAD_VASC",strScore)
document.CVText=CHA2DS2_Text(strScore)
return strScore
}
}
/*function to create CHA2DS2 text*/
{ fn CHA2DS2_Text(strScore)
{
local strTxt=""
if DOCUMENT.AF_CHF=="yes" then
strTxt=strTxt+(if strTxt<>"",", ","")+"CHF(1)"
endif
if DOCUMENT.AF_HTN=="yes" then
strTxt=strTxt+(if strTxt<>"",", ","")+"HBP(1)"
endif
if DOCUMENT.AF_75=="yes" then
strTxt=strTxt+(if strTxt<>"",", ","")+"Age>=75(2)"
endif
if DOCUMENT.AF_DM=="yes" then
strTxt=strTxt+(if strTxt<>"",", ","")+"DM(1)"
endif
if DOCUMENT.AF_CVATIA=="yes" then
strTxt=strTxt+(if strTxt<>"",", ","")+"CVA/TIA(2)"
endif
if DOCUMENT.AF_IVD=="yes" then
strTxt=strTxt+(if strTxt<>"",", ","")+"MI/PAD(1)"
endif
if DOCUMENT.AF_65=="yes" then
strTxt=strTxt+(if strTxt<>"",", ","")+"Age 65-75(1)"
endif
if DOCUMENT.AF_F=="yes" then
strTxt=strTxt+(if strTxt<>"",", ","")+"Female(1)"
endif
if strTxt=="" then
strTxt="There are no risk factors. The CHA2DS2-VASc score is 0."+HRET
else
strTxt="The thromboembolic risk factors are as follows: "+strTxt + ". The CHA2DS2-VASc score is "+strScore+". "
endif
cond
case val(strScore)=0
strTxt=strTxt+"The estimated stroke risk per year is 0%. "
case val(strScore)=1
strTxt=strTxt+"The estimated stroke risk per year is 1.3%. "
case val(strScore)=2
strTxt=strTxt+"The estimated stroke risk per year is 2.2%. "
case val(strScore)=3
strTxt=strTxt+"The estimated stroke risk per year is 3.2%. "
case val(strScore)=4
strTxt=strTxt+"The estimated stroke risk per year is 4.0%. "
case val(strScore)=5
strTxt=strTxt+"The estimated stroke risk per year is 6.7%. "
case val(strScore)=6
strTxt=strTxt+"The estimated stroke risk per year is 9.8%. "
case val(strScore)=7
strTxt=strTxt+"The estimated stroke risk per year is 9.6%. "
case val(strScore)=8
strTxt=strTxt+"The estimated stroke risk per year is 9.6%. "
case val(strScore)=9
strTxt=strTxt+"The estimated stroke risk per year is 15.2%. "
endcond
cond
case val(strScore)=0
strTxt=strTxt+"Manage with no antithrombotic therapy."
case val(strScore)=1
strTxt=strTxt+"Manage with aspirin or anticoagulants, oral anticoagulants preferred."
else
strTxt=strTxt+"Manage with oral anticoagulants."
endcond
return strTxt
}
}