Hello All,
Does anyone have a Framingham Cardiovascular Risk Assessment they would be willing to share? I need to create one as part of a larger cardio form and didn't want to reinvent the wheel if it was not necessary. I saw some discussion of one a couple of years ago but didn't see a link to a download in the thread.
Thanks,
Brad
I use the following function that I wrote and I send the following from data displays, "UM" for Untreated Score for Male, "TM" for Treated Score for Male, "UF" for Untreated Score for Female, and "TF" for Treated Score for Female.
fn fnCV_RC(CVGender)
{
local CVPoints=0
local CVStr=""
cond
case CVGender == "UM" or CVGender == "TM"
cond
case PATIENT_AGE() >= "20" and PATIENT_AGE() < "35"
CVPoints=-9
case PATIENT_AGE() >= "35" and PATIENT_AGE() < "40"
CVPoints=-4
case PATIENT_AGE() >= "40" and PATIENT_AGE() < "45"
CVPoints=0
case PATIENT_AGE() >= "45" and PATIENT_AGE() < "50"
CVPoints=3
case PATIENT_AGE() >= "50" and PATIENT_AGE() < "55"
CVPoints=6
case PATIENT_AGE() >= "55" and PATIENT_AGE() < "60"
CVPoints=8
case PATIENT_AGE() >= "60" and PATIENT_AGE() < "65"
CVPoints=10
case PATIENT_AGE() >= "65" and PATIENT_AGE() < "70"
CVPoints=11
case PATIENT_AGE() >= "70" and PATIENT_AGE() < "75"
CVPoints=12
case PATIENT_AGE() >= "75" and PATIENT_AGE() < "80"
CVPoints=13
else "" endcond
cond
case obsany("CHOLESTEROL") < 160
CVPoints=CVPoints
case obsany("CHOLESTEROL") >= 160 and obsany("CHOLESTEROL") < 200
cond
case PATIENT_AGE() >= 20 and PATIENT_AGE() < 40
CVPoints=CVPoints+4
case PATIENT_AGE() >= 40 and PATIENT_AGE() < 50
CVPoints=CVPoints+3
case PATIENT_AGE() >= 50 and PATIENT_AGE() < 60
CVPoints=CVPoints+2
case PATIENT_AGE() >= 60 and PATIENT_AGE() < 70
CVPoints=CVPoints+1
case PATIENT_AGE() >= 70 and PATIENT_AGE() < 80
CVPoints=CVPoints
else "" endcond
case obsany("CHOLESTEROL") >= 200 and obsany("CHOLESTEROL") < 240
cond
case PATIENT_AGE() >= 20 and PATIENT_AGE() < 40
CVPoints=CVPoints+7
case PATIENT_AGE() >= 40 and PATIENT_AGE() < 50
CVPoints=CVPoints+5
case PATIENT_AGE() >= 50 and PATIENT_AGE() < 60
CVPoints=CVPoints+3
case PATIENT_AGE() >= 60 and PATIENT_AGE() < 70
CVPoints=CVPoints+1
case PATIENT_AGE() >= 70 and PATIENT_AGE() < 80
CVPoints=CVPoints
else "" endcond
case obsany("CHOLESTEROL") >= 240 and obsany("CHOLESTEROL") < 280
cond
case PATIENT_AGE() >= 20 and PATIENT_AGE() < 40
CVPoints=CVPoints+9
case PATIENT_AGE() >= 40 and PATIENT_AGE() < 50
CVPoints=CVPoints+6
case PATIENT_AGE() >= 50 and PATIENT_AGE() < 60
CVPoints=CVPoints+4
case PATIENT_AGE() >= 60 and PATIENT_AGE() < 70
CVPoints=CVPoints+2
case PATIENT_AGE() >= 70 and PATIENT_AGE() < 80
CVPoints=CVPoints+1
else "" endcond
case obsany("CHOLESTEROL") >= 280
cond
case PATIENT_AGE() >= 20 and PATIENT_AGE() < 40
CVPoints=CVPoints+11
case PATIENT_AGE() >= 40 and PATIENT_AGE() < 50
CVPoints=CVPoints+8
case PATIENT_AGE() >= 50 and PATIENT_AGE() < 60
CVPoints=CVPoints+5
case PATIENT_AGE() >= 60 and PATIENT_AGE() < 70
CVPoints=CVPoints+3
case PATIENT_AGE() >= 70 and PATIENT_AGE() < 80
CVPoints=CVPoints+1
else "" endcond
else "" endcond
cond
case obsany("SMOK STATUS") == "current some day smoker" or obsany("SMOK STATUS") == "current every day smoker" or obsany("SMOK STATUS") == "smoker - current status unknown" or obsany("SMOK STATUS") == "Current"
cond
case PATIENT_AGE() >= 20 and PATIENT_AGE() < 40
CVPoints=CVPoints+8
case PATIENT_AGE() >= 40 and PATIENT_AGE() < 50
CVPoints=CVPoints+5
case PATIENT_AGE() >= 50 and PATIENT_AGE() < 60
CVPoints=CVPoints+3
case PATIENT_AGE() >= 60 and PATIENT_AGE() < 70
CVPoints=CVPoints+1
case PATIENT_AGE() >= 70 and PATIENT_AGE() < 80
CVPoints=CVPoints+1
else "" endcond
else "" endcond
cond
case obsany("HDL") = ""
CVPoints=CVPoints
case obsany("HDL") >= 60
CVPoints=CVPoints-1
case obsany("HDL") >= 50 and obsany("HDL") < 60
CVPoints=CVPoints
case obsany("HDL") >= 40 and obsany("HDL") < 50
CVPoints=CVPoints+1
case obsany("HDL") < 40
CVPoints=CVPoints+2
else "" endcond
case CVGender == "UF" or CVGender == "TF"
cond
case PATIENT_AGE() >= "20" and PATIENT_AGE() < "35"
CVPoints=-7
case PATIENT_AGE() >= "35" and PATIENT_AGE() < "40"
CVPoints=-3
case PATIENT_AGE() >= "40" and PATIENT_AGE() < "45"
CVPoints=0
case PATIENT_AGE() >= "45" and PATIENT_AGE() < "50"
CVPoints=3
case PATIENT_AGE() >= "50" and PATIENT_AGE() < "55"
CVPoints=6
case PATIENT_AGE() >= "55" and PATIENT_AGE() < "60"
CVPoints=8
case PATIENT_AGE() >= "60" and PATIENT_AGE() < "65"
CVPoints=10
case PATIENT_AGE() >= "65" and PATIENT_AGE() < "70"
CVPoints=12
case PATIENT_AGE() >= "70" and PATIENT_AGE() < "75"
CVPoints=14
case PATIENT_AGE() >= "75" and PATIENT_AGE() < "80"
CVPoints=16
else "" endcond
cond
case obsany("CHOLESTEROL") < 160
CVPoints=CVPoints
case obsany("CHOLESTEROL") >= 160 and obsany("CHOLESTEROL") < 200
cond
case PATIENT_AGE() >= 20 and PATIENT_AGE() < 40
CVPoints=CVPoints+4
case PATIENT_AGE() >= 40 and PATIENT_AGE() < 50
CVPoints=CVPoints+3
case PATIENT_AGE() >= 50 and PATIENT_AGE() < 60
CVPoints=CVPoints+2
case PATIENT_AGE() >= 60 and PATIENT_AGE() < 70
CVPoints=CVPoints+1
case PATIENT_AGE() >= 70 and PATIENT_AGE() < 80
CVPoints=CVPoints+1
else "" endcond
case obsany("CHOLESTEROL") >= 200 and obsany("CHOLESTEROL") < 240
cond
case PATIENT_AGE() >= 20 and PATIENT_AGE() < 40
CVPoints=CVPoints+8
case PATIENT_AGE() >= 40 and PATIENT_AGE() < 50
CVPoints=CVPoints+6
case PATIENT_AGE() >= 50 and PATIENT_AGE() < 60
CVPoints=CVPoints+4
case PATIENT_AGE() >= 60 and PATIENT_AGE() < 70
CVPoints=CVPoints+2
case PATIENT_AGE() >= 70 and PATIENT_AGE() < 80
CVPoints=CVPoints+1
else "" endcond
case obsany("CHOLESTEROL") >= 240 and obsany("CHOLESTEROL") < 280
cond
case PATIENT_AGE() >= 20 and PATIENT_AGE() < 40
CVPoints=CVPoints+11
case PATIENT_AGE() >= 40 and PATIENT_AGE() < 50
CVPoints=CVPoints+8
case PATIENT_AGE() >= 50 and PATIENT_AGE() < 60
CVPoints=CVPoints+5
case PATIENT_AGE() >= 60 and PATIENT_AGE() < 70
CVPoints=CVPoints+3
case PATIENT_AGE() >= 70 and PATIENT_AGE() < 80
CVPoints=CVPoints+2
else "" endcond
case obsany("CHOLESTEROL") >= 280
cond
case PATIENT_AGE() >= 20 and PATIENT_AGE() < 40
CVPoints=CVPoints+13
case PATIENT_AGE() >= 40 and PATIENT_AGE() < 50
CVPoints=CVPoints+10
case PATIENT_AGE() >= 50 and PATIENT_AGE() < 60
CVPoints=CVPoints+7
case PATIENT_AGE() >= 60 and PATIENT_AGE() < 70
CVPoints=CVPoints+4
case PATIENT_AGE() >= 70 and PATIENT_AGE() < 80
CVPoints=CVPoints+2
else "" endcond
else "" endcond
cond
case obsany("SMOK STATUS") == "current some day smoker" or obsany("SMOK STATUS") == "current every day smoker" or obsany("SMOK STATUS") == "smoker - current status unknown" or obsany("SMOK STATUS") == "Current"
cond
case PATIENT_AGE() >= 20 and PATIENT_AGE() < 40
CVPoints=CVPoints+9
case PATIENT_AGE() >= 40 and PATIENT_AGE() < 50
CVPoints=CVPoints+7
case PATIENT_AGE() >= 50 and PATIENT_AGE() < 60
CVPoints=CVPoints+4
case PATIENT_AGE() >= 60 and PATIENT_AGE() < 70
CVPoints=CVPoints+2
case PATIENT_AGE() >= 70 and PATIENT_AGE() < 80
CVPoints=CVPoints+1
else "" endcond
else "" endcond
cond
case obsany("HDL") = ""
CVPoints=CVPoints
case obsany("HDL") >= 60
CVPoints=CVPoints-1
case obsany("HDL") >= 50 and obsany("HDL") < 60
CVPoints=CVPoints
case obsany("HDL") >= 40 and obsany("HDL") < 50
CVPoints=CVPoints+1
case obsany("HDL") < 40
CVPoints=CVPoints+2
else "" endcond
else "" endcond
cond
case CVGender == "UM"
cond
case obsany("BP SYSTOLIC") < 130
CVPoints=CVPoints
case obsany("BP SYSTOLIC") >= 130 and obsany("BP SYSTOLIC") < 160
CVPoints=CVPoints+1
case obsany("BP SYSTOLIC") >= 160
CVPoints=CVPoints+2
else "" endcond
case CVGender == "TM"
cond
case obsany("BP SYSTOLIC") < 120
CVPoints=CVPoints
case obsany("BP SYSTOLIC") >= 120 and obsany("BP SYSTOLIC") < 130
CVPoints=CVPoints+1
case obsany("BP SYSTOLIC") >= 130 and obsany("BP SYSTOLIC") < 160
CVPoints=CVPoints+2
case obsany("BP SYSTOLIC") >= 160
CVPoints=CVPoints+3
else "" endcond
case CVGender == "UF"
cond
case obsany("BP SYSTOLIC") < 120
CVPoints=CVPoints
case obsany("BP SYSTOLIC") >= 120 and obsany("BP SYSTOLIC") < 130
CVPoints=CVPoints+1
case obsany("BP SYSTOLIC") >= 130 and obsany("BP SYSTOLIC") < 140
CVPoints=CVPoints+2
case obsany("BP SYSTOLIC") >= 140 and obsany("BP SYSTOLIC") < 160
CVPoints=CVPoints+3
case obsany("BP SYSTOLIC") >= 160
CVPoints=CVPoints+4
else "" endcond
case CVGender == "TF"
cond
case obsany("BP SYSTOLIC") < 120
CVPoints=CVPoints
case obsany("BP SYSTOLIC") >= 120 and obsany("BP SYSTOLIC") < 130
CVPoints=CVPoints+3
case obsany("BP SYSTOLIC") >= 130 and obsany("BP SYSTOLIC") < 140
CVPoints=CVPoints+4
case obsany("BP SYSTOLIC") >= 140 and obsany("BP SYSTOLIC") < 160
CVPoints=CVPoints+5
case obsany("BP SYSTOLIC") >= 160
CVPoints=CVPoints+6
else "" endcond
else "" endcond
cond
case CVGender == "UM" or CVGender == "TM"
cond
case CVPoints < 0
CVStr=" < 1%"
case CVPoints >= 0 and CVPoints < 5
CVStr=" 1%"
case CVPoints >= 5 and CVPoints < 7
CVStr=" 2%"
case CVPoints = 7
CVStr=" 3%"
case CVPoints = 8
CVStr=" 4%"
case CVPoints = 9
CVStr=" 5%"
case CVPoints = 10
CVStr=" 6%"
case CVPoints = 11
CVStr=" 8%"
case CVPoints = 12
CVStr=" 10%"
case CVPoints = 13
CVStr=" 12%"
case CVPoints = 14
CVStr=" 16%"
case CVPoints = 15
CVStr=" 20%"
case CVPoints = 16
CVStr=" 25%"
case CVPoints >= 17
CVStr=" 30%"
else "" endcond
case CVGender == "UF" or CVGender == "TF"
cond
case CVPoints < 9
CVStr=" < 1%"
case CVPoints >= 9 and CVPoints < 13
CVStr=" 1%"
case CVPoints >= 13 and CVPoints < 15
CVStr=" 2%"
case CVPoints = 15
CVStr=" 3%"
case CVPoints = 16
CVStr=" 4%"
case CVPoints = 17
CVStr=" 5%"
case CVPoints = 18
CVStr=" 6%"
case CVPoints = 19
CVStr=" 8%"
case CVPoints = 20
CVStr=" 11%"
case CVPoints = 21
CVStr=" 14%"
case CVPoints = 22
CVStr=" 17%"
case CVPoints = 23
CVStr=" 22%"
case CVPoints = 24
CVStr=" 27%"
case CVPoints >= 25
CVStr=" 30%"
else "" endcond
else "" endcond
return CVStr
}
Good morning
With some help from fellow user czelnick's post a couple years ago, I put together a text component that gives the pooled cohort CV risk calculation, the Framingham risk, the AHA/ACC lipid recommendations, and the National Lipid Association lipid recommendations. We launch it via quicktext.
{fn Framingham_M_risk(){
local points=0
local TCHOL,HDL
cond
case PATIENT_AGE()<20:
return "Too young to calculate Framingham Risk Score"
break
case PATIENT_AGE()<35:
points=-9
break
case PATIENT_AGE()<40:
points=-4
break
case PATIENT_AGE()<45:
points=0
break
case PATIENT_AGE()<50:
points=3
break
case PATIENT_AGE()<55:
points=6
break
case PATIENT_AGE()<60:
points=8
break
case PATIENT_AGE()<65:
points=10
break
case PATIENT_AGE()<70:
points=11
break
case PATIENT_AGE()<75:
points=12
break
case PATIENT_AGE()<80:
points=13
break
else return "Cannot calculate Framingham 10 YR Risk"
endcond
TCHOL=getTCHOL()
if TCHOL="" then return "Missing total cholesterol" endif
if TCHOL<160 then
points=points+0
endif
if TCHOL=160 then
if PATIENT_AGE()<40 then
points=points+4
else if PATIENT_AGE()<50 then
points=points+3
else if PATIENT_AGE()<60 then
points=points+2
else if PATIENT_AGE()<70 then
points=points+1
endif endif endif endif
endif
if TCHOL=200 then
if PATIENT_AGE()<40 then
points=points+7
else if PATIENT_AGE()<50 then
points=points+5
else if PATIENT_AGE()<60 then
points=points+3
else if PATIENT_AGE()<70 then
points=points+1
endif endif endif endif
endif
if TCHOL =240 then
if PATIENT_AGE()<40 then
points=points+9
else if PATIENT_AGE()<50 then
points=points+6
else if PATIENT_AGE()<60 then
points=points+4
else if PATIENT_AGE()=280 then
if PATIENT_AGE()<40 then
points=points+11
else if PATIENT_AGE()<50 then
points=points+8
else if PATIENT_AGE()<60 then
points=points+5
else if PATIENT_AGE()0 THEN SMOKSTATUS=1 ELSE SMOKSTATUS=0 ENDIF
if SMOKSTATUS=1 then
if PATIENT_AGE()<40 then
points=points+8
else if PATIENT_AGE()<50 then
points=points+5
else if PATIENT_AGE()59 then
points=points-1
else if HDL<50 then
points=points+1
else if HDL<40 then
points=points+2
endif endif endif
local BPsys=OBSANY("BP SYSTOLIC")
if CCC_sys_filter_meds("36")"" then
if BPsys<120 then
else if BPsys<130 then
points=points+1
else if BPsys<160 then
points=points+2
else
points=points+3
endif endif endif
endif
if CCC_sys_filter_meds("36")=="" then
if BPsys<130 then
else if BPsys<160 then
points=points+1
else
points=points+2
endif endif
endif
local risk=""
cond
case points<0
risk="<0"
break
case points <5
risk="1%"
break
case points <7
risk="2%"
break
case points<8
risk="3%"
break
case points<9
risk="4%"
break
case points<10
risk="5%"
break
case points<11
risk="6%"
break
case points<12
risk="8%"
break
case points<13
risk="10%"
break
case points<14
risk="12%"
break
case points<15
risk="16%"
break
case points<16
risk="20%"
break
case points30%"
endcond
return risk}}
{fn Framingham_F_risk(){
local points=0
local TCHOL,HDL
cond
case PATIENT_AGE()<20:
return "Too young to calculate Framingham Risk Score"
break
case PATIENT_AGE()<35:
points=-7
break
case PATIENT_AGE()<40:
points=-3
break
case PATIENT_AGE()<45:
points=0
break
case PATIENT_AGE()<50:
points=3
break
case PATIENT_AGE()<55:
points=6
break
case PATIENT_AGE()<60:
points=8
break
case PATIENT_AGE()<65:
points=10
break
case PATIENT_AGE()<70:
points=12
break
case PATIENT_AGE()<75:
points=14
break
case PATIENT_AGE()<80:
points=16
break
else return "Cannot calculate Framingham 10 YR Risk"
endcond
TCHOL=getTCHOL()
if TCHOL="" then return "Missing total cholesterol" endif
if TCHOL<160 then
points=points+0
endif
if TCHOL=160 then
if PATIENT_AGE()<40 then
points=points+4
else if PATIENT_AGE()<50 then
points=points+3
else if PATIENT_AGE()<60 then
points=points+2
else if PATIENT_AGE()<70 then
points=points+1
else
points=points+1
endif endif endif endif
endif
if TCHOL=200 then
if PATIENT_AGE()<40 then
points=points+8
else if PATIENT_AGE()<50 then
points=points+6
else if PATIENT_AGE()<60 then
points=points+4
else if PATIENT_AGE()<70 then
points=points+2
else point=points+1
endif endif endif endif
endif
if TCHOL =240 then
if PATIENT_AGE()<40 then
points=points+11
else if PATIENT_AGE()<50 then
points=points+8
else if PATIENT_AGE()<60 then
points=points+5
else if PATIENT_AGE()=280 then
if PATIENT_AGE()<40 then
points=points+13
else if PATIENT_AGE()<50 then
points=points+10
else if PATIENT_AGE()<60 then
points=points+7
else if PATIENT_AGE()0 THEN SMOKSTATUS=1 ELSE SMOKSTATUS=0 ENDIF
if SMOKSTATUS=1 then
if PATIENT_AGE()<40 then
points=points+9
else if PATIENT_AGE()<50 then
points=points+7
else if PATIENT_AGE()<60 then
points=points+4
else if PATIENT_AGE()59 then
points=points-1
else if HDL<50 then
points=points+1
else if HDL<40 then
points=points+2
endif endif endif
local BPsys=OBSANY("BP SYSTOLIC")
if CCC_sys_filter_meds("36")"" then
if BPsys<120 then
else if BPsys<130 then
points=points+3
else if BPsys<140 then
points=points+4
else if BPsys<160 then
points=points+5
else
points=points+6
endif endif endif endif
endif
if CCC_sys_filter_meds("36")=="" then
if BPsys<120 then
else if BPsys<130 then
points=points+1
else if BPsys<140 then
points=points+2
else if BPsys<160 then
points=points+3
else
points=points+4
endif endif endif endif
endif
local risk=""
cond
case points<0
risk="<0"
break
case points <5
risk="1%"
break
case points <7
risk="2%"
break
case points<8
risk="3%"
break
case points<9
risk="4%"
break
case points<10
risk="5%"
break
case points<11
risk="6%"
break
case points<12
risk="8%"
break
case points<13
risk="10%"
break
case points<14
risk="12%"
break
case points<15
risk="16%"
break
case points<16
risk="20%"
break
case points30%"
endcond
return risk}}{fn getLDL(){local LDLdatearray=array(lastobsdate("LDL"),lastobsdate("LDL (CALCUL)"),lastobsdate("SUMTLDL-C"),lastobsdate("LDLPLASMA"))
local LDLvaluearray=array(lastobsvalue("LDL"),lastobsvalue("LDL (CALCUL)"),lastobsvalue("SUMTLDL-C"),lastobsvalue("LDLPLASMA"))
local greatest_index=1
for i=1,i<=4,i=i+1
do
if LDLdatearray[i]UNDEFINED then
if LDLdatearray[greatest_index]==UNDEFINED then
greatest_index=i
else
if durationdays(str(LDLdatearray[greatest_index]),str(LDLdatearray[i]))>0 then
greatest_index=i
endif
endif
endif
endfor
if LDLdatearray[greatest_index]==UNDEFINED then
return ""
else
return LDLvaluearray[greatest_index]
endif}}{fn getHDL(){local HDLdatearray=array(lastobsdate("HDL"),lastobsdate("HDLTOTALDIR"),lastobsdate("THDLDIR"))
local HDLvaluearray=array(lastobsvalue("HDL"),lastobsvalue("HDLTOTALDIR"),lastobsvalue("THDLDIR"))
local greatest_index=1
for i=1,i<=3,i=i+1
do
if HDLdatearray[i]UNDEFINED then
if HDLdatearray[greatest_index]==UNDEFINED then
greatest_index=i
else
if durationdays(str(HDLdatearray[greatest_index]),str(HDLdatearray[i]))>0 then
greatest_index=i
endif
endif
endif
endfor
if HDLdatearray[greatest_index]==UNDEFINED then
return ""
else
return HDLvaluearray[greatest_index]
endif}}{fn getTCHOL(){local TCHOLdatearray=array(lastobsdate("CHOLESTEROL"),lastobsdate("SUMTOTCHOL"))
local TCHOLvaluearray=array(lastobsvalue("CHOLESTEROL"),lastobsvalue("SUMTOTCHOL"))
local greatest_index=1
for i=1,i<=2,i=i+1
do
if TCHOLdatearray[i]UNDEFINED then
if TCHOLdatearray[greatest_index]==UNDEFINED then
greatest_index=i
else
if durationdays(str(TCHOLdatearray[greatest_index]),str(TCHOLdatearray[i]))>0 then
greatest_index=i
endif
endif
endif
endfor
if TCHOLdatearray[greatest_index]==UNDEFINED then
return ""
else
return TCHOLvaluearray[greatest_index]
endif}}{fn getTRIG(){local TRIGdatearray=array(lastobsdate("TRIGLYCERIDE"),lastobsdate("TRIGLYC FAST"),lastobsdate(“TRIGLYC TOT”),lastobsdate(“TRIGLYCRDES”),lastobsdate(“TG-DIRECT”),lastobsdate(“TRIG”))
local TRIGvaluearray= array(lastobsvalue("TRIGLYCERIDE"),lastobsvalue("TRIGLYC FAST"),lastobsvalue(“TRIGLYC TOT”),lastobsvalue(“TRIGLYCRDES”),lastobsvalue(“TG-DIRECT”),lastobsvalue(“TRIG”))
local greatest_index=1
for i=1,i<=6,i=i+1
do
if TRIGdatearray[i]UNDEFINED then
if TRIGdatearray[greatest_index]==UNDEFINED then
greatest_index=i
else
if durationdays(str(TRIGdatearray[greatest_index]),str(TRIGdatearray[i]))>0 then
greatest_index=i
endif
endif
endif
endfor
if TRIGdatearray[greatest_index]==UNDEFINED then
return ""
else
return TRIGvaluearray[greatest_index]
endif}}{fn CVRskcount() {global risk_factors=0
local cvr=""
If match(Toupper(OBSANY("SMOK STATUS")),"CURRENT")>0 then
risk_factors=risk_factors+1
cvr=cvr + "Smoking/Tobacco Use
"
else "" endif
If OBSANY("HX OF HTN")=="yes" then
risk_factors=risk_factors+1
cvr=cvr + "Hypertension
"
else
If ccc_sys_hasdx("ICD-401^ICD-402^ICD-403^ICD-404^ICD-405") then cvr=cvr + "Hypertension
"
risk_factors=risk_factors+1
else ""
endif
endif
If ccc_sys_hasdx("ICD-585^ICD-403^ICD-404") then
cvr=cvr + "Chronic Kidney Disease
"
risk_factors=risk_factors+1
else "" endif
If ccc_sys_hasdx("ICD-250^ICD-249") then
risk_factors=risk_factors+1
cvr=cvr + "Diabetes Mellitus
" else "" endif
If OBSANY("FH<55MALE MI")=="yes" then
risk_factors=risk_factors+1
cvr=cvr + "Family History of Heart Disease in a Male before Age 55
" else "" endif
If OBSANY("FH<65FEMALMI")=="yes" then
risk_factors=risk_factors+1
cvr= cvr + "Family History of Heart Disease in a Female before Age 65
" else "" endif
If getHDL() <40 then
risk_factors=risk_factors+1
cvr=cvr + "Low HDL, below 40
" else "" endif
If OBSANY("CARDCASCORE") "" then cvr=cvr + "
Cardiac Calcium Score= " + OBSANY("CARDCASCORE") + " [Normal <300 or <75%]
" else "" endif
If OBSANY("CTCARTCASCO") "" then cvr=cvr + "
Cardiac Calcium Score= " + OBSANY("CTCARTCASCO") + " [Normal <300 or <75%]
" else "" endif
If OBSANY("CRP") "" then cvr=cvr + "
C-Reactive Protein(CRP)= " + OBSANY("CRP") + " [Normal <2 mg/ml]
" else "" endif
If OBSANY("CRP HI SENS") "" then cvr=cvr + "
C-Reactive Protein(High Sensitivity CRP)= " + OBSANY("CRP HI SENS") + " [Normal <2 mg/ml]
" else "" endif
If OBSANY("CRP QUANTI") "" then cvr=cvr + "
C-Reactive Protein(Quantitative CRP)= " + OBSANY("CRP QUANTI") + " [Normal 45 then
risk_factors=risk_factors+1
cvr=cvr + "Male, Age >45
" else "" endif
else
If PATIENT_AGE ()>55 then
risk_factors=risk_factors+1
cvr =cvr + "Female, Age >55
" else "" endif
endif
If cvr=="" then cvr="No Major Cardiac Risk Factors Recorded
" endif
return risk_factors}}{fn CVRsk() {global risk_factors=0
local cvr=""
If match(Toupper(OBSANY("SMOK STATUS")),"CURRENT")>0 then
risk_factors=risk_factors+1
cvr=cvr + "Smoking/Tobacco Use
"
else "" endif
If OBSANY("HX OF HTN")=="yes" then
risk_factors=risk_factors+1
cvr=cvr + "Hypertension
"
else
If ccc_sys_hasdx("ICD-401^ICD-402^ICD-403^ICD-404^ICD-405") then cvr=cvr + "Hypertension
"
risk_factors=risk_factors+1
else ""
endif
endif
If ccc_sys_hasdx("ICD-585^ICD-403^ICD-404") then
cvr=cvr + "Chronic Kidney Disease
"
risk_factors=risk_factors+1
else "" endif
If ccc_sys_hasdx("ICD-250^ICD-249") then
risk_factors=risk_factors+1
cvr=cvr + "Diabetes Mellitus
" else "" endif
If OBSANY("FH<55MALE MI")=="yes" then
risk_factors=risk_factors+1
cvr=cvr + "Family History of Heart Disease in a Male before Age 55
" else "" endif
If OBSANY("FH<65FEMALMI")=="yes" then
risk_factors=risk_factors+1
cvr= cvr + "Family History of Heart Disease in a Female before Age 65
" else "" endif
If getHDL() <40 then
risk_factors=risk_factors+1
cvr=cvr + "Low HDL, below 40
" else "" endif
If OBSANY("CARDCASCORE") "" then cvr=cvr + "
Cardiac Calcium Score= " + OBSANY("CARDCASCORE") + " [Normal <300 or <75%]
" else "" endif
If OBSANY("CTCARTCASCO") "" then cvr=cvr + "
Cardiac Calcium Score= " + OBSANY("CTCARTCASCO") + " [Normal <300 or <75%]
" else "" endif
If OBSANY("CRP") "" then cvr=cvr + "
C-Reactive Protein(CRP)= " + OBSANY("CRP") + " [Normal <2 mg/ml]
" else "" endif
If OBSANY("CRP HI SENS") "" then cvr=cvr + "
C-Reactive Protein(High Sensitivity CRP)= " + OBSANY("CRP HI SENS") + " [Normal <2 mg/ml]
" else "" endif
If OBSANY("CRP QUANTI") "" then cvr=cvr + "
C-Reactive Protein(Quantitative CRP)= " + OBSANY("CRP QUANTI") + " [Normal 45 then
risk_factors=risk_factors+1
cvr=cvr + "Male, Age >45
" else "" endif
else
If PATIENT_AGE ()>55 then
risk_factors=risk_factors+1
cvr =cvr + "Female, Age >55
" else "" endif
endif
If cvr=="" then cvr="No Major Cardiac Risk Factors Recorded
" endif
return cvr}}{fn ln(z) {local a,b,c,d,f
if z<1/2 then return "Cannot find ln of number below 0.5" endif
a=(z-1)/z
d=a
b=a
f=z*100
for t=2, t<f, t=t+1
do
b=b*a
c=(1/t)*b
d=d+c
endfor
return d}}{fn PCCVRisk() {local insum,e,w,r,q,s,t,MCV,PCRisk,SMOKSTATUS,DIABSTATUS
cond
case (PATIENT_AGE())20
lAGE=ln(PATIENT_AGE())
lCHOL=ln(getTCHOL())
lHDL=ln(getHDL())
lBPS=ln(OBSANY("BP SYSTOLIC"))
If match(Toupper(OBSANY("SMOK STATUS")),"CURRENT")>0 THEN SMOKSTATUS=1 ELSE SMOKSTATUS=0 ENDIF
If ccc_sys_hasdx("ICD-250.^ICD-249.") then DIABSTATUS=1 else DIABSTATUS=0 ENDIF
If PATIENT.SEX=="M" then
If MATCH(PATIENT.RACE,"Black")> 0 then MCV=19.54 s=0.8954 //BLACK MALE
If (ccc_sys_hasdx("ICD-401"))=="FALSE" then
insum=2.469*lAGE+0.302*lCHOL+(-0.307)*lHDL+1.809*lBPS+0.549*SMOKSTATUS+0.645*DIABSTATUS
Else
insum=2.469*lAGE+0.302*lCHOL+(-0.307)*lHDL+1.916*lBPS+0.549*SMOKSTATUS+0.645*DIABSTATUS
Endif
Else
MCV=61.18 s=0.9144 //WHITE MALE
If (ccc_sys_hasdx("ICD-401"))=="FALSE" then
insum=12.344*lAGE+11.853*lCHOL+(-2.664)*(lAGE*lCHOL)+(-7.99)*lHDL+1.769*(lAGE*lHDL)+1.764*lBPS+7.837*SMOKSTATUS+(-1.795)*lAGE*SMOKSTATUS+0.658*DIABSTATUS
Else
insum=12.344*lAGE+11.853*lCHOL+(-2.664)*(lAGE*lCHOL)+(-7.99)*lHDL+1.769*(lAGE*lHDL)+1.797*lBPS+7.837*SMOKSTATUS+(-1.795)*lAGE*SMOKSTATUS+0.658*DIABSTATUS
Endif
Endif
Else //FEMALE
If MATCH(PATIENT.RACE,"Black")> 0 then MCV= 86.61 s=0.9533 //BLACK FEMALE
If (ccc_sys_hasdx("ICD-401"))=="FALSE" then
insum=17.114*lAGE+0.94*lCHOL+(-18.92)*lHDL+4.475*(lAGE*lHDL)+27.820*lBPS+(-6.087)*(lAGE*lBPS)+0.691*SMOKSTATUS+0.874*DIABSTATUS
Else
insum=17.114*lAGE+0.94*lCHOL+(-18.92)*lHDL+4.475*(lAGE*lHDL)+29.291*lBPS+(-6.432)*(lAGE*lBPS)+0.691*SMOKSTATUS+0.874*DIABSTATUS
Endif
Else MCV=(-29.18) s=0.9665 //WHITE FEMALE
If (ccc_sys_hasdx("ICD-401"))=="FALSE" then
insum=(-29.799)*lAGE+4.884*(lAGE*lAGE)+13.540*lCHOL+(-3.114)*(lAGE*lCHOL)+(-13.578)*lHDL+3.149*(lAGE*lHDL)+1.957*lBPS+7.574*SMOKSTATUS+(-1.665)*lAGE*SMOKSTATUS+0.661*DIABSTATUS
Else
insum=(-29.799)*lAGE+4.884*(lAGE*lAGE)+13.540*lCHOL+(-3.114)*(lAGE*lCHOL)+(-13.578)*lHDL+3.149*(lAGE*lHDL)+2.019*lBPS+7.574*SMOKSTATUS+(-1.665)*lAGE*SMOKSTATUS+0.661*DIABSTATUS
Endif
Endif
Endif
e=2.71828
w=insum-MCV
r=e^w
q=s^r
PCRisk=(1-q)*100
t= "-Based on: Total Cholesterol = " + getTCHOL() + " and HDL= " + getHDL() + " and Systolic BP = " + (OBSANY("BP SYSTOLIC")) + fmt( "
10-Year Pooled Cohort Cardiovascular Risk = ","B") + PCRisk +"%"
return t
endcond}}{fn sys_filter_all(GCIlist) {// Returns list of Name and date of current meds in allergy list
// that match GPI fragments in list.
// Returns null otherwise.
local meds=getfield(ALL_AFTER("DELIMITED"),"|","")
local types=getfield(GCIlist,"^","")
local r="", i=0, j=0
for j=1, j<=size(meds), j=j+1 do
for i=1, i<=size(types), i=i+1 do
if match(CCC_sys_dp(meds[j],6),types[i])==1
then if r"" then r=r+hret endif
r=r+CCC_sys_dp(meds[j],1)+" ("+CCC_sys_dp(meds[j],2)+")" break
else continue
endif
endfor
endfor
return r }}
{fn risk_assessment(){
local risk_factors1= CVRskcount()
if ccc_sys_hasdx("ICD-250^ICD-249") then
if risk_factors1>1 then
return "VERY HIGH RISK"
else
return "HIGH RISK"
endif
endif
if ccc_sys_hasdx("ICD-410^ICD-411^ICD-413^ICD-414^ICD-V45.8^ICD-429.2^ICD-440^ICD-441^ICD-442^ICD-43^ICD-443.89^ICD-443.9^ICD-443.2^ICD-V15.1") then
return "VERY HIGH RISK"
endif
if ccc_sys_hasdx("ICD-585.3^ICD-585.4") then
return "HIGH RISK"
endif
local rLDL=getLDL()
if rLDL"" then
if rLDL>189 then
return "HIGH RISK"
endif
endif
if risk_factors1>2 then
return "HIGH RISK"
endif
if risk_factors10 and hdl>0 then return tcho-hdl else return "missing value"
endif}}{fn LDLtxlevel(){local ans, risk
risk=risk_assessment()
if risk=="VERY HIGH RISK" then
ans=">=70"
endif
if risk=="HIGH RISK" then
ans= ">=100"
endif
if risk=="MODERATE RISK" then
ans=">=130"
endif
if risk=="LOW RISK" then
ans=">=160"
endif
return ans}}{fn nonHDLtxlevel(){local ans, risk
risk=risk_assessment()
if risk=="VERY HIGH RISK" then
ans=">=100"
endif
if risk=="HIGH RISK" then
ans= ">=130"
endif
if risk=="MODERATE RISK" then
ans=">=160"
endif
if risk=="LOW RISK" then
ans=">=190"
endif
return ans}}{fn nonHDLgoal(){
local ans, risk
risk=risk_assessment()
if risk=="VERY HIGH RISK" then
ans="<=100"
else
ans="<=130"
endif
return ans}}{fn LDLgoal(){
local ans, risk
risk=risk_assessment()
if risk=="VERY HIGH RISK" then
ans="<=70"
else
ans="<=100"
endif
return ans}}
Vascular Disease Risk Assessment:
Personal Risks:{if ccc_sys_hasdx("ICD-250^ICD-249") then "
-Diabetes
" else "" endif}{if ccc_sys_hasdx("ICD-410^ICD-411^ICD-413^ICD-414^ICD-V45.8^ICD-429.2^ICD-440^ICD-441^ICD-442^ICD-43^ICD-443.89^ICD-443.9^ICD-443.2^ICD-V15.1") then "
-Cardiovascular Disease
" else "
Major Cardiac Risk Factors:
" + CVRsk() endif + "
" + cond
case CCC_sys_filter_meds("3940")""
"-Current Statin on Medlist:
" + CCC_sys_filter_meds("3940")+ "
"
case CCC_sys_filter_meds("3999")""
"-Current Statin on Medlist:
" + CCC_sys_filter_meds("3999")+ "
"
case OBSANY("NOTONSTATIN")""
"-Past history Statin declined or contraindicated"
case sys_filter_all("3940") ""
"-Allergy list includes a Statin"
else
"-No Statin on Med or Allergy List and No documented contraindication"
endcond}
{PCCVRisk()}
Framingham 10 Year Cardiac Risk is: {if PATIENT.SEX=="F" then Framingham_F_risk() else Framingham_M_risk() endif}
(NOTE: The Framingham and Pooled Cohort estimates of risk use different equations and different risk factors. At times one might predict a much higher risk than the other.)
The above factors predict a {risk_assessment()} of cardiovascular disease. The National Lipid Association states that "Non HDL cholesterol" (the total cholesterol level minus the HDL ("good cholesterol") level is the best way to measure the risk of heart disease or stroke related to cholesterol.
Last LDL cholesterol level: {getLDL()}
LDL level to consider drug therapy: {LDLtxlevel()}
LDL goal: {LDLgoal()}
Last non HDL cholesterol: {nonHDL()}
Non HDL cholesterol level to consider drug therapy: {nonHDLtxlevel()}
Non HDL cholesterol goal: {nonHDLgoal()}
Thank you both for your help. I'm going to take a look at your code and incorporate what I can. Thanks again.
Dr Adams, there are some errors in your code. It looks like some pieces are missing - one places is :
case points<16
risk="20%"
break
case points30%"
endcond
Another example is:
If OBSANY("CRP QUANTI") "" then cvr=cvr + "
C-Reactive Protein(Quantitative CRP)= " + OBSANY("CRP QUANTI") + " [Normal 45 then
risk_factors=risk_factors+1
cvr=cvr + "Male, Age >45
" else "" endif
else
If PATIENT_AGE ()>55 then
risk_factors=risk_factors+1
cvr =cvr + "Female, Age >55
" else "" endif
endif
Could you send me your code or upload it here? david-shower at ouhsc dot edu.
Thanks,
POOLED_RISK_NLA_FRAMINGHAM_TEXT_COMPONENT
Sounds like copy/paste didn't work. I've attached the file.
SA