Copy of Snippet "Model for End-Stage Liver Disease (Combined MELD)"

Gender: {formmenu: male; default=female; name=gender}
Serum bilirubin: {formtext: name=Serum bilirubin raw} {note}Used: {=`serum bilirubin`}{endnote}
INR: {formtext: name=INR raw} {note}Used: {=inr}{endnote}
Serum creatinine: {formtext: name=serum creatinine raw} {note}Used: {=`serum creatinine`}{endnote}
Sodium: {formtext: name=Sodium raw} {note}Used: {=sodium}{endnote}
Serum albumin: {formtext: name=Serum albumin raw} {note}Used: {=`Serum albumin`}{endnote}
Maximum serum: {formtext: name=Maximum serum raw; default=3} {note}Used: {=`Maximum serum`}{endnote}
MELD 3.0 = {=1.33*Female + 4.56*ln(`Serum bilirubin`) + 0.82*(137 - Sodium) - 0.24*(137 - Sodium)*ln(`Serum bilirubin`) + 9.09*ln(INR) + 11.14*ln(`Serum creatinine`) + 1.85*(3.5 - `Serum albumin`) - 1.83*(3.5 - `Serum albumin`)*ln(`Serum creatinine`) + 6}

{note: trim=left}{Female=1 if gender="female" else 0}
{`Serum bilirubin`=max(1, `Serum bilirubin raw`)}
{INR=max(1, `INR raw`)}
{`serum creatinine`=max(1, `serum creatinine raw`)}
{Sodium=max(min(137, `Sodium raw`), 125)}
{`Serum albumin`=max(min(3.5, `Serum albumin raw`), 1.5)}
{`Maximum serum`=min(3, `Maximum serum raw`)}{endnote}


this is exacvtly it, and I am able to learn a bit more from your logic too. thanks! will let you know if I have any other questions!