/biomarker-analytics/my_global_functions/global_functions.phpget_risk_colors($status)"biomarkers" object."lab_format": "SI" OR "lab_format": "CONV"🩸 Biomarkers: Dual-Algorithm Architecture
Documentation of the Single Page Application (SPA) logic governing biomarker evaluation. Because medical thresholds and units of measurement vary drastically across the globe, this script utilizes a “Gateway Selection” to route users into one of two completely distinct clinical calculators.
Step 1: The Gateway Choice
When the user loads the Biomarker page for the first time, the 19 input fields are hidden. The user is presented with a forced choice: “Select your Lab Report Format”. They choose based on the units printed on their physical paper (e.g., mmol/L vs mg/dL). Flags are provided as subtle visual hints, avoiding polarizing country labels.
Step 2: The Dual Forms
Based on their choice, the SPA unhides one of two distinct HTML forms.
Form A (SI Units) and Form B (Conventional Units) exist independently in the DOM. This ensures the browser’s native HTML5 min="", max="", and step="" validation rules are strictly bound to the correct unit. (e.g., A user cannot accidentally submit a US cholesterol score of 180 into a European box that has a strict HTML max limit of 30).
Step 3: The Dual Calculators
When the user clicks “Save”, the JavaScript bundles their 19 metrics and adds the master identifier: "lab_format": "SI" or "lab_format": "CONV". When evaluating the risk to display the UI cards, the script reads this key and routes the math through either runBioCalc_SI() or runBioCalc_CONV(). The resulting statuses are mapped to the Global Color SSOT.
Both calculators output identical standardized status words. These words are intercepted by get_risk_colors() to universally style the UI cards and CSS dots.
Elevated / Monitor (Borderline / Insufficient)
High / Low (Serious Clinical Issue)
Severe / Very Low (Critical / Urgent Issue)
The deterministic mathematical thresholds used by both calculators. Note: “Male/Female” variations are dynamically handled based on the user’s saved gender in the root JSON.
| Biomarker | Standard International (SI) Molecular Count (mmol/L, pmol/L) 🇬🇧 🇪🇺 🇦🇺 🇨🇦 🇩🇪 | Conventional Units Weight/Volume (mg/dL, ng/dL, %) 🇺🇸 🇯🇵 🇮🇳 🇩🇪 |
|---|---|---|
| Testosterone (Total) Hormonal baseline. |
Male < 8.6 nmol/L Very Low
Male < 12.0 nmol/L Low
Male > 29.0 nmol/L High
Female < 0.29 nmol/L Low
Female > 1.67 nmol/L High
|
Male < 250 ng/dL Very Low
Male < 350 ng/dL Low
Male > 835 ng/dL High
Female < 8 ng/dL Low
Female > 48 ng/dL High
|
| TSH Thyroid Stimulating Hormone. |
< 0.27 mIU/L Low
> 4.2 mIU/L High
> 10.0 mIU/L Severe
|
< 0.27 mIU/L Low
> 4.2 mIU/L High
> 10.0 mIU/L Severe
*TSH units are universally standard.
|
| Free T4 Available Thyroid. |
< 12.0 pmol/L Low
> 22.0 pmol/L High
|
< 0.9 ng/dL Low
> 1.7 ng/dL High
|
| Ferritin Iron storage. |
Male < 30 ug/L Very Low
Male > 400 ug/L Very High
Female < 13 ug/L Very Low
Female < 30 ug/L Low
Female > 200 ug/L High
|
Male < 30 ng/mL Very Low
Male > 400 ng/mL Very High
Female < 13 ng/mL Very Low
Female < 30 ng/mL Low
Female > 200 ng/mL High
*ug/L and ng/mL are a 1:1 equivalent.
|
| Vitamin D Bone/Immune health. |
< 50 nmol/L Very Low
< 75 nmol/L Low
> 220 nmol/L Very High
|
< 20 ng/mL Very Low
< 30 ng/mL Low
> 88 ng/mL Very High
|
| Vitamin B12 Nerve health. |
< 148 pmol/L Very Low
< 250 pmol/L Low
> 900 pmol/L High
|
< 200 pg/mL Very Low
< 339 pg/mL Low
> 1220 pg/mL High
|
| HbA1c 3-month blood sugar. |
> 42 mmol/mol High
> 48 mmol/mol Very High
|
> 5.7 % High
> 6.5 % Very High
*Uses strict ADA thresholds for USA.
|
| Total Cholesterol Lipid baseline. |
> 5.0 mmol/L High
|
> 200 mg/dL High
|
| LDL Cholesterol “Bad” cholesterol. |
> 3.0 mmol/L High
|
> 130 mg/dL High
|
| HDL Cholesterol “Good” cholesterol. |
Male < 1.0 mmol/L Low
Female < 1.2 mmol/L Low
|
Male < 40 mg/dL Low
Female < 50 mg/dL Low
|
| Triglycerides Fat in blood. |
> 1.7 mmol/L High
> 2.3 mmol/L Very High
|
> 150 mg/dL High
> 200 mg/dL Very High
|
| hs-CRP Systemic Inflammation. |
> 3.0 mg/L High
> 5.0 mg/L Very High
|
> 3.0 mg/L High
> 5.0 mg/L Very High
*Units are universally standard.
|
| ALT & GGT Liver enzymes. |
Male > 50 IU/L High
Female > 35 IU/L High
|
Male > 50 U/L High
Female > 35 U/L High
*IU/L and U/L are a 1:1 equivalent.
|
| eGFR Kidney filtration. |
< 90 mL/min Monitor
< 60 mL/min Low
|
< 90 mL/min Monitor
< 60 mL/min Low
*Units are universally standard.
|