Reference Data
@loop/health-data provides the static clinical reference data used throughout the Loop Health platform — biomarker ranges, peptide catalog, lab panel definitions, contraindication records, and synonym maps.
Installation
pnpm add @loop/health-dataBiomarker Ranges
Sex-specific reference ranges for lab biomarkers with normal and optimal bounds.
import { getBiomarkerById, getBiomarkersByCategory, biomarkerRanges } from '@loop/health-data';
// Get a specific biomarker
const result = getBiomarkerById('testosterone-total');
if (result.ok) {
const biomarker = result.value;
console.log(biomarker.name); // 'Total Testosterone'
console.log(biomarker.unit); // 'ng/dL'
console.log(biomarker.male); // { low: 300, high: 1000, optimalLow: 500, optimalHigh: 900 }
console.log(biomarker.female); // { low: 15, high: 70, optimalLow: 20, optimalHigh: 50 }
console.log(biomarker.category); // 'hormones'
}
// Get all biomarkers in a category
const hormones = getBiomarkersByCategory('hormones');
// Access the full dataset
console.log(biomarkerRanges.length); // Total number of biomarkersBiomarker Categories
| Category | Examples |
|---|---|
hormones | Testosterone, estradiol, DHEA-S, cortisol |
thyroid | TSH, free T3, free T4 |
metabolic | Glucose, insulin, HbA1c |
lipids | Total cholesterol, LDL, HDL, triglycerides |
liver | ALT, AST, GGT, bilirubin |
kidney | Creatinine, BUN, eGFR |
blood | CBC, hemoglobin, hematocrit, platelets |
inflammation | CRP, hsCRP, ESR, ferritin |
vitamins | Vitamin D, B12, folate, iron |
Value Interpretation
import { getInterpretation, validateBiomarkerValue } from '@loop/health-data';
// Get interpretation with message
const interp = getInterpretation('testosterone-total', 650, { sex: 'male' });
if (interp.ok) {
console.log(interp.value.status); // 'optimal'
console.log(interp.value.inRange); // true
console.log(interp.value.message); // 'Within optimal range'
}
// Simple validation
const valid = validateBiomarkerValue('tsh', 2.1, 'female');
if (valid.ok) {
console.log(valid.value.status); // 'optimal'
}Range Lookup
import { getBiomarkerRange } from '@loop/health-data';
const range = getBiomarkerRange('testosterone-total', { sex: 'male', age: 35 });
if (range.ok) {
console.log(range.value);
// { low: 300, normalLow: 300, normalHigh: 1000, high: 1000,
// optimalLow: 500, optimalHigh: 900, unit: 'ng/dL' }
}Peptide Catalog
import { getPeptideById, getPeptidesByCategory, searchPeptidesByGoal, peptideInventory } from '@loop/health-data';
const peptide = getPeptideById('bpc-157');
if (peptide.ok) {
console.log(peptide.value.name); // 'BPC-157'
console.log(peptide.value.category); // 'recovery'
console.log(peptide.value.description); // Clinical description
console.log(peptide.value.goals); // ['gut-healing', 'recovery', 'anti-inflammatory']
}
// Search by goal
const recoveryPeptides = searchPeptidesByGoal('recovery');
// Get by category
const ghPeptides = getPeptidesByCategory('growth-hormone');Peptide Categories
| Category | Examples |
|---|---|
recovery | BPC-157, TB-500 |
growth-hormone | Ipamorelin, CJC-1295, Tesamorelin |
metabolic | Semaglutide, Tirzepatide |
cognitive | Semax, Selank |
sexual-health | PT-141 |
anti-aging | Epithalon, GHK-Cu |
Lab Panel Definitions
import { getPanelById, getPanelsByTargetSex, panelDefinitions } from '@loop/health-data';
const panel = getPanelById('comprehensive-metabolic');
if (panel.ok) {
console.log(panel.value.name); // 'Comprehensive Metabolic Panel'
console.log(panel.value.biomarkers); // ['glucose', 'bun', 'creatinine', ...]
console.log(panel.value.targetSex); // null (both sexes)
}
// Get panels recommended for males
const malePanels = getPanelsByTargetSex('male');Peptide-Specific Panels
import { getPanelsForPeptide, getMissingPanels, getRequiredPanelsForPeptide } from '@loop/health-data';
// Panels recommended before starting ipamorelin
const panels = getPanelsForPeptide('ipamorelin');
// Check which panels are missing
const missing = getMissingPanels(['testosterone-total', 'igf-1'], 'ipamorelin');
// Full requirements
const reqs = getRequiredPanelsForPeptide('ipamorelin');Synonym Resolution
Maps alternative names to canonical identifiers across biomarkers, conditions, and peptides.
import { resolveSynonym, normalizeBiomarkerName } from '@loop/health-data';
// Biomarker synonyms
resolveSynonym('biomarkers', 'Total T'); // 'testosterone-total'
resolveSynonym('biomarkers', 'Hemoglobin A1c'); // 'hba1c'
resolveSynonym('biomarkers', 'Free T4'); // 'free-t4'
// Condition synonyms
resolveSynonym('conditions', 'type 2 diabetes'); // 'type-2-diabetes'
resolveSynonym('conditions', 'high blood pressure'); // 'hypertension'
// Peptide synonyms
resolveSynonym('peptides', 'Body Protection Compound 157'); // 'bpc-157'
// Normalize biomarker name
normalizeBiomarkerName('Total Testosterone'); // 'testosterone-total'Contraindication Data
import { getPeptideContraindications, checkContraindication, checkBiomarkerSafety } from '@loop/health-data';
// Get all contraindications for a peptide
const contras = getPeptideContraindications('mk-677');
if (contras.ok) {
console.log(contras.value.absolute); // Absolute contraindications
console.log(contras.value.relative); // Relative (caution) contraindications
}
// Check a specific condition
const check = checkContraindication('mk-677', { condition: 'diabetes' });
if (check.ok) {
console.log(check.value.blocked); // true/false
console.log(check.value.severity); // 'absolute' | 'relative'
console.log(check.value.reason); // Explanation
}
// Check biomarker safety for a peptide
const safety = checkBiomarkerSafety('ipamorelin', [
{ biomarkerId: 'igf-1', value: 350, sex: 'male' },
]);Constants
import {
BIOMARKER_CATEGORIES,
PEPTIDE_CATEGORIES,
PANEL_CATEGORIES,
CONTRAINDICATION_SEVERITIES,
MEDICAL_DISCLAIMER,
DATA_VERSION,
} from '@loop/health-data';