Sunquest Calculation for Free Testosterone and Bioavailable Testosterone

  • History
  • JavaScript Calculation
  • Sunquest Free Testosterone Calculation
  • Sunquest BioAvailable Testosterone Calc

I was asked to setup a calculation for both free testosterone and bioavailable testosterone in Sunquest using the same calculations written by Dr. Tom Fiers and Prof. Dr. J.M. Kaufman at the University Hospital of Ghent, Belgium.

The link to the webpage that has the online calculations for free testosterone and bioavailable testosterone with an explaination of the calculations can be found here: http://www.issam.ch/freetesto.htm

I used the website to check the results of my Sunquest calculation. If you want to setup this calculation in Sunquest at your facility, you have to be careful to take into account the resulting units for each test code and make adjustments to match your reporting units. These are the units we use at our facility.

Test Test Name Units
ALB Albumin g/dL
SHBG Sex Hormone Binding Globulin nmol/L
TESTBA BioAvailable Testosterone nmol/L
TESTF Free Testosterone nmol/L
TESTOS Testosterone ng/dL

This is the Javascript calculation found on http://www.issam.ch/freetesto.htm.

GetCookie("CalcMemory");
// SetCookie("CalcMemory", memory);

bereken()
{
var album=document.ftesto.album.value
var shbg=document.ftesto.shbg.value
var testo=document.ftesto.testo.value
var albumeenh=document.ftesto.albeenheid.value
var testoeenh=document.ftesto.testoeenheid.value
var kt=1000000000
var destr=""
var wortel=0
var afrond=1
var ftesto=0
// var memory = GetCookie("CalcMemory");
// SetCookie("CalcMemory", memory);

 

if (album==0 || album==null || shbg==0 || shbg==null || testo==0 || testo==null ) 

{
alert("Please fill in values for Albumin, SHBG and Testosterone before calculating")
}

 

else

  {
if (testoeenh=="ng/dL")  {testo = testo}
if (testoeenh=="ng/mL")  {testo = testo * 100}
if (testoeenh=="nmol/dL")  {testo = testo * 288.4 }
if (testoeenh=="nmol/mL")  {testo = testo * 288.4 * 100}
if (testoeenh=="nmol/L")   {testo = testo * 28.84}

       testo2 = testo / 2.8 * 1e-10
shbg=shbg/10
shbg2=shbg * 1e-8

              if (albumeenh=="g/L") {album = album/10}

       fa=((36000*album*(1.45 * .0001))+1) *kt 
fa1= ((36000*album*(1.45 * .0001))+1)
fb=kt*(shbg2-testo2)+fa1
fc=-testo2
wortel=Math.sqrt(fb*fb -4 * fa *fc)
ftesto= (-fb +wortel)/(2*fa)
ftestop=(ftesto * 100)/testo2
ftc=(ftestop/100) * testo
biot = ftc * fa1
ftesto3=ftestop
biot2=(biot*100)/testo

              if (testoeenh=="ng/mL")

                     {
ftc=ftc/100;
biot=biot/100;

              if (testoeenh=="nmol/dL")
{
ftc = ftc * 0.00347;   
biot = biot * 0.00347;
}

              if (testoeenh=="nmol/L")
{
ftc = ftc * 0.0347;   
biot = biot * 0.0347;  
}

              if (testoeenh=="nmol/mL")
{
tc = ftc * 0.0000347;
biot = biot * 0.0000347;  
}

document.resultaat.freet.value = roundoff(ftc) + " "+ testoeenh + "  =  "+ roundoff(ftestop) + " %" 
document.resultaat.biot.value = roundoff(biot) + " "+ testoeenh + "  =  "+ roundoff(biot2) + " %" 

}
return true;
}

function roundoff(value)
{     var value4= "" + Math.round(value)
var bonus2=value4.length + 1     
var bonus=0    

              if (value <100) {bonus=bonus+1}     
if (value <10) {bonus=bonus+1}
if (value <1) {bonus=bonus+1}     
if (value <0.1) {bonus=bonus+1}
if (value <0.01) {bonus=bonus+1}
if (value <0.001) {bonus=bonus+1}
if (value <0.0001) {bonus=bonus+1}
bonus2=bonus2+bonus    
var whole= Math.round(value * Math.pow(10, bonus));
var whole2= ""+ whole * Math.pow(10, -1*bonus);
var whole2= whole2.substr(0,bonus2)

return whole2;
}

Some of the R variables could have been simplified, but I wanted them to closely match the JavaScript calculation in order to make it easier to compare the two calculations.

Calculated test: TESTF Free Testosterone
Calculation Variables:

Variable Type Hours to search Prompt mode
-------------------------------------------------------------------------------

R1 ALB Filed
Test Default Value:

R2 SHBG Filed
Test Default Value:

R3 TESTOS Filed
Test Default Value:

R4 Calculated
Conditions for Calculated Variable:
-----------------------------------
1. If R4 = R4
Then Set R4 To 1000000000

R5     Calculated (R3/2.8)*0.0000000001

R6     Calculated (R2/10)*0.00000001

R7     Calculated ((36000*R1*(1.45*0.0001))+1)*R4

R8     Calculated ((36000*R1*(1.45*0.0001))+1)

R9     Calculated (R4*(R6-R5)+R8)*(R4*(R6-R5)+R8)

R10    Calculated R9+(4*R7*R5)

R11    Calculated
Function: ^ZSQRT     Input Component: R10

R12 Calculated  (R11-((R4*(R6-R5))+R8))/(2*R7)

R13 Calculated  (R12*100)/R5

R14 Calculated (R13/100)*R3

R15 Calculated R14/28.84

Arithmetic Expression: R15

Default Calculation Value:

Conditions for Defaulting :
----------------------------
1. If R15 = R15
Then Set Result to R15

Press RETURN to continue :
Conditions for Appending :
---------------------------
1. If R15 = R15
Then Append Result With MNTFG

Conditions for Prefixing :

Calculated test: TESTBA BioAvailable Testosterone
Calculation Variables:

Variable Type Hours to search Prompt mode
-------------------------------------------------------------------------------

R1 ALB Filed
Test Default Value:

R2 TESTF Filed
Test Default Value:

R3 Calculated ((R1*5.22)+1)

R4 Calculated ((R2*28.84)*R3)/28.84

Arithmetic Expression: R4

Press RETURN to continue :

Default Calculation Value:

Conditions for Defaulting :
----------------------------
1. If R4 = R4
Then Set Result to R4

Conditions for Appending :
---------------------------
1. If R4 = R4
Then Append Result With MNBAG