Integrating Health Indices
After initialization, you can read the indices already calculated for the current session or calculate a new set from factors your app supplies. Your license must include Health Indices. For the embedded flow, the SDK handles the form and calculation.
Providing User Risk Factors
Start with the index your app will display and collect the inputs it needs. Omit unknown values. Zero and false are actual inputs, so using them as defaults can change the result.
| Input | Expected value |
|---|---|
| Age, gender, race, country | Age in years. Use SDK enum values for gender and race. Country is a two-letter ISO code such as "US". |
| Body measurements | Height and waist, neck, and hip circumferences in centimeters. Weight in kilograms. |
| Blood pressure | Systolic and diastolic pressure in mmHg. |
| Blood chemistry | Total cholesterol, HDL cholesterol, triglycerides, and fasting glucose in mg/dL. |
| Lifestyle and medical history | Smoking, diabetes, fruit and vegetable intake, prior high glucose, and history of hypertension use booleans. Physical activity and hypertension treatment use the SDK enums. |
| Family history | For parental hypertension, select neither, one, or both parents. For family diabetes, distinguish first-degree relatives, other relatives, and no family history. |
Use the SDK’s named values for gender (male, female, other), race (White, African American, other), activity (sedentary, lightly active, moderately active, very active, extra active), and hypertension treatment (not needed, no, yes). Leave a field unset when the answer is unknown.
Convert values collected in other units before sending them to the SDK. To prefill or clear the embedded form, see Health risk factors.
Computing Health Risks
This example computes waist-to-height ratio from just two values. A waist of 85 cm and a height of 170 cm should give 0.50. Other fields can be unavailable in the same result. Computing with new factors also updates the session’s factors for subsequent features such as PDF reports. Use the getter when you only need to read the existing result.
const factors = { bodyHeight: 170, waistCircumference: 85 }
const risks = await shenaiSDK.computeHealthRisks(factors)
const ratio = risks.waistToHeightRatioTo read the session’s existing indices, use shenaiSDK.getHealthRisks().
Input and result field names
-
Profile —
age,gender,race,country. -
Body measurements —
bodyHeight,bodyWeight,waistCircumference,neckCircumference,hipCircumference. -
Blood pressure and lab values —
sbp,dbp,cholesterol,cholesterolHdl,fastingGlucose,triglyceride. -
Lifestyle and history —
isSmoker,hypertensionTreatment,hasDiabetes,physicalActivity,vegetableFruitDiet,historyOfHypertension,historyOfHighGlucose,parentalHypertension,familyDiabetes. -
Individual indices —
wellnessScore,vascularAge,waistToHeightRatio,bodyFatPercentage,bodyRoundnessIndex,aBodyShapeIndex,conicityIndex,basalMetabolicRate,totalDailyEnergyExpenditure,hypertensionRisk,diabetesRisk,nonAlcoholicFattyLiverDiseaseRisk. -
Cardiovascular disease (
cvDiseases) —overallRisk,coronaryHeartDiseaseRisk,strokeRisk,heartFailureRisk,peripheralVascularDiseaseRisk. -
Events (
hardAndFatalEvents) —coronaryDeathEventRisk,fatalStrokeEventRisk,totalCVMortalityRisk,hardCVEventRisk. -
Factor scores (
scores) —ageScore,sbpScore,smokingScore,diabetesScore,bmiScore,cholesterolScore,cholesterolHdlScore,totalScore.
Reading the result
| Output | What your app receives |
|---|---|
| Cardiovascular disease risks | Overall, coronary heart disease, stroke, heart failure, and peripheral vascular disease risks, each as a percentage. |
| Hard and fatal events | Percentages for a first hard cardiovascular event, coronary death, fatal stroke, and total cardiovascular mortality. |
| Cardiovascular risk score | Points for age, systolic pressure, smoking, diabetes, BMI or cholesterol and HDL, plus the total points. |
| Chronic disease estimates | Hypertension and diabetes risks are percentages. Fatty liver risk is a category (low, moderate, or high). |
| Other indices | Vascular age in years, body fat as a percentage, waist-to-height ratio, BRI, ABSI, conicity, and energy estimates in kcal/day. |
| Wellness Score | A score from 0 to 100 when successful scan data is available for the current profile. |
Check availability for each field, including values inside nested results. UI V3 restrictions also apply to the API: vascular age, cardiovascular risks and scores, and chronic disease risks are unavailable in this mode. A risk value of 12 means 12%. A waist-to-height ratio of 0.50 is already a ratio. See the index reference for definitions and time horizons.
Minimal, Maximal, and Reference Values
Use the minimum and maximum helpers to draw the SDK’s reference band for an index. These bounds describe the reference band, so a person’s result can fall outside them. Some indices, including Wellness Score, have no such bounds.
Use the reference helper to calculate a comparison profile. It preserves the supplied age, gender, race, and country and substitutes reference factors such as untreated systolic pressure of 125 mmHg and no smoking. It returns the same result structure, with values where the model has sufficient inputs.
const lower = await shenaiSDK.getMinimalRisks(factors)
const upper = await shenaiSDK.getMaximalRisks(factors)
const reference = await shenaiSDK.getReferenceRisks(factors)If an expected value is missing or your display differs from the embedded UI, see Health Indices troubleshooting.