I am trying to calculate the FIB-4 score for a patient in a form. It uses their ALT, AST and PLATELETS. I get it to calculate successfully ONLY on my workstation, regardless of who is logged into Centricity on that workstation. On any other workstation it yields no result. I have a check box (document.calc_fib4) to click if you want it to calculate the value, and a field containing the obs term that is populated with that calculated value. If the check box is not clicked, I do see the value Blah in the obs term regardless of the workstation. Here is the relevant code. I have tried it in a variety of ways but to no avail. Any ideas would be much appreciated!
{!if document.calc_fib4 == "" then obsnow ("FIBROSISSCRE", "blah") else obsnow("FIBROSISSCRE", fib_4(obsany("SGOT (AST)"),obsany("SGPT (ALT)"),obsany("PLATELETS"))) endif } fn fib_4 (ast,alt,plt) { local pltlen=match(plt,1," ") if (pltlen=0) then pltlen=size(plt)-1 endif str(patient_age()*val(ast)/val(sub(plt,1,pltlen))* sqrrt(val(alt))) } {fn sqrRt(num) { local nLow local nHi local nVal local nSqr local nErr if num = "" then return "" endif if num <> val(str(num)) then return "" endif if num = 1 then return "1" endif if num > 1 then nLow = 1 nHi = num else nLow = num nHi = 1 endif nVal = (nLow+nHi)/2 nSqr = nVal*nVal nErr = nSqr-num if nErr<0 then nErr=-1*nErr endif if nErr>0.003 then while nErr>0.003 do if nSqr < num then nLow = nVal else nHi = nVal endif nVal = (nLow+nHi)/2 nSqr = nVal*nVal nErr = nSqr-num if nErr < 0 then nErr = -1*nErr endif endwhile endif nVal = round(nVal,2) nVal = str(truncate(nVal,2)) return nVal } }
additional info - it is the patient_age() function that is the culprit, but why I don't know. It doesn't work whether I assume it returns a string or a number on workstations other than mine, and only works on mine when I assume a number
the patient_age function is in the mellib.txt file. make sure all workstations have the same mellib.txt file.
jjordet said:
the patient_age function is in the mellib.txt file. make sure all workstations have the same mellib.txt file.
thank you
At least one other person for whom it doesn't work seems to have the file. Is there some way we need to point to it so that it knows to access functions in there? Assuming our forms know to access this file, can we add any functions we want there for general use?
if your workstations are all fat client, it should be in the Centricity folder. if your workstations are using Citrix, it should be in the Centricity folder on the Citrix server. shouldn't have to point to it in any way. you can add to the file, but it will be replaced with every upgrade. I have tweaked functions in the file, but I add comments at the top of the file stating which functions I've tweaked and how. I also keep a copy of the file separate, so it doesn't get overwritten with an upgrade and so I can compare what's changed with the upgrade.
jjordet said:
if your workstations are all fat client, it should be in the Centricity folder. if your workstations are using Citrix, it should be in the Centricity folder on the Citrix server. shouldn't have to point to it in any way. you can add to the file, but it will be replaced with every upgrade. I have tweaked functions in the file, but I add comments at the top of the file stating which functions I've tweaked and how. I also keep a copy of the file separate, so it doesn't get overwritten with an upgrade and so I can compare what's changed with the upgrade.
hmm, that makes sense but everyone has the same mellib.txt file in the same place. Since patient_age() is a one-liner, I am using its code in my calculation and all is well. Will follow up with GE
Thanks!
Ken