UNPKG

periop-calculators

Version:

Evidence-based perioperative risk assessment calculators for healthcare professionals

271 lines (264 loc) 8.75 kB
interface PatientDemographics { age: number; sex: 'male' | 'female'; weight: number; height: number; neckCircumference?: number; } interface StopBangInput { snoring: boolean; tiredness: boolean; observed: boolean; pressure: boolean; bmi?: number; age?: number; neckCircumference?: number; gender?: 'male' | 'female'; } interface StopBangResult { score: number; risk: 'low' | 'intermediate' | 'high'; interpretation: string; components: { S: boolean; T: boolean; O: boolean; P: boolean; B: boolean; A: boolean; N: boolean; G: boolean; }; recommendations: string[]; } interface CalculatorError { code: string; message: string; field?: string; } interface ValidationResult { isValid: boolean; errors: CalculatorError[]; } interface RCRIInput$1 { highRiskSurgery: boolean; ischemicHeartDisease: boolean; congestiveHeartFailure: boolean; cerebrovascularDisease: boolean; insulinDependentDiabetes: boolean; renalInsufficiency: boolean; } interface RCRIResult$1 { score: number; riskClass: 'I' | 'II' | 'III' | 'IV'; estimatedRisk: string; riskPercentage: number; interpretation: string; riskFactors: { highRiskSurgery: boolean; ischemicHeartDisease: boolean; congestiveHeartFailure: boolean; cerebrovascularDisease: boolean; insulinDependentDiabetes: boolean; renalInsufficiency: boolean; }; recommendations: string[]; } interface ApfelScoreInput { female: boolean; nonSmoker: boolean; historyOfPONV: boolean; postoperativeOpioids: boolean; } interface ApfelScoreResult { score: number; riskPercentage: number; risk: 'low' | 'moderate' | 'high' | 'very-high'; interpretation: string; riskFactors: { female: boolean; nonSmoker: boolean; historyOfPONV: boolean; postoperativeOpioids: boolean; }; recommendations: string[]; } interface MELDScoreInput { /** Serum bilirubin in mg/dL */ bilirubin: number; /** Serum creatinine in mg/dL */ creatinine: number; /** International normalized ratio (INR) */ inr: number; /** Patient has received dialysis twice within the past week */ dialysis?: boolean; } interface MELDScoreResult { /** MELD score (6-40) */ score: number; /** 3-month mortality estimate */ mortalityRisk: string; /** Mortality percentage */ mortalityPercentage: number; /** Risk category */ risk: 'low' | 'moderate' | 'high' | 'very-high'; /** Clinical interpretation */ interpretation: string; /** Laboratory values used in calculation */ labValues: { bilirubin: number; creatinine: number; inr: number; dialysis: boolean; }; /** Clinical recommendations */ recommendations: string[]; } /** * Calculate STOP-BANG score for obstructive sleep apnea risk assessment * * STOP-BANG is a validated screening tool for obstructive sleep apnea (OSA) * in surgical patients. It consists of 8 yes/no questions. * * Score interpretation: * - 0-2: Low risk of OSA * - 3-4: Intermediate risk of OSA * - 5-8: High risk of OSA * * @param input - STOP-BANG questionnaire responses * @param demographics - Optional patient demographics for auto-calculation * @returns StopBangResult with score, risk level, and recommendations * @throws Error if required inputs are missing or invalid * * @example * ```typescript * const result = calculateStopBang({ * snoring: true, * tiredness: true, * observed: false, * pressure: true, * bmi: 36, * age: 55, * neckCircumference: 43, * gender: 'male' * }); * console.log(result.score); // 6 * console.log(result.risk); // 'high' * ``` */ declare function calculateStopBang(input: StopBangInput, demographics?: PatientDemographics): StopBangResult; /** * Simplified version of STOP-BANG calculation using just the basic inputs * @param input - Basic STOP-BANG inputs * @returns Just the numeric score (0-8) */ declare function calculateStopBangScore(input: StopBangInput): number; /** * RCRI (Revised Cardiac Risk Index) Calculator * * Reference: Lee TH, et al. Derivation and prospective validation of a simple index * for prediction of cardiac risk of major noncardiac surgery. Circulation. 1999;100(10):1043-9. */ interface RCRIInput { /** High-risk surgery (intraperitoneal, intrathoracic, or suprainguinal vascular) */ highRiskSurgery: boolean; /** History of ischemic heart disease */ ischemicHeartDisease: boolean; /** History of congestive heart failure */ congestiveHeartFailure: boolean; /** History of cerebrovascular disease */ cerebrovascularDisease: boolean; /** Insulin therapy for diabetes */ insulinDependentDiabetes: boolean; /** Preoperative serum creatinine >2.0 mg/dL (>177 μmol/L) */ renalInsufficiency: boolean; } interface RCRIResult { /** Total RCRI score (0-6) */ score: number; /** Risk classification */ riskClass: 'I' | 'II' | 'III' | 'IV'; /** Estimated risk of major cardiac complications */ estimatedRisk: string; /** Risk percentage */ riskPercentage: number; /** Clinical interpretation */ interpretation: string; /** Individual risk factors present */ riskFactors: { highRiskSurgery: boolean; ischemicHeartDisease: boolean; congestiveHeartFailure: boolean; cerebrovascularDisease: boolean; insulinDependentDiabetes: boolean; renalInsufficiency: boolean; }; /** Clinical recommendations based on risk */ recommendations: string[]; } /** * Calculate the Revised Cardiac Risk Index (RCRI) score * @param input RCRI risk factors * @returns RCRI calculation result with score, risk class, and recommendations */ declare function calculateRCRI(input: RCRIInput): RCRIResult; /** * Helper function to determine if a surgery type is high risk according to RCRI * @param surgeryType Description of the surgery * @returns Whether the surgery is considered high risk */ declare function isHighRiskSurgery(surgeryType: string): boolean; /** * Calculates the Apfel Score for predicting postoperative nausea and vomiting (PONV) * @param input - Patient risk factors * @returns Apfel score result with risk assessment and recommendations * @throws {CalculatorError} If input validation fails */ declare function calculateApfelScore(input: ApfelScoreInput): ApfelScoreResult; /** * Returns detailed information about a specific Apfel risk factor * @param factor - The risk factor to get information about * @returns Detailed description of the risk factor */ declare function getApfelRiskFactorInfo(factor: keyof ApfelScoreInput): string; /** * Calculates the MELD (Model for End-Stage Liver Disease) Score * * The MELD score is a validated scoring system used to assess the severity of * end-stage liver disease and predict short-term mortality. It is widely used * in surgical risk assessment and liver transplant allocation. * * Formula: MELD = 3.78 × ln(bilirubin) + 11.2 × ln(INR) + 9.57 × ln(creatinine) + 6.43 * * @param input - Laboratory values and dialysis status * @returns MELD score result with risk assessment and recommendations * @throws {CalculatorError} If input validation fails * * @example * ```typescript * const result = calculateMELDScore({ * bilirubin: 2.5, * creatinine: 1.8, * inr: 1.6, * dialysis: false * }); * console.log(result.score); // 18 * console.log(result.risk); // 'moderate' * ``` */ declare function calculateMELDScore(input: MELDScoreInput): MELDScoreResult; /** * Helper function to determine if a MELD score indicates high surgical risk * @param score MELD score * @returns Whether the score indicates high or very high risk */ declare function isHighRiskMELD(score: number): boolean; /** * Helper function to get MELD score interpretation without full calculation * @param score MELD score * @returns Risk category */ declare function getMELDRiskCategory(score: number): 'low' | 'moderate' | 'high' | 'very-high'; declare function calculateBMI(weightKg: number, heightCm: number): number; export { calculateApfelScore, calculateBMI, calculateMELDScore, calculateRCRI, calculateStopBang, calculateStopBangScore, getApfelRiskFactorInfo, getMELDRiskCategory, isHighRiskMELD, isHighRiskSurgery }; export type { ApfelScoreInput, ApfelScoreResult, CalculatorError, MELDScoreInput, MELDScoreResult, PatientDemographics, RCRIInput$1 as RCRIInput, RCRIResult$1 as RCRIResult, StopBangInput, StopBangResult, ValidationResult };