We are trying to create an alert on children who have BMI % of 85 or higher but I can't find a function tha t would calculate the percentile for BMI?
Any help is appreciated,
Holly Tabor
Holly, Do a search for this CHUG post "I need help with some Action Button’s. I’m new to VFE". This post has a function that calculates BMI. - Beverly
Thank you for that, not exactly what I am looking for. I have the BMI calculation but I need the calculation that gives you the patients percentile... so far no luck finding a function for that and when I search on the cdc site its pretty complex.
use the BMI calculation function, then determine the specific percentile for each age range, then compare values, ie if obsnow("BMI") >= x and patient.age == y then userok("alert")
where x is the actual numeric value of the BMI that makes up the 85th percentile
Holly,
Not sure if this will help you but as long as the childs Height & Weight are entered there is a button on the Vital Signs form that is called Pediatric Growth %. Once selected it will give you the option to add the percentile to the note or not. This will work on anyone between 2 & 20 yrs old i believe. I tried to add a print screen but i don't know how.
That is exactly what I need... We don't have that form in our system. Is there any chance you could send it to me? [email protected]
We are on CPS 10 and it is one that came canned.
[MLI_FORM:Enterprise\CCC\Vital Signs-2-CCC]
Hi Holly,
If you are building your own form, below are the MEL functions needed to calculate a BMI%ile. I don't know who created these functions...I downloaded them from the old CHUG Forum years ago.
fn GetBMIPercentile(bmi)
{
local lmsArr
local index = 0
cond
case PATIENT._AGEINMONTHS < 24: /*Do Nothing*/
case PATIENT._AGEINMONTHS >= 276: /*Do Nothing*/
else:
if PATIENT._AGEINMONTHS < 60 then
index = 24
endif
lmsArr=GetLms("bmi_age", PATIENT._AGEINMONTHS - index, TRUE, index)
if size(lmsArr) <> 0 then
OBSNOW("BMI%ILE", STR(GetPercentile(GetZScore(bmi, lmsArr[2], lmsArr[3],lmsArr[4]))))
endif
endcond
}
fn GetLms(fileName, ageInMonths, addAgeToFileName, adjIndex){
local fileNameAge = 0
local rawLmsArr
local lmsArr
local index
if addAgeToFileName then
cond
case ageInMonths < 60: fileNameAge = 60
case ageInMonths < 120: fileNameAge = 120
case ageInMonths < 180: fileNameAge = 180
case ageInMonths < 240: fileNameAge = 240
case ageInMonths >= 240: fileNameAge = ""
endcond
fileName=fileName + "_" + str(fileNameAge)
endif
lmsArr=GetRawLmsArray( fileName )
// RETURN "" ON ERROR
if size(lmsArr)==0 then
return ""
endif
index=ageInMonths-fileNameAge+1.5
if addAgeToFileName then
index=index+60
endif
index = div(index, 1)
if size(lmsArr) < index then
return ""
endif
local rawHi
local rawLo
rawLo=get(lmsArr,index)
if size(lmsArr)>index then
index = index+1
endif
rawHi=get(lmsArr,(index))
rawLo = getfield( rawLo, "|")
rawHi=getfield( rawHi, "|")
ageInMonths = ageInMonths+adjIndex
lmsArr=GetLMSArray(ageInMonths, rawLo, rawHi)
return lmsArr
}
fn GetRawLmsArray(fileName)
{
local path
local file
local text = ""
local lmsArr
path = GetGrowthChartLmsDataPath() + fileName
file = FILEOPEN( path, "r")
if file <> NULL then
text = FILEREAD(file)
FILECLOSE(file)
else
USEROK( "Unable to open file '" + path + "'" )
endif
if size(text)==0 then
return ""
endif
lmsArr = getfield(text, ",")
return lmsArr
}
fn GetGrowthChartLmsDataPath(){
local path
local GC_DIR
local backslashes = "\\\\"
local backslash
backslash=get(backslashes, 2)
GC_DIR = backslash + "clinical content" + backslash + "peds_growth_data" + backslash + PATIENT.SEX + backslash
path=DIR_EMR() + GC_DIR
return path
}
fn GetLMSArray(ptAge, lmsArrLow, lmsArrHigh ){
local ageLow
local ageHigh
local L
local M
local S
local LMSArr
local fractAbove
ageLow=1*lmsArrLow[4]
ageHigh=1*lmsArrHigh[4]
if (ageHigh-ageLow)==0 then
fractAbove=1
else
fractAbove = (ptAge-ageLow)/(ageHigh-ageLow)
endif
L = 1*lmsArrLow[1] + (1*lmsArrHigh[1]-1*lmsArrLow[1])*fractAbove
M = 1*lmsArrLow[2] + (1*lmsArrHigh[2]-1*lmsArrLow[2])*fractAbove
S = 1*lmsArrLow[3] + (1*lmsArrHigh[3]-1*lmsArrLow[3])*fractAbove
LMSArr = array( ptAge, L, M, S )
return LMSArr
}
fn GetPercentile(z){
local p10
local p9
local p4
local p3
local p2
local p1
local p
p10 = 1 + (0.33267 * AbsValue(z))
p9 = 1/p10
p4 = (0.4361836 * p9) - (0.1201676 * (p9^2)) + (0.937298 * (p9^3))
p1= 2 * 3.14159265
p3 = (AbsValue(z)^2)
p2 = -1 * p3/2
local pp
pp = 1/(p1^0.5)*(2.71828182845905^p2)*p4
p = 1 - pp
if z > 0 then
p = p*100
else
p= 100 - p*100
endif
p = div((p+0.5),1)
return p
}
fn GetZScore(val, lVal, mVal, sVal){
local z
z = val/mVal
if lVal == 0 then
lVal = 0.000000001
endif
z = z^lVal
z = z-1
z = z/(1*lVal*1*sVal)
return z
}
fn AbsValue(val){
if val < 0 then
return -1 * val
endif
return val
}