Hello everyone,
I'm building a form that will dispaly both GFRC and CKD Stage. I've gotten the results to display using a mel expression, but I'm not sure how I can translate this into the chart note. Please see the form below. Thanks for the help.
Copy your code you created to calculate these over to the Translation tab. It should be in the Chart Note box. You'll also need to label it, so just put "GFRc: " +
in front of your round()
function and "CKD Stage: " +
in front of your other code.
Hey MikeSeale,
It's interesting because if I enter the same exact code into the translation tab I get MEL vomit errors.
Thanks,
Mike
"...I’ve gotten the results to display using a mel expression..."
I would do something like this...
Take the {....} code from your data display
Assuming there is an obsterm("X") that I am displaying some result of it in the data display
In the MEL area on the right, define a new document variable
{DOCUMENT.displayThis = fnDisplayThis( obsnow("X") ) }
{fn fnDisplayThis( theObsvalue ) {
local strVal = ""
... mel code from data display calculating using theObsvalue ...
strVal = ...whatever is the final value of the mel code ...
return strVal
}}
Then in the data display Text Translation, put:
{ DOCUMENT.DisplayThis }
If you do not follow what I am talking about, post your MEL code here for us to see what you are doing...
- Beverly
Laboratory - Changes1 <--- Here is the form I'm working with.
Mel Expression:
GFRc: {if OBSANY("Creatinine") == "" then "***" else "GFRc: " round(175 * (OBSANY ("Creatinine")^ -1.154) * (PATIENT_AGE()^-0.203) * (if PATIENT.SEX =="F" then 0.742 else 1 endif) * (if PATIENT.RACE == "Black or African American" then "1.212" else "1" endif),1) endif}
CKD Stage:
{MDRD4 = 175 * (OBSANY ("Creatinine")^ -1.154) * (PATIENT_AGE()^-0.203) * (if PATIENT.SEX =="F" then 0.742 else 1 endif) * (if PATIENT.RACE == "Black or African American" then "1.212" else "1" endif) cond case MDRD4 =="" " " case MDRD4>=90 "Normal Kidney Function" case MDRD4<90 AND MDRD4>=60 " 2 +" case MDRD4<60 AND MDRD4>=45 "3A" case MDRD4<45 AND MDRD4>=30 "3B" case MDRD4<30 AND MDRD4>=15 "4" case MDRD4<15 "5" endcond}
OK, I will tackle the first one. I have not tested it, try it and see if this works. If it does, try writing the next one and let us know how that goes...
Here was your Original mel code from the Data display:
GFRc: if OBSANY("Creatinine") == "" then
"***"
else
"GFRc: " round(
175 * (OBSANY ("Creatinine")^ -1.154) * (PATIENT_AGE()^-0.203)
* (if PATIENT.SEX =="F" then 0.742 else 1 endif)
* (if PATIENT.RACE == "Black or African American" then "1.212" else "1" endif)
,1)
endif
Try replacing it with the following...
Add this to the MEL code area on the Right:
{DOCUMENT.displayGFR = fnCalcGFR( OBSANY("Creatinine") )}
{fn fnCalcGFR( obsVal ) {
local sRet=""
if OBSANY("Creatinine")=="" then
sRet = "***"
else
local sexCalc = (if PATIENT.SEX=="F",0.742,1)
local raceCalc = (if PATIENT.RACE=="Black or African American", 1.212, 1)
local obsCalc = (OBSANY("Creatinine")^ -1.154) * (PATIENT_AGE()^-0.203)
sRet = round(175 * obsCalc * sexCalc * raceCalc, 1)
endif
return sRet
}}
Add this to the Data Display on the Form
In the Mel Expression connection put
{ "GFRc: " + DOCUMENT.displayGFR }
In the Text Translation put this:
{ FMT("GFRc: ","B") + DOCUMENT.displayGFR }
Let me know if this worked 🙂
- Beverly
No luck 🙁
I tested this code, and it works to display the GFRc in the data display and in the text translation (Chart Note):
I put this into the data display
Connection: MEL Expression
{"GFRc: " + DOCUMENT.displayGFR }
Translation:
{if DOCUMENT.displayGFR=="" then FMT("GFRc: ","B") + DOCUMENT.displayGFR else "" endif}
I put this calculation function and document variable on the right in the MEL coding area of the Form:
{DOCUMENT.displayGFR = fnCalcGFR( OBSANY("Creatinine") )}
{fn fnCalcGFR( obsVal ) {
local sRet=""
if obsVal=="" then
sRet = "***"
else
local sexCalc = (if PATIENT.SEX=="F",0.742,1)
local raceCalc = (if PATIENT.RACE=="Black or African American", 1.212, 1)
local obsCalc = (obsVal^-1.154) * (PATIENT_AGE()^-0.203)
sRet = round(175 * obsCalc * sexCalc * raceCalc, 1)
endif
return sRet
}}
Let us know if this works for you – Beverly
It worked in the data display, but not the translation. Thanks for your efforts.
-Mike
Ok. I got the text translation to work for GFRC. Thanks again! Now I will take a stab at the CKD Stage.
Was it this line ?
Translation:
{if DOCUMENT.displayGFR=="" then FMT("GFRc: ","B") + DOCUMENT.displayGFR else "" endif}
Looks like I should have put <> instead of ==
Translation:
{if DOCUMENT.displayGFR<>"" then FMT("GFRc: ","B") + DOCUMENT.displayGFR else "" endif}
sorry about that.
Yep, that was the issue. I'm having trouble solving the next translation for CKD stage. Please let me know if you have any ideas. You've been a huge help so far.
{MDRD4 = 175 * (OBSANY ("Creatinine")^ -1.154) * (PATIENT_AGE()^-0.203) * (if PATIENT.SEX =="F" then 0.742 else 1 endif) * (if PATIENT.RACE == "Black or African American" then "1.212" else "1" endif) cond case MDRD4 =="" " " case MDRD4>=90 "Normal Kidney Function" case MDRD4=60 " 2 +" case MDRD4=45 "3A" case MDRD4=30 "3B" case MDRD4=15 "4" case MDRD4<15 "5" endcond}
Your case statement was missing its else before the endcond.
Following the same style of solution as I showed for GFRc,
here is the MEL code function and new document variable:
DOCUMENT.displayMDRD4.
I have not tested this, but should work.
{DOCUMENT.displayMDRD4 = fnCalcMDRD4( OBSANY("Creatinine") )}
{fn fnCalcMDRD4( obsVal ) {
local sRet=""
if obsVal=="" then
sRet = "" // ? did you want to return "***" here, like with GFRc
else
local MDRD4=""
local sexCalc = (if PATIENT.SEX=="F",0.742,1)
local raceCalc = (if PATIENT.RACE=="Black or African American"
, 1.212, 1)
local obsCalc = 175 * (obsVal^-1.154)
* (PATIENT_AGE()^-0.203)
* sexCalc * raceCalc
MDRD4 = obsCalc
cond
case MDRD4 ==""
sRet=" "
case MDRD4>=90
sRet="Normal Kidney Function"
case MDRD4=60
sRet=" 2 +"
case MDRD4=45
sRet= "3A"
case MDRD4=30
sRet="3B"
case MDRD4=15
sRet="4"
case MDRD4<15
sRet="5"
else
sRet=""
endcond
endif
return sRet
}}
Let me know if this works for you.
- Beverly
Hi Beverly,
The CKD stage is showing as blank in the data display, but there are no MEL errors. I've double checked that the pt should have a CDK stage. Also, I've checked that the MEL expression is setup properly. I'll keep working on this. We're so close!
Thanks,
Mike
Try uncommenting the case statements to use the TRUNCATE (if you have not done so)
case MDRD4==60 // TRUNCATE(MDRD4, 0)==60
to
case TRUNCATE(MDRD4, 0)==60
... etc
also, I am never quite sure if I should use ==60 or =60 when doing numeric comparisons,
and lastly - you might have to do debugging to see what the value of MDRD4 is,
so throw in a userok() statement like this:
After this line
MDRD4 = obsCalc
put
userok(" OBSANY(Creatinine) = " + OBSANY("Creatinine")
+ HRET + "obsval = " + obsval
+ HRET + "MDRD4 = " + MDRDR
+ HRET + "TRUNC = " + TRUNCATE(MDRD4,0)
)
See what values you are getting, so you know why it is not being matched by the cond...endcond block.
- Beverly