Name

corrected_hormone — Convert a "raw" hormone concentration into a corrected concentration, using the provided mathematical expression.

Synopsis

NUMERIC(8,2) corrected_hormone ( raw_conc,  
  correction);  
NUMERIC(8,2) raw_conc ;
text correction ;
 

Input

raw_conc

The concentration in need of correction, e.g. a HORMONE_RESULT_DATA.Raw_ng_g value. A NUMERIC(8,2) number, or any other data type that can be interpreted as a number and converted to NUMERIC(8,2).

correction

A text string containing a mathematical expression that indicates the arithmetic needed to correct the raw concentration. Usually this will be a HORMONE_KITS.Correction value. When referring to the "raw" value, the string %s must be used[308]. Some example expressions are provided below.

Example "Correction" Values and Their Meaning
Correction Interpretation
%s Use the raw value, no correction needed
%s / 100 Divide the raw value by 100
(2 * %s) + 50 Multiply the raw value by 2, then add 50

It is assumed that this mathematical correction is based on a linear relationship, so %s cannot appear more than once in the "correction".

Description

Returns a number, the corrected concentration. If either or both of the parameters is NULL, returns NULL.

This function is used by the ESTROGENS, GLUCOCORTICOIDS, HORMONE_RESULTS, PROGESTERONES, TESTOSTERONES, and THYROID_HORMONES views to generate their respective Corrected_ng_g columns. It may also be useful to users who want to try a different correction factor that is not recorded in HORMONE_KITS.



[308] Yes, %s is ugly, but this was not chosen arbitrarily. It has a very specific meaning for the PostgreSQL FORMAT() function, which is used in this function to convert the "correction" string into SQL that is executed to perform the calculation.


Page generated: 2024-05-31T10:38:14-04:00.